@objectstack/console 9.0.1 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/assets/{AiPendingActionsPage-B9iWZUDQ.js → AiPendingActionsPage-B-n-gqzM.js} +1 -1
  2. package/dist/assets/{ApiConsolePage-ZBL7GLt2.js → ApiConsolePage-uPTuvhXX.js} +1 -1
  3. package/dist/assets/{AppManagementPage-A8AufLcC.js → AppManagementPage-CNpBOuFm.js} +1 -1
  4. package/dist/assets/ApprovalsInboxPage-BFNNZBXy.js +1 -0
  5. package/dist/assets/{AuditLogPage-DWQl9my4.js → AuditLogPage-_9ECzJM8.js} +1 -1
  6. package/dist/assets/{ComponentNavView-CqfUzDMU.js → ComponentNavView-CDdExuCL.js} +1 -1
  7. package/dist/assets/ConsoleFloatingChatbot-DThmuzxB.js +1 -0
  8. package/dist/assets/{DeveloperHubPage-D7pt27Ji.js → DeveloperHubPage-mdknfgGp.js} +1 -1
  9. package/dist/assets/FlowRunsPage-yleJQxJv.js +1 -0
  10. package/dist/assets/{IntegrationsPage-CHg7ApBe.js → IntegrationsPage-7SUsLOvq.js} +2 -2
  11. package/dist/assets/ProfilePage-D4yjFTMG.js +1 -0
  12. package/dist/assets/PublicFormsPage-DWj4wR8t.js +1 -0
  13. package/dist/assets/{SettingsHub-DerOpof3.js → SettingsHub-7kLSZWnI.js} +1 -1
  14. package/dist/assets/{SettingsView-BNq6smI8.js → SettingsView-DqnY47y1.js} +1 -1
  15. package/dist/assets/{SystemHubPage-UTl8x-Bf.js → SystemHubPage-DeiksJan.js} +1 -1
  16. package/dist/assets/assistantBus-Bppk-Y9t.js +1 -0
  17. package/dist/assets/data-adapter-D1EJuDUI.js +1 -0
  18. package/dist/assets/framework-CHiz03zG.js +34 -0
  19. package/dist/assets/highlighted-body-OFNGDK62-Du4wVUV7.js +1 -0
  20. package/dist/assets/index-B_NAVTba.js +32 -0
  21. package/dist/assets/index-DwG7_t-6.css +2 -0
  22. package/dist/assets/mergeServerFields-CNavewPY.js +7 -0
  23. package/dist/assets/mermaid-GHXKKRXX-D0s_nNwO.js +1 -0
  24. package/dist/assets/plugin-calendar-u9Aa9OAR.js +1 -0
  25. package/dist/assets/{plugin-charts-BjUzf65B.js → plugin-charts-DSBNwB9E.js} +2 -2
  26. package/dist/assets/{plugin-chatbot-DUla2_T9.js → plugin-chatbot-BzJE6C-F.js} +6 -6
  27. package/dist/assets/plugin-dashboard-C5nSNZfG.js +5 -0
  28. package/dist/assets/{plugin-form-CcC4fdyJ.js → plugin-form-DrL6xDfP.js} +1 -1
  29. package/dist/assets/plugin-gantt-aDdnMW0u.js +1 -0
  30. package/dist/assets/plugin-grid-CSHgWd0O.js +6 -0
  31. package/dist/assets/plugin-kanban-D45w069C.js +1 -0
  32. package/dist/assets/{plugin-map-Bt30Mxn6.js → plugin-map-ue6Mjnhb.js} +1 -1
  33. package/dist/assets/{plugin-markdown-tayYSGF3.js → plugin-markdown-6MvgfANj.js} +1 -1
  34. package/dist/assets/plugin-report-QmyiWpfC.js +59 -0
  35. package/dist/assets/plugin-timeline-DrUpbBdn.js +1 -0
  36. package/dist/assets/plugin-view-DS-dSLs-.js +1 -0
  37. package/dist/assets/plugins-views-DH1gGZh6.js +4 -0
  38. package/dist/assets/{src-DOKKicsm.js → src-s-NNbVef.js} +1 -1
  39. package/dist/assets/{types-TLjbGkho.js → types-Decs33Tv.js} +1 -1
  40. package/dist/assets/{ui-components-DeXgqLMc.js → ui-components-BbPoD3rS.js} +2 -2
  41. package/dist/assets/{ui-layout-CvIgXgRF.js → ui-layout-CWeej0a8.js} +1 -1
  42. package/dist/assets/vendor-objectstack-RB3xvhcR.js +102 -0
  43. package/dist/index.html +4 -4
  44. package/package.json +1 -1
  45. package/dist/assets/ApprovalsInboxPage-Be6DrS7X.js +0 -1
  46. package/dist/assets/ConsoleFloatingChatbot-ByiTKdo6.js +0 -1
  47. package/dist/assets/FlowRunsPage-R-JzHY35.js +0 -1
  48. package/dist/assets/ProfilePage-D7kxyCKj.js +0 -1
  49. package/dist/assets/PublicFormsPage-B1VZJXuJ.js +0 -1
  50. package/dist/assets/data-adapter-DlR5JXpU.js +0 -1
  51. package/dist/assets/framework-DoGxClbR.js +0 -34
  52. package/dist/assets/highlighted-body-OFNGDK62-Bu5WidAv.js +0 -1
  53. package/dist/assets/index-Bt0jFx__.js +0 -32
  54. package/dist/assets/index-CJppnf0b.css +0 -2
  55. package/dist/assets/mergeServerFields-DL5isEen.js +0 -7
  56. package/dist/assets/mermaid-GHXKKRXX-BAcku4Xs.js +0 -1
  57. package/dist/assets/plugin-calendar-CUnlH4Wo.js +0 -1
  58. package/dist/assets/plugin-dashboard-DbPGiGy-.js +0 -5
  59. package/dist/assets/plugin-gantt-BRef4N3J.js +0 -1
  60. package/dist/assets/plugin-grid-BiWgglXK.js +0 -6
  61. package/dist/assets/plugin-kanban-C1UyFHza.js +0 -1
  62. package/dist/assets/plugin-report-qca5M0OZ.js +0 -59
  63. package/dist/assets/plugin-timeline-DZoFKL82.js +0 -1
  64. package/dist/assets/plugin-view-Ei4BPIYk.js +0 -1
  65. package/dist/assets/plugins-views-qoGCOQ47.js +0 -4
  66. package/dist/assets/vendor-objectstack-B2q1QmZh.js +0 -102
@@ -0,0 +1,5 @@
1
+ import{o as e,r as t,t as n}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as r,g as i,t as a}from"./vendor-react-DR370ovB.js";import{B as o,D as s,H as c,J as l,K as u,W as d,X as f,Y as p,Z as m,mt as h,q as g,r as _,t as v,ut as y,v as b,y as x}from"./framework-CHiz03zG.js";import{$s as S,A as C,Ai as w,At as T,Bn as E,Bs as D,Ea as O,Fn as k,Ft as A,Gn as j,H as M,In as N,It as ee,Jn as te,K as P,Kn as ne,Ks as re,Mt as ie,Nt as ae,Pr as F,Qa as I,T as oe,Y as se,Yn as L,Zs as R,a as z,br as B,bs as ce,ec as le,hi as V,i as H,j as ue,l as de,m as U,os as W,pa as G,pr as K,q,s as fe,ti as J,xi as Y,zn as X}from"./ui-components-BbPoD3rS.js";import{o as pe,t as me}from"./vendor-ui-utils-rQOI1gAo.js";import{_ as he,c as ge,d as _e,g as ve,h as ye,i as be,n as xe,o as Se,p as Ce,s as we,t as Te}from"./vendor-dndkit-DMFEUxSy.js";var Z=e(r(),1),Ee=e(i(),1),Q=a();function De(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&e.provider===`object`}function Oe(e,t){if(t==null||e==null||typeof e!=`number`||!Number.isFinite(e)||typeof t!=`number`||!Number.isFinite(t))return null;if(t===0)return e===0?{value:0,direction:`neutral`}:{value:100,direction:e>0?`up`:`down`};let n=e-t;if(n===0)return{value:0,direction:`neutral`};let r=Math.round(n/Math.abs(t)*100);return{value:Math.abs(r),direction:r>0?`up`:`down`}}function ke(e,t){if(e==null)return`—`;if(typeof e!=`number`)return String(e);if(!t)return Number.isInteger(e)?String(e):e.toLocaleString(void 0,{maximumFractionDigits:2});let n=t.includes(`%`),r=t.includes(`$`),i=t.split(`.`)[1]?.match(/0/g)?.length??0,a=e.toLocaleString(void 0,{minimumFractionDigits:i,maximumFractionDigits:i});return`${r?`$`:``}${a}${n?`%`:``}`}function Ae(e){return e==null?`—`:typeof e==`number`?Number.isInteger(e)?String(e):e.toLocaleString(void 0,{maximumFractionDigits:2}):String(e)}var je=new Set([`metric`,`kpi`,`gauge`,`solid-gauge`,`bullet`]),Me={bar:`bar`,column:`column`,"horizontal-bar":`horizontal-bar`,"grouped-bar":`bar`,"stacked-bar":`bar`,"bi-polar-bar":`bar`,line:`line`,spline:`line`,"step-line":`line`,area:`area`,"stacked-area":`area`,pie:`pie`,donut:`donut`,funnel:`funnel`,pyramid:`funnel`,scatter:`scatter`,bubble:`scatter`,radar:`radar`,treemap:`treemap`,sankey:`sankey`};function Ne({widget:e,dataSource:t}){let n=String(e?.dataset??``),r=(0,Z.useMemo)(()=>Array.isArray(e?.dimensions)?e.dimensions.filter(Boolean):[],[e]),i=(0,Z.useMemo)(()=>Array.isArray(e?.values)?e.values.filter(Boolean):[],[e]),a=e?.compareTo&&typeof e.compareTo==`object`?e.compareTo:void 0,s=String(e?.type??``),c=je.has(s)||r.length===0,u=s===`table`||s===`pivot`,d=e?.filter,f=(0,Z.useMemo)(()=>d&&typeof d==`object`&&Object.keys(d).length>0?l(d):void 0,[d]),[p,m]=(0,Z.useState)({status:`idle`,rows:[]});if((0,Z.useEffect)(()=>{let e=t;if(!e||typeof e.queryDataset!=`function`){m({status:`error`,rows:[],error:`This data source does not support dataset queries.`});return}if(i.length===0){m({status:`idle`,rows:[]});return}let o=!1;return m({status:`loading`,rows:[]}),e.queryDataset(n,{dimensions:r,measures:i,...f?{runtimeFilter:f}:{},...a?{compareTo:a}:{}}).then(e=>{o||m({status:`ok`,rows:Array.isArray(e?.rows)?e.rows:[],fields:Array.isArray(e?.fields)?e.fields:[]})}).catch(e=>{o||m({status:`error`,rows:[],error:String(e?.message??e)})}),()=>{o=!0}},[`${n}|${r.join(`,`)}|${i.join(`,`)}|${JSON.stringify(d??null)}|${JSON.stringify(a??null)}`]),i.length===0)return(0,Q.jsx)(`div`,{className:`flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground`,children:`Pick measures (values) for this dataset widget.`});if(p.status===`loading`||p.status===`idle`)return(0,Q.jsx)(`div`,{className:`flex h-full w-full items-center justify-center p-4 text-muted-foreground`,children:(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin`})});if(p.status===`error`)return(0,Q.jsxs)(`div`,{role:`alert`,className:`flex h-full w-full items-start gap-2 rounded border border-destructive/40 bg-destructive/5 p-3 text-xs text-destructive`,children:[(0,Q.jsx)(F,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`break-words`,children:p.error})]});if(p.rows.length===0)return(0,Q.jsxs)(`div`,{className:`flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground`,children:[(0,Q.jsx)(ce,{className:`mr-2 h-4 w-4`}),`No rows`]});let h=new Map((p.fields??[]).map(e=>[e.name,e])),g=e=>h.get(e);if(c){let e=g(i[0]),t=p.rows[0]?.[i[0]];return(0,Q.jsxs)(`div`,{className:`flex h-full w-full flex-col items-start justify-center gap-1 p-2`,children:[(0,Q.jsx)(`span`,{className:`text-2xl font-semibold tabular-nums`,children:ke(t,e?.format)}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?.label??i[0]})]})}if(u){let e=[...r,...i];return(0,Q.jsx)(`div`,{className:`h-full w-full overflow-auto p-1`,children:(0,Q.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,Q.jsx)(`thead`,{className:`bg-muted/40`,children:(0,Q.jsx)(`tr`,{children:e.map(e=>(0,Q.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium whitespace-nowrap`,children:g(e)?.label??e},e))})}),(0,Q.jsx)(`tbody`,{children:p.rows.map((t,n)=>(0,Q.jsx)(`tr`,{className:`border-t`,children:e.map(e=>(0,Q.jsx)(`td`,{className:`px-2 py-1 whitespace-nowrap tabular-nums`,children:i.includes(e)?ke(t[e],g(e)?.format):Ae(t[e])},e))},n))})]})})}let _=Me[s]??`bar`,v=i.map(e=>({dataKey:e,label:g(e)?.label??e}));return(0,Q.jsx)(`div`,{className:R(`h-full w-full min-h-[220px]`),children:(0,Q.jsx)(o,{schema:{type:`chart`,chartType:_,data:p.rows,xAxisKey:r[0],series:v}})})}function Pe({id:e,disabled:t,gridSpan:n,className:r,children:i}){let{attributes:a,listeners:o,setNodeRef:s,transform:c,transition:l,isDragging:u,isOver:d}=Se({id:e,disabled:t});return(0,Q.jsx)(`div`,{ref:s,style:{transform:he.Transform.toString(c),transition:l,opacity:u?.4:1,...n?{gridColumn:`span ${n.w}`,gridRow:`span ${n.h}`}:{}},className:R(`h-full w-full`,r,!t&&`cursor-grab active:cursor-grabbing`,d&&!u&&`ring-2 ring-primary ring-offset-2 rounded-lg`),"data-sortable-widget-id":e,...a,...o,children:i})}function Fe(e){return e?se(e):null}function Ie(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var Le=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],Re={column:`bar`,"stacked-bar":`bar`,"grouped-bar":`bar`,"bi-polar-bar":`bar`,spline:`line`,"step-line":`line`,"stacked-area":`area`,pyramid:`funnel`,bubble:`scatter`},ze=new Set([`bar`,`horizontal-bar`,`line`,`area`,`pie`,`donut`,`scatter`,`funnel`,`radar`,`treemap`,`sankey`]),Be=new Set([`gauge`,`solid-gauge`,`kpi`,`bullet`]),Ve=new Set([`sunburst`,`word-cloud`,`choropleth`,`bubble-map`,`gl-map`,`heatmap`,`waterfall`,`box-plot`,`violin`,`candlestick`,`stock`]),He=new Set([`bar`,`horizontal-bar`,`line`,`area`,`pie`,`donut`,`funnel`]);function Ue(e){return He.has(e)?{enabled:!0}:void 0}var We=(0,Z.forwardRef)(({schema:e,className:t,dataSource:n,onRefresh:r,recordCount:i,userActions:a,designMode:c,selectedWidgetId:l,onWidgetClick:u,onWidgetsReorder:d,modalHandler:f,scriptHandlers:p,hideHeaderText:m,...h},g)=>{let v=(()=>{if(e.columns!=null)return e.columns;let t=e.widgets??[],n=0;for(let e of t){let t=(e.layout?.x??0)+(e.layout?.w??0);t>n&&(n=t),(e.layout?.w??0)>n&&(n=e.layout.w)}return n>4?12:4})(),y=v,b=e.gap||4,[x,C]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(!1),D=(0,Z.useRef)(null),{executeAction:O,engine:k}=s({actions:(0,Z.useMemo)(()=>(e.header?.actions??[]).map(e=>({name:e.actionUrl||e.label,type:e.actionType||`url`,target:e.actionUrl,label:e.label})),[e.header?.actions])}),{dashboardLabel:A,dashboardDescription:M,dashboardActionLabel:N,widgetTitle:ee,widgetDescription:P,fieldLabel:re}=S(),{t:ie}=_(),ae=(0,Z.useCallback)((e,t,n)=>n&&(!t||t===`value`||t===`count`||n===`count`)?ie(`report.aggregate.${n}`,{defaultValue:n}):e?re(e,t,t):t,[ie,re]),F=e.name,I=(0,Z.useCallback)(e=>F?N(F,e.actionUrl||e.label,e.label):e.label,[F,N]),oe=(0,Z.useCallback)(e=>{let t=Ie(e.title);return!F||!e.id||t===void 0?t:ee(F,e.id,t)},[F,ee]),se=(0,Z.useCallback)(e=>{let t=Ie(e.description);return!F||!e.id?t:P(F,e.id,t)},[F,P]);(0,Z.useEffect)(()=>{let e=k.getRunner();if(f&&e.setModalHandler(f),p)for(let[t,n]of Object.entries(p))e.registerScript(t,n)},[k,f,p]),(0,Z.useEffect)(()=>{let e=()=>E(window.innerWidth<768);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let z=(0,Z.useCallback)(()=>{r&&(C(!0),r(),setTimeout(()=>C(!1),600))},[r]);(0,Z.useEffect)(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!r))return D.current=setInterval(z,e.refreshInterval*1e3),()=>{D.current&&clearInterval(D.current)}},[e.refreshInterval,r,z]);let B=(0,Z.useCallback)((e,t)=>{!c||!u||!t||(e.stopPropagation(),u(t))},[c,u]),ce=(0,Z.useCallback)((t,n,r)=>{if(!c||!u)return;let i=e.widgets||[];if(t.key===`Enter`||t.key===` `)t.preventDefault(),u(n??null);else if(t.key===`ArrowRight`||t.key===`ArrowDown`){t.preventDefault();let e=r+1<i.length?i[r+1]:null;e?.id&&u(e.id)}else if(t.key===`ArrowLeft`||t.key===`ArrowUp`){t.preventDefault();let e=r-1>=0?i[r-1]:null;e?.id&&u(e.id)}else t.key===`Escape`&&(t.preventDefault(),u(null))},[c,u,e.widgets]),le=(0,Z.useCallback)(e=>{!c||!u||e.target===e.currentTarget&&u(null)},[c,u]),V=!!(c&&d),H=ve(ye(_e,{activationConstraint:{distance:5}})),ue=(0,Z.useCallback)(t=>{if(!V)return;let{active:n,over:r}=t;if(!r||n.id===r.id)return;let i=e.widgets??[],a=i.findIndex(e=>e.id===n.id),o=i.findIndex(e=>e.id===r.id);a<0||o<0||d?.(xe(i,a,o))},[V,e.widgets,d]),de=(e,t,r)=>{let i=e.layout?{...e.layout,w:Math.min(e.layout.w,y)}:void 0,a=!!e.dataset,s=(()=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`metric`&&e.object){let t=n.data,r=De(t)&&t.aggregate?{field:e.valueField||t.aggregate.field,function:e.aggregate||t.aggregate.function,groupBy:e.categoryField??t.aggregate.groupBy??`_all`}:e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`_all`}:void 0;return{type:`object-metric`,objectName:e.object||(De(t)?t.object:void 0),aggregate:r,filter:(De(t)?t.filter:void 0)||e.filter,label:n.label||oe(e)||``,fallbackValue:n.value,trend:n.trend,icon:n.icon,description:n.description,colorVariant:e.colorVariant,format:n.format,currency:n.currency,prefix:n.prefix,suffix:n.suffix,drillDown:n.drillDown??{enabled:!0},title:n.label||oe(e)||``,compareTo:e.compareTo}}if(Be.has(t||``)&&e.object){let t=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`_all`}:void 0;return{type:`object-metric`,objectName:e.object,aggregate:t,filter:e.filter,label:n.label||oe(e)||``,fallbackValue:n.fallbackValue??n.value,icon:n.icon,description:n.description,colorVariant:e.colorVariant,format:n.format,currency:n.currency,prefix:n.prefix,suffix:n.suffix,invert:n.invert,compareTo:e.compareTo}}let r=t&&Re[t]||t;if(r&&ze.has(r)){let t=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(De(t)){let o=t.aggregate,s=(()=>{let t=e.categoryField||o?.groupBy;if(t)return e.categoryGranularity&&typeof t==`string`?{field:t,dateGranularity:e.categoryGranularity}:t})(),c=o?{field:e.valueField||o.field,function:e.aggregate||o.function,groupBy:s}:void 0,l=c?.field||a,u=e.object||t.object;return{type:`object-chart`,chartType:r,objectName:u,aggregate:c,filter:t.filter||e.filter,xAxisKey:i,series:[{dataKey:l,label:ae(u,l,c?.function)}],colors:Le,drillDown:n.drillDown??Ue(r),compareTo:e.compareTo,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(!t&&e.object){let t=e.categoryField||`name`,a=e.categoryGranularity?{field:t,dateGranularity:e.categoryGranularity}:t,o=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:a}:void 0,s=e.valueField||`value`;return{type:`object-chart`,chartType:r,objectName:e.object,aggregate:o,filter:e.filter,xAxisKey:i,series:[{dataKey:s,label:ae(e.object,s,e.aggregate)}],colors:Le,drillDown:n.drillDown??Ue(r),compareTo:e.compareTo,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}return{type:`chart`,chartType:r,data:Array.isArray(t)?t:t?.items||[],xAxisKey:i,series:[{dataKey:a,label:ae(e.object,a,e.aggregate)}],colors:Le,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(t===`table`){let t=e.data||n.data;if(De(t)){let{data:r,...i}=n;return{type:`object-data-table`,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter,searchable:e.searchable??!1,pagination:e.pagination??!1,className:`border-0`}}return!t&&e.object?{type:`object-data-table`,...n,objectName:e.object,filter:e.filter,searchable:e.searchable??!1,pagination:e.pagination??!1,className:`border-0`}:{type:`data-table`,...n,data:t?.items||[],searchable:!1,pagination:!1,className:`border-0`}}if(t===`pivot`){let t=e.data||n.data,r=e,i={rowField:r.rowField??n.rowField,columnField:r.columnField??n.columnField,valueField:r.valueField??n.valueField,aggregation:r.aggregation??n.aggregation??`sum`,showRowTotals:r.showRowTotals??n.showRowTotals,showColumnTotals:r.showColumnTotals??n.showColumnTotals,format:r.format??n.format},a=(De(t)||!t&&e.object)&&n.drillDown===void 0?{...n,drillDown:{enabled:!0}}:n;if(De(t)){let{data:n,...r}=a;return{type:`object-pivot`,...r,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter}}return!t&&e.object?{type:`object-pivot`,...a,...i,objectName:e.object,filter:e.filter}:{type:`pivot`,...n,...i,data:Array.isArray(t)?t:t?.items||[]}}if(t===`list`){let t=e.data||n.data;if(De(t)){let{data:r,...i}=n;return{type:`object-data-table`,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter,searchable:!1,pagination:!1,className:`border-0`}}return!t&&e.object?{type:`object-data-table`,...n,objectName:e.object,filter:e.filter,searchable:!1,pagination:!1,className:`border-0`}:{type:`data-table`,...n,data:Array.isArray(t)?t:t?.items||[],searchable:!1,pagination:!1,className:`border-0`}}return t===`custom`?{type:`text`,value:"Custom widget — set `component` to a UIComponent schema.",variant:`caption`,align:`center`,className:`flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-muted-foreground`}:t&&Ve.has(t)?{type:`text`,value:`「${t}」chart type is not supported yet`,variant:`caption`,align:`center`,className:`flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-muted-foreground`}:{...e,...n}})(),u=e.type===`metric`&&!a,d=oe(e),f=se(e),p=e.id||d||`widget-${t}`,m=c&&l===e.id,h=c?{"data-testid":`dashboard-preview-widget-${e.id}`,"data-widget-id":e.id,role:`button`,tabIndex:0,"aria-selected":m,"aria-label":`Widget: ${d||`Widget ${t+1}`}`,onClick:t=>B(t,e.id),onKeyDown:n=>ce(n,e.id,t)}:{},g=c?R(`cursor-pointer rounded-lg transition-all outline-none`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,m?`ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10`:`hover:ring-2 hover:ring-primary/40 hover:shadow-sm`):void 0,_=!T&&i&&!V?{gridColumn:`span ${i.w}`,gridRow:`span ${i.h}`}:void 0,v=u?(0,Q.jsxs)(`div`,{className:R(`h-full w-full`,c&&`relative`,g),style:_,...h,children:[a?(0,Q.jsx)(`div`,{className:R(`h-full w-full`,c&&`pointer-events-none`),children:(0,Q.jsx)(Ne,{widget:e,dataSource:n})}):(0,Q.jsx)(o,{schema:s,className:R(`h-full w-full`,c&&`pointer-events-none`),dataSource:n}),c&&(0,Q.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]}):(0,Q.jsxs)(j,{className:R(`overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md`,`bg-card/50 backdrop-blur-sm`,r&&`w-full`,c&&`relative`,g),style:_,...h,children:[d&&(0,Q.jsxs)(te,{className:`pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6`,children:[(0,Q.jsx)(L,{className:`text-sm sm:text-base font-medium tracking-tight truncate`,title:d,children:d}),f&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 line-clamp-2`,children:f})]}),(0,Q.jsx)(ne,{className:`p-0`,children:(0,Q.jsx)(`div`,{className:R(`h-full w-full`,`p-3 sm:p-4 md:p-6`,c&&`pointer-events-none`),children:a?(0,Q.jsx)(Ne,{widget:e,dataSource:n}):(0,Q.jsx)(o,{schema:s,dataSource:n})})}),c&&(0,Q.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]});return V&&e.id?(0,Q.jsx)(Pe,{id:e.id,gridSpan:!T&&i?{w:i.w,h:i.h}:void 0,children:v},p):(0,Q.jsx)(Z.Fragment,{children:v},p)},U=e.header&&(0,Q.jsxs)(`div`,{className:`col-span-full mb-4`,children:[!m&&e.header.showTitle!==!1&&e.title&&(0,Q.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:F?A({name:F,label:Ie(e.title)}):Ie(e.title)}),!m&&e.header.showDescription!==!1&&e.description&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:F?M({name:F,description:Ie(e.description)}):Ie(e.description)}),e.header.actions&&e.header.actions.length>0&&(0,Q.jsx)(`div`,{className:`flex gap-2 mt-3`,children:e.header.actions.map((e,t)=>{let n=Fe(e.icon);return(0,Q.jsxs)(K,{variant:`outline`,size:`sm`,onClick:async()=>{let{actionType:t,actionUrl:n,label:r}=e;if(!t||!n){console.warn(`[DashboardRenderer] Header action missing actionType/actionUrl:`,e);return}if(t===`url`){/^https?:\/\//.test(n)||n.startsWith(`//`)?window.location.assign(n):(window.history.pushState({},``,n),window.dispatchEvent(new PopStateEvent(`popstate`)));return}if(t===`modal`||t===`script`){let e=await O(n||r);e?.success||console.warn(`[DashboardRenderer] action failed`,e?.error);return}console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`)},children:[n&&(0,Q.jsx)(n,{className:`w-4 h-4 mr-1.5`}),I(e)]},t)})})]}),W=i!==void 0&&(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[i.toLocaleString(),` records`]}),G=a?JSON.stringify(a):void 0,q=r&&(0,Q.jsxs)(`div`,{className:R(`flex items-center justify-end gap-3 mb-2`,!T&&`col-span-full`),children:[W,(0,Q.jsxs)(K,{variant:`outline`,size:`sm`,onClick:z,disabled:x,"aria-label":`Refresh dashboard`,children:[(0,Q.jsx)(w,{className:R(`h-4 w-4 mr-2`,x&&`animate-spin`)}),x?`Refreshing…`:`Refresh All`]})]}),fe=(0,Z.useMemo)(()=>(e.widgets??[]).map(e=>e.id).filter(e=>!!e),[e.widgets]),J=(0,Z.useMemo)(()=>(e.widgets??[]).filter(e=>e.type===`metric`).map(e=>e.id).filter(e=>!!e),[e.widgets]),Y=(0,Z.useMemo)(()=>(e.widgets??[]).filter(e=>e.type!==`metric`).map(e=>e.id).filter(e=>!!e),[e.widgets]);if(T){let n=e.widgets?.filter(e=>e.type===`metric`)||[],r=e.widgets?.filter(e=>e.type!==`metric`)||[],i=(0,Q.jsxs)(`div`,{ref:g,className:R(`flex flex-col gap-4 px-4`,t),"data-user-actions":G,onClick:le,...h,children:[U,q,n.length>0&&(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,onClick:le,children:(0,Q.jsx)(Te,{items:J,strategy:be,disabled:!V,children:n.map((e,t)=>de(e,t))})}),r.length>0&&(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,onClick:le,children:(0,Q.jsx)(Te,{items:Y,strategy:we,disabled:!V,children:r.map((e,t)=>de(e,t,!0))})})]});return V?(0,Q.jsx)(ge,{sensors:H,collisionDetection:Ce,onDragEnd:ue,children:i}):i}let X=e.columns!=null||v!==4,pe=(0,Q.jsxs)(`div`,{ref:g,className:R(`grid auto-rows-min`,!X&&`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,t),style:{...X&&{gridTemplateColumns:`repeat(${y}, minmax(0, 1fr))`},gap:`${b*.25}rem`},"data-user-actions":G,onClick:le,...h,children:[U,q,(0,Q.jsx)(Te,{items:fe,strategy:be,disabled:!V,children:e.widgets?.map((e,t)=>de(e,t))})]});return V?(0,Q.jsx)(ge,{sensors:H,collisionDetection:Ce,onDragEnd:ue,children:pe}):pe});function Ge(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function Ke(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function qe(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=Ge(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=Ke(r,u,s[0]),f=Ke(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function Je(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=Ge(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=Ze(d,0,s-r),f=Ze(f,0,l-i),{x:d,y:f}}function Ye(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=Ge(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function Xe(e,t,n){let{margin:r,rowHeight:i}=e,a=Ge(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function Ze(e,t,n){return Math.max(Math.min(e,n),t)}function Qe(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function $e(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&Qe(r,t))return r}}function et(e,t){return e.filter(e=>Qe(e,t))}function tt(e,t){return t===`horizontal`?rt(e):t===`vertical`||t===`wrap`?nt(e):[...e]}function nt(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function rt(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function it(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=r.y+r.h;e>t&&(t=e)}}return t}function at(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&r.i===t)return r}}function ot(e){return e.filter(e=>e.static===!0)}function st(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function ct(e){let t=Array(e.length);for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t[n]=st(r))}return t}function lt(e,t){let n=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r];i!==void 0&&(t.i===i.i?n[r]=t:n[r]=i)}return n}function ut(e,t,n){let r=at(e,t);return r?(r=n(st(r)),[lt(e,r),r]):[[...e],null]}function dt(e,t){let n=ot(e);for(let r=0;r<e.length;r++){let i=e[r];if(i!==void 0)if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;$e(n,i);)i.y++}return e}function ft(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=tt(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=et(d,t),p=f.length>0;if(p&&c)return ct(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;e<f.length;e++){let n=f[e];n!==void 0&&(n.moved||(m=n.static?pt(m,n,t,i,o):pt(m,t,n,i,o)))}return m}function pt(e,t,n,r,i,a){let o=i===`horizontal`,s=i===`vertical`,c=t.static;if(r){r=!1;let a={x:o?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:`-1`},l=$e(e,a),u=l!==void 0&&l.y+l.h>t.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return ft(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return ft(e,n,void 0,n.y+1,r,c,i);if(u&&i===null)return t.y=n.y,n.y+=n.h,[...e];if(d&&o)return ft(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:ft(e,n,l,u,r,c,i)}function mt(e,t,n){return Math.max(t,Math.min(n,e))}var ht=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:mt(t,0,Math.max(0,r-e.w)),y:mt(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:mt(t,1,Math.max(1,o)),h:mt(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:mt(t,e.minW??1,e.maxW??1/0),h:mt(n,e.minH??1,e.maxH??1/0)}}}];function gt(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function _t(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function vt({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function yt({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function bt(e){return e*100+`%`}function xt(e,t,n,r){return e+n>r?t:n}function St(e,t,n){return e<0?t:n}function Ct(e){return Math.max(0,e)}function wt(e){return Math.max(0,e)}var Tt=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:St(o,e.height,i),top:wt(o)}},Et=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:xt(e.left,e.width,o,n),left:Ct(i)}},Dt=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:wt(r),left:0}:{height:i,width:a,top:wt(r),left:o}},Ot=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:St(r,e.height,a),top:wt(r)}},kt={n:Tt,ne:(e,t,n)=>Tt(e,Et(e,t,n)),e:Et,se:(e,t,n)=>Ot(e,Et(e,t,n)),s:Ot,sw:(e,t,n)=>Ot(e,Dt(e,t)),w:Dt,nw:(e,t,n)=>Tt(e,Dt(e,t))};function At(e,t,n,r){let i=kt[e];return i?i(t,{...t,...n},r):n}var jt={type:`transform`,scale:1,calcStyle(e){return vt(e)}},Mt={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},Nt={enabled:!0,bounded:!1,threshold:3},Pt={enabled:!0,handles:[`se`]},Ft={enabled:!1,defaultItem:{w:1,h:1}};function It(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??ot(e).length>0;for(let i=o+1;i<e.length;i++){let o=e[i];if(o!==void 0&&!o.static){if(!s&&o.y>t.y+t.h)break;Qe(t,o)&&It(e,o,n+t[a],r,s)}}t[r]=n}function Lt(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!$e(e,t);)t.y--;let i;for(;(i=$e(e,t))!==void 0;)It(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Rt(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!$e(e,t);)t.x--;let i;for(;(i=$e(e,t))!==void 0;)if(It(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!$e(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var zt={type:`vertical`,allowOverlap:!1,compact(e,t){let n=ot(e),r=it(n),i=nt(e),a=Array(e.length);for(let t=0;t<i.length;t++){let o=i[t];if(o===void 0)continue;let s=st(o);s.static||(s=Lt(n,s,i,r),r=Math.max(r,s.y+s.h),n.push(s));let c=e.indexOf(o);a[c]=s,s.moved=!1}return a}},Bt={type:`horizontal`,allowOverlap:!1,compact(e,t){let n=ot(e),r=rt(e),i=Array(e.length);for(let a=0;a<r.length;a++){let o=r[a];if(o===void 0)continue;let s=st(o);s.static||(s=Rt(n,s,t,r),n.push(s));let c=e.indexOf(o);i[c]=s,s.moved=!1}return i}},Vt={type:null,allowOverlap:!1,compact(e,t){return ct(e)}},Ht={...zt,allowOverlap:!0,compact(e,t){return ct(e)}},Ut={...Bt,allowOverlap:!0,compact(e,t){return ct(e)}},Wt={...Vt,allowOverlap:!0};function Gt(e,t=!1,n=!1){let r;return r=t?e===`vertical`?Ht:e===`horizontal`?Ut:Wt:e===`vertical`?zt:e===`horizontal`?Bt:Vt,n?{...r,preventCollision:n}:r}function Kt(e){return Object.keys(e).sort((t,n)=>e[t]-e[n])}function qt(e,t){let n=Kt(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;i<n.length;i++){let a=n[i];a!==void 0&&t>e[a]&&(r=a)}return r}function Jt(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Yt(e,t,n,r,i,a){let o=e[n];if(o)return ct(o);let s=e[r],c=Kt(t),l=c.slice(c.indexOf(n));for(let t=0;t<l.length;t++){let n=l[t];if(n===void 0)continue;let r=e[n];if(r){s=r;break}}let u=dt(ct(s||[]),{cols:i});return(typeof a==`object`&&a?a:Gt(a)).compact(u,i)}function Xt(e,t){if(Array.isArray(e))return e;let n=e,r=n[t];if(r!==void 0)return r;let i=Object.keys(n);for(let e of i){let t=n[e];if(t!==void 0)return t}return[10,10]}var Zt=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(e,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=`[object Arguments]`,c=`[object Boolean]`,l=`[object Date]`,u=`[object RegExp]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object Set]`,h=`[object String]`,g=Object.prototype.toString;function _(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,_=e.areObjectsEqual,v=e.areRegExpsEqual,y=e.areSetsEqual,b=e.createIsNestedEqual,x=b(S);function S(e,b,S){if(e===b)return!0;if(!e||!b||typeof e!=`object`||typeof b!=`object`)return e!==e&&b!==b;if(i(e)&&i(b))return _(e,b,x,S);var C=Array.isArray(e),w=Array.isArray(b);if(C||w)return C===w&&t(e,b,x,S);var T=g.call(e);return T===g.call(b)?T===l?n(e,b,x,S):T===u?v(e,b,x,S):T===d?r(e,b,x,S):T===m?y(e,b,x,S):T===p||T===s?a(e)||a(b)?!1:_(e,b,x,S):T===c||T===f||T===h?o(e.valueOf(),b.valueOf()):!1:!1}return S}function v(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-- >0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var y=n(v);function b(e,t){return o(e.valueOf(),t.valueOf())}function x(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var S=n(x),C=`_owner`,w=Object.prototype.hasOwnProperty;function T(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-- >0;){if(o=i[a],o===C){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!w.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var E=n(T);function D(e,t){return e.source===t.source&&e.flags===t.flags}function O(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var k=n(O),A=Object.freeze({areArraysEqual:v,areDatesEqual:b,areMapsEqual:x,areObjectsEqual:T,areRegExpsEqual:D,areSetsEqual:O,createIsNestedEqual:t}),j=Object.freeze({areArraysEqual:y,areDatesEqual:b,areMapsEqual:S,areObjectsEqual:E,areRegExpsEqual:D,areSetsEqual:k,createIsNestedEqual:t}),M=_(A);function N(e,t){return M(e,t,void 0)}var ee=_(r(A,{createIsNestedEqual:function(){return o}}));function te(e,t){return ee(e,t,void 0)}var P=_(j);function ne(e,t){return P(e,t,new WeakMap)}var re=_(r(j,{createIsNestedEqual:function(){return o}}));function ie(e,t){return re(e,t,new WeakMap)}function ae(e){return _(r(A,e(A)))}function F(e){var t=_(r(j,e(j)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=ne,e.circularShallowEqual=ie,e.createCustomCircularEqual=F,e.createCustomEqual=ae,e.deepEqual=N,e.sameValueZeroEqual=o,e.shallowEqual=te,Object.defineProperty(e,"__esModule",{value:!0})}))}));function Qt(e={}){let{measureBeforeMount:t=!1,initialWidth:n=1280}=e,[r,i]=(0,Z.useState)(n),[a,o]=(0,Z.useState)(!t),s=(0,Z.useRef)(null),c=(0,Z.useRef)(null),l=(0,Z.useCallback)(()=>{let e=s.current;if(e){let t=e.offsetWidth;i(t),a||o(!0)}},[a]);return(0,Z.useEffect)(()=>{let e=s.current;if(e){if(l(),typeof ResizeObserver<`u`){let t=null;return c.current=new ResizeObserver(e=>{let n=e[0];if(n){let e=n.contentRect.width;t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{i(e),t=null})}}),c.current.observe(e),()=>{t!==null&&cancelAnimationFrame(t),c.current&&=(c.current.disconnect(),null)}}return()=>{c.current&&=(c.current.disconnect(),null)}}},[l]),{width:r,mounted:a,containerRef:s,measureWidth:l}}var $t=n(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),en=n(((e,t)=>{var n=$t();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),tn=n(((e,t)=>{t.exports=en()()})),$=e(tn(),1);function nn(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function rn(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function an(e){return typeof e==`number`&&!isNaN(e)}function on(e){return parseInt(e,10)}function sn(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var cn=[`Moz`,`Webkit`,`O`,`ms`];function ln(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<cn.length;n++)if(un(e,cn[n])in t)return cn[n];return``}function un(e,t){return t?`${t}${dn(e)}`:e}function dn(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var fn=ln(),pn=``;function mn(e,t){pn||=nn([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return rn(e[t])})??``;let n=e[pn];return rn(n)?!!n.call(e,t):!1}function hn(e,t,n){let r=e;do{if(mn(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function gn(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function _n(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function vn(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=on(n.borderTopWidth),t+=on(n.borderBottomWidth),t}function yn(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=on(n.borderLeftWidth),t+=on(n.borderRightWidth),t}function bn(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=on(n.paddingTop),t-=on(n.paddingBottom),t}function xn(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=on(n.paddingLeft),t-=on(n.paddingRight),t}function Sn(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function Cn(e,t){let n=Tn(e,t,`px`);return{[un(`transform`,fn)]:n}}function wn(e,t){return Tn(e,t,``)}function Tn({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function En(e,t){return e.targetTouches&&nn(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&nn(e.changedTouches,e=>t===e.identifier)}function Dn(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function On(e){if(!e)return;let t=e.getElementById(`react-draggable-style-el`);t||(t=e.createElement(`style`),t.type=`text/css`,t.id=`react-draggable-style-el`,t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
2
+ `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
3
+ `,e.getElementsByTagName(`head`)[0].appendChild(t)),e.body&&jn(e.body,`react-draggable-transparent-selection`)}function kn(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{An(e)}):An(e)}function An(e){if(e)try{e.body&&Mn(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function jn(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function Mn(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function Nn(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:Bn(r);let i=Vn(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+on(s.paddingLeft)+on(o.marginLeft),top:-i.offsetTop+on(s.paddingTop)+on(o.marginTop),right:xn(a)-yn(i)-i.offsetLeft+on(s.paddingRight)-on(o.marginRight),bottom:bn(a)-vn(i)-i.offsetTop+on(s.paddingBottom)-on(o.marginBottom)}}return an(r.right)&&(t=Math.min(t,r.right)),an(r.bottom)&&(n=Math.min(n,r.bottom)),an(r.left)&&(t=Math.max(t,r.left)),an(r.top)&&(n=Math.max(n,r.top)),[t,n]}function Pn(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function Fn(e){return e.props.axis===`both`||e.props.axis===`x`}function In(e){return e.props.axis===`both`||e.props.axis===`y`}function Ln(e,t,n){let r=typeof t==`number`?En(e,t):null;if(typeof t==`number`&&!r)return null;let i=Vn(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return Sn(r||e,a,n.props.scale)}function Rn(e,t,n){let r=!an(e.lastX),i=Vn(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function zn(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function Bn(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Vn(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}function Hn(...e){({}).DRAGGABLE_DEBUG&&console.log(...e)}var Un={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Wn=Un.mouse,Gn=class extends Z.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!hn(e.target,this.props.handle,t)||this.props.cancel&&hn(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=Dn(e);this.touchIdentifier=r;let i=Ln(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=Rn(this,a,o);Hn(`DraggableCore: handleDragStart: %j`,s),Hn(`calling`,this.props.onStart),!(this.props.onStart(e,s)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&On(n),this.dragging=!0,this.lastX=a,this.lastY=o,gn(n,Wn.move,this.handleDrag),gn(n,Wn.stop,this.handleDragStop))},this.handleDrag=e=>{let t=Ln(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=Pn(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=Rn(this,n,r);if(Hn(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=Ln(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=Pn(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=Rn(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&kn(a.ownerDocument),Hn(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Hn(`DraggableCore: Removing handlers`),_n(a.ownerDocument,Wn.move,this.handleDrag),_n(a.ownerDocument,Wn.stop,this.handleDragStop))},this.onMouseDown=e=>(Wn=Un.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Wn=Un.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Wn=Un.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Wn=Un.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&gn(e,Un.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;_n(t,Un.mouse.move,this.handleDrag),_n(t,Un.touch.move,this.handleDrag),_n(t,Un.mouse.stop,this.handleDragStop),_n(t,Un.touch.stop,this.handleDragStop),_n(e,Un.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&kn(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ee.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Hn(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return Z.cloneElement(Z.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Gn.displayName=`DraggableCore`,Gn.propTypes={allowAnyClick:$.default.bool,allowMobileScroll:$.default.bool,children:$.default.node.isRequired,disabled:$.default.bool,enableUserSelectHack:$.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:$.default.arrayOf($.default.number),handle:$.default.string,cancel:$.default.string,nodeRef:$.default.object,onStart:$.default.func,onDrag:$.default.func,onStop:$.default.func,onMouseDown:$.default.func,scale:$.default.number,className:sn,style:sn,transform:sn},Gn.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Kn=class extends Z.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Hn(`Draggable: onDragStart: %j`,t),this.props.onStart(e,zn(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Hn(`Draggable: onDrag: %j`,t);let n=zn(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=Nn(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,zn(this,t))===!1)return!1;Hn(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Hn(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ee.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,h={x:Fn(this)&&p?this.state.x:m.x,y:In(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=wn(h,c):d=Cn(h,c);let g=Z.Children.only(n),_=pe(g.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return Z.createElement(Gn,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},Z.cloneElement(g,{className:_,style:{...g.props.style,...d},transform:f}))}};Kn.displayName=`Draggable`,Kn.propTypes={...Gn.propTypes,axis:$.default.oneOf([`both`,`x`,`y`,`none`]),bounds:$.default.oneOfType([$.default.shape({left:$.default.number,right:$.default.number,top:$.default.number,bottom:$.default.number}),$.default.string,$.default.oneOf([!1])]),defaultClassName:$.default.string,defaultClassNameDragging:$.default.string,defaultClassNameDragged:$.default.string,defaultPosition:$.default.shape({x:$.default.number,y:$.default.number}),positionOffset:$.default.shape({x:$.default.oneOfType([$.default.number,$.default.string]),y:$.default.oneOfType([$.default.number,$.default.string])}),position:$.default.shape({x:$.default.number,y:$.default.number}),className:sn,style:sn,transform:sn},Kn.defaultProps={...Gn.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var qn=n(((e,t)=>{var n=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of s(t))!l.call(e,i)&&i!==n&&a(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e},f=(e,t,r)=>(r=e==null?{}:n(c(e)),d(t||!e||!e.__esModule?a(r,`default`,{value:e,enumerable:!0}):r,e)),p=e=>d(a({},`__esModule`,{value:!0}),e),m={};u(m,{DraggableCore:()=>pe,default:()=>he}),t.exports=p(m);var h=f(r()),g=f(tn()),_=f(i()),v=me();function y(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function b(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function x(e){return typeof e==`number`&&!isNaN(e)}function S(e){return parseInt(e,10)}function C(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var w=[`Moz`,`Webkit`,`O`,`ms`];function T(e=`transform`){if(typeof window>`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;n<w.length;n++)if(E(e,w[n])in t)return w[n];return``}function E(e,t){return t?`${t}${D(e)}`:e}function D(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}var O=T(),k=``;function A(e,t){k||=y([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(t){return b(e[t])})??``;let n=e[k];return b(n)?!!n.call(e,t):!1}function j(e,t,n){let r=e;do{if(A(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function M(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.addEventListener?e.addEventListener(t,a,i):e.attachEvent?e.attachEvent(`on`+t,a):e[`on`+t]=a}function N(e,t,n,r){if(!e)return;let i={capture:!0,...r},a=n;e.removeEventListener?e.removeEventListener(t,a,i):e.detachEvent?e.detachEvent(`on`+t,a):e[`on`+t]=null}function ee(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=S(n.borderTopWidth),t+=S(n.borderBottomWidth),t}function te(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=S(n.borderLeftWidth),t+=S(n.borderRightWidth),t}function P(e){let t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=S(n.paddingTop),t-=S(n.paddingBottom),t}function ne(e){let t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=S(n.paddingLeft),t-=S(n.paddingRight),t}function re(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function ie(e,t){let n=F(e,t,`px`);return{[E(`transform`,O)]:n}}function ae(e,t){return F(e,t,``)}function F({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;return n&&(i=`translate(${`${typeof n.x==`string`?n.x:n.x+r}`}, ${`${typeof n.y==`string`?n.y:n.y+r}`})`+i),i}function I(e,t){return e.targetTouches&&y(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&y(e.changedTouches,e=>t===e.identifier)}function oe(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function se(e){if(!e)return;let t=e.getElementById(`react-draggable-style-el`);t||(t=e.createElement(`style`),t.type=`text/css`,t.id=`react-draggable-style-el`,t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
4
+ `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
5
+ `,e.getElementsByTagName(`head`)[0].appendChild(t)),e.body&&z(e.body,`react-draggable-transparent-selection`)}function L(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{R(e)}):R(e)}function R(e){if(e)try{e.body&&B(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function z(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function B(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function ce(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:W(r);let i=G(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+S(s.paddingLeft)+S(o.marginLeft),top:-i.offsetTop+S(s.paddingTop)+S(o.marginTop),right:ne(a)-te(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:P(a)-ee(i)-i.offsetTop+S(s.paddingBottom)-S(o.marginBottom)}}return x(r.right)&&(t=Math.min(t,r.right)),x(r.bottom)&&(n=Math.min(n,r.bottom)),x(r.left)&&(t=Math.max(t,r.left)),x(r.top)&&(n=Math.max(n,r.top)),[t,n]}function le(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function V(e){return e.props.axis===`both`||e.props.axis===`x`}function H(e){return e.props.axis===`both`||e.props.axis===`y`}function ue(e,t,n){let r=typeof t==`number`?I(e,t):null;if(typeof t==`number`&&!r)return null;let i=G(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return re(r||e,a,n.props.scale)}function de(e,t,n){let r=!x(e.lastX),i=G(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function U(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function W(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function G(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}var K=f(r()),q=f(tn()),fe=f(i());function J(...e){({}).DRAGGABLE_DEBUG&&console.log(...e)}var Y={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},X=Y.mouse,pe=class extends K.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!j(e.target,this.props.handle,t)||this.props.cancel&&j(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=oe(e);this.touchIdentifier=r;let i=ue(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=de(this,a,o);J(`DraggableCore: handleDragStart: %j`,s),J(`calling`,this.props.onStart),!(this.props.onStart(e,s)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&se(n),this.dragging=!0,this.lastX=a,this.lastY=o,M(n,X.move,this.handleDrag),M(n,X.stop,this.handleDragStop))},this.handleDrag=e=>{let t=ue(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=le(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=de(this,n,r);if(J(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=ue(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=le(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=de(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&L(a.ownerDocument),J(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(J(`DraggableCore: Removing handlers`),N(a.ownerDocument,X.move,this.handleDrag),N(a.ownerDocument,X.stop,this.handleDragStop))},this.onMouseDown=e=>(X=Y.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(X=Y.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(X=Y.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(X=Y.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&M(e,Y.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;N(t,Y.mouse.move,this.handleDrag),N(t,Y.touch.move,this.handleDrag),N(t,Y.mouse.stop,this.handleDragStop),N(t,Y.touch.stop,this.handleDragStop),N(e,Y.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&L(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=fe.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(J(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return K.cloneElement(K.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};pe.displayName=`DraggableCore`,pe.propTypes={allowAnyClick:q.default.bool,allowMobileScroll:q.default.bool,children:q.default.node.isRequired,disabled:q.default.bool,enableUserSelectHack:q.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:q.default.arrayOf(q.default.number),handle:q.default.string,cancel:q.default.string,nodeRef:q.default.object,onStart:q.default.func,onDrag:q.default.func,onStop:q.default.func,onMouseDown:q.default.func,scale:q.default.number,className:C,style:C,transform:C},pe.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var he=class extends h.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(J(`Draggable: onDragStart: %j`,t),this.props.onStart(e,U(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;J(`Draggable: onDrag: %j`,t);let n=U(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=ce(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,U(this,t))===!1)return!1;J(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(J(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=_.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,g={x:V(this)&&p?this.state.x:m.x,y:H(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=ae(g,c):d=ie(g,c);let _=h.Children.only(n),y=(0,v.clsx)(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return h.createElement(pe,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},h.cloneElement(_,{className:y,style:{..._.props.style,...d},transform:f}))}};he.displayName=`Draggable`,he.propTypes={...pe.propTypes,axis:g.default.oneOf([`both`,`x`,`y`,`none`]),bounds:g.default.oneOfType([g.default.shape({left:g.default.number,right:g.default.number,top:g.default.number,bottom:g.default.number}),g.default.string,g.default.oneOf([!1])]),defaultClassName:g.default.string,defaultClassNameDragging:g.default.string,defaultClassNameDragged:g.default.string,defaultPosition:g.default.shape({x:g.default.number,y:g.default.number}),positionOffset:g.default.shape({x:g.default.oneOfType([g.default.number,g.default.string]),y:g.default.oneOfType([g.default.number,g.default.string])}),position:g.default.shape({x:g.default.number,y:g.default.number}),className:C,style:C,transform:C},he.defaultProps={...pe.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(t.exports={DraggableCore:pe})})),Jn=n(((e,t)=>{var n=qn(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),Yn=n((e=>{e.__esModule=!0,e.cloneElement=l;var t=n(r());function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e){var t=c(e,`string`);return typeof t==`symbol`?t:t+``}function c(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function l(e,n){return n.style&&e.props.style&&(n.style=a(a({},e.props.style),n.style)),n.className&&e.props.className&&(n.className=e.props.className+` `+n.className),t.default.cloneElement(e,n)}})),Xn=n((e=>{e.__esModule=!0,e.resizableProps=void 0;var t=n(tn());Jn();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),Zn=n((e=>{e.__esModule=!0,e.default=void 0;var t=s(r()),n=Jn(),i=Yn(),a=Xn(),o=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(null,arguments)}function l(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=m(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var h=class extends t.Component{constructor(){super(...arguments),this.handleRefs={},this.lastHandleRect=null,this.slack=null,this.lastSize=null}componentWillUnmount(){this.resetData()}resetData(){this.lastHandleRect=this.slack=this.lastSize=null}runConstraints(e,t){let n=this.props,r=n.minConstraints,i=n.maxConstraints,a=n.lockAspectRatio;if(!r&&!i&&!a)return[e,t];if(a){let n=this.props.width/this.props.height,r=e-this.props.width,i=t-this.props.height;Math.abs(r)>Math.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&!(e===`onResize`&&!v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,n){let r=this.props.handle;if(!r)return t.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:n});if(typeof r==`function`)return r(e,n);let i=typeof r.type==`string`,a=d({ref:n},i?{}:{handleAxis:e});return t.cloneElement(r,a)}render(){let e=this.props,r=e.children,a=e.className,s=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let u=e.resizeHandles;e.transformScale;let f=l(e,o);return(0,i.cloneElement)(r,d(d({},f),{},{className:(a?a+` `:``)+`react-resizable`,children:[...t.Children.toArray(r.props.children),...u.map(e=>{let r=this.handleRefs[e]??(this.handleRefs[e]=t.createRef());return t.createElement(n.DraggableCore,c({},s,{nodeRef:r,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,r))})]}))}};e.default=h,h.propTypes=a.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),Qn=n((e=>{e.__esModule=!0,e.default=void 0;var t=c(r()),n=s(tn()),i=s(Zn()),a=Xn(),o=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(c=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(null,arguments)}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=m(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function h(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var g=class extends t.Component{constructor(){super(...arguments),this.state={width:this.props.width,height:this.props.height,propsWidth:this.props.width,propsHeight:this.props.height},this.onResize=(e,t)=>{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,n=e.handle,r=e.handleSize;e.onResize;let a=e.onResizeStart,s=e.onResizeStop,c=e.draggableOpts,u=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,m=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=h(e,o);return t.createElement(i.default,{axis:m,draggableOpts:c,handle:n,handleSize:r,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:u,onResizeStart:a,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},t.createElement(`div`,l({},y,{style:d(d({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=d(d({},a.resizableProps),{},{children:n.default.element})})),$n=n(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Zn().default,t.exports.ResizableBox=Qn().default}))(),er=Zt();function tr(e){let{children:t,cols:n,containerWidth:r,margin:i,containerPadding:a,rowHeight:o,maxRows:s,isDraggable:c,isResizable:l,isBounded:u,static:d,useCSSTransforms:f=!0,usePercentages:p=!1,transformScale:m=1,positionStrategy:h,dragThreshold:g=0,droppingPosition:_,className:v=``,style:y,handle:b=``,cancel:x=``,x:S,y:C,w,h:T,minW:E=1,maxW:D=1/0,minH:O=1,maxH:k=1/0,i:A,resizeHandles:j,resizeHandle:M,constraints:N=ht,layoutItem:ee,layout:te=[],onDragStart:P,onDrag:ne,onDragStop:re,onResizeStart:ie,onResize:ae,onResizeStop:F}=e,[I,oe]=(0,Z.useState)(!1),[se,L]=(0,Z.useState)(!1),R=(0,Z.useRef)(null),z=(0,Z.useRef)({left:0,top:0}),B=(0,Z.useRef)({top:0,left:0,width:0,height:0}),ce=(0,Z.useRef)(void 0),le=(0,Z.useRef)(te);le.current=te;let V=(0,Z.useRef)(null),H=(0,Z.useRef)(null),ue=(0,Z.useRef)(!1),de=(0,Z.useRef)({x:0,y:0}),U=(0,Z.useRef)(!1),W=(0,Z.useMemo)(()=>({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),G=(0,Z.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),K=(0,Z.useCallback)(()=>({...G,layout:le.current}),[G]),q=(0,Z.useMemo)(()=>ee??{i:A,x:S,y:C,w,h:T,minW:E,maxW:D,minH:O,maxH:k},[ee,A,S,C,w,T,E,D,O,k]),fe=(0,Z.useCallback)(e=>{if(h?.calcStyle)return h.calcStyle(e);if(f)return vt(e);let t=yt(e);return p?{...t,left:bt(e.left/r),width:bt(e.width/r)}:t},[h,f,p,r]),J=(0,Z.useCallback)((e,{node:t})=>{if(!P)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/m,o=r.left/m,s=i.top/m,c=r.top/m,l;if(h?.calcDragPosition){let t=e;l=h.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(z.current=l,g>0){let t=e;de.current={x:t.clientX,y:t.clientY},ue.current=!0,U.current=!1,oe(!0);return}oe(!0);let u=Ye(W,l.top,l.left),{x:d,y:f}=gt(N,q,u.x,u.y,K());P(A,d,f,{e,node:t,newPosition:l})},[P,m,W,h,g,N,q,K,A]),Y=(0,Z.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!ne||!I)return;let s=e;if(ue.current&&!U.current){let n=s.clientX-de.current.x,r=s.clientY-de.current.y;if(Math.hypot(n,r)<g)return;if(U.current=!0,ue.current=!1,P){let n=Ye(W,z.current.top,z.current.left),{x:r,y:i}=gt(N,q,n.x,n.y,K());P(A,r,i,{e,node:t,newPosition:z.current})}}let c=z.current.top+a,l=z.current.left+n;if(u){let{offsetParent:e}=t;if(e){let t=e.clientHeight-Ke(T,o,i[1]);c=Ze(c,0,t);let n=r-Ke(w,Ge(W),i[0]);l=Ze(l,0,n)}}let d={top:c,left:l};z.current=d;let f=Ye(W,c,l),{x:p,y:m}=gt(N,q,f.x,f.y,K());ne(A,p,m,{e,node:t,newPosition:d})},[ne,P,I,g,u,T,o,i,W,r,w,A,N,q,K]),X=(0,Z.useCallback)((e,{node:t})=>{if(!re||!I)return;let n=ue.current;if(ue.current=!1,U.current=!1,de.current={x:0,y:0},n){oe(!1),z.current={left:0,top:0};return}let{left:r,top:i}=z.current,a={top:i,left:r};oe(!1),z.current={left:0,top:0};let o=Ye(W,i,r),{x:s,y:c}=gt(N,q,o.x,o.y,K());re(A,s,c,{e,node:t,newPosition:a})},[re,I,W,N,q,K,A]);V.current=J,H.current=Y;let me=(0,Z.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?ie:o===`onResize`?ae:F;if(!s)return;let c;c=t?At(i,a,n,r):{...n,top:a.top,left:a.left},B.current=c;let l=Xe(W,c.width,c.height),{w:u,h:d}=_t(N,q,l.w,l.h,i,K());s(A,u,d,{e:e.nativeEvent,node:t,size:c,handle:i})},[ie,ae,F,r,W,A,N,q,K]),he=(0,Z.useCallback)((e,t)=>{L(!0);let n=qe(W,S,C,w,T);me(e,{...t,handle:t.handle},n,`onResizeStart`)},[me,W,S,C,w,T]),ge=(0,Z.useCallback)((e,t)=>{let n=qe(W,S,C,w,T);me(e,{...t,handle:t.handle},n,`onResize`)},[me,W,S,C,w,T]),_e=(0,Z.useCallback)((e,t)=>{L(!1),B.current={top:0,left:0,width:0,height:0};let n=qe(W,S,C,w,T);me(e,{...t,handle:t.handle},n,`onResizeStop`)},[me,W,S,C,w,T]);(0,Z.useEffect)(()=>{if(!_)return;let e=R.current;if(!e)return;let t=ce.current||{left:0,top:0},n=I&&(_.left!==t.left||_.top!==t.top);if(!I){let t={node:e,deltaX:_.left,deltaY:_.top,lastX:0,lastY:0,x:_.left,y:_.top};V.current?.(_.e,t)}else if(n){let t={node:e,deltaX:_.left-z.current.left,deltaY:_.top-z.current.top,lastX:z.current.left,lastY:z.current.top,x:_.left,y:_.top};H.current?.(_.e,t)}ce.current=_},[_,I,A]);let ve=qe(W,S,C,w,T,I?z.current:null,se?B.current:null),ye=Z.Children.only(t),be=Ge(W),xe=[Ke(E,be,i[0]),Ke(O,o,i[1])],Se=[Ke(D,be,i[0]),Ke(k,o,i[1])],Ce=ye.props,we=Ce.className,Te=Ce.style,Ee=Z.cloneElement(ye,{ref:R,className:pe(`react-grid-item`,we,v,{static:d,resizing:se,"react-draggable":c,"react-draggable-dragging":I,dropping:!!_,cssTransforms:f}),style:{...y,...Te,...fe(ve)}}),De=M;return Ee=(0,Q.jsx)($n.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:ve.width,height:ve.height,minConstraints:xe,maxConstraints:Se,onResizeStart:he,onResize:ge,onResizeStop:_e,transformScale:m,resizeHandles:j,handle:De,children:Ee}),Ee=(0,Q.jsx)(Gn,{disabled:!c,onStart:J,onDrag:Y,onStop:X,handle:b,cancel:`.react-resizable-handle`+(x?`,`+x:``),scale:m,nodeRef:R,children:Ee}),Ee}var nr=()=>{},rr=`react-grid-layout`,ir=!1;try{ir=/firefox/i.test(navigator.userAgent)}catch{}function ar(e,t){let n=Z.Children.toArray(e),r=Z.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(t?.key!==i?.key)return!1}return!0}function or(e,t,n,r){let i=[],a=new Set;Z.Children.forEach(t,t=>{if(!Z.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(st(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:it(i),w:1,h:1})}});let o=dt(i,{cols:n});return r.compact(o,n)}function sr(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=jt,compactor:c,constraints:l=ht,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=nr,onDragStart:_=nr,onDrag:v=nr,onDragStop:y=nr,onResizeStart:b=nr,onResize:x=nr,onResizeStop:S=nr,onDrop:C=nr,onDropDragOver:w=nr}=e,T=(0,Z.useMemo)(()=>({...Mt,...r}),[r]),E=(0,Z.useMemo)(()=>({...Nt,...i}),[i]),D=(0,Z.useMemo)(()=>({...Pt,...a}),[a]),O=(0,Z.useMemo)(()=>({...Ft,...o}),[o]),{cols:k,rowHeight:A,maxRows:j,margin:M,containerPadding:N}=T,{enabled:ee,bounded:te,handle:P,cancel:ne,threshold:re}=E,{enabled:ie,handles:ae,handleComponent:F}=D,{enabled:I,defaultItem:oe,onDragOver:se}=O,L=c??Gt(`vertical`),R=L.type,z=L.allowOverlap,B=L.preventCollision??!1,ce=(0,Z.useMemo)(()=>d??{i:`__dropping-elem__`,...oe},[d,oe]),le=s.type===`transform`,V=s.scale,H=N??M,[ue,de]=(0,Z.useState)(!1),[U,W]=(0,Z.useState)(()=>or(u,t,k,L)),[G,K]=(0,Z.useState)(null),[q,fe]=(0,Z.useState)(!1),[J,Y]=(0,Z.useState)(null),[X,me]=(0,Z.useState)(),he=(0,Z.useRef)(null),ge=(0,Z.useRef)(null),_e=(0,Z.useRef)(null),ve=(0,Z.useRef)(0),ye=(0,Z.useRef)(U),be=(0,Z.useRef)(u),xe=(0,Z.useRef)(t),Se=(0,Z.useRef)(R),Ce=(0,Z.useRef)(U);Ce.current=U,(0,Z.useEffect)(()=>{de(!0),(0,er.deepEqual)(U,u)||g(U)},[]),(0,Z.useEffect)(()=>{if(G||J)return;let e=!(0,er.deepEqual)(u,be.current),n=!ar(t,xe.current),r=R!==Se.current;if(e||n||r){let n=or(e?u:U,t,k,L);(0,er.deepEqual)(n,U)||W(n)}be.current=u,xe.current=t,Se.current=R},[u,t,k,R,L,G,J,U]),(0,Z.useEffect)(()=>{!G&&!(0,er.deepEqual)(U,ye.current)&&(ye.current=U,g(U.filter(e=>e.i!==ce.i)))},[U,G,g,ce.i]);let we=(0,Z.useMemo)(()=>{if(!f)return;let e=it(U),t=H[1];return e*A+(e-1)*M[1]+t*2+`px`},[f,U,A,M,H]),Te=(0,Z.useCallback)((e,t,n,r)=>{let i=Ce.current,a=at(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};he.current=st(a),_e.current=i,K(o),_(i,a,a,null,r.e,r.node)},[_]),Ee=(0,Z.useCallback)((e,t,n,r)=>{let i=Ce.current,a=he.current,o=at(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=ft(i,o,t,n,!0,B,R,k,z);v(c,a,o,s,r.e,r.node),W(L.compact(c,k)),K(s)},[B,R,k,z,L,v]),De=(0,Z.useCallback)((e,t,n,r)=>{if(!G)return;let i=Ce.current,a=he.current,o=at(i,e);if(!o)return;let s=ft(i,o,t,n,!0,B,R,k,z),c=L.compact(s,k);y(c,a,o,null,r.e,r.node);let l=_e.current;he.current=null,_e.current=null,K(null),W(c),l&&!(0,er.deepEqual)(l,c)&&g(c)},[G,B,R,k,z,L,y,g]),Oe=(0,Z.useCallback)((e,t,n,r)=>{let i=Ce.current,a=at(i,e);a&&(ge.current=st(a),_e.current=i,fe(!0),b(i,a,a,null,r.e,r.node))},[b]),ke=(0,Z.useCallback)((e,t,n,r)=>{let i=Ce.current,a=ge.current,{handle:o}=r,s=!1,c,l,[u,d]=ut(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),B&&!z&&et(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=ft(u,d,c,l,!0,B,R,k,z));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};x(f,a,d,p,r.e,r.node),W(L.compact(f,k)),K(p)},[B,R,k,z,L,x]),Ae=(0,Z.useCallback)((e,t,n,r)=>{let i=Ce.current,a=ge.current,o=at(i,e),s=L.compact(i,k);S(s,a,o??null,null,r.e,r.node);let c=_e.current;ge.current=null,_e.current=null,K(null),fe(!1),W(s),c&&!(0,er.deepEqual)(c,s)&&g(s)},[k,L,S,g]),je=(0,Z.useCallback)(()=>{let e=Ce.current;if(!e.some(e=>e.i===ce.i)){Y(null),K(null),me(void 0);return}W(L.compact(e.filter(e=>e.i!==ce.i),k)),Y(null),K(null),me(void 0)},[ce.i,k,L]),Me=(0,Z.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),ir&&!e.nativeEvent.target?.classList.contains(rr))return!1;let t=se?se(e.nativeEvent):w(e);if(t===!1)return J&&je(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...ce,...a},s=e.currentTarget.getBoundingClientRect(),c={cols:k,margin:M,maxRows:j,rowHeight:A,containerWidth:n,containerPadding:H},l=Ge(c),u=Ke(o.w,l,M[0]),d=Ke(o.h,A,M[1]),f=u/2,p=d/2,m=e.clientX-s.left+r-f,h=e.clientY-s.top+i-p,g=Math.max(0,m),_=Math.max(0,h),v={left:g/V,top:_/V,e:e.nativeEvent};if(J)X&&(X.left!==v.left||X.top!==v.top)&&me(v);else{let e=Je(c,_,g,o.w,o.h);Y((0,Q.jsx)(`div`,{},o.i)),me(v),W([...Ce.current.filter(e=>e.i!==o.i),{...o,x:e.x,y:e.y,static:!1,isDraggable:!0}])}},[J,X,ce,se,w,je,V,k,M,j,A,n,H]),Ne=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),ve.current--,ve.current<0&&(ve.current=0),ve.current===0&&je()},[je]),Pe=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),ve.current++},[]),Fe=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=Ce.current,n=t.find(e=>e.i===ce.i);ve.current=0,je(),C(t,n,e.nativeEvent)},[ce.i,je,C]),Ie=(0,Z.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=at(U,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&ee,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ie,o=r.resizeHandles||[...ae],c=i&&te&&r.isBounded!==!1,u=F;return(0,Q.jsx)(tr,{containerWidth:n,cols:k,margin:M,containerPadding:H,maxRows:j,rowHeight:A,cancel:ne,handle:P,onDragStart:Te,onDrag:Ee,onDragStop:De,onResizeStart:Oe,onResize:ke,onResizeStop:Ae,isDraggable:i,isResizable:a,isBounded:c,useCSSTransforms:le&&ue,usePercentages:!ue,transformScale:V,positionStrategy:s,dragThreshold:re,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?X:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:U,children:e},r.i)},[U,n,k,M,H,j,A,ne,P,Te,Ee,De,Oe,ke,Ae,ee,ie,te,le,ue,V,s,re,X,ae,F,l]),Le=()=>G?(0,Q.jsx)(tr,{w:G.w,h:G.h,x:G.x,y:G.y,i:G.i,className:`react-grid-placeholder ${q?`placeholder-resizing`:``}`,containerWidth:n,cols:k,margin:M,containerPadding:H,maxRows:j,rowHeight:A,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:le,transformScale:V,constraints:l,layout:U,children:(0,Q.jsx)(`div`,{})}):null;return(0,Q.jsxs)(`div`,{ref:h,className:pe(rr,p),style:{height:we,...m},onDrop:I?Fe:void 0,onDragLeave:I?Ne:void 0,onDragEnter:I?Pe:void 0,onDragOver:I?Me:void 0,children:[Z.Children.map(t,e=>Z.isValidElement(e)?Ie(e):null),I&&J&&Ie(J,!0),Le()]})}var cr={lg:1200,md:996,sm:768,xs:480,xxs:0},lr={lg:12,md:10,sm:6,xs:4,xxs:2},ur=()=>{};function dr(e,t,n,r){let i=[];Z.Children.forEach(t,t=>{if(!Z.isValidElement(t)||t.key===null)return;let n=String(t.key),r=e.find(e=>e.i===n);if(r)i.push({...r,i:n});else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:it(i),w:1,h:1})}});let a=dt(i,{cols:n});return r.compact(a,n)}function fr(e){let{children:t,width:n,breakpoint:r,breakpoints:i=cr,cols:a=lr,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=ur,onLayoutChange:p=ur,onWidthChange:m=ur,...h}=e,g=d??Gt(`vertical`),_=g.type,v=g.allowOverlap,y=(0,Z.useMemo)(()=>r??qt(i,n),[]),b=(0,Z.useMemo)(()=>Jt(y,a),[y,a]),x=(0,Z.useMemo)(()=>Yt(o,i,y,y,b,_),[]),[S,C]=(0,Z.useState)(y),[w,T]=(0,Z.useState)(b),[E,D]=(0,Z.useState)(x),[O,k]=(0,Z.useState)(o),A=(0,Z.useRef)(n),j=(0,Z.useRef)(r),M=(0,Z.useRef)(i),N=(0,Z.useRef)(a),ee=(0,Z.useRef)(o),te=(0,Z.useRef)(_),P=(0,Z.useRef)(O);(0,Z.useEffect)(()=>{P.current=O},[O]);let ne=(0,Z.useMemo)(()=>(0,er.deepEqual)(o,ee.current)?null:Yt(o,i,S,S,w,g),[o,i,S,w,g]),re=ne??E;(0,Z.useEffect)(()=>{ne!==null&&(D(ne),k(o),P.current=o,ee.current=o)},[ne,o]),(0,Z.useEffect)(()=>{if(_!==te.current){let e=g.compact(ct(re),w),t={...P.current,[S]:e};D(e),k(t),P.current=t,p(e,t),te.current=_}},[_,g,re,w,v,S,p]),(0,Z.useEffect)(()=>{let e=n!==A.current,o=r!==j.current,s=!(0,er.deepEqual)(i,M.current),c=!(0,er.deepEqual)(a,N.current);if(e||o||s||c){let e=r??qt(i,n),o=Jt(e,a),d=S;if(d!==e||s||c){let n={...P.current};n[d]||(n[d]=ct(E));let r=Yt(n,i,e,d,o,g);r=dr(r,t,o,g),n[e]=r,C(e),T(o),D(r),k(n),P.current=n,f(e,o),p(r,n)}m(n,Xt(l,e),o,u?Xt(u,e):null),A.current=n,j.current=r,M.current=i,N.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let ie=(0,Z.useCallback)(e=>{let t={...P.current,[S]:e};D(e),k(t),P.current=t,p(e,t)},[S,p]),ae=(0,Z.useMemo)(()=>Xt(l,S),[l,S]),F=(0,Z.useMemo)(()=>u===null?null:Xt(u,S),[u,S]),I=(0,Z.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:ae,containerPadding:F}),[w,s,c,ae,F]);return(0,Q.jsx)(sr,{...h,width:n,gridConfig:I,compactor:g,onLayoutChange:ie,layout:re,children:t})}function pr({editMode:e}){let t=b();return Z.useEffect(()=>{if(e)return t.startDrag({id:`dashboard-layout`,type:`dashboard-widget`,data:{}}),()=>{t.endDrag()};t.endDrag(`dashboard`)},[e,t]),null}var mr=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`];function hr(e,t){if(!e.widgets?.length)return e;let n=new Map(t.map(e=>[e.i,e])),r=e.widgets.map((e,t)=>{let r=e.id||`widget-${t}`,i=n.get(r);return i?{...e,layout:{x:i.x,y:i.y,w:i.w,h:i.h}}:e});return{...e,widgets:r}}function gr(e){return{lg:e.widgets?.map((e,t)=>({i:e.id||`widget-${t}`,x:e.layout?.x??t%4*3,y:e.layout?.y??Math.floor(t/4)*4,w:e.layout?.w??3,h:e.layout?.h??4}))||[]}}var _r=({schema:e,className:t,onLayoutChange:n,onSchemaChange:r,onRefresh:i})=>{let{width:a,containerRef:s,mounted:c}=Qt(),[l,u]=Z.useState(!1),[d,f]=Z.useState(!1),p=x(),m=Z.useRef(null),h=Z.useCallback(()=>{i&&(f(!0),i(),setTimeout(()=>f(!1),600))},[i]);Z.useEffect(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!i))return m.current=setInterval(h,e.refreshInterval*1e3),()=>{m.current&&clearInterval(m.current)}},[e.refreshInterval,i,h]);let[g,_]=Z.useState(()=>gr(e)),v=Z.useMemo(()=>JSON.stringify(e.widgets?.map((e,t)=>({i:e.id||`widget-${t}`,x:e.layout?.x,y:e.layout?.y,w:e.layout?.w,h:e.layout?.h}))??[]),[e.widgets]);Z.useEffect(()=>{_(gr(e))},[v]);let y=Z.useCallback((e,t)=>{_(t),n?.(e)},[n]),b=Z.useCallback(()=>{r?r(hr(e,g.lg)):globalThis.process?.env?.NODE_ENV!==`production`&&console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."),u(!1)},[r,e,g]),S=Z.useCallback(()=>{_(gr(e))},[e]),C=Z.useCallback(e=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`bar`||t===`horizontal-bar`||t===`line`||t===`area`||t===`pie`||t===`donut`||t===`scatter`||t===`funnel`){let r=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(De(r)){let n=r.aggregate,o=n?{field:e.valueField||n.field,function:e.aggregate||n.function,groupBy:e.categoryField||n.groupBy}:void 0,s=o?.field||a;return{type:`object-chart`,chartType:t,objectName:e.object||r.object,aggregate:o,xAxisKey:i,series:[{dataKey:s}],colors:mr,className:`h-full`}}if(!r&&e.object){let n=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`name`}:void 0;return{type:`object-chart`,chartType:t,objectName:e.object,aggregate:n,xAxisKey:i,series:[{dataKey:e.valueField||`value`}],colors:mr,className:`h-full`}}return{type:`chart`,chartType:t,data:Array.isArray(r)?r:r?.items||[],xAxisKey:i,series:[{dataKey:a}],colors:mr,className:`h-full`}}if(t===`table`){let t=e.data||n.data;if(De(t)){let{data:r,...i}=n;return{type:`data-table`,...i,objectName:e.object||t.object,dataProvider:t,data:[],searchable:!1,pagination:!1,className:`border-0`}}return!t&&e.object?{type:`data-table`,...n,objectName:e.object,data:[],searchable:!1,pagination:!1,className:`border-0`}:{type:`data-table`,...n,data:t?.items||[],searchable:!1,pagination:!1,className:`border-0`}}if(t===`pivot`){let t=e.data||n.data;if(De(t)){let{data:r,...i}=n;return{type:`pivot`,...i,objectName:e.object||t.object,dataProvider:t,data:[]}}return{type:`pivot`,...n,data:Array.isArray(t)?t:t?.items||[]}}return{...e,...n}},[]);return(0,Q.jsxs)(`div`,{ref:s,className:R(`w-full`,t),"data-testid":`grid-layout`,children:[p&&(0,Q.jsx)(pr,{editMode:l}),(0,Q.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,Q.jsx)(`h2`,{className:`text-2xl font-bold`,children:e.title||`Dashboard`}),(0,Q.jsx)(`div`,{className:`flex gap-2`,children:l?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(K,{onClick:b,size:`sm`,variant:`default`,children:[(0,Q.jsx)(Y,{className:`h-4 w-4 mr-2`}),`Save Layout`]}),(0,Q.jsxs)(K,{onClick:S,size:`sm`,variant:`outline`,children:[(0,Q.jsx)(B,{className:`h-4 w-4 mr-2`}),`Reset`]}),(0,Q.jsx)(K,{onClick:()=>u(!1),size:`sm`,variant:`ghost`,children:`Cancel`})]}):(0,Q.jsxs)(Q.Fragment,{children:[i&&(0,Q.jsxs)(K,{onClick:h,size:`sm`,variant:`outline`,disabled:d,"aria-label":`Refresh dashboard`,children:[(0,Q.jsx)(w,{className:R(`h-4 w-4 mr-2`,d&&`animate-spin`)}),d?`Refreshing…`:`Refresh All`]}),(0,Q.jsxs)(K,{onClick:()=>u(!0),size:`sm`,variant:`outline`,children:[(0,Q.jsx)(J,{className:`h-4 w-4 mr-2`}),`Edit Layout`]})]})})]}),c&&(0,Q.jsx)(fr,{className:`layout`,width:a,layouts:g,breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},rowHeight:60,dragConfig:{enabled:l,handle:`.drag-handle`},resizeConfig:{enabled:l},onLayoutChange:y,children:e.widgets?.map((e,t)=>{let n=e.id||`widget-${t}`,r=C(e);return(0,Q.jsx)(`div`,{className:`h-full`,children:e.type===`metric`?(0,Q.jsxs)(`div`,{className:`h-full w-full relative`,children:[l&&(0,Q.jsx)(`div`,{className:`drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border`,children:(0,Q.jsx)(I,{className:`h-4 w-4`})}),(0,Q.jsx)(o,{schema:r,className:`h-full w-full`})]}):(0,Q.jsxs)(j,{className:R(`h-full overflow-hidden border-border/50 shadow-sm transition-all`,`bg-card/50 backdrop-blur-sm`,l&&`ring-2 ring-primary/20`),children:[e.title&&(0,Q.jsxs)(te,{className:`pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between`,children:[(0,Q.jsx)(L,{className:`text-base font-medium tracking-tight truncate`,title:e.title,children:e.title}),l&&(0,Q.jsx)(`div`,{className:`drag-handle cursor-move p-1 hover:bg-muted/40 rounded`,children:(0,Q.jsx)(I,{className:`h-4 w-4`})})]}),(0,Q.jsx)(ne,{className:`p-0 h-full`,children:(0,Q.jsx)(`div`,{className:R(`h-full w-full overflow-auto p-4`),children:(0,Q.jsx)(o,{schema:r})})})]})},n)})})]})},vr=v({"dashboard.trend.vsLastQuarter":`vs last quarter`,"dashboard.trend.vsLastMonth":`vs last month`,"dashboard.trend.vsLastWeek":`vs last week`,"dashboard.trend.vsLastYear":`vs last year`,"dashboard.trend.vsYesterday":`vs yesterday`,"dashboard.trend.vsPreviousPeriod":`vs previous period`},`dashboard.trend.vsLastQuarter`);function yr(e){switch(e.trim().toLowerCase().replace(/\s+/g,` `)){case`vs last quarter`:case`vs previous quarter`:return`dashboard.trend.vsLastQuarter`;case`vs last month`:case`vs previous month`:return`dashboard.trend.vsLastMonth`;case`vs last week`:case`vs previous week`:return`dashboard.trend.vsLastWeek`;case`vs last year`:case`vs previous year`:return`dashboard.trend.vsLastYear`;case`vs yesterday`:return`dashboard.trend.vsYesterday`;case`vs previous period`:case`vs prior period`:return`dashboard.trend.vsPreviousPeriod`;default:return}}function br(e,t,n){if(e==null)return``;if(typeof e==`string`){let r=Number(e);return!isFinite(r)||e.trim()===``?e:br(r,t,n)}if(!isFinite(e))return String(e);let r={$:`USD`,"¥":`JPY`,"€":`EUR`,"£":`GBP`},i=(t||``).trim(),a=!!n||i.length>0&&r[i[0]]!==void 0,o=i.endsWith(`%`),s=i.match(/0\.(0+)/),c=s?s[1].length:0;if(a){let t=n||r[i[0]]||`USD`;try{return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:t,minimumFractionDigits:c,maximumFractionDigits:c}).format(e)}catch{return`${t} ${e.toFixed(c)}`}}return o?`${(e>1?e:e*100).toFixed(c)}%`:new Intl.NumberFormat(`en-US`,{minimumFractionDigits:c,maximumFractionDigits:c}).format(e)}function xr(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var Sr={default:`bg-muted text-muted-foreground`,blue:`bg-blue-500/10 text-blue-600 dark:text-blue-400`,teal:`bg-teal-500/10 text-teal-600 dark:text-teal-400`,orange:`bg-orange-500/10 text-orange-600 dark:text-orange-400`,purple:`bg-purple-500/10 text-purple-600 dark:text-purple-400`,success:`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,warning:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,danger:`bg-rose-500/10 text-rose-600 dark:text-rose-400`},Cr=({label:e,value:t,trend:n,icon:r,className:i,description:a,loading:o,error:s,colorVariant:c=`default`,format:l,currency:u,prefix:d,suffix:f,onClick:p,...m})=>{let h=Sr[c]||Sr.default,{t:g}=vr(),_=(0,Z.useMemo)(()=>{let e=xr(a)||xr(n?.label);if(!e)return e;let t=yr(e);return t?g(t):e},[a,n?.label,g]),v=(0,Z.useMemo)(()=>{let e=typeof t==`number`||typeof t==`string`&&t.trim()!==``&&isFinite(Number(t))?br(t,l,u):t??``,n=String(e);return`${d&&n.startsWith(d)?``:d??``}${n}${f&&n.endsWith(f)?``:f??``}`},[t,l,u,d,f]),y=(0,Z.useMemo)(()=>{if(typeof r==`string`){let e=se(r);return e?(0,Q.jsx)(e,{className:`h-4 w-4`}):null}return r},[r]);return(0,Q.jsxs)(j,{className:R(`h-full overflow-hidden`,p&&`cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,i),onClick:p,role:p?`button`:void 0,tabIndex:p?0:void 0,onKeyDown:p?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),p())}:void 0,...m,children:[(0,Q.jsxs)(te,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,Q.jsx)(L,{className:`text-sm font-medium truncate`,children:xr(e)}),y&&(0,Q.jsx)(`div`,{className:R(`flex h-8 w-8 items-center justify-center rounded-md shrink-0`,h),children:y})]}),(0,Q.jsx)(ne,{children:o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,"data-testid":`metric-loading`,children:[(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):s?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`metric-error`,role:`alert`,children:[(0,Q.jsx)(W,{className:`h-4 w-4 text-destructive shrink-0`}),(0,Q.jsx)(`span`,{className:`text-xs text-destructive truncate`,children:s})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`text-2xl font-bold truncate`,children:v}),(n||a)&&(0,Q.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0`,children:[n&&(0,Q.jsxs)(`span`,{className:R(`flex items-center shrink-0 font-medium`,n.direction===`up`&&`text-emerald-600 dark:text-emerald-400`,n.direction===`down`&&`text-rose-600 dark:text-rose-400`,n.direction===`neutral`&&`text-muted-foreground`),children:[n.direction===`up`&&(0,Q.jsx)(D,{className:`h-3 w-3 mr-1`}),n.direction===`down`&&(0,Q.jsx)(re,{className:`h-3 w-3 mr-1`}),n.direction===`neutral`&&(0,Q.jsx)(G,{className:`h-3 w-3 mr-1`}),n.value,`%`]}),(0,Q.jsx)(`span`,{className:`truncate min-w-0`,children:_})]})]})})]})};function wr(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var Tr=({title:e,value:t,icon:n,trend:r,trendValue:i,description:a,className:o,loading:s,error:c,...l})=>{let u=n?se(n):null;return(0,Q.jsxs)(j,{className:R(`h-full`,o),...l,children:[(0,Q.jsxs)(te,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,Q.jsx)(L,{className:`text-sm font-medium`,children:wr(e)}),u&&(0,Q.jsx)(u,{className:`h-4 w-4 text-muted-foreground`})]}),(0,Q.jsx)(ne,{children:s?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,"data-testid":`metric-card-loading`,children:[(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):c?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`metric-card-error`,role:`alert`,children:[(0,Q.jsx)(W,{className:`h-4 w-4 text-destructive shrink-0`}),(0,Q.jsx)(`span`,{className:`text-xs text-destructive truncate`,children:c})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`text-2xl font-bold`,children:t}),(r||i||a)&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center mt-1`,children:[r&&i&&(0,Q.jsxs)(`span`,{className:R(`flex items-center mr-2`,r===`up`&&`text-green-500`,r===`down`&&`text-red-500`,r===`neutral`&&`text-yellow-500`),children:[r===`up`&&(0,Q.jsx)(D,{className:`h-3 w-3 mr-1`}),r===`down`&&(0,Q.jsx)(re,{className:`h-3 w-3 mr-1`}),r===`neutral`&&(0,Q.jsx)(G,{className:`h-3 w-3 mr-1`}),i]}),wr(a)]})]})})]})},Er=({objectName:e,aggregate:t,filter:n,label:r,fallbackValue:i,trend:a,icon:s,className:d,description:p,dataSource:h,colorVariant:_,format:v,currency:y,prefix:b,suffix:x,invert:S,drillDown:C,title:w,compareTo:T,t:D})=>{let O=(0,Z.useContext)(c),j=h||O?.dataSource,[M,te]=(0,Z.useState)(!1),[P,ne]=(0,Z.useState)(null),[re,F]=(0,Z.useState)(null),[I,oe]=(0,Z.useState)(!1),[se,L]=(0,Z.useState)(null),[R,z]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{let t=!0;if(!(!j||!e||typeof j.getObjectSchema!=`function`))return j.getObjectSchema(e).then(e=>{t&&z(e)}).catch(()=>{}),()=>{t=!1}},[j,e]);let B=(0,Z.useMemo)(()=>{let e=t?.field;if(!e||!R?.fields)return null;let n=R.fields;return Array.isArray(n)?n.find(t=>t?.name===e)||null:n[e]||null},[R,t?.field]),ce=(0,Z.useMemo)(()=>{if(v)return v;if(B){if(B.type===`currency`){let e=B.precision??B.scale??0;return e>0?`0,0.${`0`.repeat(e)}`:`0,0`}if(B.type===`percent`)return`0,0%`;if(B.type===`number`||B.type===`integer`)return`0,0`}},[v,B]),le=(0,Z.useMemo)(()=>{if(y)return y;if(B?.type===`currency`)return B.defaultCurrency||B.currency||void 0},[y,B]),V=(0,Z.useMemo)(()=>t?JSON.stringify(t):``,[t]),H=(0,Z.useMemo)(()=>l(n),[n]),ue=(0,Z.useMemo)(()=>H?JSON.stringify(H):``,[H]),de=(0,Z.useMemo)(()=>T?JSON.stringify(T):``,[T]),U=(0,Z.useCallback)(async(n,r)=>{if(t&&typeof n.aggregate==`function`){let i=await n.aggregate(e,{field:t.field,function:t.function,groupBy:t.groupBy||`_all`,filter:r}),a=Array.isArray(i)?i:[];if(a.length===0)return 0;if(t.function===`count`){let e=`${t.field}_count`;return a.reduce((n,r)=>n+(Number(r[e])||Number(r[t.field])||Number(r.count)||0),0)}let o=a[0];return o[`${t.field}_${t.function}`]??o[t.field]??o.value??0}if(typeof n.find==`function`){let t=await n.find(e,{$filter:r});return(Array.isArray(t)?t:t?.data||t?.records||[]).length}return null},[e,V]),W=(0,Z.useCallback)(async(t,r)=>{if(!(!t||!e)){r.current&&(oe(!0),L(null));try{let e=T?g(n,T):null,[i,a]=await Promise.all([U(t,H),e?U(t,e):Promise.resolve(null)]);if(i===null)return;r.current&&(ne(i),F(typeof a==`number`&&Number.isFinite(a)?a:null))}catch(e){console.error(`[ObjectMetricWidget] Fetch error:`,e),r.current&&L(e instanceof Error?e.message:`Failed to load metric`)}finally{r.current&&oe(!1)}}},[e,V,ue,de,U]);(0,Z.useEffect)(()=>{let t={current:!0};return j&&e?W(j,t):(ne(null),L(null)),()=>{t.current=!1}},[j,e,W]);let G=P===null?j?`—`:i??`—`:P;S&&typeof G==`number`&&isFinite(G)&&G>=0&&G<=1&&(G=1-G);let K=(0,Z.useMemo)(()=>{if(!T||typeof P!=`number`||!Number.isFinite(P)||re===null)return;let e=Oe(P,re);if(!e)return;let t=u(T,n),r=`dashboard.trend.${t}`,i={vsPreviousPeriod:`vs previous period`,vsLastWeek:`vs last week`,vsLastMonth:`vs last month`,vsLastQuarter:`vs last quarter`,vsLastYear:`vs last year`,vsYesterday:`vs yesterday`},a=D?D(r,i[t]||t):i[t]||t;return{value:e.value,direction:e.direction,label:a}},[T,P,re,n,D])??a,q=f(C)&&!!e&&!!j,fe=(0,Z.useMemo)(()=>{let e=typeof r==`string`?r:r?.defaultValue||``;return m(C,{},(typeof w==`string`?w:w?.defaultValue||``)||e||`Details`)},[C,r,w]),J=(0,Z.useMemo)(()=>{if(!q)return null;let t=C?.target??`drawer`,n=C?.report,r=n&&typeof n==`object`&&(Array.isArray(n.columns)||`objectName`in n),i;if(r){let e=n.filter,t=e?H?{$and:[e,H]}:e:H;i=(0,Q.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,Q.jsx)(o,{schema:{type:`spec-report`,...n,filter:t}})})}else i=(0,Q.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,Q.jsx)(o,{schema:{type:`object-data-table`,objectName:e,filter:H,pageSize:25,drillDown:{enabled:!1}}})});return t===`dialog`?(0,Q.jsx)(k,{open:!0,onOpenChange:e=>!e&&te(!1),children:(0,Q.jsxs)(N,{className:`max-w-5xl`,children:[(0,Q.jsx)(X,{children:(0,Q.jsx)(E,{children:fe})}),i]})}):(0,Q.jsx)(ie,{open:!0,onOpenChange:e=>!e&&te(!1),children:(0,Q.jsxs)(ae,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col`,children:[(0,Q.jsx)(A,{children:(0,Q.jsx)(ee,{children:fe})}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:i})]})})},[q,C,e,H,fe]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Cr,{label:r,value:G,trend:K,icon:s,className:d,description:p,loading:I,error:se,colorVariant:_,format:ce,currency:le,prefix:b,suffix:x,onClick:q?()=>te(!0):void 0}),M&&J]})};function Dr(){try{let{t:e}=_(),t=e(`dashboard.total`);return!t||t===`dashboard.total`?`Total`:t}catch{return`Total`}}function Or(){try{let{t:e}=_(),t=e(`dashboard.noDataAvailable`);return!t||t===`dashboard.noDataAvailable`?`No data available`:t}catch{return`No data available`}}function kr(e,t){if(!t)return String(e);let n=``,r=``,i=!1,a,o=t,s=o.match(/^([^0-9.,#]*)/);if(s&&s[1]){let e=s[1];n=e.replace(`,`,``),e.includes(`,`)&&(i=!0),o=o.slice(s[1].length)}o.includes(`,`)&&(i=!0,o=o.replace(/,/g,``));let c=o.match(/\.(\d+)f?/);c&&(a=Number(c[1]),o=o.slice(c[0].length)),r=o.replace(/[0-9#.f]/g,``);let l=a===void 0?String(e):e.toFixed(a);if(i){let[e,t]=l.split(`.`),i=e.replace(/\B(?=(\d{3})+(?!\d))/g,`,`);return n+(t===void 0?i:`${i}.${t}`)+r}return n+l+r}var Ar=`—`;function jr(e,t){return e===``?Ar:t?.[e]??e}function Mr(e,t){if(e.length===0)return 0;switch(t){case`sum`:return e.reduce((e,t)=>e+t,0);case`count`:return e.length;case`avg`:return e.reduce((e,t)=>e+t,0)/e.length;case`min`:return Math.min(...e);case`max`:return Math.max(...e);default:return e.reduce((e,t)=>e+t,0)}}var Nr=({schema:e,className:t,rowLabels:n,columnLabels:r,rowFieldLabel:i,onDrillDown:a})=>{let{title:o,rowField:s,columnField:c,valueField:l,aggregation:u=`sum`,data:d=[],showRowTotals:p=!1,showColumnTotals:m=!1,format:h,columnColors:g,drillDown:_}=e,v=Dr(),y=Or(),b=f(_)&&typeof a==`function`,x=e=>{b&&a({...e,rowLabel:e.rowKey===void 0?e.rowLabel:n?.[e.rowKey]??e.rowKey,colLabel:e.colKey===void 0?e.colLabel:r?.[e.colKey]??e.colKey})},S=e=>t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())},w=b?`cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]`:``,T=Array.isArray(d)?d:[],{rowKeys:E,colKeys:D,matrix:O,rowTotals:k,colTotals:A,grandTotal:j}=(0,Z.useMemo)(()=>{let e=new Map,t=new Map,n={};for(let r of T){let i=String(r[s]??``),a=String(r[c]??``),o=Number(r[l])||0;e.set(i,!0),t.set(a,!0),n[i]||(n[i]={}),n[i][a]||(n[i][a]=[]),n[i][a].push(o)}let r=Array.from(e.keys()),i=Array.from(t.keys()),a={},o={},d={};for(let e of r){a[e]={};let t=[];for(let r of i){let i=n[e]?.[r]??[],o=Mr(i,u);a[e][r]=o,t.push(...i),!d[r]&&d[r]}o[e]=Mr(t,u)}for(let e of i){let t=[];for(let i of r){let r=n[i]?.[e]??[];t.push(...r)}d[e]=Mr(t,u)}let f=[];for(let e of T)f.push(Number(e[l])||0);return{rowKeys:r,colKeys:i,matrix:a,rowTotals:o,colTotals:d,grandTotal:Mr(f,u)}},[T,s,c,l,u]),M=e=>kr(e,h);return T.length===0?(0,Q.jsxs)(`div`,{className:R(`overflow-auto`,t),children:[o&&(0,Q.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:o}),(0,Q.jsx)(C,{"data-testid":`pivot-empty-state`,className:`py-8 gap-2 [&>h3]:hidden`,icon:(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 opacity-40`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Q.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`}),(0,Q.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`}),(0,Q.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`}),(0,Q.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`})]}),iconWrapperClassName:``,title:``,description:y})]}):(0,Q.jsxs)(`div`,{className:R(`overflow-auto`,t),children:[o&&(0,Q.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:o}),(0,Q.jsxs)(`table`,{className:`w-full text-sm border-collapse table-auto`,role:`table`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,Q.jsx)(`th`,{className:`text-left p-2 font-medium text-muted-foreground whitespace-nowrap`,children:i||s}),D.map(e=>{let t=()=>x({scope:`column`,colKey:e});return(0,Q.jsx)(`th`,{className:R(`text-right p-2 font-medium whitespace-nowrap`,e===``&&`italic text-muted-foreground/70`,g?.[e]??`text-muted-foreground`,w),title:e===``?`${c}: (empty)`:`${c}: ${e}`,role:b?`button`:void 0,tabIndex:b?0:void 0,onClick:b?t:void 0,onKeyDown:b?S(t):void 0,"aria-label":b?`Drill into ${c}: ${e||`(empty)`}`:void 0,children:jr(e,r)},e)}),p&&(0,Q.jsx)(`th`,{className:`text-right p-2 font-semibold text-muted-foreground bg-muted/20 whitespace-nowrap`,children:v})]})}),(0,Q.jsx)(`tbody`,{children:E.map(e=>(0,Q.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/30`,children:[(0,Q.jsx)(`td`,{className:R(`p-2 font-medium whitespace-nowrap`,e===``&&`italic text-muted-foreground/70`,w),role:b?`button`:void 0,tabIndex:b?0:void 0,onClick:b?()=>x({scope:`row`,rowKey:e}):void 0,onKeyDown:b?S(()=>x({scope:`row`,rowKey:e})):void 0,"aria-label":b?`Drill into ${s}: ${e||`(empty)`}`:void 0,children:jr(e,n)}),D.map(t=>{let n=O[e]?.[t]??0,r=()=>x({scope:`cell`,rowKey:e,colKey:t,value:n});return(0,Q.jsx)(`td`,{className:R(`text-right p-2 tabular-nums`,g?.[t],w),role:b?`button`:void 0,tabIndex:b?0:void 0,onClick:b?r:void 0,onKeyDown:b?S(r):void 0,"aria-label":b?`Drill into ${s}=${e||`(empty)`}, ${c}=${t||`(empty)`}`:void 0,children:M(n)},t)}),p&&(0,Q.jsx)(`td`,{className:R(`text-right p-2 font-semibold tabular-nums bg-muted/20`,w),role:b?`button`:void 0,tabIndex:b?0:void 0,onClick:b?()=>x({scope:`row`,rowKey:e,value:k[e]??0}):void 0,onKeyDown:b?S(()=>x({scope:`row`,rowKey:e,value:k[e]??0})):void 0,children:M(k[e]??0)})]},e))}),m&&(0,Q.jsx)(`tfoot`,{children:(0,Q.jsxs)(`tr`,{className:`border-t-2 border-border font-semibold bg-muted/40`,children:[(0,Q.jsx)(`td`,{className:`p-2`,children:v}),D.map(e=>(0,Q.jsx)(`td`,{className:R(`text-right p-2 tabular-nums`,w),role:b?`button`:void 0,tabIndex:b?0:void 0,onClick:b?()=>x({scope:`column`,colKey:e,value:A[e]??0}):void 0,onKeyDown:b?S(()=>x({scope:`column`,colKey:e,value:A[e]??0})):void 0,children:M(A[e]??0)},e)),p&&(0,Q.jsx)(`td`,{className:R(`text-right p-2 tabular-nums font-bold`,w),role:b?`button`:void 0,tabIndex:b?0:void 0,onClick:b?()=>x({scope:`total`,value:j}):void 0,onKeyDown:b?S(()=>x({scope:`total`,value:j})):void 0,children:M(j)})]})})]})]})};function Pr(e){return e.map(e=>typeof e==`string`?{header:e.replace(/_/g,` `).replace(/([A-Z])/g,` $1`).trim().replace(/\b\w/g,e=>e.toUpperCase()),accessorKey:e}:e)}function Fr(e,t){if(!t?.fields)return[];let n={};if(Array.isArray(t.fields))for(let e of t.fields)e?.name&&(n[e.name]=e);else for(let[e,r]of Object.entries(t.fields))n[e]={name:e,...r};let r=e=>e===`lookup`||e===`reference`||e===`master_detail`||e===`user`||e===`owner`,i=Array.isArray(e.columns)?e.columns:[],a=new Set;if(i.length>0){let e=i.map(e=>typeof e==`string`?e:e.accessorKey||e.name).filter(Boolean);for(let t of e){let e=n[t];e&&r(e.type)&&a.add(t)}}else for(let[e,t]of Object.entries(n))r(t?.type)&&a.add(e);return Array.from(a)}var Ir=({schema:e,dataSource:t,className:n})=>{let r=(0,Z.useContext)(c),i=t||r?.dataSource,a=d(e.bind),{fieldLabel:s,fieldOptionLabel:u}=le(),f=`No data available`,p=`No data source available for`;try{let{t:e}=_(),t=e(`dashboard.noDataAvailable`);t&&t!==`dashboard.noDataAvailable`&&(f=t);let n=e(`dashboard.noDataSourceFor`);n&&n!==`dashboard.noDataSourceFor`&&(p=n)}catch{}let[m,h]=(0,Z.useState)([]),[g,v]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(()=>!(Array.isArray(e.data)&&e.data.length>0)&&!!e.objectName),[S,C]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{let t=!0;return e.objectName&&!a&&(!e.data||e.data.length===0)?(async()=>{if(!i||!e.objectName){t&&x(!1);return}t&&(x(!0),C(null));try{let n;if(typeof i.find==`function`){let t=Fr(e,g),r={$filter:l(e.filter)};t.length&&(r.$expand=t),n=y(await i.find(e.objectName,r))}else return;t&&h(n)}catch(e){console.error(`[ObjectDataTable] Fetch error:`,e),t&&C(e instanceof Error?e.message:`Failed to load data`)}finally{t&&x(!1)}})():t&&x(!1),()=>{t=!1}},[e.objectName,i,a,e.data,e.filter,g]),(0,Z.useEffect)(()=>{let t=!0;if(!(!i||!e.objectName||typeof i.getObjectSchema!=`function`))return i.getObjectSchema(e.objectName).then(e=>{t&&v(e)}).catch(()=>{}),()=>{t=!1}},[e.objectName,i]);let w=a||e.data||m,E=Array.isArray(w)?w:[],D=(0,Z.useMemo)(()=>{let t=e.objectName,n={};if(g?.fields){let e=g.fields;if(Array.isArray(e))for(let t of e)t?.name&&(n[t.name]=t);else for(let[t,r]of Object.entries(e))n[t]={name:t,...r}}let r=e=>{let n=e.charAt(0).toUpperCase()+e.slice(1).replace(/([A-Z])/g,` $1`);return t?s(t,e,n):n},i=e=>{let r=n[e.accessorKey],i=e.referenceTo??r?.referenceTo??(typeof r?.reference==`string`?r.reference:r?.reference?.to)??r?.target,a=e.options??r?.options;t&&a&&(r?.type===`select`||r?.type===`picklist`||r?.type===`dropdown`||r?.type===`status`)&&(a=a.map(n=>{if(n==null)return n;let r=typeof n==`object`?n.value:n,i=typeof n==`object`&&n.label||String(r);return{value:r,label:u(t,e.accessorKey,String(r),i),color:typeof n==`object`?n.color:void 0}}));let o={name:e.accessorKey,label:e.header,type:e.type??r?.type,options:a,referenceTo:i,format:e.format??r?.format,currency:e.currency??r?.currency??r?.defaultCurrency,decimals:e.decimals??r?.decimals??r?.precision??r?.scale},s=new Set([`currency`,`money`,`number`,`integer`,`decimal`,`float`,`percent`,`percentage`]),c=e.align??(s.has(o.type)||typeof o.format==`string`&&/^[\$¥€£]|%$|0/.test(o.format)?`right`:void 0);if(typeof e.cell==`function`)return{...e,...o,align:c};let l=e=>{if(e==null||e===``)return``;let t=o.format;if(typeof t==`string`&&/^\$|¥|€|£/.test(t)&&typeof e==`number`){let n={$:`USD`,"¥":`JPY`,"€":`EUR`,"£":`GBP`}[t[0]];return H(e,o.currency||n)}if(typeof t==`string`&&/%/.test(t)&&typeof e==`number`){let n=(t.match(/0\.(0+)%/)||[,``])[1].length;return fe((e>1?e/100:e)*100,n)}return typeof t==`string`&&/[YMDHms]/.test(t)?z(e,t):(0,Q.jsx)(de(U(o)),{value:e,field:o})};return{...e,...o,align:c,cell:l}};if(e.columns&&e.columns.length>0){let n=Pr(e.columns);return(t?n.map(e=>({...e,header:s(t,e.accessorKey,e.header)})):n).map(i)}if(E.length===0)return[];let a=new Set([`id`,`organization_id`,`tenant_id`,`created_at`,`updated_at`,`created_by`,`updated_by`,`deleted_at`,`deleted_by`,`version`,`_id`,`__typename`]),o=(e,t)=>t&&(t.isSystem===!0||t.system===!0)?!0:a.has(e);return(Object.keys(n).length>0?Object.keys(n).filter(e=>!o(e,n[e])):Object.keys(E[0]).filter(e=>!e.startsWith(`_`)&&!o(e))).map(e=>i({header:r(e),accessorKey:e}))},[e.columns,e.objectName,E,g,s,u]);if(b&&E.length===0)return(0,Q.jsx)(`div`,{className:R(`overflow-auto`,n),"data-testid":`table-loading`,children:(0,Q.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(T,{className:`h-6 w-1/4`}),(0,Q.jsx)(T,{className:`h-6 w-1/4`}),(0,Q.jsx)(T,{className:`h-6 w-1/4`}),(0,Q.jsx)(T,{className:`h-6 w-1/4`})]}),[1,2,3,4].map(e=>(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(T,{className:`h-5 w-1/4`}),(0,Q.jsx)(T,{className:`h-5 w-1/4`}),(0,Q.jsx)(T,{className:`h-5 w-1/4`}),(0,Q.jsx)(T,{className:`h-5 w-1/4`})]},e))]})});if(S)return(0,Q.jsx)(`div`,{className:R(`overflow-auto`,n),"data-testid":`table-error`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`table-error-message`,children:[(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-60`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Q.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,Q.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,Q.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,Q.jsx)(`p`,{className:`text-xs`,children:S})]})});if(!i&&e.objectName&&E.length===0)return(0,Q.jsx)(`div`,{className:R(`overflow-auto`,n),children:(0,Q.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,Q.jsxs)(`p`,{className:`text-xs`,children:[p,` “`,e.objectName,`”`]})})});if(E.length===0)return(0,Q.jsx)(`div`,{className:R(`overflow-auto`,n),"data-testid":`table-empty-state`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:[(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-40`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Q.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,Q.jsx)(`line`,{x1:`3`,y1:`9`,x2:`21`,y2:`9`}),(0,Q.jsx)(`line`,{x1:`9`,y1:`21`,x2:`9`,y2:`9`})]}),(0,Q.jsx)(`p`,{className:`text-xs`,children:f})]})});let O={...e,type:`data-table`,data:E,columns:D};return(0,Q.jsxs)(`div`,{className:R(`relative`,n),children:[(0,Q.jsx)(ue,{active:b&&E.length>0}),(0,Q.jsx)(o,{schema:O,className:n})]})},Lr=({open:e,onClose:t,title:n,target:r=`drawer`,objectName:i,filter:a,dataSource:s,columns:c,maxRows:l,className:u,report:d})=>{let f=d&&typeof d==`object`&&(Array.isArray(d.columns)||`objectName`in d),p=(0,Q.jsx)(`div`,{className:R(`overflow-auto`,u),"data-testid":`drill-down-body`,children:f?(()=>{let e=d.filter,t=e?a?{$and:[e,a]}:e:a;return(0,Q.jsx)(o,{schema:{...d,type:`spec-report`,report:{...d,filter:t},filter:t}})})():(0,Q.jsx)(Ir,{schema:{type:`object-data-table`,objectName:i,filter:a,columns:c?.map(e=>({accessorKey:e,header:e})),pagination:!0,searchable:!1,pageSize:l},dataSource:s})});return r===`dialog`?(0,Q.jsx)(k,{open:e,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(N,{className:`max-w-5xl`,children:[(0,Q.jsx)(X,{children:(0,Q.jsx)(E,{children:n})}),p]})}):(0,Q.jsx)(ie,{open:e,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(ae,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,Q.jsx)(A,{children:(0,Q.jsx)(ee,{children:n})}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:p})]})})},Rr=({schema:e,dataSource:t,className:n})=>{let r=(0,Z.useContext)(c),i=t||r?.dataSource,a=d(e.bind),[o,s]=(0,Z.useState)([]),[u,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),[v,b]=(0,Z.useState)({}),[x,S]=(0,Z.useState)({}),[C,w]=(0,Z.useState)(null),{fieldLabel:E,fieldOptionLabel:D}=le(),O=(0,Z.useRef)(E),k=(0,Z.useRef)(D);(0,Z.useEffect)(()=>{O.current=E,k.current=D},[E,D]),(0,Z.useEffect)(()=>{if(!i||!e.objectName)return;let t=i.getObjectSchema;if(typeof t!=`function`)return;let n=!0;return Promise.resolve(t.call(i,e.objectName)).then(t=>{if(!n||!t?.fields)return;let r=e.objectName,i={},a={};for(let[e,n]of Object.entries(t.fields)){let t=n?.label?String(n.label):e;a[e]=O.current(r,e,t);let o=n?.options;if(Array.isArray(o)&&o.length>0){let t={};for(let n of o)if(n&&n.value!==void 0&&n.label!==void 0){let i=String(n.value),a=String(n.label);t[i]=k.current(r,e,i,a)}Object.keys(t).length>0&&(i[e]=t)}}b(i),S(a)}).catch(()=>{}),()=>{n=!1}},[i,e.objectName]),(0,Z.useEffect)(()=>{let t=!0;return e.objectName&&!a&&(!e.data||e.data.length===0)&&(async()=>{if(!(!i||!e.objectName)){t&&(h(!0),_(null));try{let n;if(typeof i.find==`function`)n=y(await i.find(e.objectName,{$filter:l(e.filter)}));else return;t&&s(n)}catch(e){console.error(`[ObjectPivotTable] Fetch error:`,e),t&&_(e instanceof Error?e.message:`Failed to load data`)}finally{t&&h(!1)}}})(),()=>{t=!1}},[e.objectName,i,a,e.data,e.filter]);let A=a||e.data||o,j=Array.isArray(A)?A:[];if(u&&j.length===0)return(0,Q.jsxs)(`div`,{className:R(`overflow-auto`,n),"data-testid":`pivot-loading`,children:[e.title&&(0,Q.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,Q.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(T,{className:`h-6 w-24`}),(0,Q.jsx)(T,{className:`h-6 w-20`}),(0,Q.jsx)(T,{className:`h-6 w-20`}),(0,Q.jsx)(T,{className:`h-6 w-20`})]}),[1,2,3].map(e=>(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(T,{className:`h-5 w-24`}),(0,Q.jsx)(T,{className:`h-5 w-20`}),(0,Q.jsx)(T,{className:`h-5 w-20`}),(0,Q.jsx)(T,{className:`h-5 w-20`})]},e))]})]});if(g)return(0,Q.jsxs)(`div`,{className:R(`overflow-auto`,n),"data-testid":`pivot-error`,children:[e.title&&(0,Q.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`pivot-error-message`,children:[(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-60`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Q.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,Q.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,Q.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,Q.jsx)(`p`,{className:`text-xs`,children:g})]})]});if(!i&&e.objectName&&j.length===0)return(0,Q.jsxs)(`div`,{className:R(`overflow-auto`,n),children:[e.title&&(0,Q.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,Q.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,Q.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})]});let M={...e,data:j},N=e.rowField?v[e.rowField]:void 0,ee=e.columnField?v[e.columnField]:void 0,te=e.rowField?x[e.rowField]:void 0,P=e.drillDown,ne=f(P)?e=>w(e):void 0;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Nr,{schema:M,className:n,rowLabels:N,columnLabels:ee,rowFieldLabel:te,onDrillDown:ne}),(()=>{if(!C||!e.objectName)return null;let t=p(P,C,{rowField:e.rowField,columnField:e.columnField}),n={...e.filter||{},...t};return(0,Q.jsx)(Lr,{open:!0,onClose:()=>w(null),title:m(P,C,e.title||`Details`),target:P?.target??`drawer`,objectName:e.objectName,filter:n,dataSource:i,columns:P?.columns,maxRows:P?.maxRows,report:P?.report})})()]})},zr={breadcrumb:[`Dashboard`,`Configuration`],sections:[{key:`layout`,title:`Layout`,collapsible:!0,fields:[{key:`columns`,label:`Columns`,type:`slider`,defaultValue:3,min:1,max:12,step:1},{key:`gap`,label:`Gap`,type:`slider`,defaultValue:4,min:0,max:16,step:1},{key:`rowHeight`,label:`Row height (px)`,type:`slider`,defaultValue:120,min:40,max:320,step:10}]},{key:`data`,title:`Data`,collapsible:!0,fields:[{key:`refreshInterval`,label:`Auto refresh`,type:`select`,defaultValue:`0`,options:[{value:`0`,label:`Off`},{value:`30`,label:`Every 30s`},{value:`60`,label:`Every 1 min`},{value:`300`,label:`Every 5 min`},{value:`900`,label:`Every 15 min`},{value:`1800`,label:`Every 30 min`},{value:`3600`,label:`Every 1 hour`}]}]},{key:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`title`,label:`Title`,type:`input`,placeholder:`Dashboard title`},{key:`description`,label:`Description`,type:`textarea`,placeholder:`Short summary shown under the title`},{key:`showDescription`,label:`Show description`,type:`switch`,defaultValue:!0},{key:`theme`,label:`Theme`,type:`select`,defaultValue:`auto`,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`auto`,label:`Auto`}]}]}]};function Br({open:e,onClose:t,config:n,onSave:r,onFieldChange:i}){let{draft:a,isDirty:o,updateField:s,discard:c}=oe(n,{onUpdate:i});return(0,Q.jsx)(M,{open:e,onClose:t,schema:zr,draft:a,isDirty:o,onFieldChange:s,onSave:()=>r(a),onDiscard:c})}var Vr=[{value:`metric`,label:`Metric`},{value:`bar`,label:`Bar Chart`},{value:`horizontal-bar`,label:`Horizontal Bar`},{value:`line`,label:`Line Chart`},{value:`pie`,label:`Pie Chart`},{value:`donut`,label:`Donut Chart`},{value:`area`,label:`Area Chart`},{value:`scatter`,label:`Scatter Plot`},{value:`funnel`,label:`Funnel`},{value:`table`,label:`Table`},{value:`pivot`,label:`Pivot Table`}],Hr=[{value:`default`,label:`Default`},{value:`blue`,label:`Blue`},{value:`teal`,label:`Teal`},{value:`orange`,label:`Orange`},{value:`purple`,label:`Purple`},{value:`success`,label:`Success`},{value:`warning`,label:`Warning`},{value:`danger`,label:`Danger`}],Ur=[{value:`count`,label:`Count`},{value:`sum`,label:`Sum`},{value:`avg`,label:`Average`},{value:`min`,label:`Min`},{value:`max`,label:`Max`}],Wr=[`bar`,`horizontal-bar`,`line`,`area`,`pie`,`donut`,`scatter`,`funnel`],Gr=[`bar`,`horizontal-bar`,`line`,`area`,`scatter`],Kr=[`pie`,`donut`,`funnel`],qr=[`metric`,...Wr],Jr=[...Wr],Yr=[`pivot`,`metric`,`bar`,`horizontal-bar`,`line`,`area`,`pie`,`donut`,`funnel`];function Xr(e){return!!e&&Wr.includes(e)}function Zr(e){return!!e&&Gr.includes(e)}function Qr(e){return!!e&&Jr.includes(e)}function $r(e){return!!e&&qr.includes(e)}function ei(e){return!!e&&Yr.includes(e)}var ti=[{value:`drawer`,label:`Side drawer`},{value:`dialog`,label:`Center dialog`}],ni=[{value:`group`,label:`Group`},{value:`value`,label:`Value`}],ri=[{value:`asc`,label:`↑`},{value:`desc`,label:`↓`}];function ii(e,t,n,r){return{key:e,label:t,type:`custom`,render:(i,a,o)=>(0,Q.jsx)(P,{label:t,children:(0,Q.jsx)(`div`,{"data-testid":`config-field-${e}`,children:(0,Q.jsx)(q,{options:r??[],value:i??``,onValueChange:a,placeholder:n,searchPlaceholder:`Search fields…`,emptyText:`No fields found.`,className:`h-7 w-32 text-xs`,disabled:!o.object})})})}}function ai(e,t,n){let r=e&&e.length>0,i=r?{key:`object`,label:`Data source`,type:`custom`,render:(t,n)=>(0,Q.jsx)(P,{label:`Data source`,children:(0,Q.jsx)(`div`,{"data-testid":`config-field-object`,children:(0,Q.jsx)(q,{options:e,value:t??``,onValueChange:n,placeholder:`Select object…`,searchPlaceholder:`Search objects…`,emptyText:`No objects found.`,className:`h-7 w-32 text-xs`})})})}:{key:`object`,label:`Data source`,type:`input`,placeholder:`Object name`},a=r?{...ii(`categoryField`,`Category field`,`Select field…`,t),helpText:`Group records by this field (one bar/slice/segment per value).`,visibleWhen:e=>Qr(e.type)}:{key:`categoryField`,label:`Category field`,type:`input`,placeholder:`e.g. status`,helpText:`Group records by this field (one bar/slice/segment per value).`,visibleWhen:e=>Qr(e.type)},o=r?{...ii(`valueField`,`Value field`,`Select field…`,t),helpText:`Field to aggregate (sum / average / min / max).`,visibleWhen:e=>$r(e.type)&&(e.aggregate??`count`)!==`count`}:{key:`valueField`,label:`Value field`,type:`input`,placeholder:`e.g. amount`,helpText:`Field to aggregate (sum / average / min / max).`,visibleWhen:e=>$r(e.type)&&(e.aggregate??`count`)!==`count`},s=r?ii(`rowField`,`Field`,`Select row field…`,t):{key:`rowField`,label:`Field`,type:`input`,placeholder:`e.g. owner`},c=r?ii(`columnField`,`Field`,`Select column field…`,t):{key:`columnField`,label:`Field`,type:`input`,placeholder:`e.g. stage`},l=r?ii(`valueField`,`Field`,`Select value field…`,t):{key:`valueField`,label:`Field`,type:`input`,placeholder:`e.g. amount`};return{breadcrumb:[`Dashboard`,{pivot:`Pivot table`,table:`Table`}[n??``]??(Xr(n)?`Chart`:`Widget`)],sections:[{key:`general`,title:`General`,fields:[{key:`title`,label:`Title`,type:`input`,placeholder:`Widget title`},{key:`description`,label:`Description`,type:`input`,placeholder:`Widget description`},{key:`type`,label:`Widget type`,type:`select`,options:Vr,defaultValue:`metric`}]},{key:`data`,title:`Data Binding`,collapsible:!0,visibleWhen:e=>e.type!==`pivot`,fields:[i,a,o,{key:`aggregate`,label:`Aggregation`,type:`select`,options:Ur,defaultValue:`count`,helpText:`Count ignores Value field; Sum / Avg / Min / Max require it.`,visibleWhen:e=>$r(e.type)}]},{key:`pivot-data`,title:`Data`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[i]},{key:`pivot-rows`,title:`Rows`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[s,{key:`rowSortBy`,label:`Sort by`,type:`icon-group`,options:ni,defaultValue:`group`},{key:`rowSortOrder`,label:`Sort order`,type:`icon-group`,options:ri,defaultValue:`asc`},{key:`showRowLabels`,label:`Show label`,type:`switch`,defaultValue:!0},{key:`showRowTotals`,label:`Show totals`,type:`switch`,defaultValue:!1}]},{key:`pivot-columns`,title:`Columns`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[c,{key:`columnSortBy`,label:`Sort by`,type:`icon-group`,options:ni,defaultValue:`group`},{key:`columnSortOrder`,label:`Sort order`,type:`icon-group`,options:ri,defaultValue:`asc`},{key:`showColumnLabels`,label:`Show label`,type:`switch`,defaultValue:!0},{key:`showColumnTotals`,label:`Show totals`,type:`switch`,defaultValue:!1}]},{key:`pivot-values`,title:`Values`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[l,{key:`aggregation`,label:`Aggregation`,type:`select`,options:Ur,defaultValue:`sum`},{key:`format`,label:`Number format`,type:`input`,placeholder:`e.g. $,.2f`}]},{key:`chart-axis`,title:`Axis & Series`,collapsible:!0,visibleWhen:e=>Zr(e.type),fields:[{key:`xAxisLabel`,label:`X-axis label`,type:`input`,placeholder:`e.g. Month`},{key:`yAxisLabel`,label:`Y-axis label`,type:`input`,placeholder:`e.g. Revenue`},{key:`showLegend`,label:`Show legend`,type:`switch`,defaultValue:!0}]},{key:`chart-legend`,title:`Display`,collapsible:!0,visibleWhen:e=>!!e.type&&Kr.includes(e.type),fields:[{key:`showLegend`,label:`Show legend`,type:`switch`,defaultValue:!0}]},{key:`table-options`,title:`Table options`,collapsible:!0,visibleWhen:e=>e.type===`table`,fields:[{key:`searchable`,label:`Searchable`,type:`switch`,defaultValue:!1},{key:`pagination`,label:`Pagination`,type:`switch`,defaultValue:!1}]},{key:`layout`,title:`Layout`,collapsible:!0,fields:[{key:`layoutW`,label:`Width (columns)`,type:`slider`,min:1,max:12,step:1,defaultValue:1},{key:`layoutH`,label:`Height (rows)`,type:`slider`,min:1,max:6,step:1,defaultValue:1}]},{key:`drill-down`,title:`Drill-down`,collapsible:!0,defaultCollapsed:!0,visibleWhen:e=>ei(e.type),fields:[{key:`drillDownEnabled`,label:`Enable drill-down`,type:`switch`,defaultValue:!1,helpText:`When enabled, clicking a cell / segment opens a filtered list of underlying records.`},{key:`drillDownTarget`,label:`Open in`,type:`select`,options:ti,defaultValue:`drawer`,visibleWhen:e=>!!e.drillDownEnabled}]},{key:`behavior`,title:`Behavior`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`actionUrl`,label:`Click-through URL`,type:`input`,placeholder:`https://...`}]},{key:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`colorVariant`,label:`Color variant`,type:`select`,options:Hr,defaultValue:`default`}]}]}}function oi(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`object`){let t=e;return t.defaultValue||t.key||``}return String(e)}function si(e){let t=e.type,n={...e};return Qr(t)||delete n.categoryField,$r(t)?(n.aggregate??`count`)===`count`&&delete n.valueField:(delete n.valueField,delete n.aggregate),Zr(t)||(delete n.xAxisLabel,delete n.yAxisLabel),t===`pivot`?(delete n.aggregate,delete n.categoryField):(delete n.rowField,delete n.columnField,delete n.aggregation,delete n.rowSortBy,delete n.rowSortOrder,delete n.columnSortBy,delete n.columnSortOrder,delete n.showRowLabels,delete n.showRowTotals,delete n.showColumnLabels,delete n.showColumnTotals,delete n.format),t!==`table`&&(delete n.searchable,delete n.pagination),ei(t)||(delete n.drillDownEnabled,delete n.drillDownTarget),n}function ci({open:e,onClose:t,config:n,onSave:r,onFieldChange:i,headerExtra:a,availableObjects:o,availableFields:s}){let{draft:c,isDirty:l,updateField:u,discard:d}=oe(Z.useMemo(()=>({...n,title:typeof n.title==`object`?oi(n.title):n.title,description:typeof n.description==`object`?oi(n.description):n.description}),[n]),{onUpdate:i});return(0,Q.jsx)(M,{open:e,onClose:t,schema:Z.useMemo(()=>ai(o,s,c.type),[o,s,c.type]),draft:c,isDirty:l,onFieldChange:u,onSave:()=>r(si(c)),onDiscard:d,headerExtra:a})}function li({schema:e,config:t,onConfigSave:n,onWidgetSave:r,onRefresh:i,recordCount:a,defaultConfigOpen:o=!1,className:s}){let[c,l]=(0,Z.useState)(o),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(e),[m,h]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{p(e),h(e=>e+1)},[e]);let g=Z.useMemo(()=>{if(!u||!f.widgets)return null;let e=f.widgets.find(e=>(e.id||e.title)===u);if(!e)return null;let t=e.options||{};return{...t,id:e.id??``,title:e.title??``,description:e.description??``,type:e.type??``,object:e.object??``,categoryField:e.categoryField??t.categoryField??``,valueField:e.valueField??t.valueField??``,aggregate:e.aggregate??t.aggregate??``,colorVariant:e.colorVariant??t.colorVariant??`default`,actionUrl:e.actionUrl??t.actionUrl??``,drillDownEnabled:t.drillDown?.enabled??!!(e.object&&(e.type===`pivot`||e.type===`metric`||e.type===`bar`||e.type===`horizontal-bar`||e.type===`line`||e.type===`area`||e.type===`pie`||e.type===`donut`||e.type===`funnel`)),drillDownTarget:t.drillDown?.target??`drawer`,layoutW:e.layout?.w??1,layoutH:e.layout?.h??1}},[u,m]),_=(0,Z.useCallback)(e=>{d(e),l(!0)},[]),v=(0,Z.useCallback)(()=>{d(null)},[]),y=(0,Z.useCallback)((e,t)=>{u&&p(n=>n.widgets?{...n,widgets:n.widgets.map(n=>{if((n.id||n.title)!==u)return n;if(e===`layoutW`)return{...n,layout:{...n.layout||{},w:t}};if(e===`layoutH`)return{...n,layout:{...n.layout||{},h:t}};if(e===`drillDownEnabled`||e===`drillDownTarget`){let r=n.options?.drillDown??{},i=e===`drillDownEnabled`?{...r,enabled:!!t}:{...r,target:t};return{...n,options:{...n.options||{},drillDown:i}}}return{...n,[e]:t}})}:n)},[u]),b=(0,Z.useCallback)(e=>{if(u&&r){let{drillDownEnabled:t,drillDownTarget:n,...i}=e,a={...i};(t||n)&&(a.options={...i.options||{},drillDown:{...i.options?.drillDown||{},...t===void 0?{}:{enabled:!!t},...n===void 0?{}:{target:n}}}),r(u,a)}d(null),h(e=>e+1)},[u,r]),x=(0,Z.useCallback)(()=>{l(e=>!e),d(null)},[]);return(0,Q.jsxs)(`div`,{className:R(`flex h-full w-full`,s),"data-testid":`dashboard-with-config`,children:[(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-auto relative`,children:[(0,Q.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,Q.jsxs)(K,{size:`sm`,variant:c?`default`:`outline`,onClick:x,"data-testid":`dashboard-config-toggle`,children:[(0,Q.jsx)(V,{className:`h-3.5 w-3.5 mr-1`}),`Settings`]})}),(0,Q.jsx)(We,{schema:f,onRefresh:i,recordCount:a,designMode:c,selectedWidgetId:u,onWidgetClick:_})]}),c&&(0,Q.jsx)(`div`,{className:`relative shrink-0`,children:u&&g?(0,Q.jsx)(ci,{open:!0,onClose:v,config:g,onSave:b,onFieldChange:y}):(0,Q.jsx)(Br,{open:!0,onClose:()=>l(!1),config:t,onSave:n})})]})}var ui=t({DashboardConfigPanel:()=>Br,DashboardGridLayout:()=>_r,DashboardRenderer:()=>We,DashboardWithConfig:()=>li,DrillDownDrawer:()=>Lr,MetricCard:()=>Tr,MetricWidget:()=>Cr,ObjectDataTable:()=>Ir,ObjectMetricWidget:()=>Er,ObjectPivotTable:()=>Rr,PivotTable:()=>Nr,WidgetConfigPanel:()=>ci,dashboardComponents:()=>di});h.register(`dashboard`,We,{namespace:`view`,label:`Dashboard`,category:`Complex`,icon:`layout-dashboard`,inputs:[{name:`columns`,type:`number`,label:`Columns`,defaultValue:3},{name:`gap`,type:`number`,label:`Gap`,defaultValue:4},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{columns:3,widgets:[]}}),h.register(`metric`,Cr,{namespace:`plugin-dashboard`,label:`Metric Widget`,category:`Dashboard`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`value`,type:`string`,label:`Value`}]}),h.register(`metric-card`,Tr,{namespace:`plugin-dashboard`,label:`Metric Card`,category:`Dashboard`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`value`,type:`string`,label:`Value`,required:!0},{name:`icon`,type:`string`,label:`Icon (Lucide name)`},{name:`trend`,type:`enum`,label:`Trend`,enum:[{label:`Up`,value:`up`},{label:`Down`,value:`down`},{label:`Neutral`,value:`neutral`}]},{name:`trendValue`,type:`string`,label:`Trend Value (e.g., +12%)`},{name:`description`,type:`string`,label:`Description`}],defaultProps:{title:`Metric`,value:`0`}}),h.register(`object-metric`,Er,{namespace:`plugin-dashboard`,label:`Object Metric`,category:`Dashboard`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`label`,type:`string`,label:`Label`},{name:`aggregate`,type:`object`,label:`Aggregate`,description:`Aggregation config: { field, function, groupBy }`},{name:`icon`,type:`string`,label:`Icon (Lucide name)`}],defaultProps:{label:`Metric`}}),h.register(`pivot`,Nr,{namespace:`plugin-dashboard`,label:`Pivot Table`,category:`Dashboard`,icon:`table-2`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`rowField`,type:`string`,label:`Row Field`,required:!0},{name:`columnField`,type:`string`,label:`Column Field`,required:!0},{name:`valueField`,type:`string`,label:`Value Field`,required:!0},{name:`aggregation`,type:`enum`,label:`Aggregation`,enum:[{label:`Sum`,value:`sum`},{label:`Count`,value:`count`},{label:`Average`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{name:`showRowTotals`,type:`boolean`,label:`Show Row Totals`},{name:`showColumnTotals`,type:`boolean`,label:`Show Column Totals`},{name:`format`,type:`string`,label:`Number Format`}],defaultProps:{rowField:``,columnField:``,valueField:``,aggregation:`sum`,data:[]}}),h.register(`object-pivot`,Rr,{namespace:`plugin-dashboard`,label:`Object Pivot Table`,category:`Dashboard`,icon:`table-2`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`title`,type:`string`,label:`Title`},{name:`rowField`,type:`string`,label:`Row Field`,required:!0},{name:`columnField`,type:`string`,label:`Column Field`,required:!0},{name:`valueField`,type:`string`,label:`Value Field`,required:!0},{name:`aggregation`,type:`enum`,label:`Aggregation`,enum:[{label:`Sum`,value:`sum`},{label:`Count`,value:`count`},{label:`Average`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{name:`showRowTotals`,type:`boolean`,label:`Show Row Totals`},{name:`showColumnTotals`,type:`boolean`,label:`Show Column Totals`},{name:`filter`,type:`array`,label:`Filter`},{name:`format`,type:`string`,label:`Number Format`}],defaultProps:{rowField:``,columnField:``,valueField:``,aggregation:`sum`}}),h.register(`dashboard-grid`,_r,{namespace:`plugin-dashboard`,label:`Dashboard Grid (Editable)`,category:`Complex`,icon:`layout-grid`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Dashboard`,widgets:[]}}),h.register(`object-data-table`,Ir,{namespace:`plugin-dashboard`,label:`Object Data Table`,category:`Dashboard`,icon:`table`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`columns`,type:`array`,label:`Columns`},{name:`filter`,type:`array`,label:`Filter`},{name:`searchable`,type:`boolean`,label:`Searchable`},{name:`pagination`,type:`boolean`,label:`Pagination`}],defaultProps:{searchable:!1,pagination:!1}});var di={DashboardRenderer:We,DashboardGridLayout:_r,MetricWidget:Cr,MetricCard:Tr,ObjectMetricWidget:Er,PivotTable:Nr,ObjectPivotTable:Rr,ObjectDataTable:Ir,DashboardConfigPanel:Br,WidgetConfigPanel:ci,DashboardWithConfig:li};export{We as n,ui as t};