@nice2dev/ui 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +150 -0
- package/dist/NiceApiExplorer.doc-CFJndg5h.js +25 -0
- package/dist/NiceApiExplorer.doc-TEx67kV5.cjs +1 -0
- package/dist/NiceBPMNDesigner.doc-6lK1pXRq.js +32 -0
- package/dist/NiceBPMNDesigner.doc-BY8t7qOi.cjs +8 -0
- package/dist/NiceBackupDiffViewer.doc-CYvOeX19.js +25 -0
- package/dist/NiceBackupDiffViewer.doc-ChQaZCg1.cjs +1 -0
- package/dist/NiceBackupList.doc-BdQCw0_D.cjs +1 -0
- package/dist/NiceBackupList.doc-BwjIAoqz.js +25 -0
- package/dist/NiceBackupRestoreDialog.doc-B2iiqTps.cjs +1 -0
- package/dist/NiceBackupRestoreDialog.doc-DuXSGJiD.js +25 -0
- package/dist/NiceBackupScheduler.doc-BpY45181.js +31 -0
- package/dist/NiceBackupScheduler.doc-ByeL3iH1.cjs +7 -0
- package/dist/NiceBackupStatusBadge.doc-BA3dYgiW.cjs +1 -0
- package/dist/NiceBackupStatusBadge.doc-CxwkVarP.js +25 -0
- package/dist/NiceBackupTagEditor.doc-Bej1KHco.cjs +7 -0
- package/dist/NiceBackupTagEditor.doc-CNy4uNws.js +31 -0
- package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +8 -0
- package/dist/NiceBottomSheet.doc-v-UPUKQk.js +32 -0
- package/dist/NiceBranchManager.doc-BTyRjX7X.cjs +6 -0
- package/dist/NiceBranchManager.doc-Cz4SyEqE.js +30 -0
- package/dist/NiceButton-3AcJJ15c.cjs +1 -0
- package/dist/NiceButton-vkI07DP0.js +88 -0
- package/dist/NiceCodeEditor-C43xFG8v.cjs +260 -0
- package/dist/NiceCodeEditor-CspuYLh6.js +1174 -0
- package/dist/NiceCodeEditor-VGIDWSkS.js +1181 -0
- package/dist/NiceCodeEditor-qX39PSnQ.cjs +260 -0
- package/dist/NiceColorPicker-CQhhjZ8w.cjs +1 -0
- package/dist/NiceColorPicker-Cbop7VMu.js +491 -0
- package/dist/NiceConnectorConfigForm.doc-BKrDuhXw.cjs +7 -0
- package/dist/NiceConnectorConfigForm.doc-BsHeXz3M.js +31 -0
- package/dist/NiceDataBranchGraph.doc-Axidz41W.js +29 -0
- package/dist/NiceDataBranchGraph.doc-sjLmrrtE.cjs +5 -0
- package/dist/NiceDataBranchManager.doc-B1-Rp2X4.cjs +6 -0
- package/dist/NiceDataBranchManager.doc-GUqfTFvW.js +30 -0
- package/dist/NiceDataConflictResolver.doc-CjQryrTu.cjs +5 -0
- package/dist/NiceDataConflictResolver.doc-L-TcnQMX.js +29 -0
- package/dist/NiceDataDiffViewer.doc-BzGrf0U-.cjs +6 -0
- package/dist/NiceDataDiffViewer.doc-goxhSldH.js +30 -0
- package/dist/NiceDataGrid-BDEIbuBS.js +2218 -0
- package/dist/NiceDataGrid-CS5aB-EN.cjs +10 -0
- package/dist/NiceDataGrid-CrD4HPlO.cjs +10 -0
- package/dist/NiceDataGrid-Dfg1DVbU.js +2224 -0
- package/dist/NiceDataMapper.doc-QmnmnvVq.js +30 -0
- package/dist/NiceDataMapper.doc-ytGVtYVr.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-BcmzKxh2.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-BvYa4aUJ.js +30 -0
- package/dist/NiceDataSnapshot.doc-C73K1biG.cjs +6 -0
- package/dist/NiceDataSnapshot.doc-hU7wnOzM.js +30 -0
- package/dist/NiceDesktopViews.doc-DJjYlyP2.cjs +1 -0
- package/dist/NiceDesktopViews.doc-ly-VUAJj.js +25 -0
- package/dist/NiceDeviceControlCard.doc-BZIo92-w.cjs +1 -0
- package/dist/NiceDeviceControlCard.doc-DIzZcW9L.js +25 -0
- package/dist/NiceDocumentViewer-B9VIVKyw.js +726 -0
- package/dist/NiceDocumentViewer-CDXAmPp7.cjs +180 -0
- package/dist/NiceDocumentationViewer.doc-BSNGa7a_.js +25 -0
- package/dist/NiceDocumentationViewer.doc-CrwlvPFg.cjs +1 -0
- package/dist/NiceEnergyChart.doc-DW-jllDV.cjs +1 -0
- package/dist/NiceEnergyChart.doc-DnEehTff.js +25 -0
- package/dist/NiceFeatureGate.doc-DN17uS_B.cjs +3 -0
- package/dist/NiceFeatureGate.doc-DNfFSRrh.js +27 -0
- package/dist/NiceForm-BcN4p2kG.cjs +1 -0
- package/dist/NiceForm-CISJyzoW.cjs +1 -0
- package/dist/NiceForm-DmH6k1b_.js +4775 -0
- package/dist/NiceForm-tIXS-M6b.js +4770 -0
- package/dist/NiceFormItem.doc-BJwEnDz2.js +36 -0
- package/dist/NiceFormItem.doc-Ck3PgaPD.cjs +12 -0
- package/dist/NiceGantt-CHnq-n8f.cjs +1 -0
- package/dist/NiceGantt-CTbqCuwv.cjs +1 -0
- package/dist/NiceGantt-CX3jVNaF.js +330 -0
- package/dist/NiceGantt-Dao7pN9z.js +328 -0
- package/dist/NiceGantt.doc-B6YZcJvG.cjs +11 -0
- package/dist/NiceGantt.doc-DsI1QXly.js +48 -0
- package/dist/NiceGitBlame.doc-BQ2KvGkD.js +30 -0
- package/dist/NiceGitBlame.doc-DuTSjZVN.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-D24AGos_.js +30 -0
- package/dist/NiceGitDiffViewer.doc-D9FVquBC.cjs +6 -0
- package/dist/NiceGitGraph.doc-C-8VGMIz.js +29 -0
- package/dist/NiceGitGraph.doc-eRvTmefl.cjs +5 -0
- package/dist/NiceGitHooks.doc-DCTVw7HX.cjs +5 -0
- package/dist/NiceGitHooks.doc-OCFj5w6v.js +29 -0
- package/dist/NiceHtmlEditor-DUwcqj5N.cjs +10 -0
- package/dist/NiceHtmlEditor-DeK0Of98.js +883 -0
- package/dist/NiceHtmlEditor-DiAphF1k.js +889 -0
- package/dist/NiceHtmlEditor-DvVxl4Fu.cjs +10 -0
- package/dist/NiceInstanceMonitor.doc-BSDZp5xa.js +31 -0
- package/dist/NiceInstanceMonitor.doc-HVbLufnh.cjs +7 -0
- package/dist/NiceLocaleManager.doc-CbVHDEWu.js +25 -0
- package/dist/NiceLocaleManager.doc-XH6hMW0Z.cjs +1 -0
- package/dist/NiceLockButton.doc-BMhSj3TB.cjs +1 -0
- package/dist/NiceLockButton.doc-DvHGhcfm.js +25 -0
- package/dist/NiceLoginForm-CHXbz0eu.js +747 -0
- package/dist/NiceLoginForm-DQe77Isv.js +747 -0
- package/dist/NiceLoginForm-NBCo-DUZ.cjs +1 -0
- package/dist/NiceLoginForm-ix6J1adA.cjs +1 -0
- package/dist/NiceLoginForm.css +1 -1
- package/dist/NiceMAM.doc-CsQ57saR.cjs +8 -0
- package/dist/NiceMAM.doc-hjW7buTH.js +32 -0
- package/dist/NiceMention--3P3vO-W.cjs +430 -0
- package/dist/NiceMention-Co2cqkVM.js +11316 -0
- package/dist/NiceMention-DKhk3xdM.js +11321 -0
- package/dist/NiceMention-wp1AJ5oh.cjs +430 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-BbQwiEOp.cjs +1 -0
- package/dist/NiceModal-DQEfTcnZ.js +85 -0
- package/dist/NiceModuleLifecyclePanel-22CEEVbA.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-BCd9Wv5Y.js +6825 -0
- package/dist/NiceModuleLifecyclePanel-DV3F_QdI.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-gaZkIEtK.js +6825 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NiceNetworkDiscoveryPanel.doc-B0RtGaS3.js +25 -0
- package/dist/NiceNetworkDiscoveryPanel.doc-BFgFZI5G.cjs +1 -0
- package/dist/NicePagination-B3nZDZem.js +165 -0
- package/dist/NicePagination-B8rg1Y67.cjs +1 -0
- package/dist/NicePagination-BFGt1v0a.js +165 -0
- package/dist/NicePagination-DltL3-Sz.cjs +1 -0
- package/dist/NicePipelineEditor.doc-CjqDKe2x.js +29 -0
- package/dist/NicePipelineEditor.doc-DZ0pTVTp.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-C88-TagI.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-CFtH4XJx.js +29 -0
- package/dist/NicePivotGrid-BD87Na7P.js +1163 -0
- package/dist/NicePivotGrid-BPmnvbPQ.cjs +152 -0
- package/dist/NicePivotGrid-BaZa2YZW.js +1157 -0
- package/dist/NicePivotGrid-DyOPhPO8.cjs +152 -0
- package/dist/NiceRoomGrid.doc-DJPVUQVg.cjs +8 -0
- package/dist/NiceRoomGrid.doc-DLHJS_Wb.js +32 -0
- package/dist/NiceSavedQueryPanel-BC84uRfh.cjs +586 -0
- package/dist/NiceSavedQueryPanel-BSTiZvFg.js +5130 -0
- package/dist/NiceSavedQueryPanel-CMfcODIO.js +5120 -0
- package/dist/NiceSavedQueryPanel-DrR3sw4T.cjs +586 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceSceneBar.doc-09sc3yuF.cjs +1 -0
- package/dist/NiceSceneBar.doc-DLePMuVU.js +25 -0
- package/dist/NiceSceneSelector.doc-CPzCAy-d.cjs +7 -0
- package/dist/NiceSceneSelector.doc-FCLZvPc0.js +31 -0
- package/dist/NiceScheduler-BAJRzFQN.js +1690 -0
- package/dist/NiceScheduler-DvxJ8N0I.js +1698 -0
- package/dist/NiceScheduler-TIksdF0k.cjs +5 -0
- package/dist/NiceScheduler-dJ7gHDv7.cjs +5 -0
- package/dist/NiceSchedulerViews.doc-C9opZpgg.cjs +1 -0
- package/dist/NiceSchedulerViews.doc-Dy7ZH1iL.js +25 -0
- package/dist/NiceSelect-CZR8Zu_k.js +420 -0
- package/dist/NiceSelect-DIKGbaJo.cjs +1 -0
- package/dist/NiceSensorGaugePanel.doc-BHirbWLn.cjs +8 -0
- package/dist/NiceSensorGaugePanel.doc-DjKmooI6.js +32 -0
- package/dist/NiceSpotlight.doc-BVZFfDVI.cjs +10 -0
- package/dist/NiceSpotlight.doc-JqwkzrEm.js +34 -0
- package/dist/NiceStateDesigner.doc-CfnwiwfU.js +29 -0
- package/dist/NiceStateDesigner.doc-DV4zEC50.cjs +5 -0
- package/dist/NiceStepper.doc-5VjaLM6r.js +31 -0
- package/dist/NiceStepper.doc-f8lYpr33.cjs +7 -0
- package/dist/NiceTaskInbox.doc-CHrxthqp.js +32 -0
- package/dist/NiceTaskInbox.doc-CdCTfgBq.cjs +8 -0
- package/dist/NiceTestBuilder.doc-BoBzLfa0.js +30 -0
- package/dist/NiceTestBuilder.doc-Cj1fNTvk.cjs +6 -0
- package/dist/NiceTranscoder.doc-Dnirl3wg.cjs +7 -0
- package/dist/NiceTranscoder.doc-cInCYZh7.js +31 -0
- package/dist/NiceVideoAnnotator.doc-C1iEi7OM.cjs +7 -0
- package/dist/NiceVideoAnnotator.doc-C8zyfKH_.js +31 -0
- package/dist/NiceVideoEditor.doc-C6mhEb-q.cjs +7 -0
- package/dist/NiceVideoEditor.doc-lrwmKjqj.js +31 -0
- package/dist/NiceWindow-CWN8OCHF.js +2109 -0
- package/dist/NiceWindow-Dd8qjkIW.cjs +1 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-Bo2WAI5T.cjs +768 -0
- package/dist/charts-BpELGDXh.cjs +768 -0
- package/dist/charts-ByrdMeQP.js +4767 -0
- package/dist/charts-M6LuVI7F.js +4776 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.d.ts +28 -46
- package/dist/charts.mjs +1 -1
- package/dist/core-B8eBUE4m.js +438 -0
- package/dist/core-lBFqvT0V.cjs +1 -0
- package/dist/core-lazy-Bh2yg4Et.js +351 -0
- package/dist/core-lazy-CkWKjfc6.cjs +1 -0
- package/dist/core-lazy-Ctin_LwS.cjs +1 -0
- package/dist/core-lazy-iDiropM6.js +351 -0
- package/dist/data-branching-BgIAw01q.cjs +1 -0
- package/dist/data-branching-Dak1_ZKR.cjs +1 -0
- package/dist/data-branching-DiLAO4Qt.js +6386 -0
- package/dist/data-branching-bvB9K6KS.js +6386 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +22 -18
- package/dist/data.mjs +3 -3
- package/dist/devops-Bp-_aA-9.js +8682 -0
- package/dist/devops-CXBSjnyX.cjs +17 -0
- package/dist/devops-DkVluHBp.cjs +17 -0
- package/dist/devops-zsMUueTd.js +8648 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +3 -3
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +100 -38
- package/dist/editors.mjs +8 -8
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +71 -2
- package/dist/feedback.mjs +10 -9
- package/dist/index.cjs +263 -263
- package/dist/index.css +1 -1
- package/dist/index.d.ts +641 -253
- package/dist/index.mjs +26438 -26260
- package/dist/injectStyleOnce-BzC_BCs_.js +9 -0
- package/dist/injectStyleOnce-DeWaxcdf.cjs +1 -0
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +9 -7
- package/dist/lazy.mjs +51 -51
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.css +1 -0
- package/dist/navigation.d.ts +99 -43
- package/dist/navigation.mjs +504 -547
- package/dist/no-code-BNFk_BDO.js +8275 -0
- package/dist/no-code-CFdTp543.cjs +331 -0
- package/dist/no-code-DiTEnuRv.js +8288 -0
- package/dist/no-code-wG9c0z_T.cjs +331 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.css +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +12 -6
- package/dist/overlays.mjs +1 -1
- package/dist/pickerCommons-BCRiHDE_.cjs +1 -0
- package/dist/pickerCommons-CMxFt9SW.js +548 -0
- package/dist/pickerCommons-Dc_hlz-e.cjs +1 -0
- package/dist/pickerCommons-DkumQ3KE.js +548 -0
- package/dist/style.css +12 -9
- package/package.json +3 -3
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),Xn=require("@nice2dev/i18n"),E=require("@nice2dev/ui-core"),t=require("react"),Jn=require("./NiceDataGrid-CS5aB-EN.cjs"),Ae=require("./NiceButton-3AcJJ15c.cjs"),et=require("./NiceForm-BcN4p2kG.cjs"),nt=require("./NiceModal-C4p8a82e.cjs"),tt=require("./core-lBFqvT0V.cjs"),it=require("./NiceSelect-DIKGbaJo.cjs"),En=require("./no-code-wG9c0z_T.cjs"),zn=require("./NiceColorPicker-CQhhjZ8w.cjs"),at=[];function st(n,i){return n.filter(a=>i.every(s=>{const o=a[s.field],u=s.value;switch(s.operator){case"eq":return o===u;case"ne":return o!==u;case"gt":return typeof o=="number"&&typeof u=="number"&&o>u;case"gte":return typeof o=="number"&&typeof u=="number"&&o>=u;case"lt":return typeof o=="number"&&typeof u=="number"&&o<u;case"lte":return typeof o=="number"&&typeof u=="number"&&o<=u;case"contains":return String(o).toLowerCase().includes(String(u).toLowerCase());case"startsWith":return String(o).toLowerCase().startsWith(String(u).toLowerCase());case"endsWith":return String(o).toLowerCase().endsWith(String(u).toLowerCase());default:return!0}}))}function rt(n){return n.map(i=>({field:i.field,type:i.dataType||"string",label:typeof i.header=="string"?i.header:i.field}))}function ct(n,i){const{enableAI:a=!0,aiModel:s,enableNLSearch:o=!0,enableInsights:u=!0,nlPlaceholder:x,onAIFilter:h,onInsights:y,showAISearchBar:A=!0,exampleQueries:T=["Show items from last week","Filter by status = active","Orders over $1000",'Names starting with "A"'],columns:M=at,data:D,...Q}=n,[H,q]=t.useState(""),[d,N]=t.useState([]),[w,g]=t.useState([]),[k,I]=t.useState(!1),[F,J]=t.useState(null),ne=t.useRef(null),{t:ce}=Xn.useNiceTranslation(),ue=E.useNiceAI(),{parseFilter:le,isLoading:ae}=E.useNaturalLanguageFilter(),pe=a&&ue.isConfigured,O=d.length>0?st(D||[],d):D,fe=t.useCallback(async f=>{if(!pe||!o||!f.trim())return;J(f);const l=rt(M);try{const Y=await le(f,l);N(Y),h?.(f,Y)}catch{N([])}},[pe,o,M,le,h]),Ie=t.useCallback(()=>{N([]),J(null),q("")},[]),je=t.useCallback(()=>d,[d]),L=t.useCallback(async()=>{if(!pe||!u||!D?.length)return[];try{const f=await ue.complete([{role:"user",content:`Analyze this data and provide 3-5 key insights. Data sample (${D.length} total rows): ${JSON.stringify(D.slice(0,20))}
|
|
2
|
+
|
|
3
|
+
Columns: ${M.map(l=>l.field).join(", ")}
|
|
4
|
+
|
|
5
|
+
Return a JSON array of insight strings. Be specific with numbers and trends.`}],{temperature:.3,maxTokens:500});try{const l=JSON.parse(f.content),Y=Array.isArray(l)?l:[];return g(Y),y?.(Y),Y}catch{return[]}}catch{return[]}},[pe,u,D,M,ue,y]),Z=f=>{f.preventDefault(),H.trim()&&fe(H)},p=f=>{q(f),fe(f)};return t.useImperativeHandle(i,()=>({applyNLFilter:fe,clearAIFilters:Ie,getAIFilters:je,generateInsights:L})),e.jsxs("div",{className:"nice-data-grid-ai","data-testid":n["data-testid"],children:[A&&pe&&o&&e.jsxs("div",{className:"nice-data-grid-ai__search-bar",children:[e.jsx("div",{className:"nice-data-grid-ai__search-left",children:e.jsx("span",{className:"nice-data-grid-ai__badge",children:"AI"})}),e.jsxs("form",{onSubmit:Z,className:"nice-data-grid-ai__search-form",children:[e.jsxs("div",{className:"nice-data-grid-ai__input-wrapper",children:[e.jsx("span",{className:"nice-data-grid-ai__search-icon",children:e.jsx(E.NiceIcon,{name:"search",size:14})}),e.jsx("input",{ref:ne,type:"text",value:H,onChange:f=>q(f.target.value),placeholder:x||ce("dataGridAI.searchPlaceholder","Search with natural language..."),className:"nice-data-grid-ai__input",disabled:ae}),ae&&e.jsx("span",{className:"nice-data-grid-ai__loading-spinner"}),H&&!ae&&e.jsx("button",{type:"button",className:"nice-data-grid-ai__clear-input",onClick:()=>q(""),"aria-label":ce("dataGridAI.clearInput","Clear"),children:e.jsx(E.NiceIcon,{name:"close",size:14})})]}),e.jsx("button",{type:"submit",className:"nice-data-grid-ai__search-btn",disabled:ae||!H.trim(),children:ae?ce("dataGridAI.searching","Searching..."):ce("dataGridAI.search","Search")})]}),u&&e.jsxs("button",{type:"button",className:"nice-data-grid-ai__insights-btn",onClick:()=>{L(),I(!0)},disabled:ae||!D?.length,title:ce("dataGridAI.generateInsights","Generate AI Insights"),children:[e.jsx(E.NiceIcon,{name:"lightbulb",size:14})," ",ce("dataGridAI.insights","Insights")]})]}),A&&pe&&o&&!F&&T.length>0&&e.jsxs("div",{className:"nice-data-grid-ai__examples",children:[e.jsx("span",{className:"nice-data-grid-ai__examples-label",children:ce("dataGridAI.tryAsking","Try asking:")}),e.jsx("div",{className:"nice-data-grid-ai__examples-list",children:T.slice(0,4).map((f,l)=>e.jsxs("button",{type:"button",className:"nice-data-grid-ai__example",onClick:()=>p(f),children:['"',f,'"']},l))})]}),F&&d.length>0&&e.jsxs("div",{className:"nice-data-grid-ai__active-filter",children:[e.jsxs("div",{className:"nice-data-grid-ai__filter-info",children:[e.jsx("span",{className:"nice-data-grid-ai__filter-icon",children:e.jsx(E.NiceIcon,{name:"target",size:14})}),e.jsxs("span",{className:"nice-data-grid-ai__filter-query",children:['"',F,'"']}),e.jsxs("span",{className:"nice-data-grid-ai__filter-count",children:["(",O?.length||0," ",ce("dataGridAI.results","results"),")"]})]}),e.jsx("div",{className:"nice-data-grid-ai__filter-badges",children:d.map((f,l)=>e.jsxs("span",{className:"nice-data-grid-ai__filter-badge",children:[f.field," ",f.operator," ",String(f.value)]},l))}),e.jsxs("button",{type:"button",className:"nice-data-grid-ai__clear-filter",onClick:Ie,children:[e.jsx(E.NiceIcon,{name:"close",size:14})," ",ce("dataGridAI.clearFilter","Clear")]})]}),e.jsx("div",{className:"nice-data-grid-ai__grid-wrapper",children:e.jsx(Jn.NiceDataGrid,{columns:M,data:O,...Q})}),k&&e.jsxs("div",{className:"nice-data-grid-ai__insights-panel",children:[e.jsxs("div",{className:"nice-data-grid-ai__insights-header",children:[e.jsxs("h4",{children:[e.jsx(E.NiceIcon,{name:"lightbulb",size:14})," ",ce("dataGridAI.aiInsights","AI Insights")]}),e.jsx("button",{type:"button",className:"nice-data-grid-ai__insights-close",onClick:()=>I(!1),"aria-label":ce("dataGridAI.closeInsights","Close"),children:e.jsx(E.NiceIcon,{name:"close",size:14})})]}),e.jsx("div",{className:"nice-data-grid-ai__insights-body",children:ae?e.jsx("div",{className:"nice-data-grid-ai__insights-loading",children:ce("dataGridAI.analyzing","Analyzing data...")}):w.length>0?e.jsx("ul",{className:"nice-data-grid-ai__insights-list",children:w.map((f,l)=>e.jsxs("li",{className:"nice-data-grid-ai__insight",children:[e.jsx("span",{className:"nice-data-grid-ai__insight-bullet",children:"•"}),f]},l))}):e.jsx("div",{className:"nice-data-grid-ai__insights-empty",children:ce("dataGridAI.noInsights","Click to generate insights from your data")})}),e.jsx("div",{className:"nice-data-grid-ai__insights-footer",children:e.jsxs("button",{type:"button",className:"nice-data-grid-ai__refresh-insights",onClick:()=>L(),disabled:ae,children:[e.jsx(E.NiceIcon,{name:"refresh",size:14})," ",ce("dataGridAI.refresh","Refresh")]})})]})]})}const lt=t.forwardRef(ct),ot=[],dt=[];function ut(n,i,a){const s=new Map,o=[];n.forEach(x=>s.set(String(x[i]),{data:x,children:[],key:String(x[i]),depth:0})),n.forEach(x=>{const h=x[a],y=s.get(String(x[i]));if(h!=null&&h!==""&&s.has(String(h))){const A=s.get(String(h));y.depth=A.depth+1,A.children.push(y)}else o.push(y)});const u=(x,h)=>{x.forEach(y=>{y.depth=h,u(y.children,h+1)})};return u(o,0),o}function Ln(n,i,a,s=0){return n.map(o=>({data:o,key:String(o[a]),depth:s,children:Array.isArray(o[i])?Ln(o[i],i,a,s+1):[]}))}function mt(n){const i=[],a=s=>{s.forEach(o=>{i.push(o.key),a(o.children)})};return a(n),i}function ht(n,i){const a=[],s=o=>{o.forEach(u=>{a.push(u),u.children.length>0&&i.has(u.key)&&s(u.children)})};return s(n),a}function Pn(n,i,a){return!i||!a?n:[...n].sort((o,u)=>{const x=o.data[i]??"",h=u.data[i]??"",y=typeof x=="number"&&typeof h=="number"?x-h:String(x).localeCompare(String(h));return a==="desc"?-y:y}).map(o=>({...o,children:Pn(o.children,i,a)}))}function pt({columns:n=ot,data:i=dt,keyField:a="id",parentKeyField:s="parentId",nested:o=!1,childrenField:u="children",expandedKeys:x,onExpandedChange:h,defaultExpandAll:y=!1,sortable:A=!0,sortField:T,sortDirection:M,onSort:D,selectable:Q,selectedKeys:H,onSelectionChange:q,searchable:d,searchPlaceholder:N,striped:w,compact:g,size:k="md",loading:I,disabled:F,readOnly:J,error:ne,emptyText:ce,toolbar:ue,onRowClick:le,className:ae,style:pe}){const{t:O}=E.useNiceTranslation(),fe=t.useMemo(()=>o?Ln(i,u,a):ut(i,a,s),[i,a,s,o,u]),Ie=t.useMemo(()=>mt(fe),[fe]),[je,L]=t.useState(()=>y?new Set(Ie):new Set),Z=t.useMemo(()=>x?new Set(x):je,[x,je]),[p,f]=t.useState({field:"",dir:null}),[l,Y]=t.useState(new Set),[W,m]=t.useState(""),ee=T??p.field,oe=M??p.dir,re=H??l,K=t.useMemo(()=>n.filter($=>!$.hidden),[n]),ye=t.useCallback($=>{const b=ee===$?oe==="asc"?"desc":oe==="desc"?null:"asc":"asc";D?D($,b):f({field:$,dir:b})},[ee,oe,D]),ke=t.useCallback($=>{const b=new Set(Z);b.has($)?b.delete($):b.add($),h?h([...b]):L(b)},[Z,h]),Oe=t.useCallback($=>{const b=new Set(re);b.has($)?b.delete($):b.add($),q?q(b):Y(b)},[re,q]),Me=t.useMemo(()=>{if(!W)return fe;const $=W.toLowerCase(),b=de=>de.reduce((ge,v)=>{const P=b(v.children);return(K.some(_e=>String(v.data[_e.field]??"").toLowerCase().includes($))||P.length>0)&&ge.push({...v,children:P}),ge},[]);return b(fe)},[fe,W,K]),Te=t.useMemo(()=>Pn(Me,ee,oe),[Me,ee,oe]),Ue=t.useMemo(()=>ht(Te,Z),[Te,Z]),Pe=({field:$})=>ee!==$||!oe?e.jsx("span",{className:"nice-table__sort-icon",style:{opacity:.3},children:e.jsx(E.NiceIcon,{name:"sort",size:12})}):e.jsx("span",{className:"nice-table__sort-icon",children:e.jsx(E.NiceIcon,{name:oe==="asc"?"sort-asc":"sort-desc",size:12})});return e.jsxs("div",{className:`nice-treegrid nice-datagrid ${F?"nice-treegrid--disabled":""} ${J?"nice-treegrid--readonly":""} ${ne?"nice-treegrid--error":""} ${ae||""}`,style:pe,"aria-disabled":F||void 0,"aria-busy":I||void 0,"aria-invalid":!!ne||void 0,children:[(d||ue)&&e.jsxs("div",{className:"nice-datagrid__toolbar",children:[d&&e.jsx("div",{className:"nice-datagrid__search",children:e.jsx("input",{type:"text",value:W,onChange:$=>m($.target.value),placeholder:N||O("controls.search","Search...")})}),ue]}),e.jsx("div",{className:"nice-datagrid__table-wrap",children:e.jsxs("table",{className:`nice-table nice-table--${k} ${w?"nice-table--striped":""} ${g?"nice-table--compact":""}`,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[Q&&e.jsx("th",{className:"nice-datagrid__checkbox",style:{width:36}}),K.map($=>e.jsxs("th",{style:{width:$.width,minWidth:$.minWidth,textAlign:$.align},className:A&&$.sortable!==!1?"nice-datagrid__th--sortable":void 0,onClick:()=>A&&$.sortable!==!1&&ye($.field),children:[$.header,A&&$.sortable!==!1&&e.jsx(Pe,{field:$.field})]},$.field))]})}),e.jsx("tbody",{children:I?e.jsx("tr",{children:e.jsx("td",{colSpan:K.length+(Q?1:0),className:"nice-datagrid__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):ne?e.jsx("tr",{children:e.jsx("td",{colSpan:K.length+(Q?1:0),className:"nice-datagrid__empty nice-treegrid__error",role:"alert",children:ne})}):Ue.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:K.length+(Q?1:0),className:"nice-datagrid__empty",children:ce||O("controls.noData","No data available")})}):Ue.map(($,b)=>{const de=re.has($.key),ge=$.children.length>0,v=Z.has($.key);return e.jsxs("tr",{className:de?"nice-datagrid__row--selected":void 0,onClick:()=>{J||le?.($.data)},style:le&&!J?{cursor:"pointer"}:void 0,children:[Q&&e.jsx("td",{className:"nice-datagrid__checkbox",onClick:P=>P.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:de,onChange:()=>Oe($.key),disabled:J,"aria-label":`Select row ${$.key}`})}),K.map((P,se)=>e.jsxs("td",{style:{textAlign:P.align},children:[se===0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{display:"inline-block",width:$.depth*20}}),e.jsx("button",{className:`nice-treegrid__toggle ${ge?"":"nice-treegrid__toggle--leaf"}`,onClick:_e=>{_e.stopPropagation(),ge&&ke($.key)},tabIndex:ge?0:-1,"aria-expanded":ge?v:void 0,"aria-label":ge?v?"Collapse":"Expand":void 0,children:ge?e.jsx(E.NiceIcon,{name:v?"chevron-down":"chevron-right",size:12}):""})]}),P.render?P.render($.data[P.field],$.data,b):String($.data[P.field]??"")]},P.field))]},$.key)})})]})})]})}const ft=[],gt=[];function _t(n,i,a){const s=new Map,o=[];return n.forEach(u=>{const x={...u,children:[]};s.set(String(x[i]),x)}),n.forEach(u=>{const x=u[a];x!=null&&s.has(String(x))?s.get(String(x)).children.push(s.get(String(u[i]))):o.push(s.get(String(u[i])))}),o}function xt({columns:n=ft,data:i=gt,keyField:a="key",parentKeyField:s="parentKey",expandedKeys:o,onExpandedChange:u,selectedKeys:x=[],onSelectionChange:h,selectable:y,sortable:A,loading:T,emptyText:M,className:D,style:Q,accessMode:H,id:q}){const N=E.useNiceAccessMode(H,q)==="hidden",{t:w}=E.useNiceTranslation(),[g,k]=t.useState([]),I=o??g,[F,J]=t.useState(x),ne=h?x:F,ce=t.useMemo(()=>_t(i,a,s),[i,a,s]),ue=t.useMemo(()=>n.filter(p=>!p.hidden),[n]),[le,ae]=t.useState(null),pe=t.useCallback(p=>{ae(f=>f?.field===p?f.dir==="asc"?{field:p,dir:"desc"}:null:{field:p,dir:"asc"})},[]),O=t.useCallback(p=>le?[...p].sort((l,Y)=>{const W=l[le.field]??"",m=Y[le.field]??"",ee=typeof W=="number"?W-m:String(W).localeCompare(String(m));return le.dir==="desc"?-ee:ee}).map(l=>l.children&&l.children.length?{...l,children:O(l.children)}:l):p,[le]),fe=t.useMemo(()=>O(ce),[ce,O]),Ie=t.useCallback(p=>{const f=I.includes(p)?I.filter(l=>l!==p):[...I,p];u?u(f):k(f)},[I,u]),je=t.useCallback(p=>{const f=[],l=Y=>{Y.children?.forEach(W=>{f.push(String(W[a])),l(W)})};return l(p),f},[a]),L=t.useCallback(p=>{const f=[String(p[a]),...je(p)],Y=f.every(W=>ne.includes(W))?ne.filter(W=>!f.includes(W)):Array.from(new Set([...ne,...f]));h?h(Y):J(Y)},[ne,h,a,je]),Z=(p,f)=>{const l=String(p[a]),Y=!!(p.children&&p.children.length>0),W=I.includes(l),m=Y?je(p):[],ee=m.filter(K=>ne.includes(K)).length,oe=Y&&m.length>0?ee===m.length:ne.includes(l),re=Y&&ee>0&&ee<m.length;return e.jsxs(t.Fragment,{children:[e.jsxs("tr",{className:oe?"nice-treelist__row--selected":"",children:[y&&e.jsx("td",{className:"nice-treelist__checkbox",children:e.jsx("input",{type:"checkbox",checked:oe,ref:K=>{K&&(K.indeterminate=re)},onChange:()=>L(p)})}),ue.map((K,ye)=>e.jsxs("td",{style:{textAlign:K.align},children:[ye===0&&e.jsx("span",{style:{display:"inline-block",width:f*20}}),ye===0&&e.jsx("span",{className:"nice-treelist__toggle",onClick:()=>Y&&Ie(l),style:{cursor:Y?"pointer":"default",width:20,display:"inline-block"},children:Y?e.jsx(E.NiceIcon,{name:W?"chevron-down":"chevron-right",size:12}):""}),K.render?K.render(p[K.field],p,0):String(p[K.field]??"")]},K.field))]}),Y&&W&&p.children.map(K=>Z(K,f+1))]},l)};return N?null:e.jsx("div",{className:`nice-treelist ${D||""}`,style:Q,children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[y&&e.jsx("th",{className:"nice-treelist__checkbox"}),ue.map(p=>{const f=!!A&&!!p.sortable;return e.jsxs("th",{style:{width:p.width,minWidth:p.minWidth,textAlign:p.align},className:f?"nice-treelist__th--sortable":void 0,onClick:()=>f&&pe(p.field),scope:"col","aria-sort":f?le?.field===p.field?le.dir==="asc"?"ascending":"descending":"none":void 0,children:[p.header,f&&e.jsx("span",{className:"nice-table__sort-icon","aria-hidden":"true",children:e.jsx(E.NiceIcon,{name:le?.field===p.field?le.dir==="desc"?"chevron-down":"chevron-up":"sort",size:12})})]},p.field)})]})}),e.jsx("tbody",{children:T?e.jsx("tr",{children:e.jsx("td",{colSpan:ue.length+(y?1:0),className:"nice-treelist__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):ce.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:ue.length+(y?1:0),className:"nice-treelist__empty",children:M||w("controls.noData","No data available")})}):fe.map(p=>Z(p,0))})]})})}function On(n){const i=[];if(n.children)for(const a of n.children)i.push(a.key),i.push(...On(a));return i}function Dn(n,i){if(!n.children||n.children.length===0)return i.has(n.key)?"checked":"unchecked";let a=!0,s=i.has(n.key);for(const o of n.children){const u=Dn(o,i);u==="checked"?s=!0:(u==="indeterminate"&&(s=!0),a=!1)}return a&&s?"checked":s?"indeterminate":"unchecked"}const bt=[],vt=({nodes:n=bt,header:i,selectedKeys:a=[],expandedKeys:s,onSelectionChange:o,onExpandedChange:u,selectionMode:x="none",showCheckboxes:h,searchable:y,searchPlaceholder:A,onNodeClick:T,renderNode:M,showLines:D,loading:Q,className:H,style:q,accessMode:d,id:N,draggable:w,onNodeDrop:g,onLoadChildren:k,contextMenuItems:I,onContextMenuAction:F,editable:J,onNodeEdit:ne,maxDepth:ce})=>{const le=E.useNiceAccessMode(d,N)==="hidden",{t:ae}=E.useNiceTranslation(),[pe,O]=t.useState([]),[fe,Ie]=t.useState(""),[je,L]=t.useState(new Set),[Z,p]=t.useState(new Map),[f,l]=t.useState(null),[Y,W]=t.useState(null),[m,ee]=t.useState(null),[oe,re]=t.useState(""),K=t.useRef(null),ye=s??pe,ke=t.useMemo(()=>new Set(a),[a]),Oe=t.useCallback(async(b,de)=>{const ge=!ye.includes(b),v=ge?[...ye,b]:ye.filter(P=>P!==b);if(u?u(v):O(v),ge&&k&&!de.children?.length&&de.leaf!==!0&&!Z.has(b)){L(se=>new Set(se).add(b));const P=await k(de);p(se=>new Map(se).set(b,P)),L(se=>{const _e=new Set(se);return _e.delete(b),_e})}},[ye,u,k,Z]),Me=t.useCallback((b,de)=>{if(o){if(x==="single")o(a.includes(b)?[]:[b]);else if(x==="multiple")if(h&&de.children?.length){const ge=On(de),v=[b,...ge];if(Dn(de,ke)==="checked")o(a.filter(se=>!v.includes(se)));else{const se=new Set([...a,...v]);o(Array.from(se))}}else o(a.includes(b)?a.filter(ge=>ge!==b):[...a,b])}},[a,x,o,h,ke]),Te=t.useCallback(b=>{if(!fe)return!0;const de=fe.toLowerCase();return b.text.toLowerCase().includes(de)?!0:(Z.get(b.key)??b.children)?.some(v=>Te(v))??!1},[fe,Z]),Ue=t.useCallback((b,de)=>{I?.length&&(b.preventDefault(),W({x:b.clientX,y:b.clientY,node:de}))},[I]),Pe=t.useCallback(()=>{m&&ne&&ne(m,oe),ee(null)},[m,oe,ne]),$=(b,de)=>{if(fe&&!Te(b))return null;const ge=typeof ce=="number"?Math.min(10,Math.max(1,ce)):1/0,v=de+1>=ge,P=v?void 0:Z.get(b.key)??b.children,se=!v&&(P&&P.length>0||b.leaf!==!0&&k&&!P?.length),_e=ye.includes(b.key),De=ke.has(b.key),me=je.has(b.key),U=h&&x==="multiple"&&P?.length?Dn(b,ke):De?"checked":"unchecked",We=Math.min(de+1,10),en={paddingLeft:de*20+4,"--nice-row-bg":`var(--nice-tree-level-${We}-bg, transparent)`,"--nice-row-text":`var(--nice-tree-level-${We}-text, inherit)`,"--nice-row-border":`var(--nice-tree-level-${We}-border, transparent)`,"--nice-row-hover-bg":`var(--nice-tree-level-${We}-hover-bg, var(--nice-hover-bg, color-mix(in srgb, var(--nice-text-primary) 6%, transparent)))`,"--nice-row-active-bg":`var(--nice-tree-level-${We}-active-bg, color-mix(in srgb, var(--nice-color-primary) 14%, transparent))`};return e.jsxs("li",{className:"nice-tree__node",role:"treeitem","aria-expanded":se?_e:void 0,"data-nice-depth":We,draggable:w&&!b.disabled,onDragStart:w?B=>{B.stopPropagation(),l(b.key)}:void 0,onDragOver:w?B=>{B.preventDefault(),B.stopPropagation()}:void 0,onDrop:w&&f?B=>{B.stopPropagation(),g?.(f,b.key,"inside"),l(null)}:void 0,onDragEnd:w?()=>l(null):void 0,children:[e.jsxs("div",{className:`nice-tree__row ${De?"nice-tree__row--selected":""} ${b.disabled?"nice-tree__row--disabled":""} ${f===b.key?"nice-tree__row--dragging":""}`,style:en,onClick:()=>{b.disabled||(Me(b.key,b),T?.(b))},onContextMenu:B=>Ue(B,b),onDoubleClick:J&&!b.disabled?()=>{ee(b.key),re(b.text)}:void 0,children:[e.jsx("span",{className:`nice-tree__toggle ${se?_e?"nice-tree__toggle--expanded":"":"nice-tree__toggle--leaf"}`,onClick:B=>{B.stopPropagation(),se&&Oe(b.key,b)},children:me?e.jsx("span",{className:"nice-spinner nice-spinner--xs"}):se?_e?e.jsx(E.NiceIcon,{name:"chevron-down",size:12}):e.jsx(E.NiceIcon,{name:"chevron-right",size:12}):""}),h&&x!=="none"&&e.jsx("input",{type:"checkbox",checked:U==="checked",ref:B=>{B&&(B.indeterminate=U==="indeterminate")},onChange:()=>Me(b.key,b),onClick:B=>B.stopPropagation(),tabIndex:-1,className:"nice-tree__checkbox"}),m===b.key?e.jsx("input",{type:"text",className:"nice-tree__edit-input",value:oe,onChange:B=>re(B.target.value),onBlur:Pe,onKeyDown:B=>{B.key==="Enter"&&Pe(),B.key==="Escape"&&ee(null)},autoFocus:!0,onClick:B=>B.stopPropagation()}):M?M(b):e.jsxs(e.Fragment,{children:[b.icon&&e.jsx("span",{className:"nice-tree__icon",children:b.icon}),e.jsx("span",{className:"nice-tree__text",children:b.text})]})]}),P&&P.length>0&&_e&&e.jsx("ul",{className:"nice-tree__children",role:"group",children:P.map(B=>$(B,de+1))})]},b.key)};return le?null:e.jsxs("div",{className:`nice-tree ${D?"nice-tree--lines":""} ${H||""}`,style:q,ref:K,onClick:()=>W(null),children:[i!=null&&i!==!1&&e.jsx("div",{className:"nice-tree__header",children:i}),y&&e.jsx("div",{className:"nice-tree__search",children:e.jsx("input",{type:"text",value:fe,onChange:b=>Ie(b.target.value),placeholder:A||ae("controls.search","Search..."),"aria-label":A||ae("controls.search","Search tree")})}),Q?e.jsx("div",{className:"nice-tree__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--sm"})}):e.jsx("ul",{className:"nice-tree__root",role:"tree",children:n.map(b=>$(b,0))}),Y&&I&&e.jsx("div",{className:"nice-tree__context-menu",style:{position:"fixed",top:Y.y,left:Y.x,zIndex:9999},children:I.map(b=>e.jsxs("div",{className:`nice-tree__context-item ${b.disabled?"nice-tree__context-item--disabled":""}`,onClick:()=>{b.disabled||(F?.(b.key,Y.node),W(null))},children:[b.icon&&e.jsx("span",{children:b.icon}),b.label]},b.key))})]})},yt=[],Nt=({items:n=yt,selectedKeys:i=[],onSelectionChange:a,selectionMode:s="none",searchable:o,searchPlaceholder:u,grouped:x,groupField:h="group",reorderable:y,onReorder:A,onItemClick:T,renderItem:M,showCheckboxes:D,loading:Q,emptyText:H,size:q="md",header:d,disabled:N,readOnly:w,error:g,bordered:k=!0,swipeActions:I,className:F,style:J,accessMode:ne,id:ce})=>{const le=E.useNiceAccessMode(ne,ce)==="hidden",{t:ae}=E.useNiceTranslation(),[pe,O]=t.useState(""),[fe,Ie]=t.useState(null),[je,L]=t.useState(null),Z=t.useRef(null),p=t.useMemo(()=>{if(!pe)return n;const m=pe.toLowerCase();return n.filter(ee=>ee.text.toLowerCase().includes(m))},[n,pe]),f=t.useMemo(()=>{if(!x)return null;const m=new Map;return p.forEach(ee=>{const oe=String(ee[h]??"");m.has(oe)||m.set(oe,[]),m.get(oe).push(ee)}),m},[p,x,h]),l=t.useCallback(m=>{a&&(s==="single"?a(i.includes(m)?[]:[m]):s==="multiple"&&a(i.includes(m)?i.filter(ee=>ee!==m):[...i,m]))},[i,s,a]),Y=t.useCallback(m=>{fe!==null&&fe!==m&&A&&A(fe,m),Ie(null)},[fe,A]),W=(m,ee)=>{const oe=i.includes(m.key),re=je===m.key;return e.jsxs("li",{className:`nice-list__item ${oe?"nice-list__item--selected":""} ${m.disabled?"nice-list__item--disabled":""} ${re?"nice-list__item--swiped":""}`,onClick:()=>{!m.disabled&&!N&&!w&&(l(m.key),T?.(m))},draggable:y&&!N&&!w,onDragStart:()=>Ie(ee),onDragOver:K=>K.preventDefault(),onDrop:()=>Y(ee),onTouchStart:I?.length?K=>{Z.current={x:K.touches[0].clientX,key:m.key}}:void 0,onTouchEnd:I?.length?K=>{if(!Z.current)return;const ye=K.changedTouches[0].clientX-Z.current.x;ye<-50&&Z.current.key===m.key?L(m.key):ye>50&&L(null),Z.current=null}:void 0,role:s!=="none"?"option":void 0,"aria-selected":s!=="none"?oe:void 0,children:[e.jsxs("div",{className:"nice-list__item-content",children:[D&&s!=="none"&&e.jsx("input",{type:"checkbox",checked:oe,readOnly:!0,tabIndex:-1,className:"nice-list__checkbox"}),M?M(m):e.jsxs(e.Fragment,{children:[m.icon&&e.jsx("span",{className:"nice-list__icon",children:m.icon}),e.jsx("span",{className:"nice-list__text",children:m.text}),m.badge&&e.jsx("span",{className:"nice-list__badge",children:m.badge})]})]}),I&&re&&e.jsx("div",{className:"nice-list__swipe-actions",children:I.map(K=>e.jsx("button",{className:"nice-list__swipe-btn",style:K.color?{backgroundColor:K.color}:void 0,onClick:ye=>{ye.stopPropagation(),K.onClick(m),L(null)},children:K.label},K.key))})]},m.key)};return le?null:e.jsxs("div",{className:`nice-list nice-list--${q} ${k?"nice-list--bordered":""} ${N?"nice-list--disabled":""} ${w?"nice-list--readonly":""} ${g?"nice-list--error":""} ${F||""}`,style:J,"aria-disabled":N||void 0,"aria-busy":Q||void 0,children:[d&&e.jsx("div",{className:"nice-list__header",children:d}),o&&!Q&&e.jsx("div",{className:"nice-list__search",children:e.jsx("input",{type:"text",value:pe,onChange:m=>O(m.target.value),placeholder:u||ae("controls.search","Search...")})}),Q?e.jsx("div",{className:"nice-list__loading",role:"status","aria-live":"polite",children:e.jsx("div",{className:`nice-spinner nice-spinner--${q}`})}):g?e.jsx("div",{className:"nice-list__error",role:"alert",children:g}):p.length===0?e.jsx("div",{className:"nice-list__empty",children:H||ae("controls.noData","No data available")}):f?e.jsx("div",{role:"listbox",children:Array.from(f.entries()).map(([m,ee])=>e.jsxs("div",{className:"nice-list__group",children:[e.jsx("div",{className:"nice-list__group-header",children:m}),e.jsx("ul",{className:"nice-list__items",children:ee.map((oe,re)=>W(oe,re))})]},m))}):e.jsx("ul",{className:"nice-list__items",role:"listbox",children:p.map((m,ee)=>W(m,ee))})]})},jt=[],wt=[];function kt({columns:n=jt,data:i=wt,striped:a,compact:s,size:o="md",emptyText:u,className:x,style:h,accessMode:y,id:A,displayStyle:T}){const M=E.normalizeSize(o),Q=E.useNiceAccessMode(y,A)==="hidden",H=E.useComponentDisplayStyle("table",T),q=E.useComponentDisplayClass("table",T),[d,N]=t.useState(null),w=t.useMemo(()=>d?[...i].sort((k,I)=>{const F=k[d.field]??"",J=I[d.field]??"",ne=typeof F=="number"?F-J:String(F).localeCompare(String(J));return d.dir==="desc"?-ne:ne}):i,[i,d]),g=k=>{N(I=>I?.field===k?I.dir==="asc"?{field:k,dir:"desc"}:null:{field:k,dir:"asc"})};return Q?null:e.jsx("div",{className:`nice-table-wrapper ${x||""}`,style:{...H,...h},children:e.jsxs("table",{className:`nice-table nice-table--ds-${q} nice-table--${M} ${a?"nice-table--striped":""} ${s?"nice-table--compact":""}`,"aria-rowcount":w.length,"aria-colcount":n.length,children:[e.jsx("thead",{children:e.jsx("tr",{children:n.map(k=>{const I=k.sortable?d?.field===k.field?d.dir==="asc"?"ascending":"descending":"none":void 0;return e.jsxs("th",{style:{width:k.width,textAlign:k.align},className:k.sortable?"th--sortable":void 0,onClick:()=>k.sortable&&g(k.field),scope:"col","aria-sort":I,children:[k.header,k.sortable&&e.jsx("span",{className:"nice-table__sort-icon","aria-hidden":"true",children:e.jsx(E.NiceIcon,{name:d?.field===k.field?d.dir==="desc"?"chevron-down":"chevron-up":"sort",size:12})})]},k.field)})})}),e.jsx("tbody",{children:w.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:n.length,className:"nice-table__empty",children:u||"No data"})}):w.map((k,I)=>e.jsx("tr",{children:n.map(F=>e.jsx("td",{style:{textAlign:F.align},children:F.render?F.render(k[F.field],k):String(k[F.field]??"")},F.field))},I))})]})})}const St=[];function Ct({items:n=St,tileWidth:i=180,tileHeight:a=180,direction:s="horizontal",renderTile:o,onTileClick:u,loading:x,emptyText:h,className:y,style:A}){const{t:T}=E.useNiceTranslation();return e.jsx("div",{className:`nice-tileview nice-tileview--${s} ${y||""}`,style:A,children:x?e.jsx("div",{className:"nice-tileview__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--md"})}):n.length===0?e.jsx("div",{className:"nice-tileview__empty",children:h||T("controls.noData","No data available")}):e.jsx("div",{className:"nice-tileview__container",style:{display:"flex",flexWrap:"wrap",gap:8,flexDirection:s==="vertical"?"column":"row"},children:n.map(M=>e.jsx("div",{className:"nice-tileview__tile",style:{width:i,height:a,cursor:u?"pointer":void 0},onClick:()=>u?.(M),children:o?o(M):e.jsxs(e.Fragment,{children:[M.image&&e.jsx("img",{src:M.image,alt:M.text||"",className:"nice-tileview__image"}),M.text&&e.jsx("div",{className:"nice-tileview__label",children:M.text})]})},M.key))})})}const It=[],Dt=[];function Mt({open:n}){return e.jsx(E.NiceIcon,{name:"chevron-down",size:14,style:{transition:"transform 160ms ease",transform:n?"rotate(0deg)":"rotate(-90deg)"}})}function At(){return e.jsx(E.NiceIcon,{name:"plus",size:14})}const Tt=[{target:".nice-kanban",titleKey:"tutorial.kanbanBoard.intro.title",title:"Kanban board",contentKey:"tutorial.kanbanBoard.intro.content",content:'Drag cards between columns to change their status, add cards with the "+" button, and click a card to edit its details.',placement:"auto"}],Et=Object.assign(t.forwardRef(({columns:n=It,cards:i=Dt,onCardMove:a,onCardClick:s,renderCard:o,onAddCard:u,disabled:x=!1,size:h="md",collapsible:y=!1,collapseDirection:A="vertical",layoutMode:T="scroll",viewMode:M,onViewModeChange:D,collapsedColumns:Q,onCollapsedColumnsChange:H,formItems:q,formColumns:d=1,formProps:N,editCardTitle:w,newCardTitle:g,onCardEdit:k,onCardCreate:I,onCardDelete:F,tutorial:J,cookies:ne=!1,localStorage:ce=!0,sessionStorage:ue=!1,storageMode:le,storageKey:ae,className:pe,style:O,id:fe,...Ie},je)=>{const{t:L}=E.useNiceTranslation(),[Z,p]=t.useState(null),[f,l]=t.useState(null),[Y,W]=t.useState(null),m=!!q&&(!!k||!!I),ee=t.useCallback(v=>{if(m&&k){W({key:v.key,data:{...v},column:v.column});return}s?.(v)},[m,s,k]),oe=t.useCallback(v=>{if(m&&I){W({key:null,data:{title:"",description:""},column:v});return}u?.(v)},[m,u,I]),re=tt.useStorageAdapter(ae??"nice-kanban"),[K,ye]=t.useState(()=>re.get("state")??{collapsedColumns:[],viewMode:"default"}),ke=t.useMemo(()=>Q??K.collapsedColumns??[],[Q,K.collapsedColumns]),Oe=M??K.viewMode??"default",Me=t.useCallback(v=>{ye(P=>{const se={...P,...v};return re.set("state",se),se})},[re]),Te=t.useCallback(v=>{const P=ke.includes(v)?ke.filter(se=>se!==v):[...ke,v];H?H(P):Me({collapsedColumns:P})},[ke,H,Me]);t.useCallback(v=>{D?D(v):Me({viewMode:v})},[D,Me]);const Ue=t.useCallback(v=>i.filter(P=>P.column===v).sort((P,se)=>(P.order??0)-(se.order??0)),[i]),Pe=t.useCallback((v,P)=>{x||(v.dataTransfer.effectAllowed="move",v.dataTransfer.setData("text/plain",String(P.key)),p({cardKey:P.key,fromColumn:P.column}))},[x]),$=t.useCallback((v,P)=>{v.preventDefault(),v.dataTransfer.dropEffect="move",l({column:P})},[]),b=t.useCallback(()=>{l(null)},[]),de=t.useCallback((v,P)=>{if(v.preventDefault(),l(null),!Z||x)return;const se=Ue(P);a?.(Z.cardKey,P,se.length),p(null)},[Z,x,Ue,a]),ge=t.useCallback(()=>{p(null),l(null)},[]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:je,id:fe,className:`nice-kanban nice-kanban--${h} nice-kanban--${Oe} nice-kanban--layout-${T} ${x?"nice-kanban--disabled":""} ${pe||""}`,style:{position:"relative",...O},...Ie,children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(E.NiceTutorialButton,{steps:E.resolveTutorial(J,Tt)})}),n.map(v=>{const P=Ue(v.key),se=f?.column===v.key,_e=v.limit!=null&&P.length>=v.limit,De=y&&ke.includes(v.key);return e.jsxs("div",{className:`nice-kanban__column ${se?"nice-kanban__column--dragover":""} ${De?`nice-kanban__column--collapsed nice-kanban__column--collapse-${A}`:""}`,onDragOver:me=>!De&&$(me,v.key),onDragLeave:b,onDrop:me=>!De&&de(me,v.key),children:[e.jsxs("div",{className:"nice-kanban__column-header",style:v.color?{borderTopColor:v.color}:void 0,onClick:y?()=>Te(v.key):void 0,role:y?"button":void 0,tabIndex:y?0:void 0,onKeyDown:y?me=>{(me.key==="Enter"||me.key===" ")&&Te(v.key)}:void 0,children:[y&&e.jsx("span",{className:"nice-kanban__collapse-icon","aria-hidden":"true",children:e.jsx(Mt,{open:!De})}),e.jsx("span",{className:"nice-kanban__column-title",children:v.title}),e.jsx("span",{className:"nice-kanban__column-count",children:v.limit!=null?e.jsxs("span",{className:"nice-kanban__count-frac",children:[e.jsx("span",{className:"nice-kanban__count-num",children:P.length}),e.jsx("span",{className:"nice-kanban__count-slash",children:"/"}),e.jsx("span",{className:"nice-kanban__count-den",children:v.limit})]}):P.length})]}),!De&&e.jsxs("div",{className:"nice-kanban__column-body",children:[P.map(me=>e.jsx("div",{className:`nice-kanban__card nice-kanban__card--${Oe} ${Z?.cardKey===me.key?"nice-kanban__card--dragging":""}`,draggable:!x,onDragStart:U=>Pe(U,me),onDragEnd:ge,onClick:()=>ee(me),role:"article",children:o?o(me):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-kanban__card-title",children:me.title}),Oe!=="compact"&&me.description&&e.jsx("div",{className:"nice-kanban__card-desc",children:me.description})]})},me.key)),P.length===0&&e.jsx("div",{className:"nice-kanban__empty",children:L("kanban.empty","No cards")})]}),!De&&(u||m&&I)&&!_e&&e.jsxs("button",{type:"button",className:"nice-kanban__add",onClick:()=>oe(v.key),disabled:x,children:[e.jsx(At,{})," ",L("kanban.addCard","Add card")]})]},v.key)})]}),m&&Y&&e.jsxs(nt.NiceModal,{open:!0,onClose:()=>W(null),title:Y.key==null?g||L("kanban.newCard","New card"):w||L("kanban.editCard","Edit card"),children:[e.jsx(et.NiceForm,{items:q,data:Y.data,columns:d,...N,onFieldChange:(v,P)=>W(se=>se&&{...se,data:{...se.data,[v]:P}})}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:16,flexWrap:"wrap"},children:[Y.key!=null&&F&&e.jsx(Ae.NiceButton,{type:"button",size:"sm",variant:"error",style:{marginRight:"auto"},onClick:()=>{F(Y.key),W(null)},children:L("controls.delete","Delete")}),e.jsx(Ae.NiceButton,{type:"button",size:"sm",variant:"secondary",onClick:()=>W(null),children:L("controls.cancel","Cancel")}),e.jsx(Ae.NiceButton,{type:"button",size:"sm",variant:"primary",onClick:()=>{if(Y.key==null){const v={key:`card-${Date.now()}`,title:"",column:Y.column,...Y.data};I?.(v)}else k?.(Y.key,{...Y.data,key:Y.key,column:Y.column});W(null)},children:L("controls.save","Save")})]})]})]})}),{displayName:"NiceKanbanBoard"}),zt=[];function sn(...n){return n.filter(Boolean).map(i=>typeof i=="object"?Object.entries(i).filter(([,a])=>a).map(([a])=>a).join(" "):i).join(" ")}const Rt=50,$t=[10,25,50,100,200],Lt=40,Pt={compact:32,normal:Lt,comfortable:48},Ot=10,Ut=768,Ft=500,Bt=10;function He(n,i){return i.split(".").reduce((a,s)=>a?.[s],n)}function Un(n){return n.width==="auto"?{flex:"1 1 0",minWidth:n.minWidth??80,maxWidth:n.maxWidth}:{width:n.width||150,minWidth:n.minWidth,maxWidth:n.maxWidth}}function xn(n,i,a="pl-PL"){if(n==null)return"—";switch(i.type){case"number":return new Intl.NumberFormat(a,{minimumFractionDigits:i.format?.includes(".")?i.format.split(".")[1].length:0}).format(n);case"currency":return new Intl.NumberFormat(a,{style:"currency",currency:i.currencyCode||"PLN"}).format(n);case"percent":return new Intl.NumberFormat(a,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:2}).format(n/100);case"date":return new Intl.DateTimeFormat(a,{dateStyle:"short"}).format(new Date(n));case"datetime":return new Intl.DateTimeFormat(a,{dateStyle:"short",timeStyle:"short"}).format(new Date(n));case"boolean":return n?e.jsx(E.NiceIcon,{name:"check",size:14}):e.jsx(E.NiceIcon,{name:"close",size:14});case"enum":return i.enumOptions?.find(o=>o.value===n)?.label||String(n);default:return String(n)}}function Wt(n,i,a,s){const[o,u]=t.useState(0),{startIndex:x,endIndex:h,totalHeight:y,offsetY:A}=t.useMemo(()=>{const D=n.length*a,Q=Math.ceil(i/a),H=Math.max(0,Math.floor(o/a)-s),q=Math.min(n.length,Math.ceil(o/a)+Q+s),d=H*a;return{startIndex:H,endIndex:q,totalHeight:D,offsetY:d}},[n.length,i,a,o,s]),T=t.useMemo(()=>n.slice(x,h),[n,x,h]),M=t.useCallback(D=>{u(D.currentTarget.scrollTop)},[]);return{visibleData:T,totalHeight:y,offsetY:A,handleScroll:M,startIndex:x}}function Kt(n,i){const[a,s]=t.useState(()=>{if(n&&typeof window<"u"){const u=localStorage.getItem(`nice-module-grid-${n}`);if(u)return JSON.parse(u)}return i||{}}),o=t.useCallback(u=>{s(x=>{const h={...x,...u};return n&&typeof window<"u"&&localStorage.setItem(`nice-module-grid-${n}`,JSON.stringify(h)),h})},[n]);return[a,o]}function Gt(n){const[i,a]=t.useState(typeof window<"u"&&window.innerWidth<n);return t.useEffect(()=>{if(typeof window>"u")return;const s=()=>a(window.innerWidth<n);return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[n]),i}function Qt({column:n,sort:i,onSort:a,onResize:s,resizable:o,t:u}){const x=t.useRef(null),[h,y]=t.useState(!1),A=t.useCallback(D=>{if(!o||!s)return;D.preventDefault(),y(!0);const Q=D.clientX,H=n.width||150,q=N=>{const w=N.clientX-Q,g=Math.max(n.minWidth||50,H+w);s(n.field,Math.min(g,n.maxWidth||1/0))},d=()=>{y(!1),document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",q),document.addEventListener("mouseup",d)},[n,o,s]),T=i?.direction,M=T==="asc"?e.jsx(E.NiceIcon,{name:"sort-asc",size:12}):T==="desc"?e.jsx(E.NiceIcon,{name:"sort-desc",size:12}):null;return e.jsxs("div",{className:sn("nice-module-grid__header-cell",n.sortable&&"nice-module-grid__header-cell--sortable",h&&"nice-module-grid__header-cell--resizing"),style:{...Un(n),textAlign:n.align},onClick:()=>n.sortable&&a?.(n.field),role:"columnheader","aria-sort":T==="asc"?"ascending":T==="desc"?"descending":"none",title:n.headerTooltip,children:[e.jsx("span",{className:"nice-module-grid__header-text",children:n.header}),M&&e.jsx("span",{className:"nice-module-grid__sort-indicator",children:M}),o&&e.jsx("div",{ref:x,className:"nice-module-grid__resize-handle",onMouseDown:A})]})}function Vt({column:n,row:i,rowIndex:a,value:s,locale:o="pl-PL",onClick:u}){const x=E.useAccessibleClick({onClick:u}),h=u?x:{},y={...Un(n),textAlign:n.align};if(n.render)return e.jsx("div",{className:"nice-module-grid__cell",style:y,...h,children:n.render(s,i,a)});if((n.type==="enum"||n.type==="badge")&&n.enumOptions){const A=n.enumOptions.find(T=>T.value===s);if(A)return e.jsx("div",{className:"nice-module-grid__cell",style:y,...h,children:e.jsxs("span",{className:sn("nice-module-grid__badge",`nice-module-grid__badge--${A.color||"default"}`),children:[A.icon&&e.jsx("span",{className:"nice-module-grid__badge-icon",children:A.icon}),A.label]})})}if(n.type==="progress"){const A=Math.min(100,Math.max(0,Number(s)||0));return e.jsx("div",{className:"nice-module-grid__cell",style:y,...h,children:e.jsxs("div",{className:"nice-module-grid__progress",children:[e.jsx("div",{className:"nice-module-grid__progress-bar",children:e.jsx("div",{className:sn("nice-module-grid__progress-fill",`nice-module-grid__progress-fill--${n.progressColor||"primary"}`),style:{width:`${A}%`}})}),e.jsxs("span",{className:"nice-module-grid__progress-text",children:[A,"%"]})]})})}if(n.type==="rating"){const A=n.maxRating||5,T=Number(s)||0;return e.jsx("div",{className:"nice-module-grid__cell",style:y,...h,children:e.jsx("span",{className:"nice-module-grid__rating","aria-label":`${T} out of ${A} stars`,children:Array.from({length:A},(M,D)=>e.jsx("span",{className:sn("nice-module-grid__rating-star",D<T&&"nice-module-grid__rating-star--filled"),children:e.jsx(E.NiceIcon,{name:"star",size:14})},D))})})}if(n.type==="link"&&n.linkTemplate){const A=n.linkTemplate.replace(/\{\{(\w+)\}\}/g,(T,M)=>String(He(i,M)??""));return e.jsx("div",{className:"nice-module-grid__cell",style:y,...h,children:e.jsx("a",{href:A,target:n.linkNewTab?"_blank":void 0,rel:n.linkNewTab?"noopener noreferrer":void 0,className:"nice-module-grid__link",children:xn(s,n,o)})})}if(n.type==="image"){const T={xs:24,sm:32,md:48,lg:64}[n.imageSize||"sm"];return e.jsx("div",{className:"nice-module-grid__cell",style:y,...h,children:s?e.jsx("img",{src:String(s),alt:"",className:"nice-module-grid__image",style:{width:T,height:T}}):e.jsx("div",{className:"nice-module-grid__image-placeholder",style:{width:T,height:T}})})}return n.type==="avatar"?e.jsx("div",{className:"nice-module-grid__cell",style:y,...h,children:s?e.jsx("img",{src:String(s),alt:"",className:"nice-module-grid__avatar"}):e.jsx("div",{className:"nice-module-grid__avatar-placeholder",children:"?"})}):n.type==="color"?e.jsx("div",{className:"nice-module-grid__cell",style:y,...h,children:e.jsx("span",{className:"nice-module-grid__color-swatch",style:{backgroundColor:s||"transparent"},title:s})}):n.type==="boolean"?e.jsx("div",{className:"nice-module-grid__cell",style:{...y,textAlign:n.align||"center"},...h,children:e.jsx("span",{className:sn("nice-module-grid__boolean",!!s&&"nice-module-grid__boolean--true"),children:e.jsx(E.NiceIcon,{name:s?"check":"close",size:14})})}):e.jsx("div",{className:"nice-module-grid__cell",style:y,...h,children:xn(s,n,o)})}function qt({row:n,index:i,columns:a,primaryField:s,secondaryField:o,customRender:u,selected:x,onClick:h,locale:y="pl-PL",t:A}){if(u)return e.jsx("div",{className:sn("nice-module-grid__mobile-card",x&&"nice-module-grid__mobile-card--selected"),onClick:h,children:u(n,i)});const T=a.find(D=>D.field===s)||a[0],M=a.find(D=>D.field===o)||a[1];return e.jsxs("div",{className:sn("nice-module-grid__mobile-card",x&&"nice-module-grid__mobile-card--selected"),onClick:h,role:"row","aria-selected":x,children:[e.jsxs("div",{className:"nice-module-grid__mobile-card-header",children:[e.jsx("div",{className:"nice-module-grid__mobile-card-title",children:xn(He(n,T?.field||""),T,y)}),M&&e.jsx("div",{className:"nice-module-grid__mobile-card-subtitle",children:xn(He(n,M.field),M,y)})]}),e.jsx("div",{className:"nice-module-grid__mobile-card-body",children:a.filter(D=>!D.hidden&&D.field!==s&&D.field!==o).slice(0,4).map(D=>e.jsxs("div",{className:"nice-module-grid__mobile-card-field",children:[e.jsx("span",{className:"nice-module-grid__mobile-card-label",children:D.header}),e.jsx("span",{className:"nice-module-grid__mobile-card-value",children:xn(He(n,D.field),D,y)})]},D.field))})]})}function Yt({page:n,pageSize:i,totalRows:a,pageSizeOptions:s,onPageChange:o,t:u}){const x=Math.ceil(a/i),h=(n-1)*i+1,y=Math.min(n*i,a);return e.jsxs("div",{className:"nice-module-grid__pagination",role:"navigation","aria-label":u("pagination.ariaLabel","Pagination"),children:[e.jsxs("div",{className:"nice-module-grid__pagination-info",children:[u("pagination.showing","Showing")," ",h,"–",y," ",u("pagination.of","of")," ",a]}),e.jsxs("div",{className:"nice-module-grid__pagination-controls",children:[e.jsx("select",{className:"nice-module-grid__page-size-select",value:i,onChange:A=>o(1,Number(A.target.value)),"aria-label":u("pagination.rowsPerPage","Rows per page"),children:s.map(A=>e.jsx("option",{value:A,children:A},A))}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>o(1,i),disabled:n===1,"aria-label":u("pagination.first","First"),children:e.jsx(E.NiceIcon,{name:"skip-back",size:14})}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>o(n-1,i),disabled:n===1,"aria-label":u("pagination.previous","Previous"),children:e.jsx(E.NiceIcon,{name:"chevron-left",size:14})}),e.jsxs("span",{className:"nice-module-grid__pagination-page",children:[n," / ",x]}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>o(n+1,i),disabled:n>=x,"aria-label":u("pagination.next","Next"),children:e.jsx(E.NiceIcon,{name:"chevron-right",size:14})}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>o(x,i),disabled:n>=x,"aria-label":u("pagination.last","Last"),children:e.jsx(E.NiceIcon,{name:"skip-forward",size:14})})]})]})}function Ht({columns:n}){return e.jsx("div",{className:"nice-module-grid__row nice-module-grid__row--skeleton",role:"row",children:n.filter(i=>!i.hidden).map(i=>e.jsx("div",{className:"nice-module-grid__cell nice-module-grid__cell--skeleton",style:{width:i.width==="auto"?"auto":i.width||150},children:e.jsx("div",{className:"nice-module-grid__skeleton-bar"})},i.field))})}function Zt(n,i){const{columns:a=zt,data:s,keyField:o="id",dataSource:u,onFetch:x,sortable:h=!0,sort:y,onSortChange:A,multiSort:T=!1,filter:M,searchText:D,onSearchChange:Q,searchPlaceholder:H,pagination:q=!0,page:d,pageSize:N,pageSizeOptions:w=$t,totalRows:g,onPageChange:k,virtualScroll:I=!0,rowHeight:F,overscan:J=Ot,selectionMode:ne="none",selectedKeys:ce,onSelectionChange:ue,columnResize:le=!0,onColumnWidthChange:ae,contextMenuItems:pe,onContextMenuAction:O,exportable:fe=!0,exportFormats:Ie=["csv","excel"],onExport:je,preferencesKey:L,initialPreferences:Z,density:p="normal",striped:f=!0,bordered:l=!1,hoverable:Y=!0,loading:W=!1,emptyState:m,toolbar:ee,onRowClick:oe,onRowDoubleClick:re,rowClassName:K,rowStyle:ye,mobileCardView:ke=!0,mobileBreakpoint:Oe=Ut,mobileCardRender:Me,mobilePrimaryField:Te,mobileSecondaryField:Ue,size:Pe="medium",skeletonLoading:$=!0,skeletonRows:b=Bt,"aria-label":de,"aria-labelledby":ge,"aria-describedby":v,className:P,style:se,id:_e,testId:De}=n,me=F??Pt[p],{t:U,lang:We}=E.useNiceTranslation();E.useNiceAccessMode(),E.useComponentDisplayStyle("table");const en=Gt(Oe),[B,on]=Kt(L,Z),nn=t.useRef(null),Xe=t.useRef(null),[dn,C]=t.useState([]),[X,he]=t.useState(),[Le,Ke]=t.useState(""),[xe,Ne]=t.useState(1),[Ve,Je]=t.useState(N||Rt),[Fe,qe]=t.useState(new Set),[hn,bn]=t.useState([]),[vn,wn]=t.useState(0),[kn,yn]=t.useState(!1),[Sn,Mn]=t.useState(new Set),[Ee,pn]=t.useState(null),[Nn,Cn]=t.useState({}),Be=y??dn,rn=M??X,un=D??Le,r=d??xe,c=N??Ve,j=ce??Fe,z=!!(x||u),G=g??(z?vn:s?.length??0),S=t.useMemo(()=>{const _=new Set(B.hiddenColumns||[]);return a.filter(ie=>!ie.hidden&&!_.has(ie.field))},[a,B.hiddenColumns]),R=t.useMemo(()=>{if(z)return hn;if(!s)return[];let _=[...s];if(un){const ie=un.toLowerCase(),be=a.filter(we=>we.searchable!==!1).map(we=>we.field);_=_.filter(we=>be.some(Ze=>{const cn=He(we,Ze);return String(cn??"").toLowerCase().includes(ie)}))}return Be.length>0&&_.sort((ie,be)=>{for(const we of Be){const Ze=He(ie,we.field),cn=He(be,we.field),ln=Ze<cn?-1:Ze>cn?1:0;if(ln!==0)return we.direction==="asc"?ln:-ln}return 0}),_},[z,hn,s,un,Be,a]),V=t.useMemo(()=>{if(z||!q)return R;const _=(r-1)*c;return R.slice(_,_+c)},[z,R,q,r,c]),te=nn.current?.clientHeight||400,Se=I&&V.length>Ft,{visibleData:Ce,totalHeight:Re,offsetY:Ge,handleScroll:gn,startIndex:mn}=Wt(V,te,me,J),tn=Se?Ce:V,_n=t.useCallback(async()=>{if(x){yn(!0);try{const ie=await x({page:r,pageSize:c,sort:Be,filter:rn,search:un});bn(ie.data),wn(ie.total)}catch(_){console.error("NiceModuleGrid fetch error:",_)}finally{yn(!1)}}},[x,r,c,Be,rn,un]);t.useEffect(()=>{z&&_n()},[z,_n]);const Bn=t.useCallback(_=>{const ie=Be.find(we=>we.field===_);let be;ie?ie.direction==="asc"?be=Be.map(we=>we.field===_?{...we,direction:"desc"}:we):be=Be.filter(we=>we.field!==_):be=T?[...Be,{field:_,direction:"asc"}]:[{field:_,direction:"asc"}],A?A(be):C(be)},[Be,T,A]),Wn=t.useCallback((_,ie)=>{k?k(_,ie):(Ne(_),Je(ie))},[k]),Kn=t.useCallback(_=>{Q?Q(_):Ke(_),k||Ne(1)},[Q,k]),In=t.useCallback((_,ie)=>{const be=new Set(j);if(ne==="single"?(be.clear(),be.add(_)):(ne==="multiple"||ne==="checkbox")&&(be.has(_)?be.delete(_):be.add(_)),ue){const we=V.filter(Ze=>be.has(String(He(Ze,o))));ue(be,we)}else qe(be)},[j,ne,ue,V,o]),Gn=t.useCallback((_,ie)=>{Cn(be=>({...be,[_]:ie})),ae?.(_,ie),on({columnWidths:{...B.columnWidths,[_]:ie}})},[ae,on,B.columnWidths]),Qn=t.useCallback((_,ie)=>{pe?.length&&(_.preventDefault(),pn({x:_.clientX,y:_.clientY,row:ie}))},[pe]),Vn=t.useCallback(_=>{Ee&&O?.(_,Ee.row),pn(null)},[Ee,O]),qn=t.useCallback(async _=>{if(je)await je(_,{selectedOnly:j.size>0,columns:S.map(ie=>ie.field)});else if(_==="csv"){const ie=S.map(Ye=>Ye.header).join(","),be=V.map(Ye=>S.map(Zn=>JSON.stringify(He(Ye,Zn.field)??"")).join(",")),we=[ie,...be].join(`
|
|
6
|
+
`),Ze=new Blob([we],{type:"text/csv;charset=utf-8;"}),cn=URL.createObjectURL(Ze),ln=document.createElement("a");ln.href=cn,ln.download=`export-${new Date().toISOString().slice(0,10)}.csv`,ln.click(),URL.revokeObjectURL(cn)}},[je,j,S,V,U]);t.useEffect(()=>{if(!Ee)return;const _=()=>pn(null);return document.addEventListener("click",_),()=>document.removeEventListener("click",_)},[Ee]);const Yn=t.useCallback(_=>{_.key==="Escape"&&pn(null)},[]),fn=W||kn,An=!fn&&tn.length===0,Tn=en&&ke,Hn=sn("nice-module-grid",`nice-module-grid--${p}`,`nice-module-grid--${Pe}`,f&&"nice-module-grid--striped",l&&"nice-module-grid--bordered",Y&&"nice-module-grid--hoverable",fn&&"nice-module-grid--loading",Tn&&"nice-module-grid--mobile",P);return e.jsxs("div",{ref:i,id:_e,"data-testid":De,className:Hn,style:se,onKeyDown:Yn,role:"grid","aria-label":de,"aria-labelledby":ge,"aria-describedby":v,"aria-rowcount":G,"aria-colcount":S.length,"aria-busy":fn,children:[e.jsxs("div",{className:"nice-module-grid__toolbar",children:[e.jsx("div",{className:"nice-module-grid__toolbar-search",children:e.jsx("input",{type:"search",className:"nice-module-grid__search-input",placeholder:H??U("moduleGrid.searchPlaceholder","Search…"),value:un,onChange:_=>Kn(_.target.value),"aria-label":U("moduleGrid.searchAriaLabel","Search")})}),ee,fe&&e.jsx("div",{className:"nice-module-grid__toolbar-export",children:Ie.map(_=>e.jsx("button",{className:"nice-module-grid__export-btn",onClick:()=>qn(_),"aria-label":U(`moduleGrid.export.${_}`,`Export to ${_.toUpperCase()}`),children:_.toUpperCase()},_))})]}),e.jsx("div",{ref:nn,className:"nice-module-grid__container",onScroll:Se?gn:void 0,children:Tn?e.jsx("div",{className:"nice-module-grid__mobile-list",children:fn&&$?Array.from({length:b},(_,ie)=>e.jsxs("div",{className:"nice-module-grid__mobile-card nice-module-grid__mobile-card--skeleton",children:[e.jsx("div",{className:"nice-module-grid__skeleton-bar",style:{width:"60%",height:20}}),e.jsx("div",{className:"nice-module-grid__skeleton-bar",style:{width:"40%",height:14}}),e.jsx("div",{className:"nice-module-grid__skeleton-bar",style:{width:"80%",height:14}})]},ie)):An?e.jsxs("div",{className:"nice-module-grid__empty",children:[m?.icon&&e.jsx("div",{className:"nice-module-grid__empty-icon",children:m.icon}),e.jsx("div",{className:"nice-module-grid__empty-title",children:m?.title||U("moduleGrid.noData","No data")}),m?.description&&e.jsx("div",{className:"nice-module-grid__empty-description",children:m.description}),m?.action&&e.jsxs("button",{className:"nice-module-grid__empty-action",onClick:m.action.onClick,children:[m.action.icon,m.action.label]})]}):tn.map((_,ie)=>{const be=String(He(_,o));return e.jsx(qt,{row:_,index:mn+ie,columns:S,primaryField:Te,secondaryField:Ue,customRender:Me,selected:j.has(be),locale:We,onClick:()=>{ne!=="none"&&In(be,_),oe?.(_,mn+ie)},t:U},be)})}):e.jsxs("div",{ref:Xe,className:"nice-module-grid__table",children:[e.jsxs("div",{className:"nice-module-grid__header",role:"row",children:[ne==="checkbox"&&e.jsx("div",{className:"nice-module-grid__header-cell nice-module-grid__header-cell--checkbox",children:e.jsx("input",{type:"checkbox",checked:j.size>0&&j.size===tn.length,onChange:()=>{if(j.size===tn.length)ue?.(new Set,[]),qe(new Set);else{const _=new Set(tn.map(ie=>String(He(ie,o))));ue?.(_,tn),qe(_)}},"aria-label":U("moduleGrid.selectAll","Select all")})}),S.map(_=>e.jsx(Qt,{column:{..._,width:Nn[_.field]||_.width},sort:Be.find(ie=>ie.field===_.field),onSort:h?Bn:void 0,onResize:le?Gn:void 0,resizable:le,t:U},_.field))]}),e.jsx("div",{className:"nice-module-grid__body",style:Se?{height:Re,position:"relative"}:void 0,children:fn&&$?Array.from({length:b},(_,ie)=>e.jsx(Ht,{columns:S},ie)):An?e.jsxs("div",{className:"nice-module-grid__empty",children:[m?.icon&&e.jsx("div",{className:"nice-module-grid__empty-icon",children:m.icon}),e.jsx("div",{className:"nice-module-grid__empty-title",children:m?.title||U("moduleGrid.noData","No data")}),m?.description&&e.jsx("div",{className:"nice-module-grid__empty-description",children:m.description}),m?.action&&e.jsxs("button",{className:"nice-module-grid__empty-action",onClick:m.action.onClick,children:[m.action.icon,m.action.label]})]}):e.jsx("div",{style:Se?{transform:`translateY(${Ge}px)`}:void 0,children:tn.map((_,ie)=>{const be=String(He(_,o)),we=mn+ie,Ze=j.has(be),cn=typeof K=="function"?K(_,we):K,ln=typeof ye=="function"?ye(_,we):ye;return e.jsxs("div",{className:sn("nice-module-grid__row",Ze&&"nice-module-grid__row--selected",cn),style:{...ln,height:me},role:"row","aria-rowindex":we+1,"aria-selected":Ze,onClick:()=>{ne!=="none"&&In(be,_),oe?.(_,we)},onDoubleClick:()=>re?.(_,we),onContextMenu:Ye=>Qn(Ye,_),children:[ne==="checkbox"&&e.jsx("div",{className:"nice-module-grid__cell nice-module-grid__cell--checkbox",children:e.jsx("input",{type:"checkbox",checked:Ze,onChange:()=>In(be,_),onClick:Ye=>Ye.stopPropagation(),"aria-label":U("moduleGrid.selectRow","Select row")})}),S.map(Ye=>e.jsx(Vt,{column:{...Ye,width:Nn[Ye.field]||Ye.width},row:_,rowIndex:we,value:He(_,Ye.field),locale:We},Ye.field))]},be)})})})]})}),q&&G>0&&e.jsx(Yt,{page:r,pageSize:c,totalRows:z?vn:R.length,pageSizeOptions:w,onPageChange:Wn,t:U}),Ee&&pe&&e.jsx("div",{className:"nice-module-grid__context-menu",style:{left:Ee.x,top:Ee.y},role:"menu",children:pe.filter(_=>typeof _.hidden=="function"?!_.hidden(Ee.row):!_.hidden).map(_=>{if(_.divider)return e.jsx("div",{className:"nice-module-grid__context-menu-divider"},_.key);const ie=typeof _.disabled=="function"?_.disabled(Ee.row):_.disabled;return e.jsxs("button",{className:sn("nice-module-grid__context-menu-item",_.danger&&"nice-module-grid__context-menu-item--danger",ie&&"nice-module-grid__context-menu-item--disabled"),onClick:()=>{ie||(_.onClick?.(Ee.row),Vn(_.key))},disabled:ie,role:"menuitem",children:[_.icon&&e.jsx("span",{className:"nice-module-grid__context-menu-icon",children:_.icon}),_.label]},_.key)})}),fn&&!$&&e.jsx("div",{className:"nice-module-grid__loading-overlay",children:e.jsx("div",{className:"nice-module-grid__spinner","aria-label":U("moduleGrid.loading","Loading")})})]})}const Xt=t.forwardRef(Zt),Qe={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},Jt=()=>e.jsxs("svg",{...Qe,children:[e.jsx("path",{d:"M3 7v6h6"}),e.jsx("path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13"})]}),ei=()=>e.jsxs("svg",{...Qe,children:[e.jsx("path",{d:"M21 7v6h-6"}),e.jsx("path",{d:"M3 17a9 9 0 0 1 15-6.7L21 13"})]}),ni=()=>e.jsxs("svg",{...Qe,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"15",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"18",y2:"18"})]}),ti=()=>e.jsxs("svg",{...Qe,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"6",y1:"12",x2:"18",y2:"12"}),e.jsx("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),ii=()=>e.jsxs("svg",{...Qe,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"6",y1:"18",x2:"21",y2:"18"})]}),ai=()=>e.jsxs("svg",{...Qe,children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"6",rx:"1"}),e.jsx("rect",{x:"3",y:"14",width:"18",height:"6",rx:"1"}),e.jsx("line",{x1:"12",y1:"11",x2:"12",y2:"13"})]}),si=()=>e.jsxs("svg",{...Qe,children:[e.jsx("rect",{x:"4",y:"3",width:"6",height:"18",rx:"1"}),e.jsx("rect",{x:"14",y:"3",width:"6",height:"18",rx:"1"}),e.jsx("line",{x1:"11",y1:"12",x2:"13",y2:"12"})]}),ri=()=>e.jsxs("svg",{...Qe,children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"6",rx:"1"}),e.jsx("line",{x1:"6",y1:"17",x2:"18",y2:"17"})]}),ci=()=>e.jsxs("svg",{...Qe,children:[e.jsx("rect",{x:"4",y:"3",width:"6",height:"18",rx:"1"}),e.jsx("line",{x1:"14",y1:"12",x2:"20",y2:"12"})]}),li=()=>e.jsx("svg",{...Qe,children:e.jsx("polyline",{points:"6 9 12 4 18 9"})}),oi=()=>e.jsx("svg",{...Qe,children:e.jsx("polyline",{points:"6 15 12 20 18 15"})}),di=()=>e.jsxs("svg",{...Qe,style:{opacity:.55},children:[e.jsx("polyline",{points:"6 9 12 4 18 9"}),e.jsx("polyline",{points:"6 15 12 20 18 15"})]}),ui=()=>e.jsxs("svg",{...Qe,children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),mi=()=>e.jsxs("svg",{...Qe,children:[e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),e.jsx("line",{x1:"6",y1:"18",x2:"18",y2:"6"})]});function Fn(n){let i="",a=n;for(;a>=0;)i=String.fromCharCode(65+a%26)+i,a=Math.floor(a/26)-1;return i}function ve(n,i){return`${Fn(i)}${n+1}`}function $e(n){const i=n.match(/^([A-Z]+)(\d+)$/);if(!i)return null;let a=0;for(let s=0;s<i[1].length;s++)a=a*26+(i[1].charCodeAt(s)-64);return{row:parseInt(i[2],10)-1,col:a-1}}function hi(n,i,a=new Set){const s=n.startsWith("=")?n.slice(1).trim():n,o=(d,N)=>{if(!d||!N)return[];const w=[];for(let g=d.row;g<=N.row;g++)for(let k=d.col;k<=N.col;k++){const I=ze(ve(g,k),i,new Set(a));typeof I=="number"&&w.push(I)}return w},u=(d,N)=>{if(!d||!N)return[];const w=[];for(let g=d.row;g<=N.row;g++)for(let k=d.col;k<=N.col;k++)w.push(ze(ve(g,k),i,new Set(a)));return w},x=s.match(/^(\w+)\(([A-Z]+\d+):([A-Z]+\d+)\)$/i);if(x){const d=x[1].toUpperCase(),N=$e(x[2].toUpperCase()),w=$e(x[3].toUpperCase());switch(d){case"SUM":return o(N,w).reduce((k,I)=>k+I,0);case"AVG":case"AVERAGE":{const g=o(N,w);return g.length>0?g.reduce((k,I)=>k+I,0)/g.length:0}case"COUNT":return o(N,w).length;case"COUNTA":return u(N,w).filter(g=>g!==null&&g!=="").length;case"COUNTBLANK":return u(N,w).filter(g=>g===null||g==="").length;case"MIN":{const g=o(N,w);return g.length?Math.min(...g):0}case"MAX":{const g=o(N,w);return g.length?Math.max(...g):0}case"MEDIAN":{const g=o(N,w).sort((I,F)=>I-F);if(!g.length)return 0;const k=Math.floor(g.length/2);return g.length%2?g[k]:(g[k-1]+g[k])/2}case"STDEV":{const g=o(N,w);if(g.length<2)return 0;const k=g.reduce((I,F)=>I+F,0)/g.length;return Math.sqrt(g.reduce((I,F)=>I+(F-k)**2,0)/(g.length-1))}case"PRODUCT":{const g=o(N,w);return g.length?g.reduce((k,I)=>k*I,1):0}}}const h=s.match(/^(SUMIF|COUNTIF)\(([A-Z]+\d+):([A-Z]+\d+)\s*,\s*"?([^"]*)"?\)$/i);if(h){const d=h[1].toUpperCase(),N=$e(h[2].toUpperCase()),w=$e(h[3].toUpperCase()),g=h[4];if(N&&w){let k=0;for(let I=N.row;I<=w.row;I++)for(let F=N.col;F<=w.col;F++){const J=ze(ve(I,F),i,new Set(a));(g.startsWith(">")?Number(J)>Number(g.slice(1)):g.startsWith("<")?Number(J)<Number(g.slice(1)):String(J)===g||typeof J=="number"&&J===Number(g))&&(k+=d==="SUMIF"?typeof J=="number"?J:0:1)}return k}}const y=s.match(/^IF\(([^,]+),\s*([^,]+),\s*([^)]+)\)$/i);if(y){const d=y[1].trim(),N=y[2].trim(),w=y[3].trim(),g=d.match(/^([A-Z]+\d+)\s*([><=!]+)\s*(\S+)$/i);let k=!1;if(g){const J=ze(g[1].toUpperCase(),i,new Set(a)),ne=isNaN(Number(g[3]))?g[3].replace(/^"|"$/g,""):Number(g[3]),ce=g[2],ue=typeof J=="number"?J:Number(J)||0,le=typeof ne=="number"?ne:Number(ne)||0;switch(ce){case">":k=ue>le;break;case"<":k=ue<le;break;case">=":k=ue>=le;break;case"<=":k=ue<=le;break;case"=":case"==":k=ue===le;break;case"<>":case"!=":k=ue!==le;break}}const I=k?N:w;if($e(I.toUpperCase()))return ze(I.toUpperCase(),i,new Set(a));const F=Number(I);return isNaN(F)?I.replace(/^"|"$/g,""):F}const A=s.match(/^CONCAT\((.+)\)$/i);if(A)return A[1].split(",").map(N=>N.trim()).map(N=>{if(N.startsWith('"')&&N.endsWith('"'))return N.slice(1,-1);if($e(N.toUpperCase())){const g=ze(N.toUpperCase(),i,new Set(a));return g!==null?String(g):""}return N}).join("");const T=s.match(/^VLOOKUP\(([^,]+),\s*([A-Z]+\d+):([A-Z]+\d+),\s*(\d+)\)$/i);if(T){let d;$e(T[1].trim().toUpperCase())?d=ze(T[1].trim().toUpperCase(),i,new Set(a)):d=isNaN(Number(T[1]))?T[1].replace(/^"|"$/g,""):Number(T[1]);const w=$e(T[2].toUpperCase()),g=$e(T[3].toUpperCase()),k=parseInt(T[4])-1;if(w&&g)for(let I=w.row;I<=g.row;I++){const F=ze(ve(I,w.col),i,new Set(a));if(String(F)===String(d))return ze(ve(I,w.col+k),i,new Set(a))}return null}const M=s.match(/^(ABS|ROUND|FLOOR|CEIL|CEILING|SQRT|LEN|UPPER|LOWER|TRIM|INT)\(([^)]+)\)$/i);if(M){const d=M[1].toUpperCase(),N=M[2].trim();let w;switch($e(N.toUpperCase())?w=ze(N.toUpperCase(),i,new Set(a)):w=isNaN(Number(N))?N.replace(/^"|"$/g,""):Number(N),d){case"ABS":return Math.abs(Number(w)||0);case"ROUND":return Math.round(Number(w)||0);case"FLOOR":return Math.floor(Number(w)||0);case"CEIL":case"CEILING":return Math.ceil(Number(w)||0);case"SQRT":return Math.sqrt(Number(w)||0);case"INT":return Math.trunc(Number(w)||0);case"LEN":return String(w??"").length;case"UPPER":return String(w??"").toUpperCase();case"LOWER":return String(w??"").toLowerCase();case"TRIM":return String(w??"").trim()}}const D=s.match(/^POWER\(([^,]+),\s*([^)]+)\)$/i);if(D){const d=Number($e(D[1].trim().toUpperCase())?ze(D[1].trim().toUpperCase(),i,new Set(a)):D[1].trim())||0,N=Number($e(D[2].trim().toUpperCase())?ze(D[2].trim().toUpperCase(),i,new Set(a)):D[2].trim())||0;return Math.pow(d,N)}if(/^NOW\(\)$/i.test(s))return new Date().toISOString();if(/^TODAY\(\)$/i.test(s))return new Date().toISOString().split("T")[0];if(/^PI\(\)$/i.test(s))return Math.PI;const Q=s.match(/^([A-Z]+\d+)$/i);if(Q)return ze(Q[1].toUpperCase(),i,a);const H=s.match(/^([A-Z]+\d+)\s*([+\-*/])\s*([A-Z]+\d+|\d+\.?\d*)$/i);if(H){const d=H[1].toUpperCase(),N=H[2],w=H[3],g=ze(d,i,a),I=$e(w.toUpperCase())?ze(w.toUpperCase(),i,a):parseFloat(w),F=typeof g=="number"?g:0,J=typeof I=="number"?I:0;switch(N){case"+":return F+J;case"-":return F-J;case"*":return F*J;case"/":return J!==0?F/J:null}}const q=parseFloat(s);return isNaN(q)?s:q}function ze(n,i,a){if(a.has(n))return null;a.add(n);const s=i[n];return s?s.formula?hi(s.formula,i,a):s.value:null}function Rn(n,i){return n==null?"":i==="percent"&&typeof n=="number"?`${(n*100).toFixed(1)}%`:i==="currency"&&typeof n=="number"?`$${n.toFixed(2)}`:String(n)}function $n(n){return{name:n,data:{}}}const pi=Object.assign(t.forwardRef(({sheets:n,activeSheet:i,rows:a=50,cols:s=26,showToolbar:o=!0,showFormulaBar:u=!0,showSheetTabs:x=!0,readOnly:h=!1,disabled:y=!1,loading:A=!1,error:T,size:M="md",onChange:D,onActiveSheetChange:Q,onCellSelect:H,onCopy:q,onPaste:d,onInsert:N,onRemove:w,maxUndo:g=50,sortable:k=!1,filterable:I=!1,rangeSelection:F=!0,className:J,style:ne,id:ce,...ue},le)=>{const ae=h||y,pe=E.useControlId(ce),{t:O}=E.useNiceTranslation(),[fe,Ie]=t.useState(()=>n??[$n(O("spreadsheet.sheet","Sheet")+" 1")]),[je,L]=t.useState(0),Z=n??fe,p=i??je,f=Z[p]??Z[0],[l,Y]=t.useState(null),[W,m]=t.useState(null),[ee,oe]=t.useState(!1),[re,K]=t.useState(null),[ye,ke]=t.useState(""),Oe=t.useRef(null),Me=t.useRef(null),[Te,Ue]=t.useState([]),[Pe,$]=t.useState([]),[b,de]=t.useState(null),ge=t.useRef({x:0,width:80}),[v,P]=t.useState(null),[se,_e]=t.useState(null),[De,me]=t.useState("");t.useEffect(()=>{re&&Oe.current&&Oe.current.focus()},[re]);const U=t.useMemo(()=>{if(!l)return null;const r=W??l;return{startRow:Math.min(l.row,r.row),startCol:Math.min(l.col,r.col),endRow:Math.max(l.row,r.row),endCol:Math.max(l.col,r.col)}},[l,W]),We=t.useCallback((r,c)=>U?r>=U.startRow&&r<=U.endRow&&c>=U.startCol&&c<=U.endCol:!1,[U]),en=t.useCallback(r=>{Ue(c=>{const j=[...c,r.map(z=>({...z,data:{...z.data}}))];return j.length>g?j.slice(-g):j}),$([])},[g]),B=t.useCallback((r,c=!0)=>{c&&en(Z);const j=r(Z);n||Ie(j),D?.(j)},[Z,n,D,en]),on=t.useCallback(()=>{if(Te.length===0)return;const r=Te[Te.length-1];$(c=>[...c,Z.map(j=>({...j,data:{...j.data}}))]),Ue(c=>c.slice(0,-1)),n||Ie(r),D?.(r)},[Te,Z,n,D]),nn=t.useCallback(()=>{if(Pe.length===0)return;const r=Pe[Pe.length-1];Ue(c=>[...c,Z.map(j=>({...j,data:{...j.data}}))]),$(c=>c.slice(0,-1)),n||Ie(r),D?.(r)},[Pe,Z,n,D]),Xe=t.useCallback(r=>{i||L(r),Q?.(r),Y(null),m(null),K(null)},[i,Q]),dn=t.useCallback((r,c,j)=>{const z=ve(r,c);B(G=>{const S=G.map((V,te)=>te===p?{...V,data:{...V.data}}:V),R=j.startsWith("=");return S[p].data[z]={...S[p].data[z]??{value:null},formula:R?j:void 0,value:R?null:isNaN(Number(j))?j:Number(j)},S})},[p,B]),C=t.useCallback((r,c,j)=>{j?.shiftKey&&F&&l?m({row:r,col:c}):(Y({row:r,col:c}),m(null)),K(null),H?.(p,r,c)},[p,H,F,l]),X=t.useCallback((r,c,j)=>{j.button===0&&(C(r,c,j),F&&!j.shiftKey&&oe(!0))},[C,F]),he=t.useCallback((r,c)=>{ee&&m({row:r,col:c})},[ee]);t.useEffect(()=>{if(!ee)return;const r=()=>oe(!1);return document.addEventListener("mouseup",r),()=>document.removeEventListener("mouseup",r)},[ee]);const Le=t.useCallback((r,c)=>{if(ae)return;const j=ve(r,c),z=f.data[j];z?.readOnly||(K({row:r,col:c}),ke(z?.formula??(z?.value!=null?String(z.value):"")))},[ae,f.data]),Ke=t.useCallback(()=>{re&&(dn(re.row,re.col,ye),K(null))},[re,ye,dn]),xe=t.useCallback(r=>{if(r.key==="Enter")Ke();else if(r.key==="Escape")K(null);else if(r.key==="Tab"&&(r.preventDefault(),Ke(),l)){const c=r.shiftKey?Math.max(0,l.col-1):Math.min(s-1,l.col+1);Y({row:l.row,col:c})}},[Ke,l,s]),Ne=t.useCallback((r,c)=>{if(!l)return;const j=U??{startRow:l.row,startCol:l.col,endRow:l.row,endCol:l.col};B(z=>{const G=z.map((S,R)=>R===p?{...S,data:{...S.data}}:S);for(let S=j.startRow;S<=j.endRow;S++)for(let R=j.startCol;R<=j.endCol;R++){const V=ve(S,R);G[p].data[V]={...G[p].data[V]??{value:null},[r]:c}}return G})},[l,U,p,B]),Ve=t.useCallback(r=>{if(!U||q?.(U)===!1)return;const{startRow:c,startCol:j,endRow:z,endCol:G}=U,S=[];for(let R=c;R<=z;R++){const V=[];for(let te=j;te<=G;te++){const Se=ve(R,te),Ce=f.data[Se],Re=Ce?ze(Se,f.data,new Set):null;V.push(Rn(Re,Ce?.format))}S.push(V.join(" "))}r.clipboardData.setData("text/plain",S.join(`
|
|
7
|
+
`)),r.preventDefault()},[U,f.data,q]),Je=t.useCallback(r=>{if(ae||!l)return;const c=r.clipboardData.getData("text/plain");if(!c)return;const j=c.split(`
|
|
8
|
+
`).map(z=>z.split(" "));d?.(j,l.row,l.col)!==!1&&(B(z=>{const G=z.map((S,R)=>R===p?{...S,data:{...S.data}}:S);return j.forEach((S,R)=>{S.forEach((V,te)=>{const Se=ve(l.row+R,l.col+te),Ce=V.startsWith("=");G[p].data[Se]={...G[p].data[Se]??{value:null},formula:Ce?V:void 0,value:Ce?null:isNaN(Number(V))?V:Number(V)}})}),G}),r.preventDefault())},[ae,l,p,B,d]),Fe=t.useCallback(r=>{B(c=>c.map((z,G)=>{if(G!==p)return z;const S={};for(const[R,V]of Object.entries(z.data)){const te=$e(R);te&&(te.row>r?S[ve(te.row+1,te.col)]=V:S[R]=V)}return{...z,data:S}})),N?.("row",r)},[p,B,N]),qe=t.useCallback(r=>{B(c=>c.map((z,G)=>{if(G!==p)return z;const S={};for(const[R,V]of Object.entries(z.data)){const te=$e(R);te&&(te.col>r?S[ve(te.row,te.col+1)]=V:S[R]=V)}return{...z,data:S}})),N?.("column",r)},[p,B,N]),hn=t.useCallback(r=>{B(c=>c.map((z,G)=>{if(G!==p)return z;const S={};for(const[R,V]of Object.entries(z.data)){const te=$e(R);te&&te.row!==r&&(te.row>r?S[ve(te.row-1,te.col)]=V:S[R]=V)}return{...z,data:S}})),w?.("row",r)},[p,B,w]),bn=t.useCallback(r=>{B(c=>c.map((z,G)=>{if(G!==p)return z;const S={};for(const[R,V]of Object.entries(z.data)){const te=$e(R);te&&te.col!==r&&(te.col>r?S[ve(te.row,te.col-1)]=V:S[R]=V)}return{...z,data:S}})),w?.("column",r)},[p,B,w]),vn=t.useCallback((r,c)=>{B(j=>j.map((G,S)=>{if(S!==p)return G;const R=new Map;for(const[Se,Ce]of Object.entries(G.data)){const Re=$e(Se);Re&&(R.has(Re.row)||R.set(Re.row,{}),R.get(Re.row)[Re.col]=Ce)}const V=Array.from(R.entries()).sort((Se,Ce)=>{const Re=ze(ve(Se[0],r),G.data,new Set),Ge=ze(ve(Ce[0],r),G.data,new Set),gn=typeof Re=="number"?Re:Number(Re),mn=typeof Ge=="number"?Ge:Number(Ge);if(!isNaN(gn)&&!isNaN(mn))return c==="asc"?gn-mn:mn-gn;const tn=String(Re??""),_n=String(Ge??"");return c==="asc"?tn.localeCompare(_n):_n.localeCompare(tn)}),te={};return V.forEach(([,Se],Ce)=>{for(const[Re,Ge]of Object.entries(Se))te[ve(Ce,Number(Re))]=Ge}),{...G,data:te,sortColumn:r,sortDirection:c}}))},[p,B]),wn=t.useCallback((r,c)=>{const j=f.conditionalFormats;if(!j?.length)return;const z=ve(r,c),G=ze(z,f.data,new Set),S=typeof G=="number"?G:Number(G);for(const R of j){const V=R.range.match(/^([A-Z]+\d+):([A-Z]+\d+)$/i);if(!V)continue;const te=$e(V[1].toUpperCase()),Se=$e(V[2].toUpperCase());if(!te||!Se||r<te.row||r>Se.row||c<te.col||c>Se.col)continue;let Ce=!1;switch(R.type){case"greaterThan":Ce=!isNaN(S)&&S>Number(R.value);break;case"lessThan":Ce=!isNaN(S)&&S<Number(R.value);break;case"equalTo":Ce=String(G)===String(R.value);break;case"between":Ce=!isNaN(S)&&S>=Number(R.value)&&S<=Number(R.value2);break;case"textContains":Ce=String(G).includes(String(R.value));break;case"isEmpty":Ce=G===null||G==="";break;case"isNotEmpty":Ce=G!==null&&G!=="";break}if(Ce)return{backgroundColor:R.style.bgColor,color:R.style.color,fontWeight:R.style.bold?"bold":void 0,fontStyle:R.style.italic?"italic":void 0}}},[f.conditionalFormats,f.data]),kn=t.useCallback(()=>{const r=`${O("spreadsheet.sheet","Sheet")} ${Z.length+1}`;B(c=>[...c,$n(r)]),Xe(Z.length)},[Z.length,B,Xe,O]),yn=t.useCallback(()=>{Z.length<=1||(B(r=>r.filter((c,j)=>j!==p)),Xe(Math.max(0,p-1)))},[Z.length,p,B,Xe]),Sn=t.useCallback((r,c)=>{c.trim()&&(B(j=>j.map((z,G)=>G===r?{...z,name:c.trim()}:z),!1),_e(null))},[B]),Mn=t.useMemo(()=>{if(!l)return"";const r=ve(l.row,l.col),c=f.data[r];return c?.formula??(c?.value!=null?String(c.value):"")},[l,f.data]),Ee=t.useMemo(()=>{if(!U)return null;const{startRow:r,startCol:c,endRow:j,endCol:z}=U;if(r===j&&c===z)return null;const G=[];let S=0;for(let R=r;R<=j;R++)for(let V=c;V<=z;V++){const te=ve(R,V),Se=ze(te,f.data,new Set);Se!==null&&Se!==""&&S++,typeof Se=="number"&&G.push(Se)}return G.length===0?{count:S}:{count:S,sum:G.reduce((R,V)=>R+V,0),avg:G.reduce((R,V)=>R+V,0)/G.length,min:Math.min(...G),max:Math.max(...G)}},[U,f.data]),pn=t.useCallback((r,c)=>{c.preventDefault(),c.stopPropagation(),de(r),ge.current={x:c.clientX,width:f.colWidths?.[r]??80}},[f.colWidths]);t.useEffect(()=>{if(b===null)return;const r=j=>{const z=j.clientX-ge.current.x,G=Math.max(30,ge.current.width+z);B(S=>S.map((V,te)=>te===p?{...V,colWidths:{...V.colWidths,[b]:G}}:V),!1)},c=()=>de(null);return document.addEventListener("mousemove",r),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",c)}},[b,p,B]);const Nn=t.useCallback((r,c,j)=>{r.preventDefault(),Y({row:c,col:j}),P({x:r.clientX,y:r.clientY})},[]);t.useEffect(()=>{if(!v)return;const r=()=>P(null);return document.addEventListener("click",r),()=>document.removeEventListener("click",r)},[v]);const Cn=t.useCallback(r=>{if((r.ctrlKey||r.metaKey)&&!re){if(r.key==="z"){r.preventDefault(),on();return}if(r.key==="y"){r.preventDefault(),nn();return}}if(re||!l)return;let{row:c,col:j}=l;switch(r.key){case"ArrowUp":c=Math.max(0,c-1);break;case"ArrowDown":c=Math.min(a-1,c+1);break;case"ArrowLeft":j=Math.max(0,j-1);break;case"ArrowRight":j=Math.min(s-1,j+1);break;case"Enter":Le(c,j);return;case"Delete":case"Backspace":ae||(U&&(U.startRow!==U.endRow||U.startCol!==U.endCol)?B(z=>{const G=z.map((S,R)=>R===p?{...S,data:{...S.data}}:S);for(let S=U.startRow;S<=U.endRow;S++)for(let R=U.startCol;R<=U.endCol;R++)delete G[p].data[ve(S,R)];return G}):dn(c,j,""));return;default:if(r.key.length===1&&!r.ctrlKey&&!r.metaKey&&!ae){K({row:c,col:j}),ke(r.key);return}return}r.preventDefault(),r.shiftKey&&F?m({row:c,col:j}):(Y({row:c,col:j}),m(null)),H?.(p,c,j)},[re,l,a,s,ae,Le,dn,p,H,on,nn,U,B,F]),Be=f.frozenRows??0,rn=f.frozenCols??0,un=[{value:"text",label:O("spreadsheet.formatText","Text")},{value:"number",label:O("spreadsheet.formatNumber","Number")},{value:"percent",label:O("spreadsheet.formatPercent","Percent")},{value:"currency",label:O("spreadsheet.formatCurrency","Currency")},{value:"date",label:O("spreadsheet.formatDate","Date")}];return e.jsxs("div",{ref:le,id:pe,className:`nice-spreadsheet nice-spreadsheet--${M} ${h&&!y?"nice-spreadsheet--readonly":""} ${y?"nice-spreadsheet--disabled":""} ${A?"nice-spreadsheet--loading":""} ${T?"nice-spreadsheet--error":""} ${J??""}`,style:{...ne,position:A?"relative":ne?.position},onKeyDown:Cn,onCopy:Ve,onPaste:Je,tabIndex:y?-1:0,role:"application","aria-label":O("spreadsheet.label","Spreadsheet"),"aria-disabled":y||void 0,"aria-busy":A||void 0,...ue,children:[T&&e.jsx("div",{className:"nice-spreadsheet__error",role:"alert",children:T}),A&&e.jsx("span",{className:"nice-spreadsheet__spinner","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),o&&!ae&&e.jsxs("div",{className:"nice-spreadsheet__toolbar",role:"toolbar",children:[e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:on,disabled:Te.length===0,title:O("spreadsheet.undo","Undo"),children:e.jsx(Jt,{})}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:nn,disabled:Pe.length===0,title:O("spreadsheet.redo","Redo"),children:e.jsx(ei,{})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Ae.NiceButton,{variant:f.data[l?ve(l.row,l.col):""]?.bold?"primary":"ghost",size:"sm",onClick:()=>Ne("bold",!f.data[l?ve(l.row,l.col):""]?.bold),title:O("spreadsheet.bold","Bold"),children:e.jsx("strong",{children:"B"})}),e.jsx(Ae.NiceButton,{variant:f.data[l?ve(l.row,l.col):""]?.italic?"primary":"ghost",size:"sm",onClick:()=>Ne("italic",!f.data[l?ve(l.row,l.col):""]?.italic),title:O("spreadsheet.italic","Italic"),children:e.jsx("em",{children:"I"})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>Ne("align","left"),title:O("spreadsheet.alignLeft","Align left"),children:e.jsx(ni,{})}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>Ne("align","center"),title:O("spreadsheet.alignCenter","Center"),children:e.jsx(ti,{})}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>Ne("align","right"),title:O("spreadsheet.alignRight","Align right"),children:e.jsx(ii,{})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(zn.NiceColorPicker,{value:f.data[l?ve(l.row,l.col):""]?.bgColor??"var(--nice-bg-primary, #ffffff)",onChange:r=>Ne("bgColor",r),title:O("spreadsheet.bgColor","Background color"),showInput:!1,showRandom:!1}),e.jsx(zn.NiceColorPicker,{value:f.data[l?ve(l.row,l.col):""]?.color??"var(--nice-text-primary, #000000)",onChange:r=>Ne("color",r),title:O("spreadsheet.textColor","Text color"),showInput:!1,showRandom:!1}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(it.NiceSelect,{size:"sm",value:f.data[l?ve(l.row,l.col):""]?.format??"text",onChange:r=>Ne("format",r),options:un,"aria-label":O("spreadsheet.format","Cell format")}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&Fe(l.row),title:O("spreadsheet.insertRow","Insert row"),children:e.jsx(ai,{})}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&qe(l.col),title:O("spreadsheet.insertCol","Insert column"),children:e.jsx(si,{})}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&hn(l.row),title:O("spreadsheet.deleteRow","Delete row"),children:e.jsx(ri,{})}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&bn(l.col),title:O("spreadsheet.deleteCol","Delete column"),children:e.jsx(ci,{})})]}),u&&e.jsxs("div",{className:"nice-spreadsheet__formula-bar",children:[e.jsxs("span",{className:"nice-spreadsheet__cell-label",children:[l?ve(l.row,l.col):"",U&&U.startRow!==U.endRow||U&&U.startCol!==U.endCol?`:${ve(U.endRow,U.endCol)}`:""]}),e.jsx(En.NiceTextInput,{className:"nice-spreadsheet__formula-input",value:re?ye:Mn,onChange:r=>{re?ke(r):l&&(K(l),ke(r))},onKeyDown:xe,readOnly:ae,"aria-label":O("spreadsheet.formulaBar","Formula bar")})]}),e.jsx("div",{className:"nice-spreadsheet__grid",ref:Me,children:e.jsxs("table",{role:"grid","aria-label":f.name,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"nice-spreadsheet__corner"}),Array.from({length:s},(r,c)=>e.jsxs("th",{className:`nice-spreadsheet__col-header ${c<rn?"nice-spreadsheet__col-header--frozen":""}`,style:{width:f.colWidths?.[c]??80,position:c<rn?"sticky":void 0,left:c<rn?c*80+40:void 0,zIndex:c<rn?3:void 0},children:[e.jsx("span",{children:Fn(c)}),k&&e.jsx("span",{className:"nice-spreadsheet__sort-trigger",onClick:()=>vn(c,f.sortColumn===c&&f.sortDirection==="asc"?"desc":"asc"),title:O("spreadsheet.sort","Sort"),children:f.sortColumn===c?f.sortDirection==="asc"?e.jsx(li,{}):e.jsx(oi,{}):e.jsx(di,{})}),!ae&&e.jsx("span",{className:"nice-spreadsheet__col-resize",onMouseDown:j=>pn(c,j)})]},c))]})}),e.jsx("tbody",{children:Array.from({length:a},(r,c)=>e.jsxs("tr",{className:c<Be?"nice-spreadsheet__row--frozen":"",style:c<Be?{position:"sticky",top:c*24,zIndex:2}:void 0,children:[e.jsx("td",{className:"nice-spreadsheet__row-header",children:c+1}),Array.from({length:s},(j,z)=>{const G=ve(c,z),S=f.data[G];if(S?.mergedInto)return null;const R=l?.row===c&&l?.col===z,V=We(c,z),te=re?.row===c&&re?.col===z,Se=S?ze(G,f.data,new Set):null,Ce=wn(c,z),Re=c<Be||z<rn;return e.jsxs("td",{className:`nice-spreadsheet__cell ${R?"nice-spreadsheet__cell--selected":""} ${V&&!R?"nice-spreadsheet__cell--in-range":""} ${S?.readOnly?"nice-spreadsheet__cell--readonly":""} ${Re?"nice-spreadsheet__cell--frozen":""}`,style:{textAlign:S?.align,fontWeight:S?.bold?"bold":void 0,fontStyle:S?.italic?"italic":void 0,backgroundColor:Ce?.backgroundColor??S?.bgColor,color:Ce?.color??S?.color,width:f.colWidths?.[z],height:f.rowHeights?.[c],position:Re?"sticky":void 0,left:z<rn?z*80+40:void 0,zIndex:Re?1:void 0,...Ce},colSpan:S?.colSpan,rowSpan:S?.rowSpan,onMouseDown:Ge=>X(c,z,Ge),onMouseEnter:()=>he(c,z),onDoubleClick:()=>Le(c,z),onContextMenu:Ge=>Nn(Ge,c,z),role:"gridcell","aria-selected":R,title:S?.comment,children:[S?.comment&&e.jsx("span",{className:"nice-spreadsheet__comment-indicator"}),te?e.jsx("input",{ref:Oe,className:"nice-spreadsheet__cell-editor",value:ye,onChange:Ge=>ke(Ge.target.value),onKeyDown:xe,onBlur:Ke}):Rn(Se,S?.format)]},z)})]},c))})]})}),v&&!ae&&l&&e.jsxs("div",{className:"nice-spreadsheet__context-menu",style:{position:"fixed",left:v.x,top:v.y,zIndex:1e3},children:[e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{Fe(l.row),P(null)},children:O("spreadsheet.insertRowAbove","Insert row above")}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{Fe(l.row+1),P(null)},children:O("spreadsheet.insertRowBelow","Insert row below")}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{qe(l.col),P(null)},children:O("spreadsheet.insertColLeft","Insert column left")}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{qe(l.col+1),P(null)},children:O("spreadsheet.insertColRight","Insert column right")}),e.jsx("hr",{className:"nice-spreadsheet__context-sep"}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{hn(l.row),P(null)},children:O("spreadsheet.deleteRow","Delete row")}),e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{bn(l.col),P(null)},children:O("spreadsheet.deleteCol","Delete column")})]}),Ee&&e.jsxs("div",{className:"nice-spreadsheet__status-bar",children:[e.jsxs("span",{children:[O("spreadsheet.count","Count"),": ",Ee.count]}),Ee.sum!==void 0&&e.jsxs("span",{children:[O("spreadsheet.sum","Sum"),": ",Ee.sum.toFixed(2)]}),Ee.avg!==void 0&&e.jsxs("span",{children:[O("spreadsheet.avg","Avg"),": ",Ee.avg.toFixed(2)]}),Ee.min!==void 0&&e.jsxs("span",{children:[O("spreadsheet.min","Min"),": ",Ee.min]}),Ee.max!==void 0&&e.jsxs("span",{children:[O("spreadsheet.max","Max"),": ",Ee.max]})]}),x&&e.jsxs("div",{className:"nice-spreadsheet__tabs",role:"tablist",children:[Z.map((r,c)=>e.jsx("span",{className:"nice-spreadsheet__tab-wrapper",children:se===c?e.jsx(En.NiceTextInput,{className:"nice-spreadsheet__tab-rename",value:De,onChange:j=>me(j),onBlur:()=>Sn(c,De),onKeyDown:j=>{j.key==="Enter"&&Sn(c,De),j.key==="Escape"&&_e(null)},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>{ae||(_e(c),me(r.name))},children:e.jsx(Ae.NiceButton,{variant:c===p?"primary":"ghost",size:"sm",onClick:()=>Xe(c),children:r.name})})},c)),!ae&&e.jsxs(e.Fragment,{children:[e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:kn,title:O("spreadsheet.addSheet","Add sheet"),children:e.jsx(ui,{})}),Z.length>1&&e.jsx(Ae.NiceButton,{variant:"ghost",size:"sm",onClick:yn,title:O("spreadsheet.removeSheet","Remove sheet"),children:e.jsx(mi,{})})]})]})]})}),{displayName:"NiceSpreadsheet"}),fi=`
|
|
9
|
+
.nice-reconciliation {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
height: 100%;
|
|
13
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
14
|
+
border: 1px solid var(--nice-border-color, #e5e7eb);
|
|
15
|
+
border-radius: var(--nice-radius-lg, 0.5rem);
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.nice-reconciliation__toolbar {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: 0.75rem;
|
|
23
|
+
padding: 0.75rem 1rem;
|
|
24
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
25
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
26
|
+
flex-wrap: wrap;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.nice-reconciliation__toolbar-group {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: 0.5rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.nice-reconciliation__toolbar-group--end {
|
|
36
|
+
margin-inline-start: auto;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.nice-reconciliation__btn {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 0.375rem;
|
|
43
|
+
padding: 0.375rem 0.75rem;
|
|
44
|
+
font-size: 0.8125rem;
|
|
45
|
+
font-weight: 500;
|
|
46
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
transition: all 0.15s ease;
|
|
49
|
+
border: 1px solid var(--nice-border-color, #d1d5db);
|
|
50
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
51
|
+
color: var(--nice-text-primary);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.nice-reconciliation__btn:hover {
|
|
55
|
+
background: var(--nice-bg-hover, #f3f4f6);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.nice-reconciliation__btn--primary {
|
|
59
|
+
background: var(--nice-primary, #3b82f6);
|
|
60
|
+
border-color: var(--nice-primary, #3b82f6);
|
|
61
|
+
color: white;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.nice-reconciliation__btn--primary:hover {
|
|
65
|
+
background: var(--nice-primary-dark, #2563eb);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.nice-reconciliation__btn--success {
|
|
69
|
+
background: var(--nice-success, #10b981);
|
|
70
|
+
border-color: var(--nice-success, #10b981);
|
|
71
|
+
color: white;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.nice-reconciliation__btn:disabled {
|
|
75
|
+
opacity: 0.5;
|
|
76
|
+
cursor: not-allowed;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.nice-reconciliation__content {
|
|
80
|
+
display: flex;
|
|
81
|
+
flex: 1;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.nice-reconciliation--vertical .nice-reconciliation__content {
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.nice-reconciliation__panel {
|
|
90
|
+
flex: 1;
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
min-width: 0;
|
|
94
|
+
min-height: 0;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.nice-reconciliation__panel--statements {
|
|
99
|
+
border-inline-end: 1px solid var(--nice-border-color, #e5e7eb);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.nice-reconciliation--vertical .nice-reconciliation__panel--statements {
|
|
103
|
+
border-inline-end: none;
|
|
104
|
+
border-block-end: 1px solid var(--nice-border-color, #e5e7eb);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.nice-reconciliation__panel-header {
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
justify-content: space-between;
|
|
111
|
+
padding: 0.75rem 1rem;
|
|
112
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
113
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.nice-reconciliation__panel-title {
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
font-size: 0.875rem;
|
|
119
|
+
color: var(--nice-text-primary);
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
gap: 0.5rem;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.nice-reconciliation__panel-badge {
|
|
126
|
+
font-size: 0.75rem;
|
|
127
|
+
font-weight: 500;
|
|
128
|
+
padding: 0.125rem 0.5rem;
|
|
129
|
+
border-radius: var(--nice-radius-full, 9999px);
|
|
130
|
+
background: var(--nice-bg-tertiary, #e5e7eb);
|
|
131
|
+
color: var(--nice-text-secondary);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.nice-reconciliation__panel-content {
|
|
135
|
+
flex: 1;
|
|
136
|
+
overflow: auto;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.nice-reconciliation__row {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: 0.75rem;
|
|
143
|
+
padding: 0.625rem 1rem;
|
|
144
|
+
border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
user-select: none;
|
|
147
|
+
transition: background 0.1s ease;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.nice-reconciliation__row:hover {
|
|
151
|
+
background: var(--nice-bg-hover, rgba(0, 0, 0, 0.02));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.nice-reconciliation__row--selected {
|
|
155
|
+
background: var(--nice-primary-light, rgba(59, 130, 246, 0.1));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.nice-reconciliation__row--dragging {
|
|
159
|
+
opacity: 0.6;
|
|
160
|
+
background: var(--nice-primary-light, rgba(59, 130, 246, 0.15));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.nice-reconciliation__row--drop-target {
|
|
164
|
+
background: var(--nice-success-bg, rgba(16, 185, 129, 0.15));
|
|
165
|
+
box-shadow: inset 0 0 0 2px var(--nice-success, #10b981);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.nice-reconciliation__row--matched {
|
|
169
|
+
background: var(--nice-success-bg, rgba(16, 185, 129, 0.08));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.nice-reconciliation__row--partial {
|
|
173
|
+
background: var(--nice-warning-bg, rgba(245, 158, 11, 0.08));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.nice-reconciliation__row--unmatched {
|
|
177
|
+
background: transparent;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.nice-reconciliation__row--excluded {
|
|
181
|
+
opacity: 0.5;
|
|
182
|
+
background: var(--nice-bg-tertiary, #f3f4f6);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.nice-reconciliation__status {
|
|
186
|
+
width: 0.5rem;
|
|
187
|
+
height: 0.5rem;
|
|
188
|
+
border-radius: var(--nice-radius-full, 50%);
|
|
189
|
+
flex-shrink: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.nice-reconciliation__status--matched {
|
|
193
|
+
background: var(--nice-success, #10b981);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.nice-reconciliation__status--partial {
|
|
197
|
+
background: var(--nice-warning, #f59e0b);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.nice-reconciliation__status--unmatched {
|
|
201
|
+
background: var(--nice-danger, #ef4444);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.nice-reconciliation__status--excluded {
|
|
205
|
+
background: var(--nice-text-disabled, #9ca3af);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.nice-reconciliation__row-main {
|
|
209
|
+
flex: 1;
|
|
210
|
+
min-width: 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.nice-reconciliation__row-date {
|
|
214
|
+
font-size: 0.75rem;
|
|
215
|
+
color: var(--nice-text-secondary);
|
|
216
|
+
margin-bottom: 0.125rem;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.nice-reconciliation__row-description {
|
|
220
|
+
font-size: 0.8125rem;
|
|
221
|
+
color: var(--nice-text-primary);
|
|
222
|
+
white-space: nowrap;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
text-overflow: ellipsis;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.nice-reconciliation__row-counterparty {
|
|
228
|
+
font-size: 0.75rem;
|
|
229
|
+
color: var(--nice-text-tertiary);
|
|
230
|
+
white-space: nowrap;
|
|
231
|
+
overflow: hidden;
|
|
232
|
+
text-overflow: ellipsis;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.nice-reconciliation__row-amount {
|
|
236
|
+
font-size: 0.875rem;
|
|
237
|
+
font-weight: 600;
|
|
238
|
+
font-variant-numeric: tabular-nums;
|
|
239
|
+
white-space: nowrap;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.nice-reconciliation__row-amount--positive {
|
|
243
|
+
color: var(--nice-success, #10b981);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.nice-reconciliation__row-amount--negative {
|
|
247
|
+
color: var(--nice-danger, #ef4444);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.nice-reconciliation__confidence {
|
|
251
|
+
display: flex;
|
|
252
|
+
align-items: center;
|
|
253
|
+
gap: 0.25rem;
|
|
254
|
+
font-size: 0.6875rem;
|
|
255
|
+
padding: 0.125rem 0.375rem;
|
|
256
|
+
border-radius: var(--nice-radius-sm, 0.25rem);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.nice-reconciliation__confidence--high {
|
|
260
|
+
background: var(--nice-success-bg, rgba(16, 185, 129, 0.15));
|
|
261
|
+
color: var(--nice-success-dark, #059669);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.nice-reconciliation__confidence--medium {
|
|
265
|
+
background: var(--nice-warning-bg, rgba(245, 158, 11, 0.15));
|
|
266
|
+
color: var(--nice-warning-dark, #d97706);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.nice-reconciliation__confidence--low {
|
|
270
|
+
background: var(--nice-danger-bg, rgba(239, 68, 68, 0.15));
|
|
271
|
+
color: var(--nice-danger-dark, #dc2626);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.nice-reconciliation__empty {
|
|
275
|
+
display: flex;
|
|
276
|
+
flex-direction: column;
|
|
277
|
+
align-items: center;
|
|
278
|
+
justify-content: center;
|
|
279
|
+
padding: 3rem 1rem;
|
|
280
|
+
color: var(--nice-text-secondary);
|
|
281
|
+
text-align: center;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.nice-reconciliation__empty-icon {
|
|
285
|
+
font-size: 2.5rem;
|
|
286
|
+
margin-bottom: 0.75rem;
|
|
287
|
+
opacity: 0.5;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.nice-reconciliation__summary {
|
|
291
|
+
display: flex;
|
|
292
|
+
align-items: center;
|
|
293
|
+
gap: 1.5rem;
|
|
294
|
+
padding: 0.75rem 1rem;
|
|
295
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
296
|
+
border-top: 1px solid var(--nice-border-color, #e5e7eb);
|
|
297
|
+
font-size: 0.8125rem;
|
|
298
|
+
flex-wrap: wrap;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.nice-reconciliation__summary-item {
|
|
302
|
+
display: flex;
|
|
303
|
+
align-items: center;
|
|
304
|
+
gap: 0.375rem;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.nice-reconciliation__summary-label {
|
|
308
|
+
color: var(--nice-text-secondary);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.nice-reconciliation__summary-value {
|
|
312
|
+
font-weight: 600;
|
|
313
|
+
color: var(--nice-text-primary);
|
|
314
|
+
font-variant-numeric: tabular-nums;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.nice-reconciliation__summary-value--success {
|
|
318
|
+
color: var(--nice-success, #10b981);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.nice-reconciliation__summary-value--warning {
|
|
322
|
+
color: var(--nice-warning, #f59e0b);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.nice-reconciliation__summary-value--danger {
|
|
326
|
+
color: var(--nice-danger, #ef4444);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.nice-reconciliation__resizer {
|
|
330
|
+
width: 4px;
|
|
331
|
+
background: var(--nice-border-color, #e5e7eb);
|
|
332
|
+
cursor: col-resize;
|
|
333
|
+
transition: background 0.15s ease;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.nice-reconciliation__resizer:hover {
|
|
337
|
+
background: var(--nice-primary, #3b82f6);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.nice-reconciliation--vertical .nice-reconciliation__resizer {
|
|
341
|
+
width: 100%;
|
|
342
|
+
height: 4px;
|
|
343
|
+
cursor: row-resize;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.nice-reconciliation__suggestions {
|
|
347
|
+
padding: 0.75rem 1rem;
|
|
348
|
+
background: var(--nice-info-bg, rgba(59, 130, 246, 0.08));
|
|
349
|
+
border-bottom: 1px solid var(--nice-info, #3b82f6);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.nice-reconciliation__suggestion {
|
|
353
|
+
display: flex;
|
|
354
|
+
align-items: center;
|
|
355
|
+
gap: 0.75rem;
|
|
356
|
+
padding: 0.5rem;
|
|
357
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
358
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
359
|
+
margin-bottom: 0.5rem;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.nice-reconciliation__suggestion:last-child {
|
|
363
|
+
margin-bottom: 0;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/* Dark mode */
|
|
367
|
+
.dark .nice-reconciliation {
|
|
368
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
369
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.dark .nice-reconciliation__toolbar,
|
|
373
|
+
.dark .nice-reconciliation__panel-header,
|
|
374
|
+
.dark .nice-reconciliation__summary {
|
|
375
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
376
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.dark .nice-reconciliation__row--selected {
|
|
380
|
+
background: var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2));
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/* RTL support */
|
|
384
|
+
[dir="rtl"] .nice-reconciliation__row-amount {
|
|
385
|
+
direction: ltr;
|
|
386
|
+
text-align: left;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/* Detail Panel */
|
|
390
|
+
.nice-reconciliation__detail-panel {
|
|
391
|
+
position: fixed;
|
|
392
|
+
inset-inline-end: 0;
|
|
393
|
+
top: 0;
|
|
394
|
+
bottom: 0;
|
|
395
|
+
width: 420px;
|
|
396
|
+
max-width: 90vw;
|
|
397
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
398
|
+
box-shadow: -4px 0 24px var(--nice-overlay-15, rgba(0, 0, 0, 0.15));
|
|
399
|
+
z-index: 1000;
|
|
400
|
+
display: flex;
|
|
401
|
+
flex-direction: column;
|
|
402
|
+
transform: translateX(100%);
|
|
403
|
+
transition: transform 0.25s ease-out;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.nice-reconciliation__detail-panel--open {
|
|
407
|
+
transform: translateX(0);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.nice-reconciliation__detail-header {
|
|
411
|
+
display: flex;
|
|
412
|
+
align-items: center;
|
|
413
|
+
justify-content: space-between;
|
|
414
|
+
padding: 1rem;
|
|
415
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
416
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.nice-reconciliation__detail-title {
|
|
420
|
+
font-weight: 600;
|
|
421
|
+
font-size: 1rem;
|
|
422
|
+
color: var(--nice-text-primary);
|
|
423
|
+
display: flex;
|
|
424
|
+
align-items: center;
|
|
425
|
+
gap: 0.5rem;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.nice-reconciliation__detail-close {
|
|
429
|
+
width: 2rem;
|
|
430
|
+
height: 2rem;
|
|
431
|
+
display: flex;
|
|
432
|
+
align-items: center;
|
|
433
|
+
justify-content: center;
|
|
434
|
+
background: transparent;
|
|
435
|
+
border: none;
|
|
436
|
+
cursor: pointer;
|
|
437
|
+
font-size: 1.25rem;
|
|
438
|
+
color: var(--nice-text-secondary);
|
|
439
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
440
|
+
transition: all 0.15s ease;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.nice-reconciliation__detail-close:hover {
|
|
444
|
+
background: var(--nice-bg-hover, #f3f4f6);
|
|
445
|
+
color: var(--nice-text-primary);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.nice-reconciliation__detail-content {
|
|
449
|
+
flex: 1;
|
|
450
|
+
overflow: auto;
|
|
451
|
+
padding: 1rem;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.nice-reconciliation__detail-section {
|
|
455
|
+
margin-bottom: 1.5rem;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.nice-reconciliation__detail-section-title {
|
|
459
|
+
font-weight: 600;
|
|
460
|
+
font-size: 0.875rem;
|
|
461
|
+
color: var(--nice-text-primary);
|
|
462
|
+
margin-bottom: 0.75rem;
|
|
463
|
+
display: flex;
|
|
464
|
+
align-items: center;
|
|
465
|
+
gap: 0.375rem;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.nice-reconciliation__detail-row {
|
|
469
|
+
display: flex;
|
|
470
|
+
justify-content: space-between;
|
|
471
|
+
align-items: flex-start;
|
|
472
|
+
padding: 0.5rem 0;
|
|
473
|
+
border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.nice-reconciliation__detail-row:last-child {
|
|
477
|
+
border-bottom: none;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.nice-reconciliation__detail-label {
|
|
481
|
+
font-size: 0.8125rem;
|
|
482
|
+
color: var(--nice-text-secondary);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.nice-reconciliation__detail-value {
|
|
486
|
+
font-size: 0.8125rem;
|
|
487
|
+
font-weight: 500;
|
|
488
|
+
color: var(--nice-text-primary);
|
|
489
|
+
text-align: end;
|
|
490
|
+
max-width: 60%;
|
|
491
|
+
word-break: break-word;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.nice-reconciliation__detail-divider {
|
|
495
|
+
height: 1px;
|
|
496
|
+
background: var(--nice-border-color, #e5e7eb);
|
|
497
|
+
margin: 1rem 0;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.nice-reconciliation__detail-match-info {
|
|
501
|
+
padding: 0.75rem;
|
|
502
|
+
background: var(--nice-success-bg, rgba(16, 185, 129, 0.08));
|
|
503
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
504
|
+
margin-bottom: 1rem;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.nice-reconciliation__detail-match-header {
|
|
508
|
+
display: flex;
|
|
509
|
+
align-items: center;
|
|
510
|
+
gap: 0.5rem;
|
|
511
|
+
font-weight: 600;
|
|
512
|
+
font-size: 0.8125rem;
|
|
513
|
+
color: var(--nice-success-dark, #059669);
|
|
514
|
+
margin-bottom: 0.5rem;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.nice-reconciliation__detail-match-detail {
|
|
518
|
+
font-size: 0.75rem;
|
|
519
|
+
color: var(--nice-text-secondary);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.nice-reconciliation__detail-side-by-side {
|
|
523
|
+
display: grid;
|
|
524
|
+
grid-template-columns: 1fr 1fr;
|
|
525
|
+
gap: 1rem;
|
|
526
|
+
padding: 0.75rem;
|
|
527
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
528
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
529
|
+
margin-top: 0.75rem;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.nice-reconciliation__detail-side-item {
|
|
533
|
+
padding: 0.5rem;
|
|
534
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
535
|
+
border-radius: var(--nice-radius-sm, 0.25rem);
|
|
536
|
+
border: 1px solid var(--nice-border-color, #e5e7eb);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.nice-reconciliation__detail-side-label {
|
|
540
|
+
font-size: 0.6875rem;
|
|
541
|
+
font-weight: 500;
|
|
542
|
+
text-transform: uppercase;
|
|
543
|
+
color: var(--nice-text-tertiary);
|
|
544
|
+
margin-bottom: 0.375rem;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.nice-reconciliation__detail-side-amount {
|
|
548
|
+
font-size: 1.125rem;
|
|
549
|
+
font-weight: 600;
|
|
550
|
+
font-variant-numeric: tabular-nums;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.nice-reconciliation__detail-backdrop {
|
|
554
|
+
position: fixed;
|
|
555
|
+
inset: 0;
|
|
556
|
+
background: var(--nice-overlay-30, rgba(0, 0, 0, 0.3));
|
|
557
|
+
z-index: 999;
|
|
558
|
+
opacity: 0;
|
|
559
|
+
pointer-events: none;
|
|
560
|
+
transition: opacity 0.2s ease;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.nice-reconciliation__detail-backdrop--visible {
|
|
564
|
+
opacity: 1;
|
|
565
|
+
pointer-events: auto;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.dark .nice-reconciliation__detail-panel {
|
|
569
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
570
|
+
box-shadow: -4px 0 24px var(--nice-overlay-40, rgba(0, 0, 0, 0.4));
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.dark .nice-reconciliation__detail-header {
|
|
574
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
575
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.dark .nice-reconciliation__detail-side-by-side {
|
|
579
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.dark .nice-reconciliation__detail-side-item {
|
|
583
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
584
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
585
|
+
}
|
|
586
|
+
`;function an(n,i="PLN",a="pl-PL"){return new Intl.NumberFormat(a,{style:"currency",currency:i,minimumFractionDigits:2,maximumFractionDigits:2}).format(n)}function jn(n,i="pl-PL"){return n?(typeof n=="string"?new Date(n):n).toLocaleDateString(i,{year:"numeric",month:"2-digit",day:"2-digit"}):"-"}function gi(n){return n>=80?"high":n>=50?"medium":"low"}function _i(){return`match-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function xi({item:n,isSelected:i,isDragging:a,isDropTarget:s,suggestion:o,currency:u,locale:x,onSelect:h,onDoubleClick:y,onDragStart:A,onDragEnd:T,onDrop:M,disabled:D}){const Q=n.status??"unmatched",H=o?.confidence??n.confidence,q=N=>{N.dataTransfer.setData("text/plain",n.id),N.dataTransfer.setData("source","statement"),N.dataTransfer.effectAllowed="move",A()},d=N=>{N.dataTransfer.types.includes("source")&&N.dataTransfer.getData("source")!=="statement"&&N.preventDefault()};return e.jsxs("div",{className:`nice-reconciliation__row nice-reconciliation__row--${Q} ${i?"nice-reconciliation__row--selected":""} ${a?"nice-reconciliation__row--dragging":""} ${s?"nice-reconciliation__row--drop-target":""}`,draggable:!D&&Q!=="matched",onDragStart:q,onDragEnd:T,onDragOver:d,onDrop:M,onClick:h,onDoubleClick:y,role:"row","aria-selected":i,tabIndex:0,children:[e.jsx("span",{className:`nice-reconciliation__status nice-reconciliation__status--${Q}`}),e.jsxs("div",{className:"nice-reconciliation__row-main",children:[e.jsx("div",{className:"nice-reconciliation__row-date",children:jn(n.date,x)}),e.jsx("div",{className:"nice-reconciliation__row-description",title:n.description,children:n.description}),n.counterparty&&e.jsx("div",{className:"nice-reconciliation__row-counterparty",children:n.counterparty})]}),H!=null&&e.jsxs("span",{className:`nice-reconciliation__confidence nice-reconciliation__confidence--${gi(H)}`,children:[H,"%"]}),e.jsx("span",{className:`nice-reconciliation__row-amount ${n.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:an(n.amount,u,x)})]})}function bi({item:n,isSelected:i,isDragging:a,isDropTarget:s,currency:o,locale:u,onSelect:x,onDoubleClick:h,onDragStart:y,onDragEnd:A,onDrop:T,disabled:M}){const D=n.status??"unmatched",Q=q=>{q.dataTransfer.setData("text/plain",n.id),q.dataTransfer.setData("source","entry"),q.dataTransfer.effectAllowed="move",y()},H=q=>{q.dataTransfer.types.includes("source")&&q.dataTransfer.getData("source")!=="entry"&&q.preventDefault()};return e.jsxs("div",{className:`nice-reconciliation__row nice-reconciliation__row--${D} ${i?"nice-reconciliation__row--selected":""} ${a?"nice-reconciliation__row--dragging":""} ${s?"nice-reconciliation__row--drop-target":""}`,draggable:!M&&D!=="matched",onDragStart:Q,onDragEnd:A,onDragOver:H,onDrop:T,onClick:x,onDoubleClick:h,role:"row","aria-selected":i,tabIndex:0,children:[e.jsx("span",{className:`nice-reconciliation__status nice-reconciliation__status--${D}`}),e.jsxs("div",{className:"nice-reconciliation__row-main",children:[e.jsxs("div",{className:"nice-reconciliation__row-date",children:[jn(n.date,u),n.documentNumber&&e.jsxs("span",{children:[" · ",n.documentNumber]})]}),e.jsx("div",{className:"nice-reconciliation__row-description",title:n.description,children:n.description}),n.partyName&&e.jsx("div",{className:"nice-reconciliation__row-counterparty",children:n.partyName})]}),e.jsx("span",{className:`nice-reconciliation__row-amount ${n.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:an(n.amount,o,u)})]})}const vi=t.forwardRef(function(i,a){const{t:s}=E.useNiceTranslation(),{statements:o,bankTransactions:u,entries:x,accountingEntries:h,matches:y,defaultMatches:A=[],suggestions:T=[],config:M={},currency:D,showConfidence:Q,statementPanelConfig:H,entryPanelConfig:q,onMatch:d,onAutoMatch:N,onUnmatch:w,onBatchAction:g,onFilterChange:k,onRequestSuggestions:I,onSelectionChange:F,onComplete:J,size:ne="medium",showToolbar:ce=!0,showFilters:ue=!0,showSummary:le=!0,showSuggestions:ae=!0,layout:pe="horizontal",enableDragDrop:O=!0,enableKeyboard:fe=!0,enableDetailPanel:Ie=!0,loading:je=!1,disabled:L=!1,readOnly:Z=!1,locale:p="pl-PL",labels:f={},className:l,style:Y}=i,W=t.useMemo(()=>o??u??[],[o,u]),m=t.useMemo(()=>x??h??[],[x,h]),ee=D??M.currency??"PLN",[oe,re]=t.useState(A),[K,ye]=t.useState(new Set),[ke,Oe]=t.useState(new Set),[Me,Te]=t.useState(null),[Ue,Pe]=t.useState(null),[$,b]=t.useState({}),[de,ge]=t.useState(null),v=y??oe,P=t.useRef(null),se=t.useRef(null);t.useEffect(()=>{const C="nice-reconciliation-styles";if(!document.getElementById(C)){const X=document.createElement("style");X.id=C,X.textContent=fi,document.head.appendChild(X)}},[]);const _e=t.useMemo(()=>{const C=new Set;return v.forEach(X=>X.statementIds.forEach(he=>C.add(he))),C},[v]),De=t.useMemo(()=>{const C=new Set;return v.forEach(X=>X.entryIds.forEach(he=>C.add(he))),C},[v]),me=t.useMemo(()=>{const C=W.filter(xe=>!_e.has(xe.id)),X=m.filter(xe=>!De.has(xe.id)),he=W.reduce((xe,Ne)=>xe+Ne.amount,0),Le=m.reduce((xe,Ne)=>xe+Ne.amount,0),Ke=W.filter(xe=>_e.has(xe.id)).reduce((xe,Ne)=>xe+Ne.amount,0);return{totalStatements:W.length,totalEntries:m.length,matchedStatements:W.length-C.length,matchedEntries:m.length-X.length,unmatchedStatements:C.length,unmatchedEntries:X.length,statementTotal:he,entryTotal:Le,matchedAmount:Ke,unmatchedStatementAmount:C.reduce((xe,Ne)=>xe+Ne.amount,0),unmatchedEntryAmount:X.reduce((xe,Ne)=>xe+Ne.amount,0),difference:he-Le,matchPercentage:W.length>0?Math.round((W.length-C.length)/W.length*100):0,matchCount:v.length,partialMatchCount:v.filter(xe=>xe.status==="partial").length,pendingSuggestions:T.length}},[W,m,v,T,_e,De]),U=t.useCallback((C,X)=>{const he=W.filter(Fe=>C.includes(Fe.id)),Le=m.filter(Fe=>X.includes(Fe.id));if(he.length===0||Le.length===0)return null;const Ke=he.reduce((Fe,qe)=>Fe+qe.amount,0),xe=Le.reduce((Fe,qe)=>Fe+qe.amount,0),Ne=Math.abs(Ke-xe),Ve=M.amountTolerance??.01,Je={id:_i(),statementIds:C,entryIds:X,status:Ne<=Ve?"matched":"partial",statementTotal:Ke,entryTotal:xe,difference:Ne,confidence:Ne<=Ve?100:Math.max(0,100-Ne/Math.max(Math.abs(Ke),1)*100),matchedBy:"user",matchedAt:new Date};return y||re(Fe=>[...Fe,Je]),d?.(Je,he,Le),ye(new Set),Oe(new Set),Je},[W,m,M.amountTolerance,y,d]),We=t.useCallback(C=>{const X=v.find(he=>he.id===C);X&&(y||re(he=>he.filter(Le=>Le.id!==C)),w?.(C,X.statementIds,X.entryIds))},[v,y,w]),en=t.useCallback(async()=>{const C=[],X=new Set(_e),he=new Set(De),Le=M.amountTolerance??.01,Ke=M.dateTolerance??3;for(const xe of W){if(X.has(xe.id))continue;const Ne=m.filter(Ve=>{if(he.has(Ve.id)||Math.abs(xe.amount-Ve.amount)>Le)return!1;const Fe=new Date(xe.date),qe=new Date(Ve.date);return!(Math.abs(Fe.getTime()-qe.getTime())/(1e3*60*60*24)>Ke)});if(Ne.length===1){const Ve=Ne[0],Je=U([xe.id],[Ve.id]);Je&&(C.push(Je),X.add(xe.id),he.add(Ve.id))}}return g?.("autoMatch",C),C},[W,m,_e,De,M,U,g]),B=t.useCallback((C,X,he,Le)=>{Le!==X&&(Le==="statement"?U([he],[C]):U([C],[he]),Te(null),Pe(null))},[U]),on=t.useCallback(()=>{const C=Array.from(K),X=Array.from(ke);C.length>0&&X.length>0&&U(C,X)},[K,ke,U]);t.useEffect(()=>{F?.(Array.from(K),Array.from(ke))},[K,ke,F]),t.useImperativeHandle(a,()=>({getMatches:()=>v,getUnmatchedStatements:()=>W.filter(C=>!_e.has(C.id)),getUnmatchedEntries:()=>m.filter(C=>!De.has(C.id)),createMatch:U,removeMatch:We,autoMatch:en,getSuggestions:async C=>I?I(C??W.filter(X=>!_e.has(X.id)).map(X=>X.id)):[],applySuggestion:C=>U([C.statementId],C.entryIds),approveAll:()=>{g?.("approveAll",v)},clearAll:()=>{y||re([]),g?.("clearAll",[])},exportMatched:C=>{g?.("exportMatched",v)},getSummary:()=>me,reset:()=>{y||re([]),ye(new Set),Oe(new Set),b({})},focusStatements:()=>P.current?.focus(),focusEntries:()=>se.current?.focus()}),[v,W,m,_e,De,U,We,en,I,g,y,me]);const nn=t.useMemo(()=>W.filter(C=>{if($.status&&$.status.length>0){const X=_e.has(C.id)?"matched":"unmatched";if(!$.status.includes(X))return!1}if($.searchText){const X=$.searchText.toLowerCase();if(!C.description?.toLowerCase().includes(X)&&!C.counterparty?.toLowerCase().includes(X))return!1}return!0}),[W,$,_e]),Xe=t.useMemo(()=>m.filter(C=>{if($.status&&$.status.length>0){const X=De.has(C.id)?"matched":"unmatched";if(!$.status.includes(X))return!1}if($.searchText){const X=$.searchText.toLowerCase();if(!C.description?.toLowerCase().includes(X)&&!C.partyName?.toLowerCase().includes(X))return!1}return!0}),[m,$,De]),dn=K.size>0&&ke.size>0&&!Z&&!L;return e.jsxs("div",{className:`nice-reconciliation nice-reconciliation--${pe} ${l??""}`,style:Y,children:[ce&&e.jsxs("div",{className:"nice-reconciliation__toolbar",children:[e.jsxs("div",{className:"nice-reconciliation__toolbar-group",children:[e.jsxs("button",{type:"button",className:"nice-reconciliation__btn nice-reconciliation__btn--primary",onClick:en,disabled:L||Z||je,children:[e.jsx(E.NiceIcon,{name:"zap",size:14})," ",f.autoMatch??"Auto-match"]}),e.jsxs("button",{type:"button",className:"nice-reconciliation__btn nice-reconciliation__btn--success",onClick:on,disabled:!dn||je,children:[e.jsx(E.NiceIcon,{name:"link",size:14})," ",s("reconciliationView.matchSelected","Match Selected")]})]}),e.jsxs("div",{className:"nice-reconciliation__toolbar-group nice-reconciliation__toolbar-group--end",children:[e.jsxs("button",{type:"button",className:"nice-reconciliation__btn",onClick:()=>g?.("approveAll",v),disabled:v.length===0||L||je,children:[e.jsx(E.NiceIcon,{name:"check",size:14})," ",f.approveAll??"Approve All"]}),e.jsxs("button",{type:"button",className:"nice-reconciliation__btn",onClick:()=>{y||re([]),g?.("clearAll",[])},disabled:v.length===0||L||Z||je,children:[e.jsx(E.NiceIcon,{name:"close",size:14})," ",f.clearAll??"Clear All"]})]})]}),e.jsxs("div",{className:"nice-reconciliation__content",children:[e.jsxs("div",{className:"nice-reconciliation__panel nice-reconciliation__panel--statements",children:[e.jsx("div",{className:"nice-reconciliation__panel-header",children:e.jsxs("span",{className:"nice-reconciliation__panel-title",children:[e.jsx(E.NiceIcon,{name:"file",size:14})," ",f.statementPanelTitle??"Bank Statement",e.jsx("span",{className:"nice-reconciliation__panel-badge",children:nn.length})]})}),e.jsx("div",{ref:P,className:"nice-reconciliation__panel-content",role:"listbox","aria-multiselectable":"true",children:nn.length===0?e.jsxs("div",{className:"nice-reconciliation__empty",children:[e.jsx("div",{className:"nice-reconciliation__empty-icon",children:e.jsx(E.NiceIcon,{name:"clipboard",size:32})}),f.noStatements??"No statement items"]}):nn.map(C=>e.jsx(xi,{item:{...C,status:_e.has(C.id)?"matched":"unmatched"},isSelected:K.has(C.id),isDragging:Me===C.id,isDropTarget:Ue===C.id,suggestion:T.find(X=>X.statementId===C.id),currency:ee,locale:p,onSelect:()=>{L||ye(X=>{const he=new Set(X);return he.has(C.id)?he.delete(C.id):he.add(C.id),he})},onDoubleClick:()=>Ie&&ge({type:"statement",id:C.id}),onDragStart:()=>Te(C.id),onDragEnd:()=>{Te(null),Pe(null)},onDrop:()=>{Me&&Me!==C.id&&B(C.id,"statement",Me,"entry")},disabled:L||Z||!O},C.id))})]}),e.jsxs("div",{className:"nice-reconciliation__panel nice-reconciliation__panel--entries",children:[e.jsx("div",{className:"nice-reconciliation__panel-header",children:e.jsxs("span",{className:"nice-reconciliation__panel-title",children:[e.jsx(E.NiceIcon,{name:"book",size:14})," ",f.entryPanelTitle??"Book Entries",e.jsx("span",{className:"nice-reconciliation__panel-badge",children:Xe.length})]})}),e.jsx("div",{ref:se,className:"nice-reconciliation__panel-content",role:"listbox","aria-multiselectable":"true",children:Xe.length===0?e.jsxs("div",{className:"nice-reconciliation__empty",children:[e.jsx("div",{className:"nice-reconciliation__empty-icon",children:e.jsx(E.NiceIcon,{name:"book",size:32})}),f.noEntries??"No book entries"]}):Xe.map(C=>e.jsx(bi,{item:{...C,status:De.has(C.id)?"matched":"unmatched"},isSelected:ke.has(C.id),isDragging:Me===C.id,isDropTarget:Ue===C.id,currency:ee,locale:p,onSelect:()=>{L||Oe(X=>{const he=new Set(X);return he.has(C.id)?he.delete(C.id):he.add(C.id),he})},onDoubleClick:()=>Ie&&ge({type:"entry",id:C.id}),onDragStart:()=>Te(C.id),onDragEnd:()=>{Te(null),Pe(null)},onDrop:()=>{Me&&Me!==C.id&&B(C.id,"entry",Me,"statement")},disabled:L||Z||!O},C.id))})]})]}),le&&e.jsxs("div",{className:"nice-reconciliation__summary",children:[e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Matched:"}),e.jsxs("span",{className:"nice-reconciliation__summary-value nice-reconciliation__summary-value--success",children:[me.matchedStatements,"/",me.totalStatements," (",me.matchPercentage,"%)"]})]}),e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Matched Amount:"}),e.jsx("span",{className:"nice-reconciliation__summary-value",children:an(me.matchedAmount,ee,p)})]}),e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Unmatched:"}),e.jsx("span",{className:"nice-reconciliation__summary-value nice-reconciliation__summary-value--warning",children:an(me.unmatchedStatementAmount,ee,p)})]}),e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Difference:"}),e.jsx("span",{className:`nice-reconciliation__summary-value ${Math.abs(me.difference)<.01?"nice-reconciliation__summary-value--success":"nice-reconciliation__summary-value--danger"}`,children:an(me.difference,ee,p)})]})]}),Ie&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`nice-reconciliation__detail-backdrop ${de?"nice-reconciliation__detail-backdrop--visible":""}`,onClick:()=>ge(null)}),e.jsx("div",{className:`nice-reconciliation__detail-panel ${de?"nice-reconciliation__detail-panel--open":""}`,children:de&&e.jsx(yi,{type:de.type,id:de.id,statements:W,entries:m,matches:v,currency:ee,locale:p,labels:f,onClose:()=>ge(null)})})]})]})});function yi({type:n,id:i,statements:a,entries:s,matches:o,currency:u,locale:x,labels:h,onClose:y}){const{t:A}=E.useNiceTranslation(),T=n==="statement"?a.find(d=>d.id===i):s.find(d=>d.id===i),M=n==="statement"?o.find(d=>d.statementIds.includes(i)):o.find(d=>d.entryIds.includes(i)),D=M?n==="statement"?s.filter(d=>M.entryIds.includes(d.id)):a.filter(d=>M.statementIds.includes(d.id)):[];if(!T)return null;const Q=n==="statement",H=Q?T:null,q=Q?null:T;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-reconciliation__detail-header",children:[e.jsxs("span",{className:"nice-reconciliation__detail-title",children:[e.jsx(E.NiceIcon,{name:Q?"file":"book",size:14})," ",Q?h.statementDetails??"Transaction Details":h.entryDetails??"Entry Details"]}),e.jsx("button",{type:"button",className:"nice-reconciliation__detail-close",onClick:y,"aria-label":A("reconciliationView.close","Close"),children:e.jsx(E.NiceIcon,{name:"close",size:14})})]}),e.jsxs("div",{className:"nice-reconciliation__detail-content",children:[M&&e.jsxs("div",{className:"nice-reconciliation__detail-match-info",children:[e.jsxs("div",{className:"nice-reconciliation__detail-match-header",children:[e.jsx(E.NiceIcon,{name:"check",size:14})," ",h.matchedWith??"Matched"," (",M.confidence?.toFixed(0)??100,"% confidence)"]}),e.jsx("div",{className:"nice-reconciliation__detail-match-detail",children:M.matchedBy==="ai"?h.matchedByAI??"Matched automatically by AI":h.matchedManually??"Matched manually"}),e.jsxs("div",{className:"nice-reconciliation__detail-side-by-side",children:[e.jsxs("div",{className:"nice-reconciliation__detail-side-item",children:[e.jsx("div",{className:"nice-reconciliation__detail-side-label",children:h.statementTotal??"Statement"}),e.jsx("div",{className:`nice-reconciliation__detail-side-amount ${M.statementTotal>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:an(M.statementTotal,u,x)})]}),e.jsxs("div",{className:"nice-reconciliation__detail-side-item",children:[e.jsx("div",{className:"nice-reconciliation__detail-side-label",children:h.entryTotal??"Book Entry"}),e.jsx("div",{className:`nice-reconciliation__detail-side-amount ${M.entryTotal>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:an(M.entryTotal,u,x)})]})]}),M.difference>.01&&e.jsxs("div",{className:"nice-reconciliation__detail-row",style:{marginTop:"0.5rem",borderBottom:"none"},children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[h.difference??"Difference",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",style:{color:"var(--nice-warning, #f59e0b)"},children:an(M.difference,u,x)})]})]}),e.jsxs("div",{className:"nice-reconciliation__detail-section",children:[e.jsxs("div",{className:"nice-reconciliation__detail-section-title",children:[e.jsx(E.NiceIcon,{name:"clipboard",size:14})," ",Q?h.transactionInfo??"Transaction Information":h.entryInfo??"Entry Information"]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[h.date??"Date",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:jn(T.date,x)})]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[h.description??"Description",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:T.description})]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[h.amount??"Amount",":"]}),e.jsx("span",{className:`nice-reconciliation__detail-value ${T.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:an(T.amount,u,x)})]}),Q&&H?.counterparty&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[h.counterparty??"Counterparty",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:H.counterparty})]}),Q&&H?.counterpartyAccount&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[h.accountNumber??"Account",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",style:{fontFamily:"monospace",fontSize:"0.75rem"},children:H.counterpartyAccount})]}),!Q&&q?.partyName&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[h.party??"Party",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:q.partyName})]}),!Q&&q?.documentNumber&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[h.documentRef??"Document Ref",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:q.documentNumber})]}),Q&&H?.referenceNumber&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[h.reference??"Reference",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:H.referenceNumber})]})]}),D.length>0&&e.jsxs("div",{className:"nice-reconciliation__detail-section",children:[e.jsxs("div",{className:"nice-reconciliation__detail-section-title",children:[e.jsx(E.NiceIcon,{name:"link",size:14})," ",Q?h.matchedEntries??"Matched Entries":h.matchedStatements??"Matched Statements"]}),D.map(d=>e.jsxs("div",{style:{padding:"0.5rem",background:"var(--nice-bg-secondary, #f9fafb)",borderRadius:"0.25rem",marginBottom:"0.5rem",fontSize:"0.8125rem"},children:[e.jsx("div",{style:{fontWeight:500,marginBottom:"0.25rem"},children:d.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:"var(--nice-text-secondary)"},children:[e.jsx("span",{children:jn(d.date,x)}),e.jsx("span",{style:{fontWeight:600,color:d.amount>=0?"var(--nice-success)":"var(--nice-danger)"},children:an(d.amount,u,x)})]})]},d.id))]})]})]})}const Ni=[],ji=({queries:n=Ni,currentFilter:i,currentColumns:a,currentSort:s,onLoad:o,onSave:u,onUpdate:x,onDelete:h,onShare:y,onSetDefault:A,allowSharing:T=!0,allowPinning:M=!0,position:D="dropdown",className:Q,style:H,"data-testid":q})=>{const{t:d}=E.useNiceTranslation(),[N,w]=t.useState(!1),[g,k]=t.useState(""),[I,F]=t.useState(!1),[J,ne]=t.useState(""),[ce,ue]=t.useState(""),[le,ae]=t.useState(!1),pe=n.filter(L=>L.name.toLowerCase().includes(g.toLowerCase())),O=pe.filter(L=>!L.isShared),fe=pe.filter(L=>L.isShared),Ie=async()=>{if(J.trim()){F(!0);try{await u({name:J,description:ce||void 0,filter:i??{},columns:a,sort:s}),ae(!1),ne(""),ue("")}finally{F(!1)}}},je=L=>e.jsxs("div",{className:"nice-saved-query__item",children:[L.icon&&e.jsx("span",{className:"nice-saved-query__icon","aria-hidden":"true",children:L.icon}),e.jsx("span",{className:"nice-saved-query__name",children:L.name}),L.isDefault&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--default",children:d("savedQuery.default","default")}),L.isShared&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--shared",children:d("savedQuery.shared","shared")}),L.isPinned&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--pinned",children:d("savedQuery.pinned","pinned")}),e.jsxs("div",{className:"nice-saved-query__actions",children:[e.jsx("button",{onClick:()=>{o(L),w(!1)},type:"button",children:d("savedQuery.load","Load")}),A&&e.jsx("button",{onClick:()=>A(L.id),type:"button",title:d("savedQuery.setDefault","Set as default"),"aria-label":d("savedQuery.setDefault","Set as default"),children:e.jsx(E.NiceIcon,{name:"star",size:14})}),T&&y&&e.jsx("button",{onClick:()=>y(L.id,[]),type:"button",title:d("savedQuery.share","Share"),"aria-label":d("savedQuery.share","Share"),children:e.jsx(E.NiceIcon,{name:"external-link",size:14})}),M&&e.jsx("button",{onClick:()=>x(L.id,{...L}),type:"button",title:d("savedQuery.pin","Pin"),"aria-label":d("savedQuery.pin","Pin"),children:e.jsx(E.NiceIcon,{name:"map-pin",size:14})}),e.jsx("button",{onClick:()=>h(L.id),type:"button",title:d("savedQuery.remove","Remove"),"aria-label":`${d("savedQuery.removeQuery","Remove query")} ${L.name}`,children:e.jsx(E.NiceIcon,{name:"close",size:14})})]})]},L.id);return e.jsxs("div",{className:`nice-saved-query nice-saved-query--${D} ${N?"nice-saved-query--open":""} ${Q??""}`,style:H,"data-testid":q,children:[e.jsx("button",{className:"nice-saved-query__trigger",onClick:()=>w(L=>!L),"aria-expanded":N,"aria-haspopup":"listbox",type:"button",children:d("savedQuery.trigger","Views and queries")}),N&&e.jsxs("div",{className:"nice-saved-query__panel",role:"dialog","aria-label":d("savedQuery.manage","Manage saved queries"),children:[e.jsxs("div",{className:"nice-saved-query__search-row",children:[e.jsx("input",{type:"search",placeholder:d("savedQuery.searchPlaceholder","Search queries…"),value:g,onChange:L=>k(L.target.value),"aria-label":d("savedQuery.search","Search queries")}),e.jsxs("button",{onClick:()=>ae(L=>!L),type:"button",children:[e.jsx(E.NiceIcon,{name:"plus",size:12})," ",d("savedQuery.saveCurrent","Save current view")]})]}),le&&e.jsxs("div",{className:"nice-saved-query__save-form",children:[e.jsx("input",{type:"text",placeholder:d("savedQuery.name","Query name"),value:J,onChange:L=>ne(L.target.value),"aria-label":d("savedQuery.name","Query name")}),e.jsx("input",{type:"text",placeholder:d("savedQuery.descriptionPlaceholder","Description (optional)"),value:ce,onChange:L=>ue(L.target.value),"aria-label":d("savedQuery.description","Query description")}),e.jsx("button",{onClick:Ie,disabled:I||!J.trim(),type:"button",children:I?d("savedQuery.saving","Saving…"):d("savedQuery.save","Save")}),e.jsx("button",{onClick:()=>ae(!1),type:"button",children:d("savedQuery.cancel","Cancel")})]}),O.length>0&&e.jsxs("section",{className:"nice-saved-query__group","aria-labelledby":"nice-saved-query-mine",children:[e.jsx("h3",{id:"nice-saved-query-mine",className:"nice-saved-query__group-title",children:d("savedQuery.mine","Mine")}),O.map(je)]}),fe.length>0&&e.jsxs("section",{className:"nice-saved-query__group","aria-labelledby":"nice-saved-query-shared",children:[e.jsx("h3",{id:"nice-saved-query-shared",className:"nice-saved-query__group-title",children:d("savedQuery.sharedSection","Shared")}),fe.map(je)]}),pe.length===0&&e.jsx("p",{className:"nice-saved-query__empty",children:d("savedQuery.empty","No saved queries")})]})]})};exports.NiceDataGridAI=lt;exports.NiceKanbanBoard=Et;exports.NiceList=Nt;exports.NiceModuleGrid=Xt;exports.NiceReconciliationView=vi;exports.NiceSavedQueryPanel=ji;exports.NiceSpreadsheet=pi;exports.NiceTable=kt;exports.NiceTileView=Ct;exports.NiceTreeGrid=pt;exports.NiceTreeList=xt;exports.NiceTreeView=vt;
|