@nice2dev/ui 1.1.5 → 1.1.7
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 +102 -0
- package/README.md +50 -29
- package/css/legacy-bg-text-aliases.css +65 -61
- package/dist/NiceCodeEditor-Bc81wiaN.js +1134 -0
- package/dist/NiceCodeEditor-D6f8KdHN.js +1134 -0
- package/dist/NiceCodeEditor-DE3saxyt.cjs +260 -0
- package/dist/NiceCodeEditor-DZM16My5.cjs +260 -0
- package/dist/NiceCodeEditor-HqmcJjmZ.js +1179 -0
- package/dist/NiceColorPicker-6EqXaDj0.cjs +1 -0
- package/dist/NiceColorPicker-BiEWqWnd.js +596 -0
- package/dist/NiceColorPicker-Cuc6YXqz.cjs +1 -0
- package/dist/NiceColorPicker-DMATcNWG.js +596 -0
- package/dist/NiceColorPicker-R3O1nemp.js +596 -0
- package/dist/NiceConfirmDialog-B0e10fRL.cjs +1 -0
- package/dist/NiceConfirmDialog-BBDgEMHv.js +81 -0
- package/dist/NiceConfirmDialog-C7kdr8jJ.js +81 -0
- package/dist/NiceConfirmDialog-DMHqPfFM.js +81 -0
- package/dist/NiceConfirmDialog-ZJpQLQQS.cjs +1 -0
- package/dist/NiceDataGrid-BzUw4dSu.cjs +10 -0
- package/dist/NiceDataGrid-CPKcVOVz.js +1743 -0
- package/dist/NiceDataGrid-DJr33WMy.cjs +10 -0
- package/dist/NiceDataGrid-D_4gZ1Hu.js +1736 -0
- package/dist/NiceDataGrid-DlUAaXhD.js +1736 -0
- package/dist/NiceDocumentViewer-8ghRVtfO.js +672 -0
- package/dist/NiceDocumentViewer-ChWtA_Ry.cjs +180 -0
- package/dist/NiceDocumentViewer-DwLUV7Tc.js +672 -0
- package/dist/NiceDocumentViewer-goMzF1w3.cjs +180 -0
- package/dist/NiceDocumentViewer-gt1mxzP8.js +672 -0
- package/dist/NiceForm-CHEAHxDw.js +4805 -0
- package/dist/NiceForm-CJUp1CL0.cjs +1 -0
- package/dist/NiceForm-Cp_RH3Yj.js +4805 -0
- package/dist/NiceForm-a6tGr6ss.js +4819 -0
- package/dist/NiceForm-jU89oe2S.cjs +1 -0
- package/dist/NiceGantt-BnQwyTfG.cjs +1 -0
- package/dist/NiceGantt-D8coFAvK.js +328 -0
- package/dist/NiceGantt-DOZfT6r5.js +328 -0
- package/dist/NiceGantt-DQzH1V-R.js +328 -0
- package/dist/NiceGantt-jQ8ZpXko.cjs +1 -0
- package/dist/NiceHtmlEditor-B1nlXJNW.cjs +10 -0
- package/dist/NiceHtmlEditor-Bv3VqJPG.js +862 -0
- package/dist/NiceHtmlEditor-CKsGj-Ei.cjs +10 -0
- package/dist/NiceHtmlEditor-CloMgyzg.js +841 -0
- package/dist/NiceHtmlEditor-DUAHmkWI.js +841 -0
- package/dist/NiceLoginForm-Ce_QLnLf.js +736 -0
- package/dist/NiceLoginForm-DLpNTQlR.cjs +1 -0
- package/dist/NiceLoginForm-Dg0286Cc.js +736 -0
- package/dist/NiceLoginForm-X05Vadeg.js +708 -0
- package/dist/NiceLoginForm-f_dBCnUi.cjs +1 -0
- package/dist/NiceMention-BByI4nFG.js +11120 -0
- package/dist/NiceMention-BjeLN4Jx.cjs +430 -0
- package/dist/NiceMention-C2TPiMph.cjs +430 -0
- package/dist/NiceMention-C67vT6m0.js +11145 -0
- package/dist/NiceMention-D1cdy63w.cjs +430 -0
- package/dist/NiceMention-OaCi-GNO.js +11094 -0
- package/dist/NiceMention-QIuggb9Y.js +11122 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-CHaan9al.js +95 -0
- package/dist/NiceModal-Czq6OEAT.js +95 -0
- package/dist/NiceModal-D-HFwawr.js +95 -0
- package/dist/NiceModal-DOy2XTzc.cjs +1 -0
- package/dist/NiceModal-DkawKzEE.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-1CsP8Zst.js +6997 -0
- package/dist/NiceModuleLifecyclePanel-Bkx4Yg-3.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-C5oYtczk.js +6999 -0
- package/dist/NiceModuleLifecyclePanel-DCcy2yYi.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-DqdgW-0s.js +7004 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-7od5KUa3.cjs +1 -0
- package/dist/NicePagination-DMrkR8hH.cjs +1 -0
- package/dist/NicePagination-DQmZpsSQ.js +179 -0
- package/dist/NicePagination-DipQRjPq.js +172 -0
- package/dist/NicePagination-KhlVXYaT.js +172 -0
- package/dist/NicePivotGrid-B-KthuqL.cjs +152 -0
- package/dist/NicePivotGrid-CLCTHkKO.cjs +152 -0
- package/dist/NicePivotGrid-DV54FCsH.js +1174 -0
- package/dist/NicePivotGrid-DoWLUPUs.js +1167 -0
- package/dist/NicePivotGrid-etwpfccz.js +1167 -0
- package/dist/NiceSavedQueryPanel-BABkTNc5.js +5129 -0
- package/dist/NiceSavedQueryPanel-Cfeig83P.cjs +586 -0
- package/dist/NiceSavedQueryPanel-DTWRLseb.cjs +586 -0
- package/dist/NiceSavedQueryPanel-Dy154sxE.js +5129 -0
- package/dist/NiceSavedQueryPanel-v7AffOOe.js +5129 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceScheduler-BEgB7ZgF.cjs +5 -0
- package/dist/NiceScheduler-C9JprsEI.cjs +5 -0
- package/dist/NiceScheduler-DSP-PPh0.js +1645 -0
- package/dist/NiceScheduler-DuPnaA3t.js +1652 -0
- package/dist/NiceScheduler-Oa89YZx9.js +1645 -0
- package/dist/NiceSelect-A336yeLZ.js +433 -0
- package/dist/NiceSelect-B5hTbqi2.js +433 -0
- package/dist/NiceSelect-BYSgDYzq.cjs +1 -0
- package/dist/NiceSelect-Dudf2T5T.js +433 -0
- package/dist/NiceSelect-DwBAIrX7.cjs +1 -0
- package/dist/NiceWindow-B6zjBTl9.cjs +1 -0
- package/dist/NiceWindow-BKQEx7Vf.js +1623 -0
- package/dist/NiceWindow-BnTH7Gy0.js +1623 -0
- package/dist/NiceWindow-CZN9NVZw.cjs +1 -0
- package/dist/NiceWindow-lxtPR7yZ.js +1623 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-B8_V3_nq.cjs +882 -0
- package/dist/charts-BZgyyybE.js +31933 -0
- package/dist/charts-FuDk5-r6.js +31958 -0
- package/dist/charts-INj3yFo5.js +31946 -0
- package/dist/charts-NolNXKUL.cjs +882 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-A_A6c7an.js +795 -0
- package/dist/core-B2iH2J_X.js +795 -0
- package/dist/core-BmspZEfD.js +795 -0
- package/dist/core-DAfLOet6.cjs +1 -0
- package/dist/core-ZG3bgnBR.cjs +1 -0
- package/dist/data-branching-B3TOqXAO.cjs +1 -0
- package/dist/data-branching-BUGiICDZ.js +6275 -0
- package/dist/data-branching-DMXmcocj.js +6275 -0
- package/dist/data-branching-YE8P9M5P.js +6275 -0
- package/dist/data-branching-t6uhAwIm.cjs +1 -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 +7 -2
- package/dist/data.mjs +3 -3
- package/dist/devops-BhV3OmF7.js +8285 -0
- package/dist/devops-BqUxnbRi.cjs +17 -0
- package/dist/devops-Bx-Qwj9w.cjs +17 -0
- package/dist/devops-DYZatW45.js +8251 -0
- package/dist/devops-R98k2zpd.js +8251 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +29 -16
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +59 -28
- package/dist/editors.mjs +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +445 -445
- package/dist/index.css +1 -1
- package/dist/index.d.ts +214 -119
- package/dist/index.mjs +16635 -16351
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +31 -18
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +17 -14
- package/dist/navigation.mjs +130 -130
- package/dist/no-code-BPaAS4wW.cjs +332 -0
- package/dist/no-code-CBwUVL1i.js +7447 -0
- package/dist/no-code-CjktkQ50.js +7447 -0
- package/dist/no-code-DW2NrRba.js +7447 -0
- package/dist/no-code-DmFxrZ5T.cjs +332 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.d.ts +2 -2
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +4 -4
- package/dist/overlays.mjs +2 -2
- package/dist/pickerCommons-C4XWRUvH.cjs +1 -0
- package/dist/pickerCommons-C_BpYs_m.cjs +1 -0
- package/dist/pickerCommons-DAOXH_u5.js +1122 -0
- package/dist/pickerCommons-Dn4wnDco.js +1122 -0
- package/dist/pickerCommons-DskswPS5.js +1122 -0
- package/dist/pickerCommons.css +1 -1
- package/dist/style.css +7 -7
- package/package.json +3 -3
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),P=require("./charts-NolNXKUL.cjs"),t=require("react"),ut=require("./NiceDataGrid-DJr33WMy.cjs"),Ie=require("./NiceColorPicker-Cuc6YXqz.cjs"),mt=require("./NiceForm-jU89oe2S.cjs"),ht=require("./NiceModal-DkawKzEE.cjs"),pt=require("./core-ZG3bgnBR.cjs"),gt=require("./NiceSelect-BYSgDYzq.cjs"),Bn=require("./pickerCommons-C_BpYs_m.cjs");function ft(n,i){return n.filter(a=>i.every(s=>{const d=a[s.field],m=s.value;switch(s.operator){case"eq":return d===m;case"ne":return d!==m;case"gt":return typeof d=="number"&&typeof m=="number"&&d>m;case"gte":return typeof d=="number"&&typeof m=="number"&&d>=m;case"lt":return typeof d=="number"&&typeof m=="number"&&d<m;case"lte":return typeof d=="number"&&typeof m=="number"&&d<=m;case"contains":return String(d).toLowerCase().includes(String(m).toLowerCase());case"startsWith":return String(d).toLowerCase().startsWith(String(m).toLowerCase());case"endsWith":return String(d).toLowerCase().endsWith(String(m).toLowerCase());default:return!0}}))}function _t(n){return n.map(i=>({field:i.field,type:i.dataType||"string",label:typeof i.header=="string"?i.header:i.field}))}function xt(n,i){const{enableAI:a=!0,aiModel:s,enableNLSearch:d=!0,enableInsights:m=!0,nlPlaceholder:g,onAIFilter:u,onInsights:y,showAISearchBar:S=!0,exampleQueries:A=["Show items from last week","Filter by status = active","Orders over $1000",'Names starting with "A"'],columns:U,data:w,...Y}=n,[Q,E]=t.useState(""),[z,b]=t.useState([]),[x,_]=t.useState([]),[v,C]=t.useState(!1),[T,te]=t.useState(null),ce=t.useRef(null),{t:oe}=P.Gt(),de=P.he(),{parseFilter:ue,isLoading:J}=P.kd(),we=a&&de.isConfigured,O=z.length>0?ft(w||[],z):w,he=t.useCallback(async f=>{if(!we||!d||!f.trim())return;te(f);const l=_t(U);try{const R=await ue(f,l);b(R),u?.(f,R)}catch{b([])}},[we,d,U,ue,u]),ke=t.useCallback(()=>{b([]),te(null),E("")},[]),B=t.useCallback(()=>z,[z]),xe=t.useCallback(async()=>{if(!we||!m||!w?.length)return[];try{const f=await de.complete([{role:"user",content:`Analyze this data and provide 3-5 key insights. Data sample (${w.length} total rows): ${JSON.stringify(w.slice(0,20))}
|
|
2
|
+
|
|
3
|
+
Columns: ${U.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),R=Array.isArray(l)?l:[];return _(R),y?.(R),R}catch{return[]}}catch{return[]}},[we,m,w,U,de,y]),V=f=>{f.preventDefault(),Q.trim()&&he(Q)},h=f=>{E(f),he(f)};return t.useImperativeHandle(i,()=>({applyNLFilter:he,clearAIFilters:ke,getAIFilters:B,generateInsights:xe})),e.jsxs("div",{className:"nice-data-grid-ai","data-testid":n["data-testid"],children:[S&&we&&d&&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:V,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(P.oa,{name:"search",size:14})}),e.jsx("input",{ref:ce,type:"text",value:Q,onChange:f=>E(f.target.value),placeholder:g||oe("dataGridAI.searchPlaceholder","Search with natural language..."),className:"nice-data-grid-ai__input",disabled:J}),J&&e.jsx("span",{className:"nice-data-grid-ai__loading-spinner"}),Q&&!J&&e.jsx("button",{type:"button",className:"nice-data-grid-ai__clear-input",onClick:()=>E(""),"aria-label":oe("dataGridAI.clearInput","Clear"),children:e.jsx(P.oa,{name:"close",size:14})})]}),e.jsx("button",{type:"submit",className:"nice-data-grid-ai__search-btn",disabled:J||!Q.trim(),children:J?oe("dataGridAI.searching","Searching..."):oe("dataGridAI.search","Search")})]}),m&&e.jsxs("button",{type:"button",className:"nice-data-grid-ai__insights-btn",onClick:()=>{xe(),C(!0)},disabled:J||!w?.length,title:oe("dataGridAI.generateInsights","Generate AI Insights"),children:[e.jsx(P.oa,{name:"lightbulb",size:14})," ",oe("dataGridAI.insights","Insights")]})]}),S&&we&&d&&!T&&A.length>0&&e.jsxs("div",{className:"nice-data-grid-ai__examples",children:[e.jsx("span",{className:"nice-data-grid-ai__examples-label",children:oe("dataGridAI.tryAsking","Try asking:")}),e.jsx("div",{className:"nice-data-grid-ai__examples-list",children:A.slice(0,4).map((f,l)=>e.jsxs("button",{type:"button",className:"nice-data-grid-ai__example",onClick:()=>h(f),children:['"',f,'"']},l))})]}),T&&z.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(P.oa,{name:"target",size:14})}),e.jsxs("span",{className:"nice-data-grid-ai__filter-query",children:['"',T,'"']}),e.jsxs("span",{className:"nice-data-grid-ai__filter-count",children:["(",O?.length||0," ",oe("dataGridAI.results","results"),")"]})]}),e.jsx("div",{className:"nice-data-grid-ai__filter-badges",children:z.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:ke,children:[e.jsx(P.oa,{name:"close",size:14})," ",oe("dataGridAI.clearFilter","Clear")]})]}),e.jsx("div",{className:"nice-data-grid-ai__grid-wrapper",children:e.jsx(ut.NiceDataGrid,{columns:U,data:O,...Y})}),v&&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(P.oa,{name:"lightbulb",size:14})," ",oe("dataGridAI.aiInsights","AI Insights")]}),e.jsx("button",{type:"button",className:"nice-data-grid-ai__insights-close",onClick:()=>C(!1),"aria-label":oe("dataGridAI.closeInsights","Close"),children:e.jsx(P.oa,{name:"close",size:14})})]}),e.jsx("div",{className:"nice-data-grid-ai__insights-body",children:J?e.jsx("div",{className:"nice-data-grid-ai__insights-loading",children:oe("dataGridAI.analyzing","Analyzing data...")}):x.length>0?e.jsx("ul",{className:"nice-data-grid-ai__insights-list",children:x.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:oe("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:()=>xe(),disabled:J,children:[e.jsx(P.oa,{name:"refresh",size:14})," ",oe("dataGridAI.refresh","Refresh")]})})]})]})}const bt=t.forwardRef(xt);function yt(n,i,a){const s=new Map,d=[];n.forEach(g=>s.set(String(g[i]),{data:g,children:[],key:String(g[i]),depth:0})),n.forEach(g=>{const u=g[a],y=s.get(String(g[i]));if(u!=null&&u!==""&&s.has(String(u))){const S=s.get(String(u));y.depth=S.depth+1,S.children.push(y)}else d.push(y)});const m=(g,u)=>{g.forEach(y=>{y.depth=u,m(y.children,u+1)})};return m(d,0),d}function Wn(n,i,a,s=0){return n.map(d=>({data:d,key:String(d[a]),depth:s,children:Array.isArray(d[i])?Wn(d[i],i,a,s+1):[]}))}function vt(n){const i=[],a=s=>{s.forEach(d=>{i.push(d.key),a(d.children)})};return a(n),i}function jt(n,i){const a=[],s=d=>{d.forEach(m=>{a.push(m),m.children.length>0&&i.has(m.key)&&s(m.children)})};return s(n),a}function Kn(n,i,a){return!i||!a?n:[...n].sort((d,m)=>{const g=d.data[i]??"",u=m.data[i]??"",y=typeof g=="number"&&typeof u=="number"?g-u:String(g).localeCompare(String(u));return a==="desc"?-y:y}).map(d=>({...d,children:Kn(d.children,i,a)}))}function Nt({columns:n,data:i,keyField:a="id",parentKeyField:s="parentId",nested:d=!1,childrenField:m="children",expandedKeys:g,onExpandedChange:u,defaultExpandAll:y=!1,sortable:S=!0,sortField:A,sortDirection:U,onSort:w,selectable:Y,selectedKeys:Q,onSelectionChange:E,searchable:z,searchPlaceholder:b,striped:x,compact:_,size:v="md",loading:C,disabled:T,readOnly:te,error:ce,emptyText:oe,toolbar:de,onRowClick:ue,className:J,style:we}){const{t:O}=P.Gt(),he=t.useMemo(()=>d?Wn(i,m,a):yt(i,a,s),[i,a,s,d,m]),ke=t.useMemo(()=>vt(he),[he]),[B,xe]=t.useState(()=>y?new Set(ke):new Set),V=g?new Set(g):B,[h,f]=t.useState({field:"",dir:null}),[l,R]=t.useState(new Set),[q,N]=t.useState(""),se=A??h.field,le=U??h.dir,re=Q??l,G=t.useMemo(()=>n.filter(F=>!F.hidden),[n]),be=t.useCallback(F=>{const o=se===F?le==="asc"?"desc":le==="desc"?null:"asc":"asc";w?w(F,o):f({field:F,dir:o})},[se,le,w]),Me=t.useCallback(F=>{const o=new Set(V);o.has(F)?o.delete(F):o.add(F),u?u([...o]):xe(o)},[V,u]),Re=t.useCallback(F=>{const o=new Set(re);o.has(F)?o.delete(F):o.add(F),E?E(o):R(o)},[re,E]),Te=t.useMemo(()=>{if(!q)return he;const F=q.toLowerCase(),o=ge=>ge.reduce((ee,k)=>{const $=o(k.children);return(G.some(Ne=>String(k.data[Ne.field]??"").toLowerCase().includes(F))||$.length>0)&&ee.push({...k,children:$}),ee},[]);return o(he)},[he,q,G]),Pe=t.useMemo(()=>Kn(Te,se,le),[Te,se,le]),Ue=t.useMemo(()=>jt(Pe,V),[Pe,V]),Ce=({field:F})=>se!==F||!le?e.jsx("span",{className:"nice-table__sort-icon",style:{opacity:.3},children:"↕"}):e.jsx("span",{className:"nice-table__sort-icon",children:e.jsx(P.oa,{name:le==="asc"?"sort-asc":"sort-desc",size:12})});return e.jsxs("div",{className:`nice-treegrid nice-datagrid ${T?"nice-treegrid--disabled":""} ${te?"nice-treegrid--readonly":""} ${ce?"nice-treegrid--error":""} ${J||""}`,style:we,"aria-disabled":T||void 0,"aria-busy":C||void 0,"aria-invalid":!!ce||void 0,children:[(z||de)&&e.jsxs("div",{className:"nice-datagrid__toolbar",children:[z&&e.jsx("div",{className:"nice-datagrid__search",children:e.jsx("input",{type:"text",value:q,onChange:F=>N(F.target.value),placeholder:b||O("controls.search","Search...")})}),de]}),e.jsx("div",{className:"nice-datagrid__table-wrap",children:e.jsxs("table",{className:`nice-table nice-table--${v} ${x?"nice-table--striped":""} ${_?"nice-table--compact":""}`,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[Y&&e.jsx("th",{className:"nice-datagrid__checkbox",style:{width:36}}),G.map(F=>e.jsxs("th",{style:{width:F.width,minWidth:F.minWidth,textAlign:F.align},className:S&&F.sortable!==!1?"nice-datagrid__th--sortable":void 0,onClick:()=>S&&F.sortable!==!1&&be(F.field),children:[F.header,S&&F.sortable!==!1&&e.jsx(Ce,{field:F.field})]},F.field))]})}),e.jsx("tbody",{children:C?e.jsx("tr",{children:e.jsx("td",{colSpan:G.length+(Y?1:0),className:"nice-datagrid__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):ce?e.jsx("tr",{children:e.jsx("td",{colSpan:G.length+(Y?1:0),className:"nice-datagrid__empty nice-treegrid__error",role:"alert",children:ce})}):Ue.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:G.length+(Y?1:0),className:"nice-datagrid__empty",children:oe||O("controls.noData","No data available")})}):Ue.map((F,o)=>{const ge=re.has(F.key),ee=F.children.length>0,k=V.has(F.key);return e.jsxs("tr",{className:ge?"nice-datagrid__row--selected":void 0,onClick:()=>{te||ue?.(F.data)},style:ue&&!te?{cursor:"pointer"}:void 0,children:[Y&&e.jsx("td",{className:"nice-datagrid__checkbox",onClick:$=>$.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:ge,onChange:()=>Re(F.key),disabled:te,"aria-label":`Select row ${F.key}`})}),G.map(($,H)=>e.jsxs("td",{style:{textAlign:$.align},children:[H===0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{display:"inline-block",width:F.depth*20}}),e.jsx("button",{className:`nice-treegrid__toggle ${ee?"":"nice-treegrid__toggle--leaf"}`,onClick:Ne=>{Ne.stopPropagation(),ee&&Me(F.key)},tabIndex:ee?0:-1,"aria-expanded":ee?k:void 0,"aria-label":ee?k?"Collapse":"Expand":void 0,children:ee?e.jsx(P.oa,{name:k?"chevron-down":"chevron-right",size:12}):""})]}),$.render?$.render(F.data[$.field],F.data,o):String(F.data[$.field]??"")]},$.field))]},F.key)})})]})})]})}function wt(n,i,a){const s=new Map,d=[];return n.forEach(m=>{const g={...m,children:[]};s.set(String(g[i]),g)}),n.forEach(m=>{const g=m[a];g!=null&&s.has(String(g))?s.get(String(g)).children.push(s.get(String(m[i]))):d.push(s.get(String(m[i])))}),d}function kt({columns:n,data:i,keyField:a="key",parentKeyField:s="parentKey",expandedKeys:d,onExpandedChange:m,selectedKeys:g=[],onSelectionChange:u,selectable:y,sortable:S,loading:A,emptyText:U,className:w,style:Y,accessMode:Q,id:E}){const b=P.Dc(Q,E)==="hidden",{t:x}=P.Gt(),[_,v]=t.useState([]),C=d??_,[T,te]=t.useState(g),ce=u?g:T,oe=t.useMemo(()=>wt(i,a,s),[i,a,s]),de=t.useMemo(()=>n.filter(h=>!h.hidden),[n]),[ue,J]=t.useState(null),we=t.useCallback(h=>{J(f=>f?.field===h?f.dir==="asc"?{field:h,dir:"desc"}:null:{field:h,dir:"asc"})},[]),O=t.useCallback(h=>ue?[...h].sort((l,R)=>{const q=l[ue.field]??"",N=R[ue.field]??"",se=typeof q=="number"?q-N:String(q).localeCompare(String(N));return ue.dir==="desc"?-se:se}).map(l=>l.children&&l.children.length?{...l,children:O(l.children)}:l):h,[ue]),he=t.useMemo(()=>O(oe),[oe,O]),ke=t.useCallback(h=>{const f=C.includes(h)?C.filter(l=>l!==h):[...C,h];m?m(f):v(f)},[C,m]),B=t.useCallback(h=>{const f=[],l=R=>{R.children?.forEach(q=>{f.push(String(q[a])),l(q)})};return l(h),f},[a]),xe=t.useCallback(h=>{const f=[String(h[a]),...B(h)],R=f.every(q=>ce.includes(q))?ce.filter(q=>!f.includes(q)):Array.from(new Set([...ce,...f]));u?u(R):te(R)},[ce,u,a,B]),V=(h,f)=>{const l=String(h[a]),R=!!(h.children&&h.children.length>0),q=C.includes(l),N=R?B(h):[],se=N.filter(G=>ce.includes(G)).length,le=R&&N.length>0?se===N.length:ce.includes(l),re=R&&se>0&&se<N.length;return e.jsxs(t.Fragment,{children:[e.jsxs("tr",{className:le?"nice-treelist__row--selected":"",children:[y&&e.jsx("td",{className:"nice-treelist__checkbox",children:e.jsx("input",{type:"checkbox",checked:le,ref:G=>{G&&(G.indeterminate=re)},onChange:()=>xe(h)})}),de.map((G,be)=>e.jsxs("td",{style:{textAlign:G.align},children:[be===0&&e.jsx("span",{style:{display:"inline-block",width:f*20}}),be===0&&e.jsx("span",{className:"nice-treelist__toggle",onClick:()=>R&&ke(l),style:{cursor:R?"pointer":"default",width:20,display:"inline-block"},children:R?e.jsx(P.oa,{name:q?"chevron-down":"chevron-right",size:12}):""}),G.render?G.render(h[G.field],h,0):String(h[G.field]??"")]},G.field))]}),R&&q&&h.children.map(G=>V(G,f+1))]},l)};return b?null:e.jsx("div",{className:`nice-treelist ${w||""}`,style:Y,children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[y&&e.jsx("th",{className:"nice-treelist__checkbox"}),de.map(h=>{const f=!!S&&!!h.sortable;return e.jsxs("th",{style:{width:h.width,minWidth:h.minWidth,textAlign:h.align},className:f?"nice-treelist__th--sortable":void 0,onClick:()=>f&&we(h.field),scope:"col","aria-sort":f?ue?.field===h.field?ue.dir==="asc"?"ascending":"descending":"none":void 0,children:[h.header,f&&e.jsx("span",{className:"nice-table__sort-icon","aria-hidden":"true",children:e.jsx(P.oa,{name:ue?.field===h.field?ue.dir==="desc"?"chevron-down":"chevron-up":"sort",size:12})})]},h.field)})]})}),e.jsx("tbody",{children:A?e.jsx("tr",{children:e.jsx("td",{colSpan:de.length+(y?1:0),className:"nice-treelist__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):oe.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:de.length+(y?1:0),className:"nice-treelist__empty",children:U||x("controls.noData","No data available")})}):he.map(h=>V(h,0))})]})})}function Vn(n){const i=[];if(n.children)for(const a of n.children)i.push(a.key),i.push(...Vn(a));return i}function Tn(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 d of n.children){const m=Tn(d,i);m==="checked"?s=!0:(m==="indeterminate"&&(s=!0),a=!1)}return a&&s?"checked":s?"indeterminate":"unchecked"}const St=({nodes:n,header:i,selectedKeys:a=[],expandedKeys:s,onSelectionChange:d,onExpandedChange:m,selectionMode:g="none",showCheckboxes:u,searchable:y,searchPlaceholder:S,onNodeClick:A,renderNode:U,showLines:w,loading:Y,className:Q,style:E,accessMode:z,id:b,draggable:x,onNodeDrop:_,onLoadChildren:v,contextMenuItems:C,onContextMenuAction:T,editable:te,onNodeEdit:ce,maxDepth:oe})=>{const ue=P.Dc(z,b)==="hidden",{t:J}=P.Gt(),[we,O]=t.useState([]),[he,ke]=t.useState(""),[B,xe]=t.useState(new Set),[V,h]=t.useState(new Map),[f,l]=t.useState(null),[R,q]=t.useState(null),[N,se]=t.useState(null),[le,re]=t.useState(""),G=t.useRef(null),be=s??we,Me=t.useMemo(()=>new Set(a),[a]),Re=t.useCallback(async(o,ge)=>{const ee=!be.includes(o),k=ee?[...be,o]:be.filter($=>$!==o);if(m?m(k):O(k),ee&&v&&!ge.children?.length&&ge.leaf!==!0&&!V.has(o)){xe(H=>new Set(H).add(o));const $=await v(ge);h(H=>new Map(H).set(o,$)),xe(H=>{const Ne=new Set(H);return Ne.delete(o),Ne})}},[be,m,v,V]),Te=t.useCallback((o,ge)=>{if(d){if(g==="single")d(a.includes(o)?[]:[o]);else if(g==="multiple")if(u&&ge.children?.length){const ee=Vn(ge),k=[o,...ee];if(Tn(ge,Me)==="checked")d(a.filter(H=>!k.includes(H)));else{const H=new Set([...a,...k]);d(Array.from(H))}}else d(a.includes(o)?a.filter(ee=>ee!==o):[...a,o])}},[a,g,d,u,Me]),Pe=t.useCallback(o=>{if(!he)return!0;const ge=he.toLowerCase();return o.text.toLowerCase().includes(ge)?!0:(V.get(o.key)??o.children)?.some(k=>Pe(k))??!1},[he,V]),Ue=t.useCallback((o,ge)=>{C?.length&&(o.preventDefault(),q({x:o.clientX,y:o.clientY,node:ge}))},[C]),Ce=t.useCallback(()=>{N&&ce&&ce(N,le),se(null)},[N,le,ce]),F=(o,ge)=>{if(he&&!Pe(o))return null;const ee=typeof oe=="number"?Math.min(10,Math.max(1,oe)):1/0,k=ge+1>=ee,$=k?void 0:V.get(o.key)??o.children,H=!k&&($&&$.length>0||o.leaf!==!0&&v&&!$?.length),Ne=be.includes(o.key),De=Me.has(o.key),fe=B.has(o.key),ie=u&&g==="multiple"&&$?.length?Tn(o,Me):De?"checked":"unchecked",Ge=Math.min(ge+1,10),un={paddingLeft:ge*20+4,"--nice-row-bg":`var(--nice-tree-level-${Ge}-bg, transparent)`,"--nice-row-text":`var(--nice-tree-level-${Ge}-text, inherit)`,"--nice-row-border":`var(--nice-tree-level-${Ge}-border, transparent)`,"--nice-row-hover-bg":`var(--nice-tree-level-${Ge}-hover-bg, var(--nice-hover-bg, color-mix(in srgb, var(--nice-text-primary) 6%, transparent)))`,"--nice-row-active-bg":`var(--nice-tree-level-${Ge}-active-bg, color-mix(in srgb, var(--nice-color-primary) 14%, transparent))`};return e.jsxs("li",{className:"nice-tree__node",role:"treeitem","aria-expanded":H?Ne:void 0,"data-nice-depth":Ge,draggable:x&&!o.disabled,onDragStart:x?W=>{W.stopPropagation(),l(o.key)}:void 0,onDragOver:x?W=>{W.preventDefault(),W.stopPropagation()}:void 0,onDrop:x&&f?W=>{W.stopPropagation(),_?.(f,o.key,"inside"),l(null)}:void 0,onDragEnd:x?()=>l(null):void 0,children:[e.jsxs("div",{className:`nice-tree__row ${De?"nice-tree__row--selected":""} ${o.disabled?"nice-tree__row--disabled":""} ${f===o.key?"nice-tree__row--dragging":""}`,style:un,onClick:()=>{o.disabled||(Te(o.key,o),A?.(o))},onContextMenu:W=>Ue(W,o),onDoubleClick:te&&!o.disabled?()=>{se(o.key),re(o.text)}:void 0,children:[e.jsx("span",{className:`nice-tree__toggle ${H?Ne?"nice-tree__toggle--expanded":"":"nice-tree__toggle--leaf"}`,onClick:W=>{W.stopPropagation(),H&&Re(o.key,o)},children:fe?e.jsx("span",{className:"nice-spinner nice-spinner--xs"}):H?Ne?e.jsx(P.oa,{name:"chevron-down",size:12}):e.jsx(P.oa,{name:"chevron-right",size:12}):""}),u&&g!=="none"&&e.jsx("input",{type:"checkbox",checked:ie==="checked",ref:W=>{W&&(W.indeterminate=ie==="indeterminate")},onChange:()=>Te(o.key,o),onClick:W=>W.stopPropagation(),tabIndex:-1,className:"nice-tree__checkbox"}),N===o.key?e.jsx("input",{type:"text",className:"nice-tree__edit-input",value:le,onChange:W=>re(W.target.value),onBlur:Ce,onKeyDown:W=>{W.key==="Enter"&&Ce(),W.key==="Escape"&&se(null)},autoFocus:!0,onClick:W=>W.stopPropagation()}):U?U(o):e.jsxs(e.Fragment,{children:[o.icon&&e.jsx("span",{className:"nice-tree__icon",children:o.icon}),e.jsx("span",{className:"nice-tree__text",children:o.text})]})]}),$&&$.length>0&&Ne&&e.jsx("ul",{className:"nice-tree__children",role:"group",children:$.map(W=>F(W,ge+1))})]},o.key)};return ue?null:e.jsxs("div",{className:`nice-tree ${w?"nice-tree--lines":""} ${Q||""}`,style:E,ref:G,onClick:()=>q(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:he,onChange:o=>ke(o.target.value),placeholder:S||J("controls.search","Search..."),"aria-label":S||J("controls.search","Search tree")})}),Y?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(o=>F(o,0))}),R&&C&&e.jsx("div",{className:"nice-tree__context-menu",style:{position:"fixed",top:R.y,left:R.x,zIndex:9999},children:C.map(o=>e.jsxs("div",{className:`nice-tree__context-item ${o.disabled?"nice-tree__context-item--disabled":""}`,onClick:()=>{o.disabled||(T?.(o.key,R.node),q(null))},children:[o.icon&&e.jsx("span",{children:o.icon}),o.label]},o.key))})]})},Ct=({items:n,selectedKeys:i=[],onSelectionChange:a,selectionMode:s="none",searchable:d,searchPlaceholder:m,grouped:g,groupField:u="group",reorderable:y,onReorder:S,onItemClick:A,renderItem:U,showCheckboxes:w,loading:Y,emptyText:Q,size:E="md",header:z,disabled:b,readOnly:x,error:_,bordered:v=!0,swipeActions:C,className:T,style:te,accessMode:ce,id:oe})=>{const ue=P.Dc(ce,oe)==="hidden",{t:J}=P.Gt(),[we,O]=t.useState(""),[he,ke]=t.useState(null),[B,xe]=t.useState(null),V=t.useRef(null),h=t.useMemo(()=>{if(!we)return n;const N=we.toLowerCase();return n.filter(se=>se.text.toLowerCase().includes(N))},[n,we]),f=t.useMemo(()=>{if(!g)return null;const N=new Map;return h.forEach(se=>{const le=String(se[u]??"");N.has(le)||N.set(le,[]),N.get(le).push(se)}),N},[h,g,u]),l=t.useCallback(N=>{a&&(s==="single"?a(i.includes(N)?[]:[N]):s==="multiple"&&a(i.includes(N)?i.filter(se=>se!==N):[...i,N]))},[i,s,a]),R=t.useCallback(N=>{he!==null&&he!==N&&S&&S(he,N),ke(null)},[he,S]),q=(N,se)=>{const le=i.includes(N.key),re=B===N.key;return e.jsxs("li",{className:`nice-list__item ${le?"nice-list__item--selected":""} ${N.disabled?"nice-list__item--disabled":""} ${re?"nice-list__item--swiped":""}`,onClick:()=>{!N.disabled&&!b&&!x&&(l(N.key),A?.(N))},draggable:y&&!b&&!x,onDragStart:()=>ke(se),onDragOver:G=>G.preventDefault(),onDrop:()=>R(se),onTouchStart:C?.length?G=>{V.current={x:G.touches[0].clientX,key:N.key}}:void 0,onTouchEnd:C?.length?G=>{if(!V.current)return;const be=G.changedTouches[0].clientX-V.current.x;be<-50&&V.current.key===N.key?xe(N.key):be>50&&xe(null),V.current=null}:void 0,role:s!=="none"?"option":void 0,"aria-selected":s!=="none"?le:void 0,children:[e.jsxs("div",{className:"nice-list__item-content",children:[w&&s!=="none"&&e.jsx("input",{type:"checkbox",checked:le,readOnly:!0,tabIndex:-1,className:"nice-list__checkbox"}),U?U(N):e.jsxs(e.Fragment,{children:[N.icon&&e.jsx("span",{className:"nice-list__icon",children:N.icon}),e.jsx("span",{className:"nice-list__text",children:N.text}),N.badge&&e.jsx("span",{className:"nice-list__badge",children:N.badge})]})]}),C&&re&&e.jsx("div",{className:"nice-list__swipe-actions",children:C.map(G=>e.jsx("button",{className:"nice-list__swipe-btn",style:G.color?{backgroundColor:G.color}:void 0,onClick:be=>{be.stopPropagation(),G.onClick(N),xe(null)},children:G.label},G.key))})]},N.key)};return ue?null:e.jsxs("div",{className:`nice-list nice-list--${E} ${v?"nice-list--bordered":""} ${b?"nice-list--disabled":""} ${x?"nice-list--readonly":""} ${_?"nice-list--error":""} ${T||""}`,style:te,"aria-disabled":b||void 0,"aria-busy":Y||void 0,children:[z&&e.jsx("div",{className:"nice-list__header",children:z}),d&&!Y&&e.jsx("div",{className:"nice-list__search",children:e.jsx("input",{type:"text",value:we,onChange:N=>O(N.target.value),placeholder:m||J("controls.search","Search...")})}),Y?e.jsx("div",{className:"nice-list__loading",role:"status","aria-live":"polite",children:e.jsx("div",{className:`nice-spinner nice-spinner--${E}`})}):_?e.jsx("div",{className:"nice-list__error",role:"alert",children:_}):h.length===0?e.jsx("div",{className:"nice-list__empty",children:Q||J("controls.noData","No data available")}):f?e.jsx("div",{role:"listbox",children:Array.from(f.entries()).map(([N,se])=>e.jsxs("div",{className:"nice-list__group",children:[e.jsx("div",{className:"nice-list__group-header",children:N}),e.jsx("ul",{className:"nice-list__items",children:se.map((le,re)=>q(le,re))})]},N))}):e.jsx("ul",{className:"nice-list__items",role:"listbox",children:h.map((N,se)=>q(N,se))})]})};function Dt({columns:n,data:i,striped:a,compact:s,size:d="md",emptyText:m,className:g,style:u,accessMode:y,id:S,displayStyle:A}){const U=P.Js(d),Y=P.Dc(y,S)==="hidden",Q=P.rc("table",A),E=P.ac("table",A),[z,b]=t.useState(null),x=t.useMemo(()=>z?[...i].sort((v,C)=>{const T=v[z.field]??"",te=C[z.field]??"",ce=typeof T=="number"?T-te:String(T).localeCompare(String(te));return z.dir==="desc"?-ce:ce}):i,[i,z]),_=v=>{b(C=>C?.field===v?C.dir==="asc"?{field:v,dir:"desc"}:null:{field:v,dir:"asc"})};return Y?null:e.jsx("div",{className:`nice-table-wrapper ${g||""}`,style:{...Q,...u},children:e.jsxs("table",{className:`nice-table nice-table--ds-${E} nice-table--${U} ${a?"nice-table--striped":""} ${s?"nice-table--compact":""}`,"aria-rowcount":x.length,"aria-colcount":n.length,children:[e.jsx("thead",{children:e.jsx("tr",{children:n.map(v=>{const C=v.sortable?z?.field===v.field?z.dir==="asc"?"ascending":"descending":"none":void 0;return e.jsxs("th",{style:{width:v.width,textAlign:v.align},className:v.sortable?"th--sortable":void 0,onClick:()=>v.sortable&&_(v.field),scope:"col","aria-sort":C,children:[v.header,v.sortable&&e.jsx("span",{className:"nice-table__sort-icon","aria-hidden":"true",children:e.jsx(P.oa,{name:z?.field===v.field?z.dir==="desc"?"chevron-down":"chevron-up":"sort",size:12})})]},v.field)})})}),e.jsx("tbody",{children:x.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:n.length,className:"nice-table__empty",children:m||"No data"})}):x.map((v,C)=>e.jsx("tr",{children:n.map(T=>e.jsx("td",{style:{textAlign:T.align},children:T.render?T.render(v[T.field],v):String(v[T.field]??"")},T.field))},C))})]})})}function It({items:n,tileWidth:i=180,tileHeight:a=180,direction:s="horizontal",renderTile:d,onTileClick:m,loading:g,emptyText:u,className:y,style:S}){const{t:A}=P.Gt();return e.jsx("div",{className:`nice-tileview nice-tileview--${s} ${y||""}`,style:S,children:g?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:u||A("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(U=>e.jsx("div",{className:"nice-tileview__tile",style:{width:i,height:a,cursor:m?"pointer":void 0},onClick:()=>m?.(U),children:d?d(U):e.jsxs(e.Fragment,{children:[U.image&&e.jsx("img",{src:U.image,alt:U.text||"",className:"nice-tileview__image"}),U.text&&e.jsx("div",{className:"nice-tileview__label",children:U.text})]})},U.key))})})}function Mt({open:n}){return e.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transition:"transform 160ms ease",transform:n?"rotate(0deg)":"rotate(-90deg)"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}function At(){return e.jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}const zt=[{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"}],qn=t.forwardRef(({columns:n,cards:i,onCardMove:a,onCardClick:s,renderCard:d,onAddCard:m,disabled:g=!1,size:u="md",collapsible:y=!1,collapseDirection:S="vertical",layoutMode:A="scroll",viewMode:U,onViewModeChange:w,collapsedColumns:Y,onCollapsedColumnsChange:Q,formItems:E,formColumns:z=1,formProps:b,editCardTitle:x,newCardTitle:_,onCardEdit:v,onCardCreate:C,onCardDelete:T,tutorial:te,cookies:ce=!1,localStorage:oe=!0,sessionStorage:de=!1,storageMode:ue,storageKey:J,className:we,style:O,id:he,...ke},B)=>{const{t:xe}=P.Gt(),[V,h]=t.useState(null),[f,l]=t.useState(null),[R,q]=t.useState(null),N=!!E&&(!!v||!!C),se=t.useCallback(k=>{if(N&&v){q({key:k.key,data:{...k},column:k.column});return}s?.(k)},[N,s,v]),le=t.useCallback(k=>{if(N&&C){q({key:null,data:{title:"",description:""},column:k});return}m?.(k)},[N,m,C]),re=pt.useStorageAdapter(J??"nice-kanban"),[G,be]=t.useState(()=>re.get("state")??{collapsedColumns:[],viewMode:"default"}),Me=Y??G.collapsedColumns??[],Re=U??G.viewMode??"default",Te=t.useCallback(k=>{be($=>{const H={...$,...k};return re.set("state",H),H})},[re]),Pe=t.useCallback(k=>{const $=Me.includes(k)?Me.filter(H=>H!==k):[...Me,k];Q?Q($):Te({collapsedColumns:$})},[Me,Q,Te]);t.useCallback(k=>{w?w(k):Te({viewMode:k})},[w,Te]);const Ue=t.useCallback(k=>i.filter($=>$.column===k).sort(($,H)=>($.order??0)-(H.order??0)),[i]),Ce=t.useCallback((k,$)=>{g||(k.dataTransfer.effectAllowed="move",k.dataTransfer.setData("text/plain",String($.key)),h({cardKey:$.key,fromColumn:$.column}))},[g]),F=t.useCallback((k,$)=>{k.preventDefault(),k.dataTransfer.dropEffect="move",l({column:$})},[]),o=t.useCallback(()=>{l(null)},[]),ge=t.useCallback((k,$)=>{if(k.preventDefault(),l(null),!V||g)return;const H=Ue($);a?.(V.cardKey,$,H.length),h(null)},[V,g,Ue,a]),ee=t.useCallback(()=>{h(null),l(null)},[]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:B,id:he,className:`nice-kanban nice-kanban--${u} nice-kanban--${Re} nice-kanban--layout-${A} ${g?"nice-kanban--disabled":""} ${we||""}`,style:{position:"relative",...O},...ke,children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(P.Ql,{steps:P.Yl(te,zt)})}),n.map(k=>{const $=Ue(k.key),H=f?.column===k.key,Ne=k.limit!=null&&$.length>=k.limit,De=y&&Me.includes(k.key);return e.jsxs("div",{className:`nice-kanban__column ${H?"nice-kanban__column--dragover":""} ${De?`nice-kanban__column--collapsed nice-kanban__column--collapse-${S}`:""}`,onDragOver:fe=>!De&&F(fe,k.key),onDragLeave:o,onDrop:fe=>!De&&ge(fe,k.key),children:[e.jsxs("div",{className:"nice-kanban__column-header",style:k.color?{borderTopColor:k.color}:void 0,onClick:y?()=>Pe(k.key):void 0,role:y?"button":void 0,tabIndex:y?0:void 0,onKeyDown:y?fe=>{(fe.key==="Enter"||fe.key===" ")&&Pe(k.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:k.title}),e.jsx("span",{className:"nice-kanban__column-count",children:k.limit!=null?e.jsxs("span",{className:"nice-kanban__count-frac",children:[e.jsx("span",{className:"nice-kanban__count-num",children:$.length}),e.jsx("span",{className:"nice-kanban__count-slash",children:"/"}),e.jsx("span",{className:"nice-kanban__count-den",children:k.limit})]}):$.length})]}),!De&&e.jsxs("div",{className:"nice-kanban__column-body",children:[$.map(fe=>e.jsx("div",{className:`nice-kanban__card nice-kanban__card--${Re} ${V?.cardKey===fe.key?"nice-kanban__card--dragging":""}`,draggable:!g,onDragStart:ie=>Ce(ie,fe),onDragEnd:ee,onClick:()=>se(fe),role:"article",children:d?d(fe):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-kanban__card-title",children:fe.title}),Re!=="compact"&&fe.description&&e.jsx("div",{className:"nice-kanban__card-desc",children:fe.description})]})},fe.key)),$.length===0&&e.jsx("div",{className:"nice-kanban__empty",children:xe("kanban.empty","No cards")})]}),!De&&(m||N&&C)&&!Ne&&e.jsxs("button",{type:"button",className:"nice-kanban__add",onClick:()=>le(k.key),disabled:g,children:[e.jsx(At,{})," ",xe("kanban.addCard","Add card")]})]},k.key)})]}),N&&R&&e.jsxs(ht.NiceModal,{open:!0,onClose:()=>q(null),title:R.key==null?_||xe("kanban.newCard","New card"):x||xe("kanban.editCard","Edit card"),children:[e.jsx(mt.NiceForm,{items:E,data:R.data,columns:z,...b,onFieldChange:(k,$)=>q(H=>H&&{...H,data:{...H.data,[k]:$}})}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:16,flexWrap:"wrap"},children:[R.key!=null&&T&&e.jsx(Ie.NiceButton,{type:"button",size:"sm",variant:"error",style:{marginRight:"auto"},onClick:()=>{T(R.key),q(null)},children:xe("controls.delete","Delete")}),e.jsx(Ie.NiceButton,{type:"button",size:"sm",variant:"secondary",onClick:()=>q(null),children:xe("controls.cancel","Cancel")}),e.jsx(Ie.NiceButton,{type:"button",size:"sm",variant:"primary",onClick:()=>{if(R.key==null){const k={key:`card-${Date.now()}`,title:"",column:R.column,...R.data};C?.(k)}else v?.(R.key,{...R.data,key:R.key,column:R.column});q(null)},children:xe("controls.save","Save")})]})]})]})});qn.displayName="NiceKanbanBoard";function an(...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,Et=[10,25,50,100,200],$t=40,Tt=10,Lt=768,Pt=500,Ot=10;function Ze(n,i){return i.split(".").reduce((a,s)=>a?.[s],n)}function yn(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(P.oa,{name:"check",size:14}):e.jsx(P.oa,{name:"close",size:14});case"enum":return i.enumOptions?.find(d=>d.value===n)?.label||String(n);default:return String(n)}}function Ut(n,i,a,s){const[d,m]=t.useState(0),{startIndex:g,endIndex:u,totalHeight:y,offsetY:S}=t.useMemo(()=>{const w=n.length*a,Y=Math.ceil(i/a),Q=Math.max(0,Math.floor(d/a)-s),E=Math.min(n.length,Math.ceil(d/a)+Y+s),z=Q*a;return{startIndex:Q,endIndex:E,totalHeight:w,offsetY:z}},[n.length,i,a,d,s]),A=t.useMemo(()=>n.slice(g,u),[n,g,u]),U=t.useCallback(w=>{m(w.currentTarget.scrollTop)},[]);return{visibleData:A,totalHeight:y,offsetY:S,handleScroll:U,startIndex:g}}function Bt(n,i){const[a,s]=t.useState(()=>{if(n&&typeof window<"u"){const m=localStorage.getItem(`nice-module-grid-${n}`);if(m)return JSON.parse(m)}return i||{}}),d=t.useCallback(m=>{s(g=>{const u={...g,...m};return n&&typeof window<"u"&&localStorage.setItem(`nice-module-grid-${n}`,JSON.stringify(u)),u})},[n]);return[a,d]}function Ft(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 Gt({column:n,sort:i,onSort:a,onResize:s,resizable:d,t:m}){const g=t.useRef(null),[u,y]=t.useState(!1),S=t.useCallback(w=>{if(!d||!s)return;w.preventDefault(),y(!0);const Y=w.clientX,Q=n.width||150,E=b=>{const x=b.clientX-Y,_=Math.max(n.minWidth||50,Q+x);s(n.field,Math.min(_,n.maxWidth||1/0))},z=()=>{y(!1),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",z)};document.addEventListener("mousemove",E),document.addEventListener("mouseup",z)},[n,d,s]),A=i?.direction,U=A==="asc"?e.jsx(P.oa,{name:"sort-asc",size:12}):A==="desc"?e.jsx(P.oa,{name:"sort-desc",size:12}):null;return e.jsxs("div",{className:an("nice-module-grid__header-cell",n.sortable&&"nice-module-grid__header-cell--sortable",u&&"nice-module-grid__header-cell--resizing"),style:{width:n.width==="auto"?"auto":n.width||150,minWidth:n.minWidth,maxWidth:n.maxWidth,textAlign:n.align},onClick:()=>n.sortable&&a?.(n.field),role:"columnheader","aria-sort":A==="asc"?"ascending":A==="desc"?"descending":"none",title:n.headerTooltip,children:[e.jsx("span",{className:"nice-module-grid__header-text",children:n.header}),U&&e.jsx("span",{className:"nice-module-grid__sort-indicator",children:U}),d&&e.jsx("div",{ref:g,className:"nice-module-grid__resize-handle",onMouseDown:S})]})}function Wt({column:n,row:i,rowIndex:a,value:s,locale:d="pl-PL",onClick:m}){const g=P.el({onClick:m}),u=m?g:{};if(n.render)return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...u,children:n.render(s,i,a)});if(n.type==="enum"&&n.enumOptions){const y=n.enumOptions.find(S=>S.value===s);if(y)return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...u,children:e.jsxs("span",{className:an("nice-module-grid__badge",`nice-module-grid__badge--${y.color||"default"}`),children:[y.icon&&e.jsx("span",{className:"nice-module-grid__badge-icon",children:y.icon}),y.label]})})}if(n.type==="progress"){const y=Math.min(100,Math.max(0,Number(s)||0));return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...u,children:e.jsxs("div",{className:"nice-module-grid__progress",children:[e.jsx("div",{className:an("nice-module-grid__progress-bar",`nice-module-grid__progress-bar--${n.progressColor||"primary"}`),style:{width:`${y}%`}}),e.jsxs("span",{className:"nice-module-grid__progress-text",children:[y,"%"]})]})})}if(n.type==="rating"){const y=n.maxRating||5,S=Number(s)||0;return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...u,children:e.jsx("span",{className:"nice-module-grid__rating","aria-label":`${S} out of ${y} stars`,children:Array.from({length:y},(A,U)=>e.jsx("span",{className:an("nice-module-grid__star",U<S&&"nice-module-grid__star--filled"),children:e.jsx(P.oa,{name:"star",size:14})},U))})})}if(n.type==="link"&&n.linkTemplate){const y=n.linkTemplate.replace(/\{\{(\w+)\}\}/g,(S,A)=>String(Ze(i,A)??""));return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...u,children:e.jsx("a",{href:y,target:n.linkNewTab?"_blank":void 0,rel:n.linkNewTab?"noopener noreferrer":void 0,className:"nice-module-grid__link",children:yn(s,n,d)})})}if(n.type==="image"){const S={xs:24,sm:32,md:48,lg:64}[n.imageSize||"sm"];return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...u,children:s?e.jsx("img",{src:String(s),alt:"",className:"nice-module-grid__image",style:{width:S,height:S}}):e.jsx("div",{className:"nice-module-grid__image-placeholder",style:{width:S,height:S}})})}return n.type==="avatar"?e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...u,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:{textAlign:n.align},...u,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:{textAlign:n.align||"center"},...u,children:e.jsx("span",{className:an("nice-module-grid__boolean",!!s&&"nice-module-grid__boolean--true"),children:e.jsx(P.oa,{name:s?"check":"close",size:14})})}):e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...u,children:yn(s,n,d)})}function Kt({row:n,index:i,columns:a,primaryField:s,secondaryField:d,customRender:m,selected:g,onClick:u,locale:y="pl-PL",t:S}){if(m)return e.jsx("div",{className:an("nice-module-grid__mobile-card",g&&"nice-module-grid__mobile-card--selected"),onClick:u,children:m(n,i)});const A=a.find(w=>w.field===s)||a[0],U=a.find(w=>w.field===d)||a[1];return e.jsxs("div",{className:an("nice-module-grid__mobile-card",g&&"nice-module-grid__mobile-card--selected"),onClick:u,role:"row","aria-selected":g,children:[e.jsxs("div",{className:"nice-module-grid__mobile-card-header",children:[e.jsx("div",{className:"nice-module-grid__mobile-card-title",children:yn(Ze(n,A?.field||""),A,y)}),U&&e.jsx("div",{className:"nice-module-grid__mobile-card-subtitle",children:yn(Ze(n,U.field),U,y)})]}),e.jsx("div",{className:"nice-module-grid__mobile-card-body",children:a.filter(w=>!w.hidden&&w.field!==s&&w.field!==d).slice(0,4).map(w=>e.jsxs("div",{className:"nice-module-grid__mobile-card-field",children:[e.jsx("span",{className:"nice-module-grid__mobile-card-label",children:w.header}),e.jsx("span",{className:"nice-module-grid__mobile-card-value",children:yn(Ze(n,w.field),w,y)})]},w.field))})]})}function Vt({page:n,pageSize:i,totalRows:a,pageSizeOptions:s,onPageChange:d,t:m}){const g=Math.ceil(a/i),u=(n-1)*i+1,y=Math.min(n*i,a);return e.jsxs("div",{className:"nice-module-grid__pagination",role:"navigation","aria-label":m("pagination.ariaLabel","Pagination"),children:[e.jsxs("div",{className:"nice-module-grid__pagination-info",children:[m("pagination.showing","Showing")," ",u,"–",y," ",m("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:S=>d(1,Number(S.target.value)),"aria-label":m("pagination.rowsPerPage","Rows per page"),children:s.map(S=>e.jsx("option",{value:S,children:S},S))}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>d(1,i),disabled:n===1,"aria-label":m("pagination.first","First"),children:"««"}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>d(n-1,i),disabled:n===1,"aria-label":m("pagination.previous","Previous"),children:"«"}),e.jsxs("span",{className:"nice-module-grid__pagination-page",children:[n," / ",g]}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>d(n+1,i),disabled:n>=g,"aria-label":m("pagination.next","Next"),children:"»"}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>d(g,i),disabled:n>=g,"aria-label":m("pagination.last","Last"),children:"»»"})]})]})}function qt({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,data:s,keyField:d="id",dataSource:m,onFetch:g,sortable:u=!0,sort:y,onSortChange:S,multiSort:A=!1,filterable:U=!1,filter:w,onFilterChange:Y,searchText:Q,onSearchChange:E,searchPlaceholder:z="moduleGrid.searchPlaceholder",pagination:b=!0,page:x,pageSize:_,pageSizeOptions:v=Et,totalRows:C,onPageChange:T,virtualScroll:te=!0,rowHeight:ce=$t,overscan:oe=Tt,selectionMode:de="none",selectedKeys:ue,onSelectionChange:J,columnReorder:we=!0,onColumnOrderChange:O,columnResize:he=!0,onColumnWidthChange:ke,groupBy:B,onGroupByChange:xe,groupRowRender:V,expandAllGroups:h=!1,editable:f=!1,onCellEdit:l,onRowEdit:R,editMode:q="cell",contextMenuItems:N,onContextMenuAction:se,exportable:le=!0,exportFormats:re=["csv","excel"],onExport:G,preferencesKey:be,initialPreferences:Me,onPreferencesChange:Re,density:Te="normal",striped:Pe=!0,bordered:Ue=!1,hoverable:Ce=!0,loading:F=!1,emptyState:o,toolbar:ge,onRowClick:ee,onRowDoubleClick:k,rowClassName:$,rowStyle:H,mobileCardView:Ne=!0,mobileBreakpoint:De=Lt,mobileCardRender:fe,mobilePrimaryField:ie,mobileSecondaryField:Ge,moduleId:un,permissions:W,size:sn="medium",skeletonLoading:Ye=!0,skeletonRows:en=Ot,"aria-label":j,"aria-labelledby":X,"aria-describedby":pe,className:Fe,style:Ke,id:_e,testId:ze}=n,{t:je}=P.Gt();P.Dc(),P.rc("table");const Je=Ft(De),[Be,He]=Bt(be,Me),mn=t.useRef(null),vn=t.useRef(null),[jn,Sn]=t.useState([]),[Cn,Ln]=t.useState(),[Dn,Nn]=t.useState(""),[In,Ve]=t.useState(1),[Mn,An]=t.useState(_||Rt),[zn,hn]=t.useState(new Set),[rn,Rn]=t.useState([]),[r,c]=t.useState(0),[D,L]=t.useState(!1),[K,M]=t.useState(new Set),[I,Z]=t.useState(null),[ne,Ae]=t.useState({}),me=y??jn,Ee=w??Cn,Oe=Q??Dn,cn=x??In,nn=_??Mn,Xe=ue??zn,xn=C??r??s?.length??0,pn=!!(g||m),ln=t.useMemo(()=>{const p=new Set(Be.hiddenColumns||[]);return a.filter(ae=>!ae.hidden&&!p.has(ae.field))},[a,Be.hiddenColumns]),bn=t.useMemo(()=>{if(pn)return rn;if(!s)return[];let p=[...s];if(Oe){const ae=Oe.toLowerCase(),ye=a.filter(Se=>Se.searchable!==!1).map(Se=>Se.field);p=p.filter(Se=>ye.some(Qe=>{const on=Ze(Se,Qe);return String(on??"").toLowerCase().includes(ae)}))}return me.length>0&&p.sort((ae,ye)=>{for(const Se of me){const Qe=Ze(ae,Se.field),on=Ze(ye,Se.field),dn=Qe<on?-1:Qe>on?1:0;if(dn!==0)return Se.direction==="asc"?dn:-dn}return 0}),p},[pn,rn,s,Oe,me,a]),gn=t.useMemo(()=>{if(pn||!b)return bn;const p=(cn-1)*nn;return bn.slice(p,p+nn)},[pn,bn,b,cn,nn]),Xn=mn.current?.clientHeight||400,wn=te&&gn.length>Pt,{visibleData:Qn,totalHeight:Yn,offsetY:Jn,handleScroll:et,startIndex:En}=Ut(gn,Xn,ce,oe),fn=wn?Qn:gn,Pn=t.useCallback(async()=>{if(g){L(!0);try{const ae=await g({page:cn,pageSize:nn,sort:me,filter:Ee,search:Oe});Rn(ae.data),c(ae.total)}catch(p){console.error("NiceModuleGrid fetch error:",p)}finally{L(!1)}}},[g,cn,nn,me,Ee,Oe]);t.useEffect(()=>{pn&&Pn()},[pn,Pn]);const nt=t.useCallback(p=>{const ae=me.find(Se=>Se.field===p);let ye;ae?ae.direction==="asc"?ye=me.map(Se=>Se.field===p?{...Se,direction:"desc"}:Se):ye=me.filter(Se=>Se.field!==p):ye=A?[...me,{field:p,direction:"asc"}]:[{field:p,direction:"asc"}],S?S(ye):Sn(ye)},[me,A,S]),tt=t.useCallback((p,ae)=>{T?T(p,ae):(Ve(p),An(ae))},[T]),it=t.useCallback(p=>{E?E(p):Nn(p),T||Ve(1)},[E,T]),$n=t.useCallback((p,ae)=>{const ye=new Set(Xe);if(de==="single"?(ye.clear(),ye.add(p)):(de==="multiple"||de==="checkbox")&&(ye.has(p)?ye.delete(p):ye.add(p)),J){const Se=gn.filter(Qe=>ye.has(String(Ze(Qe,d))));J(ye,Se)}else hn(ye)},[Xe,de,J,gn,d]),at=t.useCallback((p,ae)=>{Ae(ye=>({...ye,[p]:ae})),ke?.(p,ae),He({columnWidths:{...Be.columnWidths,[p]:ae}})},[ke,He,Be.columnWidths]),st=t.useCallback((p,ae)=>{N?.length&&(p.preventDefault(),Z({x:p.clientX,y:p.clientY,row:ae}))},[N]),rt=t.useCallback(p=>{I&&se?.(p,I.row),Z(null)},[I,se]),ct=t.useCallback(async p=>{if(G)await G(p,{selectedOnly:Xe.size>0,columns:ln.map(ae=>ae.field)});else if(p==="csv"){const ae=ln.map(qe=>qe.header).join(","),ye=gn.map(qe=>ln.map(dt=>JSON.stringify(Ze(qe,dt.field)??"")).join(",")),Se=[ae,...ye].join(`
|
|
6
|
+
`),Qe=new Blob([Se],{type:"text/csv;charset=utf-8;"}),on=URL.createObjectURL(Qe),dn=document.createElement("a");dn.href=on,dn.download=`export-${new Date().toISOString().slice(0,10)}.csv`,dn.click(),URL.revokeObjectURL(on)}},[G,Xe,ln,gn,je]);t.useEffect(()=>{if(!I)return;const p=()=>Z(null);return document.addEventListener("click",p),()=>document.removeEventListener("click",p)},[I]);const lt=t.useCallback(p=>{p.key==="Escape"&&Z(null)},[]),_n=F||D,On=!_n&&fn.length===0,Un=Je&&Ne,ot=an("nice-module-grid",`nice-module-grid--${Te}`,`nice-module-grid--${sn}`,Pe&&"nice-module-grid--striped",Ue&&"nice-module-grid--bordered",Ce&&"nice-module-grid--hoverable",_n&&"nice-module-grid--loading",Un&&"nice-module-grid--mobile",Fe);return e.jsxs("div",{ref:i,id:_e,"data-testid":ze,className:ot,style:Ke,onKeyDown:lt,role:"grid","aria-label":j,"aria-labelledby":X,"aria-describedby":pe,"aria-rowcount":xn,"aria-colcount":ln.length,"aria-busy":_n,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:z,value:Oe,onChange:p=>it(p.target.value),"aria-label":je("moduleGrid.searchAriaLabel","Search")})}),ge,le&&e.jsx("div",{className:"nice-module-grid__toolbar-export",children:re.map(p=>e.jsx("button",{className:"nice-module-grid__export-btn",onClick:()=>ct(p),"aria-label":je(`moduleGrid.export.${p}`,`Export to ${p.toUpperCase()}`),children:p.toUpperCase()},p))})]}),e.jsx("div",{ref:mn,className:"nice-module-grid__container",onScroll:wn?et:void 0,children:Un?e.jsx("div",{className:"nice-module-grid__mobile-list",children:_n&&Ye?Array.from({length:en},(p,ae)=>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}})]},ae)):On?e.jsxs("div",{className:"nice-module-grid__empty",children:[o?.icon&&e.jsx("div",{className:"nice-module-grid__empty-icon",children:o.icon}),e.jsx("div",{className:"nice-module-grid__empty-title",children:o?.title||je("moduleGrid.noData","No data")}),o?.description&&e.jsx("div",{className:"nice-module-grid__empty-description",children:o.description}),o?.action&&e.jsxs("button",{className:"nice-module-grid__empty-action",onClick:o.action.onClick,children:[o.action.icon,o.action.label]})]}):fn.map((p,ae)=>{const ye=String(Ze(p,d));return e.jsx(Kt,{row:p,index:En+ae,columns:ln,primaryField:ie,secondaryField:Ge,customRender:fe,selected:Xe.has(ye),onClick:()=>{de!=="none"&&$n(ye,p),ee?.(p,En+ae)},t:je},ye)})}):e.jsxs("div",{ref:vn,className:"nice-module-grid__table",children:[e.jsxs("div",{className:"nice-module-grid__header",role:"row",children:[de==="checkbox"&&e.jsx("div",{className:"nice-module-grid__header-cell nice-module-grid__header-cell--checkbox",children:e.jsx("input",{type:"checkbox",checked:Xe.size>0&&Xe.size===fn.length,onChange:()=>{if(Xe.size===fn.length)J?.(new Set,[]),hn(new Set);else{const p=new Set(fn.map(ae=>String(Ze(ae,d))));J?.(p,fn),hn(p)}},"aria-label":je("moduleGrid.selectAll","Select all")})}),ln.map(p=>e.jsx(Gt,{column:{...p,width:ne[p.field]||p.width},sort:me.find(ae=>ae.field===p.field),onSort:u?nt:void 0,onResize:he?at:void 0,resizable:he,t:je},p.field))]}),e.jsx("div",{className:"nice-module-grid__body",style:wn?{height:Yn,position:"relative"}:void 0,children:_n&&Ye?Array.from({length:en},(p,ae)=>e.jsx(qt,{columns:ln},ae)):On?e.jsxs("div",{className:"nice-module-grid__empty",children:[o?.icon&&e.jsx("div",{className:"nice-module-grid__empty-icon",children:o.icon}),e.jsx("div",{className:"nice-module-grid__empty-title",children:o?.title||je("moduleGrid.noData","No data")}),o?.description&&e.jsx("div",{className:"nice-module-grid__empty-description",children:o.description}),o?.action&&e.jsxs("button",{className:"nice-module-grid__empty-action",onClick:o.action.onClick,children:[o.action.icon,o.action.label]})]}):e.jsx("div",{style:wn?{transform:`translateY(${Jn}px)`}:void 0,children:fn.map((p,ae)=>{const ye=String(Ze(p,d)),Se=En+ae,Qe=Xe.has(ye),on=typeof $=="function"?$(p,Se):$,dn=typeof H=="function"?H(p,Se):H;return e.jsxs("div",{className:an("nice-module-grid__row",Qe&&"nice-module-grid__row--selected",on),style:{...dn,height:ce},role:"row","aria-rowindex":Se+1,"aria-selected":Qe,onClick:()=>{de!=="none"&&$n(ye,p),ee?.(p,Se)},onDoubleClick:()=>k?.(p,Se),onContextMenu:qe=>st(qe,p),children:[de==="checkbox"&&e.jsx("div",{className:"nice-module-grid__cell nice-module-grid__cell--checkbox",children:e.jsx("input",{type:"checkbox",checked:Qe,onChange:()=>$n(ye,p),onClick:qe=>qe.stopPropagation(),"aria-label":je("moduleGrid.selectRow","Select row")})}),ln.map(qe=>e.jsx(Wt,{column:{...qe,width:ne[qe.field]||qe.width},row:p,rowIndex:Se,value:Ze(p,qe.field)},qe.field))]},ye)})})})]})}),b&&xn>0&&e.jsx(Vt,{page:cn,pageSize:nn,totalRows:pn?r:bn.length,pageSizeOptions:v,onPageChange:tt,t:je}),I&&N&&e.jsx("div",{className:"nice-module-grid__context-menu",style:{left:I.x,top:I.y},role:"menu",children:N.filter(p=>typeof p.hidden=="function"?!p.hidden(I.row):!p.hidden).map(p=>{if(p.divider)return e.jsx("div",{className:"nice-module-grid__context-menu-divider"},p.key);const ae=typeof p.disabled=="function"?p.disabled(I.row):p.disabled;return e.jsxs("button",{className:an("nice-module-grid__context-menu-item",p.danger&&"nice-module-grid__context-menu-item--danger",ae&&"nice-module-grid__context-menu-item--disabled"),onClick:()=>{ae||(p.onClick?.(I.row),rt(p.key))},disabled:ae,role:"menuitem",children:[p.icon&&e.jsx("span",{className:"nice-module-grid__context-menu-icon",children:p.icon}),p.label]},p.key)})}),_n&&!Ye&&e.jsx("div",{className:"nice-module-grid__loading-overlay",children:e.jsx("div",{className:"nice-module-grid__spinner","aria-label":je("moduleGrid.loading","Loading")})})]})}const Ht=t.forwardRef(Zt),We={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},Xt=()=>e.jsxs("svg",{...We,children:[e.jsx("path",{d:"M3 7v6h6"}),e.jsx("path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13"})]}),Qt=()=>e.jsxs("svg",{...We,children:[e.jsx("path",{d:"M21 7v6h-6"}),e.jsx("path",{d:"M3 17a9 9 0 0 1 15-6.7L21 13"})]}),Yt=()=>e.jsxs("svg",{...We,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"})]}),Jt=()=>e.jsxs("svg",{...We,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"})]}),ei=()=>e.jsxs("svg",{...We,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"})]}),ni=()=>e.jsxs("svg",{...We,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"})]}),ti=()=>e.jsxs("svg",{...We,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"})]}),ii=()=>e.jsxs("svg",{...We,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"})]}),ai=()=>e.jsxs("svg",{...We,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"})]}),si=()=>e.jsx("svg",{...We,children:e.jsx("polyline",{points:"6 9 12 4 18 9"})}),ri=()=>e.jsx("svg",{...We,children:e.jsx("polyline",{points:"6 15 12 20 18 15"})}),ci=()=>e.jsxs("svg",{...We,style:{opacity:.55},children:[e.jsx("polyline",{points:"6 9 12 4 18 9"}),e.jsx("polyline",{points:"6 15 12 20 18 15"})]}),li=()=>e.jsxs("svg",{...We,children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),oi=()=>e.jsxs("svg",{...We,children:[e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),e.jsx("line",{x1:"6",y1:"18",x2:"18",y2:"6"})]});function Zn(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`${Zn(i)}${n+1}`}function Le(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 di(n,i,a=new Set){const s=n.startsWith("=")?n.slice(1).trim():n,d=(z,b)=>{if(!z||!b)return[];const x=[];for(let _=z.row;_<=b.row;_++)for(let v=z.col;v<=b.col;v++){const C=$e(ve(_,v),i,new Set(a));typeof C=="number"&&x.push(C)}return x},m=(z,b)=>{if(!z||!b)return[];const x=[];for(let _=z.row;_<=b.row;_++)for(let v=z.col;v<=b.col;v++)x.push($e(ve(_,v),i,new Set(a)));return x},g=s.match(/^(\w+)\(([A-Z]+\d+):([A-Z]+\d+)\)$/i);if(g){const z=g[1].toUpperCase(),b=Le(g[2].toUpperCase()),x=Le(g[3].toUpperCase());switch(z){case"SUM":return d(b,x).reduce((v,C)=>v+C,0);case"AVG":case"AVERAGE":{const _=d(b,x);return _.length>0?_.reduce((v,C)=>v+C,0)/_.length:0}case"COUNT":return d(b,x).length;case"COUNTA":return m(b,x).filter(_=>_!==null&&_!=="").length;case"COUNTBLANK":return m(b,x).filter(_=>_===null||_==="").length;case"MIN":{const _=d(b,x);return _.length?Math.min(..._):0}case"MAX":{const _=d(b,x);return _.length?Math.max(..._):0}case"MEDIAN":{const _=d(b,x).sort((C,T)=>C-T);if(!_.length)return 0;const v=Math.floor(_.length/2);return _.length%2?_[v]:(_[v-1]+_[v])/2}case"STDEV":{const _=d(b,x);if(_.length<2)return 0;const v=_.reduce((C,T)=>C+T,0)/_.length;return Math.sqrt(_.reduce((C,T)=>C+(T-v)**2,0)/(_.length-1))}case"PRODUCT":{const _=d(b,x);return _.length?_.reduce((v,C)=>v*C,1):0}}}const u=s.match(/^(SUMIF|COUNTIF)\(([A-Z]+\d+):([A-Z]+\d+)\s*,\s*"?([^"]*)"?\)$/i);if(u){const z=u[1].toUpperCase(),b=Le(u[2].toUpperCase()),x=Le(u[3].toUpperCase()),_=u[4];if(b&&x){let v=0;for(let C=b.row;C<=x.row;C++)for(let T=b.col;T<=x.col;T++){const te=$e(ve(C,T),i,new Set(a));(_.startsWith(">")?Number(te)>Number(_.slice(1)):_.startsWith("<")?Number(te)<Number(_.slice(1)):String(te)===_||typeof te=="number"&&te===Number(_))&&(v+=z==="SUMIF"?typeof te=="number"?te:0:1)}return v}}const y=s.match(/^IF\(([^,]+),\s*([^,]+),\s*([^)]+)\)$/i);if(y){const z=y[1].trim(),b=y[2].trim(),x=y[3].trim(),_=z.match(/^([A-Z]+\d+)\s*([><=!]+)\s*(\S+)$/i);let v=!1;if(_){const te=$e(_[1].toUpperCase(),i,new Set(a)),ce=isNaN(Number(_[3]))?_[3].replace(/^"|"$/g,""):Number(_[3]),oe=_[2],de=typeof te=="number"?te:Number(te)||0,ue=typeof ce=="number"?ce:Number(ce)||0;switch(oe){case">":v=de>ue;break;case"<":v=de<ue;break;case">=":v=de>=ue;break;case"<=":v=de<=ue;break;case"=":case"==":v=de===ue;break;case"<>":case"!=":v=de!==ue;break}}const C=v?b:x;if(Le(C.toUpperCase()))return $e(C.toUpperCase(),i,new Set(a));const T=Number(C);return isNaN(T)?C.replace(/^"|"$/g,""):T}const S=s.match(/^CONCAT\((.+)\)$/i);if(S)return S[1].split(",").map(b=>b.trim()).map(b=>{if(b.startsWith('"')&&b.endsWith('"'))return b.slice(1,-1);if(Le(b.toUpperCase())){const _=$e(b.toUpperCase(),i,new Set(a));return _!==null?String(_):""}return b}).join("");const A=s.match(/^VLOOKUP\(([^,]+),\s*([A-Z]+\d+):([A-Z]+\d+),\s*(\d+)\)$/i);if(A){let z;Le(A[1].trim().toUpperCase())?z=$e(A[1].trim().toUpperCase(),i,new Set(a)):z=isNaN(Number(A[1]))?A[1].replace(/^"|"$/g,""):Number(A[1]);const x=Le(A[2].toUpperCase()),_=Le(A[3].toUpperCase()),v=parseInt(A[4])-1;if(x&&_)for(let C=x.row;C<=_.row;C++){const T=$e(ve(C,x.col),i,new Set(a));if(String(T)===String(z))return $e(ve(C,x.col+v),i,new Set(a))}return null}const U=s.match(/^(ABS|ROUND|FLOOR|CEIL|CEILING|SQRT|LEN|UPPER|LOWER|TRIM|INT)\(([^)]+)\)$/i);if(U){const z=U[1].toUpperCase(),b=U[2].trim();let x;switch(Le(b.toUpperCase())?x=$e(b.toUpperCase(),i,new Set(a)):x=isNaN(Number(b))?b.replace(/^"|"$/g,""):Number(b),z){case"ABS":return Math.abs(Number(x)||0);case"ROUND":return Math.round(Number(x)||0);case"FLOOR":return Math.floor(Number(x)||0);case"CEIL":case"CEILING":return Math.ceil(Number(x)||0);case"SQRT":return Math.sqrt(Number(x)||0);case"INT":return Math.trunc(Number(x)||0);case"LEN":return String(x??"").length;case"UPPER":return String(x??"").toUpperCase();case"LOWER":return String(x??"").toLowerCase();case"TRIM":return String(x??"").trim()}}const w=s.match(/^POWER\(([^,]+),\s*([^)]+)\)$/i);if(w){const z=Number(Le(w[1].trim().toUpperCase())?$e(w[1].trim().toUpperCase(),i,new Set(a)):w[1].trim())||0,b=Number(Le(w[2].trim().toUpperCase())?$e(w[2].trim().toUpperCase(),i,new Set(a)):w[2].trim())||0;return Math.pow(z,b)}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 Y=s.match(/^([A-Z]+\d+)$/i);if(Y)return $e(Y[1].toUpperCase(),i,a);const Q=s.match(/^([A-Z]+\d+)\s*([+\-*/])\s*([A-Z]+\d+|\d+\.?\d*)$/i);if(Q){const z=Q[1].toUpperCase(),b=Q[2],x=Q[3],_=$e(z,i,a),C=Le(x.toUpperCase())?$e(x.toUpperCase(),i,a):parseFloat(x),T=typeof _=="number"?_:0,te=typeof C=="number"?C:0;switch(b){case"+":return T+te;case"-":return T-te;case"*":return T*te;case"/":return te!==0?T/te:null}}const E=parseFloat(s);return isNaN(E)?s:E}function $e(n,i,a){if(a.has(n))return null;a.add(n);const s=i[n];return s?s.formula?di(s.formula,i,a):s.value:null}function Fn(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 Gn(n){return{name:n,data:{}}}const Hn=t.forwardRef(({sheets:n,activeSheet:i,rows:a=50,cols:s=26,showToolbar:d=!0,showFormulaBar:m=!0,showSheetTabs:g=!0,readOnly:u=!1,disabled:y=!1,loading:S=!1,error:A,size:U="md",onChange:w,onActiveSheetChange:Y,onCellSelect:Q,onCopy:E,onPaste:z,onInsert:b,onRemove:x,maxUndo:_=50,sortable:v=!1,filterable:C=!1,rangeSelection:T=!0,className:te,style:ce,id:oe,...de},ue)=>{const J=u||y,we=P.bc(oe),{t:O}=P.Gt(),[he,ke]=t.useState(()=>n??[Gn(O("spreadsheet.sheet","Sheet")+" 1")]),[B,xe]=t.useState(0),V=n??he,h=i??B,f=V[h]??V[0],[l,R]=t.useState(null),[q,N]=t.useState(null),[se,le]=t.useState(!1),[re,G]=t.useState(null),[be,Me]=t.useState(""),Re=t.useRef(null),Te=t.useRef(null),[Pe,Ue]=t.useState([]),[Ce,F]=t.useState([]),[o,ge]=t.useState(null),ee=t.useRef({x:0,width:80}),[k,$]=t.useState(null),[H,Ne]=t.useState(null),[De,fe]=t.useState("");t.useEffect(()=>{re&&Re.current&&Re.current.focus()},[re]);const ie=t.useMemo(()=>{if(!l)return null;const r=q??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,q]),Ge=t.useCallback((r,c)=>ie?r>=ie.startRow&&r<=ie.endRow&&c>=ie.startCol&&c<=ie.endCol:!1,[ie]),un=t.useCallback(r=>{Ue(c=>{const D=[...c,r.map(L=>({...L,data:{...L.data}}))];return D.length>_?D.slice(-_):D}),F([])},[_]),W=t.useCallback((r,c=!0)=>{c&&un(V);const D=r(V);n||ke(D),w?.(D)},[V,n,w,un]),sn=t.useCallback(()=>{if(Pe.length===0)return;const r=Pe[Pe.length-1];F(c=>[...c,V.map(D=>({...D,data:{...D.data}}))]),Ue(c=>c.slice(0,-1)),n||ke(r),w?.(r)},[Pe,V,n,w]),Ye=t.useCallback(()=>{if(Ce.length===0)return;const r=Ce[Ce.length-1];Ue(c=>[...c,V.map(D=>({...D,data:{...D.data}}))]),F(c=>c.slice(0,-1)),n||ke(r),w?.(r)},[Ce,V,n,w]),en=t.useCallback(r=>{i||xe(r),Y?.(r),R(null),N(null),G(null)},[i,Y]),j=t.useCallback((r,c,D)=>{const L=ve(r,c);W(K=>{const M=K.map((Z,ne)=>ne===h?{...Z,data:{...Z.data}}:Z),I=D.startsWith("=");return M[h].data[L]={...M[h].data[L]??{value:null},formula:I?D:void 0,value:I?null:isNaN(Number(D))?D:Number(D)},M})},[h,W]),X=t.useCallback((r,c,D)=>{D?.shiftKey&&T&&l?N({row:r,col:c}):(R({row:r,col:c}),N(null)),G(null),Q?.(h,r,c)},[h,Q,T,l]),pe=t.useCallback((r,c,D)=>{D.button===0&&(X(r,c,D),T&&!D.shiftKey&&le(!0))},[X,T]),Fe=t.useCallback((r,c)=>{se&&N({row:r,col:c})},[se]);t.useEffect(()=>{if(!se)return;const r=()=>le(!1);return document.addEventListener("mouseup",r),()=>document.removeEventListener("mouseup",r)},[se]);const Ke=t.useCallback((r,c)=>{if(J)return;const D=ve(r,c),L=f.data[D];L?.readOnly||(G({row:r,col:c}),Me(L?.formula??(L?.value!=null?String(L.value):"")))},[J,f.data]),_e=t.useCallback(()=>{re&&(j(re.row,re.col,be),G(null))},[re,be,j]),ze=t.useCallback(r=>{if(r.key==="Enter")_e();else if(r.key==="Escape")G(null);else if(r.key==="Tab"&&(r.preventDefault(),_e(),l)){const c=r.shiftKey?Math.max(0,l.col-1):Math.min(s-1,l.col+1);R({row:l.row,col:c})}},[_e,l,s]),je=t.useCallback((r,c)=>{if(!l)return;const D=ie??{startRow:l.row,startCol:l.col,endRow:l.row,endCol:l.col};W(L=>{const K=L.map((M,I)=>I===h?{...M,data:{...M.data}}:M);for(let M=D.startRow;M<=D.endRow;M++)for(let I=D.startCol;I<=D.endCol;I++){const Z=ve(M,I);K[h].data[Z]={...K[h].data[Z]??{value:null},[r]:c}}return K})},[l,ie,h,W]),Je=t.useCallback(r=>{if(!ie||E?.(ie)===!1)return;const{startRow:c,startCol:D,endRow:L,endCol:K}=ie,M=[];for(let I=c;I<=L;I++){const Z=[];for(let ne=D;ne<=K;ne++){const Ae=ve(I,ne),me=f.data[Ae],Ee=me?$e(Ae,f.data,new Set):null;Z.push(Fn(Ee,me?.format))}M.push(Z.join(" "))}r.clipboardData.setData("text/plain",M.join(`
|
|
7
|
+
`)),r.preventDefault()},[ie,f.data,E]),Be=t.useCallback(r=>{if(J||!l)return;const c=r.clipboardData.getData("text/plain");if(!c)return;const D=c.split(`
|
|
8
|
+
`).map(L=>L.split(" "));z?.(D,l.row,l.col)!==!1&&(W(L=>{const K=L.map((M,I)=>I===h?{...M,data:{...M.data}}:M);return D.forEach((M,I)=>{M.forEach((Z,ne)=>{const Ae=ve(l.row+I,l.col+ne),me=Z.startsWith("=");K[h].data[Ae]={...K[h].data[Ae]??{value:null},formula:me?Z:void 0,value:me?null:isNaN(Number(Z))?Z:Number(Z)}})}),K}),r.preventDefault())},[J,l,h,W,z]),He=t.useCallback(r=>{W(c=>c.map((L,K)=>{if(K!==h)return L;const M={};for(const[I,Z]of Object.entries(L.data)){const ne=Le(I);ne&&(ne.row>r?M[ve(ne.row+1,ne.col)]=Z:M[I]=Z)}return{...L,data:M}})),b?.("row",r)},[h,W,b]),mn=t.useCallback(r=>{W(c=>c.map((L,K)=>{if(K!==h)return L;const M={};for(const[I,Z]of Object.entries(L.data)){const ne=Le(I);ne&&(ne.col>r?M[ve(ne.row,ne.col+1)]=Z:M[I]=Z)}return{...L,data:M}})),b?.("column",r)},[h,W,b]),vn=t.useCallback(r=>{W(c=>c.map((L,K)=>{if(K!==h)return L;const M={};for(const[I,Z]of Object.entries(L.data)){const ne=Le(I);ne&&ne.row!==r&&(ne.row>r?M[ve(ne.row-1,ne.col)]=Z:M[I]=Z)}return{...L,data:M}})),x?.("row",r)},[h,W,x]),jn=t.useCallback(r=>{W(c=>c.map((L,K)=>{if(K!==h)return L;const M={};for(const[I,Z]of Object.entries(L.data)){const ne=Le(I);ne&&ne.col!==r&&(ne.col>r?M[ve(ne.row,ne.col-1)]=Z:M[I]=Z)}return{...L,data:M}})),x?.("column",r)},[h,W,x]),Sn=t.useCallback((r,c)=>{W(D=>D.map((K,M)=>{if(M!==h)return K;const I=new Map;for(const[Ae,me]of Object.entries(K.data)){const Ee=Le(Ae);Ee&&(I.has(Ee.row)||I.set(Ee.row,{}),I.get(Ee.row)[Ee.col]=me)}const Z=Array.from(I.entries()).sort((Ae,me)=>{const Ee=$e(ve(Ae[0],r),K.data,new Set),Oe=$e(ve(me[0],r),K.data,new Set),cn=typeof Ee=="number"?Ee:Number(Ee),nn=typeof Oe=="number"?Oe:Number(Oe);if(!isNaN(cn)&&!isNaN(nn))return c==="asc"?cn-nn:nn-cn;const Xe=String(Ee??""),xn=String(Oe??"");return c==="asc"?Xe.localeCompare(xn):xn.localeCompare(Xe)}),ne={};return Z.forEach(([,Ae],me)=>{for(const[Ee,Oe]of Object.entries(Ae))ne[ve(me,Number(Ee))]=Oe}),{...K,data:ne,sortColumn:r,sortDirection:c}}))},[h,W]),Cn=t.useCallback((r,c)=>{const D=f.conditionalFormats;if(!D?.length)return;const L=ve(r,c),K=$e(L,f.data,new Set),M=typeof K=="number"?K:Number(K);for(const I of D){const Z=I.range.match(/^([A-Z]+\d+):([A-Z]+\d+)$/i);if(!Z)continue;const ne=Le(Z[1].toUpperCase()),Ae=Le(Z[2].toUpperCase());if(!ne||!Ae||r<ne.row||r>Ae.row||c<ne.col||c>Ae.col)continue;let me=!1;switch(I.type){case"greaterThan":me=!isNaN(M)&&M>Number(I.value);break;case"lessThan":me=!isNaN(M)&&M<Number(I.value);break;case"equalTo":me=String(K)===String(I.value);break;case"between":me=!isNaN(M)&&M>=Number(I.value)&&M<=Number(I.value2);break;case"textContains":me=String(K).includes(String(I.value));break;case"isEmpty":me=K===null||K==="";break;case"isNotEmpty":me=K!==null&&K!=="";break}if(me)return{backgroundColor:I.style.bgColor,color:I.style.color,fontWeight:I.style.bold?"bold":void 0,fontStyle:I.style.italic?"italic":void 0}}},[f.conditionalFormats,f.data]),Ln=t.useCallback(()=>{const r=`${O("spreadsheet.sheet","Sheet")} ${V.length+1}`;W(c=>[...c,Gn(r)]),en(V.length)},[V.length,W,en,O]),Dn=t.useCallback(()=>{V.length<=1||(W(r=>r.filter((c,D)=>D!==h)),en(Math.max(0,h-1)))},[V.length,h,W,en]),Nn=t.useCallback((r,c)=>{c.trim()&&(W(D=>D.map((L,K)=>K===r?{...L,name:c.trim()}:L),!1),Ne(null))},[W]),In=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]),Ve=t.useMemo(()=>{if(!ie)return null;const{startRow:r,startCol:c,endRow:D,endCol:L}=ie;if(r===D&&c===L)return null;const K=[];let M=0;for(let I=r;I<=D;I++)for(let Z=c;Z<=L;Z++){const ne=ve(I,Z),Ae=$e(ne,f.data,new Set);Ae!==null&&Ae!==""&&M++,typeof Ae=="number"&&K.push(Ae)}return K.length===0?{count:M}:{count:M,sum:K.reduce((I,Z)=>I+Z,0),avg:K.reduce((I,Z)=>I+Z,0)/K.length,min:Math.min(...K),max:Math.max(...K)}},[ie,f.data]),Mn=t.useCallback((r,c)=>{c.preventDefault(),c.stopPropagation(),ge(r),ee.current={x:c.clientX,width:f.colWidths?.[r]??80}},[f.colWidths]);t.useEffect(()=>{if(o===null)return;const r=D=>{const L=D.clientX-ee.current.x,K=Math.max(30,ee.current.width+L);W(M=>M.map((Z,ne)=>ne===h?{...Z,colWidths:{...Z.colWidths,[o]:K}}:Z),!1)},c=()=>ge(null);return document.addEventListener("mousemove",r),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",c)}},[o,h,W]);const An=t.useCallback((r,c,D)=>{r.preventDefault(),R({row:c,col:D}),$({x:r.clientX,y:r.clientY})},[]);t.useEffect(()=>{if(!k)return;const r=()=>$(null);return document.addEventListener("click",r),()=>document.removeEventListener("click",r)},[k]);const zn=t.useCallback(r=>{if((r.ctrlKey||r.metaKey)&&!re){if(r.key==="z"){r.preventDefault(),sn();return}if(r.key==="y"){r.preventDefault(),Ye();return}}if(re||!l)return;let{row:c,col:D}=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":D=Math.max(0,D-1);break;case"ArrowRight":D=Math.min(s-1,D+1);break;case"Enter":Ke(c,D);return;case"Delete":case"Backspace":J||(ie&&(ie.startRow!==ie.endRow||ie.startCol!==ie.endCol)?W(L=>{const K=L.map((M,I)=>I===h?{...M,data:{...M.data}}:M);for(let M=ie.startRow;M<=ie.endRow;M++)for(let I=ie.startCol;I<=ie.endCol;I++)delete K[h].data[ve(M,I)];return K}):j(c,D,""));return;default:if(r.key.length===1&&!r.ctrlKey&&!r.metaKey&&!J){G({row:c,col:D}),Me(r.key);return}return}r.preventDefault(),r.shiftKey&&T?N({row:c,col:D}):(R({row:c,col:D}),N(null)),Q?.(h,c,D)},[re,l,a,s,J,Ke,j,h,Q,sn,Ye,ie,W,T]),hn=f.frozenRows??0,rn=f.frozenCols??0,Rn=[{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:ue,id:we,className:`nice-spreadsheet nice-spreadsheet--${U} ${u&&!y?"nice-spreadsheet--readonly":""} ${y?"nice-spreadsheet--disabled":""} ${S?"nice-spreadsheet--loading":""} ${A?"nice-spreadsheet--error":""} ${te??""}`,style:{...ce,position:S?"relative":ce?.position},onKeyDown:zn,onCopy:Je,onPaste:Be,tabIndex:y?-1:0,role:"application","aria-label":O("spreadsheet.label","Spreadsheet"),"aria-disabled":y||void 0,"aria-busy":S||void 0,...de,children:[A&&e.jsx("div",{className:"nice-spreadsheet__error",role:"alert",children:A}),S&&e.jsx("span",{className:"nice-spreadsheet__spinner","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),d&&!J&&e.jsxs("div",{className:"nice-spreadsheet__toolbar",role:"toolbar",children:[e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:sn,disabled:Pe.length===0,title:O("spreadsheet.undo","Undo"),children:e.jsx(Xt,{})}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:Ye,disabled:Ce.length===0,title:O("spreadsheet.redo","Redo"),children:e.jsx(Qt,{})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Ie.NiceButton,{variant:f.data[l?ve(l.row,l.col):""]?.bold?"primary":"ghost",size:"sm",onClick:()=>je("bold",!f.data[l?ve(l.row,l.col):""]?.bold),title:O("spreadsheet.bold","Bold"),children:e.jsx("strong",{children:"B"})}),e.jsx(Ie.NiceButton,{variant:f.data[l?ve(l.row,l.col):""]?.italic?"primary":"ghost",size:"sm",onClick:()=>je("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(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>je("align","left"),title:O("spreadsheet.alignLeft","Align left"),children:e.jsx(Yt,{})}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>je("align","center"),title:O("spreadsheet.alignCenter","Center"),children:e.jsx(Jt,{})}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>je("align","right"),title:O("spreadsheet.alignRight","Align right"),children:e.jsx(ei,{})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Ie.NiceColorPicker,{value:f.data[l?ve(l.row,l.col):""]?.bgColor??"var(--nice-bg-primary, #ffffff)",onChange:r=>je("bgColor",r),title:O("spreadsheet.bgColor","Background color"),showInput:!1,showRandom:!1}),e.jsx(Ie.NiceColorPicker,{value:f.data[l?ve(l.row,l.col):""]?.color??"var(--nice-text-primary, #000000)",onChange:r=>je("color",r),title:O("spreadsheet.textColor","Text color"),showInput:!1,showRandom:!1}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(gt.NiceSelect,{size:"sm",value:f.data[l?ve(l.row,l.col):""]?.format??"text",onChange:r=>je("format",r),options:Rn,"aria-label":O("spreadsheet.format","Cell format")}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&He(l.row),title:O("spreadsheet.insertRow","Insert row"),children:e.jsx(ni,{})}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&mn(l.col),title:O("spreadsheet.insertCol","Insert column"),children:e.jsx(ti,{})}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&vn(l.row),title:O("spreadsheet.deleteRow","Delete row"),children:e.jsx(ii,{})}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&jn(l.col),title:O("spreadsheet.deleteCol","Delete column"),children:e.jsx(ai,{})})]}),m&&e.jsxs("div",{className:"nice-spreadsheet__formula-bar",children:[e.jsxs("span",{className:"nice-spreadsheet__cell-label",children:[l?ve(l.row,l.col):"",ie&&ie.startRow!==ie.endRow||ie&&ie.startCol!==ie.endCol?`:${ve(ie.endRow,ie.endCol)}`:""]}),e.jsx(Bn.NiceTextInput,{className:"nice-spreadsheet__formula-input",value:re?be:In,onChange:r=>{re?Me(r):l&&(G(l),Me(r))},onKeyDown:ze,readOnly:J,"aria-label":O("spreadsheet.formulaBar","Formula bar")})]}),e.jsx("div",{className:"nice-spreadsheet__grid",ref:Te,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:Zn(c)}),v&&e.jsx("span",{className:"nice-spreadsheet__sort-trigger",onClick:()=>Sn(c,f.sortColumn===c&&f.sortDirection==="asc"?"desc":"asc"),title:O("spreadsheet.sort","Sort"),children:f.sortColumn===c?f.sortDirection==="asc"?e.jsx(si,{}):e.jsx(ri,{}):e.jsx(ci,{})}),!J&&e.jsx("span",{className:"nice-spreadsheet__col-resize",onMouseDown:D=>Mn(c,D)})]},c))]})}),e.jsx("tbody",{children:Array.from({length:a},(r,c)=>e.jsxs("tr",{className:c<hn?"nice-spreadsheet__row--frozen":"",style:c<hn?{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},(D,L)=>{const K=ve(c,L),M=f.data[K];if(M?.mergedInto)return null;const I=l?.row===c&&l?.col===L,Z=Ge(c,L),ne=re?.row===c&&re?.col===L,Ae=M?$e(K,f.data,new Set):null,me=Cn(c,L),Ee=c<hn||L<rn;return e.jsxs("td",{className:`nice-spreadsheet__cell ${I?"nice-spreadsheet__cell--selected":""} ${Z&&!I?"nice-spreadsheet__cell--in-range":""} ${M?.readOnly?"nice-spreadsheet__cell--readonly":""} ${Ee?"nice-spreadsheet__cell--frozen":""}`,style:{textAlign:M?.align,fontWeight:M?.bold?"bold":void 0,fontStyle:M?.italic?"italic":void 0,backgroundColor:me?.backgroundColor??M?.bgColor,color:me?.color??M?.color,width:f.colWidths?.[L],height:f.rowHeights?.[c],position:Ee?"sticky":void 0,left:L<rn?L*80+40:void 0,zIndex:Ee?1:void 0,...me},colSpan:M?.colSpan,rowSpan:M?.rowSpan,onMouseDown:Oe=>pe(c,L,Oe),onMouseEnter:()=>Fe(c,L),onDoubleClick:()=>Ke(c,L),onContextMenu:Oe=>An(Oe,c,L),role:"gridcell","aria-selected":I,title:M?.comment,children:[M?.comment&&e.jsx("span",{className:"nice-spreadsheet__comment-indicator"}),ne?e.jsx("input",{ref:Re,className:"nice-spreadsheet__cell-editor",value:be,onChange:Oe=>Me(Oe.target.value),onKeyDown:ze,onBlur:_e}):Fn(Ae,M?.format)]},L)})]},c))})]})}),k&&!J&&l&&e.jsxs("div",{className:"nice-spreadsheet__context-menu",style:{position:"fixed",left:k.x,top:k.y,zIndex:1e3},children:[e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{He(l.row),$(null)},children:O("spreadsheet.insertRowAbove","Insert row above")}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{He(l.row+1),$(null)},children:O("spreadsheet.insertRowBelow","Insert row below")}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{mn(l.col),$(null)},children:O("spreadsheet.insertColLeft","Insert column left")}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{mn(l.col+1),$(null)},children:O("spreadsheet.insertColRight","Insert column right")}),e.jsx("hr",{className:"nice-spreadsheet__context-sep"}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{vn(l.row),$(null)},children:O("spreadsheet.deleteRow","Delete row")}),e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{jn(l.col),$(null)},children:O("spreadsheet.deleteCol","Delete column")})]}),Ve&&e.jsxs("div",{className:"nice-spreadsheet__status-bar",children:[e.jsxs("span",{children:[O("spreadsheet.count","Count"),": ",Ve.count]}),Ve.sum!==void 0&&e.jsxs("span",{children:[O("spreadsheet.sum","Sum"),": ",Ve.sum.toFixed(2)]}),Ve.avg!==void 0&&e.jsxs("span",{children:[O("spreadsheet.avg","Avg"),": ",Ve.avg.toFixed(2)]}),Ve.min!==void 0&&e.jsxs("span",{children:[O("spreadsheet.min","Min"),": ",Ve.min]}),Ve.max!==void 0&&e.jsxs("span",{children:[O("spreadsheet.max","Max"),": ",Ve.max]})]}),g&&e.jsxs("div",{className:"nice-spreadsheet__tabs",role:"tablist",children:[V.map((r,c)=>e.jsx("span",{className:"nice-spreadsheet__tab-wrapper",children:H===c?e.jsx(Bn.NiceTextInput,{className:"nice-spreadsheet__tab-rename",value:De,onChange:D=>fe(D),onBlur:()=>Nn(c,De),onKeyDown:D=>{D.key==="Enter"&&Nn(c,De),D.key==="Escape"&&Ne(null)},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>{J||(Ne(c),fe(r.name))},children:e.jsx(Ie.NiceButton,{variant:c===h?"primary":"ghost",size:"sm",onClick:()=>en(c),children:r.name})})},c)),!J&&e.jsxs(e.Fragment,{children:[e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:Ln,title:O("spreadsheet.addSheet","Add sheet"),children:e.jsx(li,{})}),V.length>1&&e.jsx(Ie.NiceButton,{variant:"ghost",size:"sm",onClick:Dn,title:O("spreadsheet.removeSheet","Remove sheet"),children:e.jsx(oi,{})})]})]})]})});Hn.displayName="NiceSpreadsheet";const ui=`
|
|
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-light, 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-light, rgba(16, 185, 129, 0.08));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.nice-reconciliation__row--partial {
|
|
173
|
+
background: var(--nice-warning-light, 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-disabled, #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-light, 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-light, 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-light, 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-light, 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-light, 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 tn(n,i="PLN",a="pl-PL"){return new Intl.NumberFormat(a,{style:"currency",currency:i,minimumFractionDigits:2,maximumFractionDigits:2}).format(n)}function kn(n,i="pl-PL"){return n?(typeof n=="string"?new Date(n):n).toLocaleDateString(i,{year:"numeric",month:"2-digit",day:"2-digit"}):"-"}function mi(n){return n>=80?"high":n>=50?"medium":"low"}function hi(){return`match-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function pi({item:n,isSelected:i,isDragging:a,isDropTarget:s,suggestion:d,currency:m,locale:g,onSelect:u,onDoubleClick:y,onDragStart:S,onDragEnd:A,onDrop:U,disabled:w}){const Y=n.status??"unmatched",Q=d?.confidence??n.confidence,E=b=>{b.dataTransfer.setData("text/plain",n.id),b.dataTransfer.setData("source","statement"),b.dataTransfer.effectAllowed="move",S()},z=b=>{b.dataTransfer.types.includes("source")&&b.dataTransfer.getData("source")!=="statement"&&b.preventDefault()};return e.jsxs("div",{className:`nice-reconciliation__row nice-reconciliation__row--${Y} ${i?"nice-reconciliation__row--selected":""} ${a?"nice-reconciliation__row--dragging":""} ${s?"nice-reconciliation__row--drop-target":""}`,draggable:!w&&Y!=="matched",onDragStart:E,onDragEnd:A,onDragOver:z,onDrop:U,onClick:u,onDoubleClick:y,role:"row","aria-selected":i,tabIndex:0,children:[e.jsx("span",{className:`nice-reconciliation__status nice-reconciliation__status--${Y}`}),e.jsxs("div",{className:"nice-reconciliation__row-main",children:[e.jsx("div",{className:"nice-reconciliation__row-date",children:kn(n.date,g)}),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})]}),Q!=null&&e.jsxs("span",{className:`nice-reconciliation__confidence nice-reconciliation__confidence--${mi(Q)}`,children:[Q,"%"]}),e.jsx("span",{className:`nice-reconciliation__row-amount ${n.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:tn(n.amount,m,g)})]})}function gi({item:n,isSelected:i,isDragging:a,isDropTarget:s,currency:d,locale:m,onSelect:g,onDoubleClick:u,onDragStart:y,onDragEnd:S,onDrop:A,disabled:U}){const w=n.status??"unmatched",Y=E=>{E.dataTransfer.setData("text/plain",n.id),E.dataTransfer.setData("source","entry"),E.dataTransfer.effectAllowed="move",y()},Q=E=>{E.dataTransfer.types.includes("source")&&E.dataTransfer.getData("source")!=="entry"&&E.preventDefault()};return e.jsxs("div",{className:`nice-reconciliation__row nice-reconciliation__row--${w} ${i?"nice-reconciliation__row--selected":""} ${a?"nice-reconciliation__row--dragging":""} ${s?"nice-reconciliation__row--drop-target":""}`,draggable:!U&&w!=="matched",onDragStart:Y,onDragEnd:S,onDragOver:Q,onDrop:A,onClick:g,onDoubleClick:u,role:"row","aria-selected":i,tabIndex:0,children:[e.jsx("span",{className:`nice-reconciliation__status nice-reconciliation__status--${w}`}),e.jsxs("div",{className:"nice-reconciliation__row-main",children:[e.jsxs("div",{className:"nice-reconciliation__row-date",children:[kn(n.date,m),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:tn(n.amount,d,m)})]})}const fi=t.forwardRef(function(i,a){const{statements:s,bankTransactions:d,entries:m,accountingEntries:g,matches:u,defaultMatches:y=[],suggestions:S=[],config:A={},currency:U,showConfidence:w,statementPanelConfig:Y,entryPanelConfig:Q,onMatch:E,onAutoMatch:z,onUnmatch:b,onBatchAction:x,onFilterChange:_,onRequestSuggestions:v,onSelectionChange:C,onComplete:T,size:te="medium",showToolbar:ce=!0,showFilters:oe=!0,showSummary:de=!0,showSuggestions:ue=!0,layout:J="horizontal",enableDragDrop:we=!0,enableKeyboard:O=!0,enableDetailPanel:he=!0,loading:ke=!1,disabled:B=!1,readOnly:xe=!1,locale:V="pl-PL",labels:h={},className:f,style:l}=i,R=s??d??[],q=m??g??[],N=U??A.currency??"PLN",[se,le]=t.useState(y),[re,G]=t.useState(new Set),[be,Me]=t.useState(new Set),[Re,Te]=t.useState(null),[Pe,Ue]=t.useState(null),[Ce,F]=t.useState({}),[o,ge]=t.useState(null),ee=u??se,k=t.useRef(null),$=t.useRef(null);t.useEffect(()=>{const j="nice-reconciliation-styles";if(!document.getElementById(j)){const X=document.createElement("style");X.id=j,X.textContent=ui,document.head.appendChild(X)}},[]);const H=t.useMemo(()=>{const j=new Set;return ee.forEach(X=>X.statementIds.forEach(pe=>j.add(pe))),j},[ee]),Ne=t.useMemo(()=>{const j=new Set;return ee.forEach(X=>X.entryIds.forEach(pe=>j.add(pe))),j},[ee]),De=t.useMemo(()=>{const j=R.filter(_e=>!H.has(_e.id)),X=q.filter(_e=>!Ne.has(_e.id)),pe=R.reduce((_e,ze)=>_e+ze.amount,0),Fe=q.reduce((_e,ze)=>_e+ze.amount,0),Ke=R.filter(_e=>H.has(_e.id)).reduce((_e,ze)=>_e+ze.amount,0);return{totalStatements:R.length,totalEntries:q.length,matchedStatements:R.length-j.length,matchedEntries:q.length-X.length,unmatchedStatements:j.length,unmatchedEntries:X.length,statementTotal:pe,entryTotal:Fe,matchedAmount:Ke,unmatchedStatementAmount:j.reduce((_e,ze)=>_e+ze.amount,0),unmatchedEntryAmount:X.reduce((_e,ze)=>_e+ze.amount,0),difference:pe-Fe,matchPercentage:R.length>0?Math.round((R.length-j.length)/R.length*100):0,matchCount:ee.length,partialMatchCount:ee.filter(_e=>_e.status==="partial").length,pendingSuggestions:S.length}},[R,q,ee,S,H,Ne]),fe=t.useCallback((j,X)=>{const pe=R.filter(Be=>j.includes(Be.id)),Fe=q.filter(Be=>X.includes(Be.id));if(pe.length===0||Fe.length===0)return null;const Ke=pe.reduce((Be,He)=>Be+He.amount,0),_e=Fe.reduce((Be,He)=>Be+He.amount,0),ze=Math.abs(Ke-_e),je=A.amountTolerance??.01,Je={id:hi(),statementIds:j,entryIds:X,status:ze<=je?"matched":"partial",statementTotal:Ke,entryTotal:_e,difference:ze,confidence:ze<=je?100:Math.max(0,100-ze/Math.max(Math.abs(Ke),1)*100),matchedBy:"user",matchedAt:new Date};return u||le(Be=>[...Be,Je]),E?.(Je,pe,Fe),G(new Set),Me(new Set),Je},[R,q,A.amountTolerance,u,E]),ie=t.useCallback(j=>{const X=ee.find(pe=>pe.id===j);X&&(u||le(pe=>pe.filter(Fe=>Fe.id!==j)),b?.(j,X.statementIds,X.entryIds))},[ee,u,b]),Ge=t.useCallback(async()=>{const j=[],X=new Set(H),pe=new Set(Ne),Fe=A.amountTolerance??.01,Ke=A.dateTolerance??3;for(const _e of R){if(X.has(_e.id))continue;const ze=q.filter(je=>{if(pe.has(je.id)||Math.abs(_e.amount-je.amount)>Fe)return!1;const Be=new Date(_e.date),He=new Date(je.date);return!(Math.abs(Be.getTime()-He.getTime())/(1e3*60*60*24)>Ke)});if(ze.length===1){const je=ze[0],Je=fe([_e.id],[je.id]);Je&&(j.push(Je),X.add(_e.id),pe.add(je.id))}}return x?.("autoMatch",j),j},[R,q,H,Ne,A,fe,x]),un=t.useCallback((j,X,pe,Fe)=>{Fe!==X&&(Fe==="statement"?fe([pe],[j]):fe([j],[pe]),Te(null),Ue(null))},[fe]),W=t.useCallback(()=>{const j=Array.from(re),X=Array.from(be);j.length>0&&X.length>0&&fe(j,X)},[re,be,fe]);t.useEffect(()=>{C?.(Array.from(re),Array.from(be))},[re,be,C]),t.useImperativeHandle(a,()=>({getMatches:()=>ee,getUnmatchedStatements:()=>R.filter(j=>!H.has(j.id)),getUnmatchedEntries:()=>q.filter(j=>!Ne.has(j.id)),createMatch:fe,removeMatch:ie,autoMatch:Ge,getSuggestions:async j=>v?v(j??R.filter(X=>!H.has(X.id)).map(X=>X.id)):[],applySuggestion:j=>fe([j.statementId],j.entryIds),approveAll:()=>{x?.("approveAll",ee)},clearAll:()=>{u||le([]),x?.("clearAll",[])},exportMatched:j=>{x?.("exportMatched",ee)},getSummary:()=>De,reset:()=>{u||le([]),G(new Set),Me(new Set),F({})},focusStatements:()=>k.current?.focus(),focusEntries:()=>$.current?.focus()}),[ee,R,q,H,Ne,fe,ie,Ge,v,x,u,De]);const sn=t.useMemo(()=>R.filter(j=>{if(Ce.status&&Ce.status.length>0){const X=H.has(j.id)?"matched":"unmatched";if(!Ce.status.includes(X))return!1}if(Ce.searchText){const X=Ce.searchText.toLowerCase();if(!j.description?.toLowerCase().includes(X)&&!j.counterparty?.toLowerCase().includes(X))return!1}return!0}),[R,Ce,H]),Ye=t.useMemo(()=>q.filter(j=>{if(Ce.status&&Ce.status.length>0){const X=Ne.has(j.id)?"matched":"unmatched";if(!Ce.status.includes(X))return!1}if(Ce.searchText){const X=Ce.searchText.toLowerCase();if(!j.description?.toLowerCase().includes(X)&&!j.partyName?.toLowerCase().includes(X))return!1}return!0}),[q,Ce,Ne]),en=re.size>0&&be.size>0&&!xe&&!B;return e.jsxs("div",{className:`nice-reconciliation nice-reconciliation--${J} ${f??""}`,style:l,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:Ge,disabled:B||xe||ke,children:[e.jsx(P.oa,{name:"zap",size:14})," ",h.autoMatch??"Auto-match"]}),e.jsxs("button",{type:"button",className:"nice-reconciliation__btn nice-reconciliation__btn--success",onClick:W,disabled:!en||ke,children:[e.jsx(P.oa,{name:"link",size:14})," 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:()=>x?.("approveAll",ee),disabled:ee.length===0||B||ke,children:[e.jsx(P.oa,{name:"check",size:14})," ",h.approveAll??"Approve All"]}),e.jsxs("button",{type:"button",className:"nice-reconciliation__btn",onClick:()=>{u||le([]),x?.("clearAll",[])},disabled:ee.length===0||B||xe||ke,children:[e.jsx(P.oa,{name:"close",size:14})," ",h.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(P.oa,{name:"file",size:14})," ",h.statementPanelTitle??"Bank Statement",e.jsx("span",{className:"nice-reconciliation__panel-badge",children:sn.length})]})}),e.jsx("div",{ref:k,className:"nice-reconciliation__panel-content",role:"listbox","aria-multiselectable":"true",children:sn.length===0?e.jsxs("div",{className:"nice-reconciliation__empty",children:[e.jsx("div",{className:"nice-reconciliation__empty-icon",children:e.jsx(P.oa,{name:"clipboard",size:32})}),h.noStatements??"No statement items"]}):sn.map(j=>e.jsx(pi,{item:{...j,status:H.has(j.id)?"matched":"unmatched"},isSelected:re.has(j.id),isDragging:Re===j.id,isDropTarget:Pe===j.id,suggestion:S.find(X=>X.statementId===j.id),currency:N,locale:V,onSelect:()=>{B||G(X=>{const pe=new Set(X);return pe.has(j.id)?pe.delete(j.id):pe.add(j.id),pe})},onDoubleClick:()=>he&&ge({type:"statement",id:j.id}),onDragStart:()=>Te(j.id),onDragEnd:()=>{Te(null),Ue(null)},onDrop:()=>{Re&&Re!==j.id&&un(j.id,"statement",Re,"entry")},disabled:B||xe||!we},j.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(P.oa,{name:"book",size:14})," ",h.entryPanelTitle??"Book Entries",e.jsx("span",{className:"nice-reconciliation__panel-badge",children:Ye.length})]})}),e.jsx("div",{ref:$,className:"nice-reconciliation__panel-content",role:"listbox","aria-multiselectable":"true",children:Ye.length===0?e.jsxs("div",{className:"nice-reconciliation__empty",children:[e.jsx("div",{className:"nice-reconciliation__empty-icon",children:e.jsx(P.oa,{name:"book",size:32})}),h.noEntries??"No book entries"]}):Ye.map(j=>e.jsx(gi,{item:{...j,status:Ne.has(j.id)?"matched":"unmatched"},isSelected:be.has(j.id),isDragging:Re===j.id,isDropTarget:Pe===j.id,currency:N,locale:V,onSelect:()=>{B||Me(X=>{const pe=new Set(X);return pe.has(j.id)?pe.delete(j.id):pe.add(j.id),pe})},onDoubleClick:()=>he&&ge({type:"entry",id:j.id}),onDragStart:()=>Te(j.id),onDragEnd:()=>{Te(null),Ue(null)},onDrop:()=>{Re&&Re!==j.id&&un(j.id,"entry",Re,"statement")},disabled:B||xe||!we},j.id))})]})]}),de&&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:[De.matchedStatements,"/",De.totalStatements," (",De.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:tn(De.matchedAmount,N,V)})]}),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:tn(De.unmatchedStatementAmount,N,V)})]}),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(De.difference)<.01?"nice-reconciliation__summary-value--success":"nice-reconciliation__summary-value--danger"}`,children:tn(De.difference,N,V)})]})]}),he&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`nice-reconciliation__detail-backdrop ${o?"nice-reconciliation__detail-backdrop--visible":""}`,onClick:()=>ge(null)}),e.jsx("div",{className:`nice-reconciliation__detail-panel ${o?"nice-reconciliation__detail-panel--open":""}`,children:o&&e.jsx(_i,{type:o.type,id:o.id,statements:R,entries:q,matches:ee,currency:N,locale:V,labels:h,onClose:()=>ge(null)})})]})]})});function _i({type:n,id:i,statements:a,entries:s,matches:d,currency:m,locale:g,labels:u,onClose:y}){const S=n==="statement"?a.find(E=>E.id===i):s.find(E=>E.id===i),A=n==="statement"?d.find(E=>E.statementIds.includes(i)):d.find(E=>E.entryIds.includes(i)),U=A?n==="statement"?s.filter(E=>A.entryIds.includes(E.id)):a.filter(E=>A.statementIds.includes(E.id)):[];if(!S)return null;const w=n==="statement",Y=w?S:null,Q=w?null:S;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(P.oa,{name:w?"file":"book",size:14})," ",w?u.statementDetails??"Transaction Details":u.entryDetails??"Entry Details"]}),e.jsx("button",{type:"button",className:"nice-reconciliation__detail-close",onClick:y,"aria-label":"Close",children:e.jsx(P.oa,{name:"close",size:14})})]}),e.jsxs("div",{className:"nice-reconciliation__detail-content",children:[A&&e.jsxs("div",{className:"nice-reconciliation__detail-match-info",children:[e.jsxs("div",{className:"nice-reconciliation__detail-match-header",children:[e.jsx(P.oa,{name:"check",size:14})," ",u.matchedWith??"Matched"," (",A.confidence?.toFixed(0)??100,"% confidence)"]}),e.jsx("div",{className:"nice-reconciliation__detail-match-detail",children:A.matchedBy==="ai"?u.matchedByAI??"Matched automatically by AI":u.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:u.statementTotal??"Statement"}),e.jsx("div",{className:`nice-reconciliation__detail-side-amount ${A.statementTotal>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:tn(A.statementTotal,m,g)})]}),e.jsxs("div",{className:"nice-reconciliation__detail-side-item",children:[e.jsx("div",{className:"nice-reconciliation__detail-side-label",children:u.entryTotal??"Book Entry"}),e.jsx("div",{className:`nice-reconciliation__detail-side-amount ${A.entryTotal>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:tn(A.entryTotal,m,g)})]})]}),A.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:[u.difference??"Difference",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",style:{color:"var(--nice-warning, #f59e0b)"},children:tn(A.difference,m,g)})]})]}),e.jsxs("div",{className:"nice-reconciliation__detail-section",children:[e.jsxs("div",{className:"nice-reconciliation__detail-section-title",children:[e.jsx(P.oa,{name:"clipboard",size:14})," ",w?u.transactionInfo??"Transaction Information":u.entryInfo??"Entry Information"]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[u.date??"Date",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:kn(S.date,g)})]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[u.description??"Description",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:S.description})]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[u.amount??"Amount",":"]}),e.jsx("span",{className:`nice-reconciliation__detail-value ${S.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:tn(S.amount,m,g)})]}),w&&Y?.counterparty&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[u.counterparty??"Counterparty",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:Y.counterparty})]}),w&&Y?.counterpartyAccount&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[u.accountNumber??"Account",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",style:{fontFamily:"monospace",fontSize:"0.75rem"},children:Y.counterpartyAccount})]}),!w&&Q?.partyName&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[u.party??"Party",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:Q.partyName})]}),!w&&Q?.documentNumber&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[u.documentRef??"Document Ref",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:Q.documentNumber})]}),w&&Y?.referenceNumber&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[u.reference??"Reference",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:Y.referenceNumber})]})]}),U.length>0&&e.jsxs("div",{className:"nice-reconciliation__detail-section",children:[e.jsxs("div",{className:"nice-reconciliation__detail-section-title",children:[e.jsx(P.oa,{name:"link",size:14})," ",w?u.matchedEntries??"Matched Entries":u.matchedStatements??"Matched Statements"]}),U.map(E=>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:E.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:"var(--nice-text-secondary)"},children:[e.jsx("span",{children:kn(E.date,g)}),e.jsx("span",{style:{fontWeight:600,color:E.amount>=0?"var(--nice-success)":"var(--nice-danger)"},children:tn(E.amount,m,g)})]})]},E.id))]})]})]})}const xi=({queries:n,currentFilter:i,currentColumns:a,currentSort:s,onLoad:d,onSave:m,onUpdate:g,onDelete:u,onShare:y,onSetDefault:S,allowSharing:A=!0,allowPinning:U=!0,position:w="dropdown",className:Y,style:Q,"data-testid":E})=>{const[z,b]=t.useState(!1),[x,_]=t.useState(""),[v,C]=t.useState(!1),[T,te]=t.useState(""),[ce,oe]=t.useState(""),[de,ue]=t.useState(!1),J=n.filter(B=>B.name.toLowerCase().includes(x.toLowerCase())),we=J.filter(B=>!B.isShared),O=J.filter(B=>B.isShared),he=async()=>{if(T.trim()){C(!0);try{await m({name:T,description:ce||void 0,filter:i??{},columns:a,sort:s}),ue(!1),te(""),oe("")}finally{C(!1)}}},ke=B=>e.jsxs("div",{className:"nice-saved-query__item",children:[B.icon&&e.jsx("span",{className:"nice-saved-query__icon","aria-hidden":"true",children:B.icon}),e.jsx("span",{className:"nice-saved-query__name",children:B.name}),B.isDefault&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--default",children:"domyślne"}),B.isShared&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--shared",children:"udostępnione"}),B.isPinned&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--pinned",children:"przypięte"}),e.jsxs("div",{className:"nice-saved-query__actions",children:[e.jsx("button",{onClick:()=>{d(B),b(!1)},type:"button",children:"Wczytaj"}),S&&e.jsx("button",{onClick:()=>S(B.id),type:"button",title:"Ustaw domyślne","aria-label":"Ustaw domyślne",children:e.jsx(P.oa,{name:"star",size:14})}),A&&y&&e.jsx("button",{onClick:()=>y(B.id,[]),type:"button",title:"Udostępnij","aria-label":"Udostępnij",children:e.jsx(P.oa,{name:"external-link",size:14})}),U&&e.jsx("button",{onClick:()=>g(B.id,{...B}),type:"button",title:"Przypnij","aria-label":"Przypnij",children:e.jsx(P.oa,{name:"map-pin",size:14})}),e.jsx("button",{onClick:()=>u(B.id),type:"button",title:"Usuń","aria-label":`Usuń zapytanie ${B.name}`,children:e.jsx(P.oa,{name:"close",size:14})})]})]},B.id);return e.jsxs("div",{className:`nice-saved-query nice-saved-query--${w} ${z?"nice-saved-query--open":""} ${Y??""}`,style:Q,"data-testid":E,children:[e.jsx("button",{className:"nice-saved-query__trigger",onClick:()=>b(B=>!B),"aria-expanded":z,"aria-haspopup":"listbox",type:"button",children:"Widoki i zapytania"}),z&&e.jsxs("div",{className:"nice-saved-query__panel",role:"dialog","aria-label":"Zarządzanie zapytaniami",children:[e.jsxs("div",{className:"nice-saved-query__search-row",children:[e.jsx("input",{type:"search",placeholder:"Szukaj zapytania…",value:x,onChange:B=>_(B.target.value),"aria-label":"Szukaj zapytania"}),e.jsx("button",{onClick:()=>ue(B=>!B),type:"button",children:"+ Zapisz bieżący widok"})]}),de&&e.jsxs("div",{className:"nice-saved-query__save-form",children:[e.jsx("input",{type:"text",placeholder:"Nazwa zapytania",value:T,onChange:B=>te(B.target.value),"aria-label":"Nazwa zapytania"}),e.jsx("input",{type:"text",placeholder:"Opis (opcjonalnie)",value:ce,onChange:B=>oe(B.target.value),"aria-label":"Opis zapytania"}),e.jsx("button",{onClick:he,disabled:v||!T.trim(),type:"button",children:v?"Zapisywanie…":"Zapisz"}),e.jsx("button",{onClick:()=>ue(!1),type:"button",children:"Anuluj"})]}),we.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:"Moje"}),we.map(ke)]}),O.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:"Udostępnione"}),O.map(ke)]}),J.length===0&&e.jsx("p",{className:"nice-saved-query__empty",children:"Brak zapisanych zapytań"})]})]})};exports.NiceDataGridAI=bt;exports.NiceKanbanBoard=qn;exports.NiceList=Ct;exports.NiceModuleGrid=Ht;exports.NiceReconciliationView=fi;exports.NiceSavedQueryPanel=xi;exports.NiceSpreadsheet=Hn;exports.NiceTable=Dt;exports.NiceTileView=It;exports.NiceTreeGrid=Nt;exports.NiceTreeList=kt;exports.NiceTreeView=St;
|