@object-ui/plugin-dashboard 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +21 -1
- package/dist/index.js +869 -787
- package/dist/index.umd.cjs +4 -4
- package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts +5 -0
- package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts +4 -1
- package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts +2 -0
- package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/index.d.ts +1 -1
- package/package.json +40 -7
- package/.turbo/turbo-build.log +0 -41
- package/src/DashboardConfigPanel.stories.tsx +0 -164
- package/src/DashboardConfigPanel.tsx +0 -158
- package/src/DashboardGridLayout.tsx +0 -367
- package/src/DashboardRenderer.stories.tsx +0 -173
- package/src/DashboardRenderer.tsx +0 -479
- package/src/DashboardWithConfig.tsx +0 -211
- package/src/MetricCard.tsx +0 -102
- package/src/MetricWidget.tsx +0 -96
- package/src/ObjectDataTable.tsx +0 -226
- package/src/ObjectMetricWidget.tsx +0 -159
- package/src/ObjectPivotTable.tsx +0 -160
- package/src/PivotTable.tsx +0 -262
- package/src/WidgetConfigPanel.tsx +0 -540
- package/src/__tests__/DashboardConfigPanel.test.tsx +0 -206
- package/src/__tests__/DashboardGridLayout.test.tsx +0 -199
- package/src/__tests__/DashboardRenderer.autoRefresh.test.tsx +0 -124
- package/src/__tests__/DashboardRenderer.designMode.test.tsx +0 -386
- package/src/__tests__/DashboardRenderer.header.test.tsx +0 -114
- package/src/__tests__/DashboardRenderer.mobile.test.tsx +0 -214
- package/src/__tests__/DashboardRenderer.widgetData.test.tsx +0 -1411
- package/src/__tests__/DashboardWithConfig.test.tsx +0 -276
- package/src/__tests__/MetricCard.test.tsx +0 -107
- package/src/__tests__/ObjectDataTable.test.tsx +0 -211
- package/src/__tests__/ObjectMetricWidget.test.tsx +0 -196
- package/src/__tests__/ObjectPivotTable.test.tsx +0 -192
- package/src/__tests__/PivotTable.test.tsx +0 -162
- package/src/__tests__/WidgetConfigPanel.test.tsx +0 -492
- package/src/__tests__/ensureWidgetIds.test.tsx +0 -103
- package/src/index.tsx +0 -236
- package/src/utils.ts +0 -17
- package/tsconfig.json +0 -19
- package/vite.config.ts +0 -64
- package/vitest.config.ts +0 -9
- package/vitest.setup.tsx +0 -18
package/dist/index.umd.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`@object-ui/react`),require(`@object-ui/components`),require(`react`),require(`lucide-react`),require(`clsx`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`@object-ui/react`,`@object-ui/components`,`react`,`lucide-react`,`clsx`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginDashboard={},e.ObjectUICore,e.ObjectUIReact,e.ObjectUIComponents,e.React,e.lucide_react,e.clsx))})(this,function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=Object.create,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=u(t),a=0,o=i.length,s;a<o;a++)s=i[a],!f.call(e,s)&&s!==n&&c(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=l(t,s))||r.enumerable});return e},h=(e,t,n)=>(n=e==null?{}:s(d(e)),m(t||!e||!e.__esModule?c(n,`default`,{value:e,enumerable:!0}):n,e));i=h(i,1),a=h(a,1),o=h(o,1);function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&e.provider===`object`}var _=p((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),v=p((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`@object-ui/react`),require(`@object-ui/components`),require(`react`),require(`lucide-react`),require(`clsx`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`@object-ui/react`,`@object-ui/components`,`react`,`lucide-react`,`clsx`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginDashboard={},e.ObjectUICore,e.ObjectUIReact,e.ObjectUIComponents,e.React,e.lucide_react,e.clsx))})(this,function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=Object.create,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,p=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=u(t),a=0,o=i.length,s;a<o;a++)s=i[a],!f.call(e,s)&&s!==n&&c(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=l(t,s))||r.enumerable});return e},h=(e,t,n)=>(n=e==null?{}:s(d(e)),m(t||!e||!e.__esModule?c(n,`default`,{value:e,enumerable:!0}):n,e));i=h(i,1),a=h(a,1),o=h(o,1);function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&e.provider===`object`}var _=p((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),v=p((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),y=p(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=_():t.exports=v()}))();function b(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var x=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],S=(0,i.forwardRef)(({schema:e,className:t,dataSource:o,onRefresh:s,recordCount:c,userActions:l,designMode:u,selectedWidgetId:d,onWidgetClick:f,...p},m)=>{let h=e.columns||4,_=e.gap||4,[v,S]=(0,i.useState)(!1),[C,w]=(0,i.useState)(!1),T=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=()=>w(window.innerWidth<768);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let E=(0,i.useCallback)(()=>{s&&(S(!0),s(),setTimeout(()=>S(!1),600))},[s]);(0,i.useEffect)(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!s))return T.current=setInterval(E,e.refreshInterval*1e3),()=>{T.current&&clearInterval(T.current)}},[e.refreshInterval,s,E]);let D=(0,i.useCallback)((e,t)=>{!u||!f||!t||(e.stopPropagation(),f(t))},[u,f]),O=(0,i.useCallback)((t,n,r)=>{if(!u||!f)return;let i=e.widgets||[];if(t.key===`Enter`||t.key===` `)t.preventDefault(),f(n??null);else if(t.key===`ArrowRight`||t.key===`ArrowDown`){t.preventDefault();let e=r+1<i.length?i[r+1]:null;e?.id&&f(e.id)}else if(t.key===`ArrowLeft`||t.key===`ArrowUp`){t.preventDefault();let e=r-1>=0?i[r-1]:null;e?.id&&f(e.id)}else t.key===`Escape`&&(t.preventDefault(),f(null))},[u,f,e.widgets]),k=(0,i.useCallback)(e=>{!u||!f||e.target===e.currentTarget&&f(null)},[u,f]),A=(e,t,i)=>{let a=e.layout?{...e.layout,w:Math.min(e.layout.w,h)}:void 0,o=(()=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`metric`&&e.object){let t=n.data,r=g(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||(g(t)?t.object:void 0),aggregate:r,filter:(g(t)?t.filter:void 0)||e.filter,label:n.label||b(e.title)||``,fallbackValue:n.value,trend:n.trend,icon:n.icon,description:n.description}}if(t===`bar`||t===`line`||t===`area`||t===`pie`||t===`donut`||t===`scatter`){let r=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(g(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:x,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}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:x,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}return{type:`chart`,chartType:t,data:Array.isArray(r)?r:r?.items||[],xAxisKey:i,series:[{dataKey:a}],colors:x,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(t===`table`){let t=e.data||n.data;if(g(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;if(g(t)){let{data:r,...i}=n;return{type:`object-pivot`,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter}}return!t&&e.object?{type:`object-pivot`,...n,objectName:e.object,filter:e.filter}:{type:`pivot`,...n,data:Array.isArray(t)?t:t?.items||[]}}return{...e,...n}})(),s=e.type===`metric`,c=b(e.title),l=b(e.description),f=e.id||c||`widget-${t}`,p=u&&d===e.id,m=u?{"data-testid":`dashboard-preview-widget-${e.id}`,"data-widget-id":e.id,role:`button`,tabIndex:0,"aria-selected":p,"aria-label":`Widget: ${c||`Widget ${t+1}`}`,onClick:t=>D(t,e.id),onKeyDown:n=>O(n,e.id,t)}:{},_=u?(0,r.cn)(`cursor-pointer rounded-lg transition-all outline-none`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,p?`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;return s?(0,y.jsxs)(`div`,{className:(0,r.cn)(`h-full w-full`,u&&`relative`,_),style:!C&&a?{gridColumn:`span ${a.w}`,gridRow:`span ${a.h}`}:void 0,...m,children:[(0,y.jsx)(n.SchemaRenderer,{schema:o,className:(0,r.cn)(`h-full w-full`,u&&`pointer-events-none`)}),u&&(0,y.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]},f):(0,y.jsxs)(r.Card,{className:(0,r.cn)(`overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md`,`bg-card/50 backdrop-blur-sm`,i&&`w-full`,u&&`relative`,_),style:!C&&a?{gridColumn:`span ${a.w}`,gridRow:`span ${a.h}`}:void 0,...m,children:[c&&(0,y.jsxs)(r.CardHeader,{className:`pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6`,children:[(0,y.jsx)(r.CardTitle,{className:`text-sm sm:text-base font-medium tracking-tight truncate`,title:c,children:c}),l&&(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 line-clamp-2`,children:l})]}),(0,y.jsx)(r.CardContent,{className:`p-0`,children:(0,y.jsx)(`div`,{className:(0,r.cn)(`h-full w-full`,`p-3 sm:p-4 md:p-6`,u&&`pointer-events-none`),children:(0,y.jsx)(n.SchemaRenderer,{schema:o})})}),u&&(0,y.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]},f)},j=e.header&&(0,y.jsxs)(`div`,{className:`col-span-full mb-4`,children:[e.header.showTitle!==!1&&e.title&&(0,y.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:b(e.title)}),e.header.showDescription!==!1&&e.description&&(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:b(e.description)}),e.header.actions&&e.header.actions.length>0&&(0,y.jsx)(`div`,{className:`flex gap-2 mt-3`,children:e.header.actions.map((e,t)=>(0,y.jsx)(r.Button,{variant:`outline`,size:`sm`,children:e.label},t))})]}),M=c!==void 0&&(0,y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[c.toLocaleString(),` records`]}),N=l?JSON.stringify(l):void 0,P=s&&(0,y.jsxs)(`div`,{className:(0,r.cn)(`flex items-center justify-end gap-3 mb-2`,!C&&`col-span-full`),children:[M,(0,y.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:E,disabled:v,"aria-label":`Refresh dashboard`,children:[(0,y.jsx)(a.RefreshCw,{className:(0,r.cn)(`h-4 w-4 mr-2`,v&&`animate-spin`)}),v?`Refreshing…`:`Refresh All`]})]});if(C){let n=e.widgets?.filter(e=>e.type===`metric`)||[],i=e.widgets?.filter(e=>e.type!==`metric`)||[];return(0,y.jsxs)(`div`,{ref:m,className:(0,r.cn)(`flex flex-col gap-4 px-4`,t),"data-user-actions":N,onClick:k,...p,children:[j,P,n.length>0&&(0,y.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,onClick:k,children:n.map((e,t)=>A(e,t))}),i.length>0&&(0,y.jsx)(`div`,{className:`flex flex-col gap-4`,onClick:k,children:i.map((e,t)=>A(e,t,!0))})]})}return(0,y.jsxs)(`div`,{ref:m,className:(0,r.cn)(`grid auto-rows-min`,`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,t),style:{...h>4&&{gridTemplateColumns:`repeat(${h}, minmax(0, 1fr))`},gap:`${_*.25}rem`},"data-user-actions":N,onClick:k,...p,children:[j,P,e.widgets?.map((e,t)=>A(e,t))]})});function C(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function w(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function T(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=C(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=w(r,u,s[0]),f=w(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 E(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=C(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=k(d,0,s-r),f=k(f,0,l-i),{x:d,y:f}}function D(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=C(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function O(e,t,n){let{margin:r,rowHeight:i}=e,a=C(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 k(e,t,n){return Math.max(Math.min(e,n),t)}function A(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 j(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&A(r,t))return r}}function M(e,t){return e.filter(e=>A(e,t))}function N(e,t){return t===`horizontal`?F(e):t===`vertical`||t===`wrap`?P(e):[...e]}function P(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function F(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function I(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 L(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&r.i===t)return r}}function R(e){return e.filter(e=>e.static===!0)}function z(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 B(e){let t=Array(e.length);for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t[n]=z(r))}return t}function V(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 H(e,t,n){let r=L(e,t);return r?(r=n(z(r)),[V(e,r),r]):[[...e],null]}function U(e,t){let n=R(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(;j(n,i);)i.y++}return e}function ee(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=N(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=M(d,t),p=f.length>0;if(p&&c)return B(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?te(m,n,t,i,o):te(m,t,n,i,o)))}return m}function te(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=j(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 ee(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return ee(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 ee(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]:ee(e,n,l,u,r,c,i)}function ne(e,t,n){return Math.max(t,Math.min(n,e))}var re=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:ne(t,0,Math.max(0,r-e.w)),y:ne(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:ne(t,1,Math.max(1,o)),h:ne(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:ne(t,e.minW??1,e.maxW??1/0),h:ne(n,e.minH??1,e.maxH??1/0)}}}];function ie(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 ae(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 oe({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 se({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function ce(e){return e*100+`%`}function le(e,t,n,r){return e+n>r?t:n}function ue(e,t,n){return e<0?t:n}function de(e){return Math.max(0,e)}function fe(e){return Math.max(0,e)}var W=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:ue(o,e.height,i),top:fe(o)}},G=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:le(e.left,e.width,o,n),left:de(i)}},K=(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:fe(r),left:0}:{height:i,width:a,top:fe(r),left:o}},pe=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:ue(r,e.height,a),top:fe(r)}},me={n:W,ne:(e,t,n)=>W(e,G(e,t,n)),e:G,se:(e,t,n)=>pe(e,G(e,t,n)),s:pe,sw:(e,t,n)=>pe(e,K(e,t)),w:K,nw:(e,t,n)=>W(e,K(e,t))};function he(e,t,n,r){let i=me[e];return i?i(t,{...t,...n},r):n}var q={type:`transform`,scale:1,calcStyle(e){return oe(e)}},ge={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},_e={enabled:!0,bounded:!1,threshold:3},ve={enabled:!0,handles:[`se`]},ye={enabled:!1,defaultItem:{w:1,h:1}};function be(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??R(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;A(t,o)&&be(e,o,n+t[a],r,s)}}t[r]=n}function xe(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&&!j(e,t);)t.y--;let i;for(;(i=j(e,t))!==void 0;)be(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Se(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!j(e,t);)t.x--;let i;for(;(i=j(e,t))!==void 0;)if(be(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!j(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Ce={type:`vertical`,allowOverlap:!1,compact(e,t){let n=R(e),r=I(n),i=P(e),a=Array(e.length);for(let t=0;t<i.length;t++){let o=i[t];if(o===void 0)continue;let s=z(o);s.static||(s=xe(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}},J={type:`horizontal`,allowOverlap:!1,compact(e,t){let n=R(e),r=F(e),i=Array(e.length);for(let a=0;a<r.length;a++){let o=r[a];if(o===void 0)continue;let s=z(o);s.static||(s=Se(n,s,t,r),n.push(s));let c=e.indexOf(o);i[c]=s,s.moved=!1}return i}},Y={type:null,allowOverlap:!1,compact(e,t){return B(e)}},X={...Ce,allowOverlap:!0,compact(e,t){return B(e)}},Z={...J,allowOverlap:!0,compact(e,t){return B(e)}},we={...Y,allowOverlap:!0};function Te(e,t=!1,n=!1){let r;return r=t?e===`vertical`?X:e===`horizontal`?Z:we:e===`vertical`?Ce:e===`horizontal`?J:Y,n?{...r,preventCollision:n}:r}function Ee(e){return Object.keys(e).sort((t,n)=>e[t]-e[n])}function De(e,t){let n=Ee(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 Q(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Oe(e,t,n,r,i,a){let o=e[n];if(o)return B(o);let s=e[r],c=Ee(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=U(B(s||[]),{cols:i});return(typeof a==`object`&&a?a:Te(a)).compact(u,i)}function ke(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 Ae=p(((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){"use strict";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 P=_(r(A,{createIsNestedEqual:function(){return o}}));function F(e,t){return P(e,t,void 0)}var I=_(j);function L(e,t){return I(e,t,new WeakMap)}var R=_(r(j,{createIsNestedEqual:function(){return o}}));function z(e,t){return R(e,t,new WeakMap)}function B(e){return _(r(A,e(A)))}function V(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=L,e.circularShallowEqual=z,e.createCustomCircularEqual=V,e.createCustomEqual=B,e.deepEqual=N,e.sameValueZeroEqual=o,e.shallowEqual=F,Object.defineProperty(e,`__esModule`,{value:!0})}))}));function je(e={}){let{measureBeforeMount:t=!1,initialWidth:n=1280}=e,[r,a]=(0,i.useState)(n),[o,s]=(0,i.useState)(!t),c=(0,i.useRef)(null),l=(0,i.useRef)(null),u=(0,i.useCallback)(()=>{let e=c.current;if(e){let t=e.offsetWidth;a(t),o||s(!0)}},[o]);return(0,i.useEffect)(()=>{let e=c.current;if(e){if(u(),typeof ResizeObserver<`u`){let t=null;return l.current=new ResizeObserver(e=>{let n=e[0];if(n){let e=n.contentRect.width;t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{a(e),t=null})}}),l.current.observe(e),()=>{t!==null&&cancelAnimationFrame(t),l.current&&=(l.current.disconnect(),null)}}return()=>{l.current&&=(l.current.disconnect(),null)}}},[u]),{width:r,mounted:o,containerRef:c,measureWidth:u}}var Me=p((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),Ne=p((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,E=n,D=d,O=i,k=h,A=m,j=r,M=o,N=a,P=f,F=!1;function I(e){return F||(F=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),L(e)||x(e)===l}function L(e){return x(e)===u}function R(e){return x(e)===c}function z(e){return x(e)===s}function B(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function V(e){return x(e)===d}function H(e){return x(e)===i}function U(e){return x(e)===h}function ee(e){return x(e)===m}function te(e){return x(e)===r}function ne(e){return x(e)===o}function re(e){return x(e)===a}function ie(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=E,e.ForwardRef=D,e.Fragment=O,e.Lazy=k,e.Memo=A,e.Portal=j,e.Profiler=M,e.StrictMode=N,e.Suspense=P,e.isAsyncMode=I,e.isConcurrentMode=L,e.isContextConsumer=R,e.isContextProvider=z,e.isElement=B,e.isForwardRef=V,e.isFragment=H,e.isLazy=U,e.isMemo=ee,e.isPortal=te,e.isProfiler=ne,e.isStrictMode=re,e.isSuspense=ie,e.isValidElementType=b,e.typeOf=x})()})),Pe=p(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Me():t.exports=Ne()})),Fe=p(((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String(`abc`);if(e[5]=`de`,Object.getOwnPropertyNames(e)[0]===`5`)return!1;for(var t={},n=0;n<10;n++)t[`_`+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(``)!==`0123456789`)return!1;var r={};return`abcdefghijklmnopqrst`.split(``).forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join(``)===`abcdefghijklmnopqrst`}catch{return!1}}t.exports=o()?Object.assign:function(e,t){for(var o,s=a(e),c,l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]),o)r.call(o,u)&&(s[u]=o[u]);if(n){c=n(o);for(var d=0;d<c.length;d++)i.call(o,c[d])&&(s[c[d]]=o[c[d]])}}return s}})),Ie=p(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Le=p(((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)})),Re=p(((e,t)=>{var n=function(){};if(process.env.NODE_ENV!==`production`){var r=Ie(),i={},a=Le();n=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}}}function o(e,t,o,s,c){if(process.env.NODE_ENV!==`production`){for(var l in e)if(a(e,l)){var u;try{if(typeof e[l]!=`function`){var d=Error((s||`React class`)+`: `+o+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name=`Invariant Violation`,d}u=e[l](t,l,s,o,null,r)}catch(e){u=e}if(u&&!(u instanceof Error)&&n((s||`React class`)+`: type specification of `+o+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+`. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).`),u instanceof Error&&!(u.message in i)){i[u.message]=!0;var f=c?c():``;n(`Failed `+o+` type: `+u.message+(f??``))}}}}o.resetWarningCache=function(){process.env.NODE_ENV!==`production`&&(i={})},t.exports=o})),$=p(((e,t)=>{var n=Pe(),r=Fe(),i=Ie(),a=Le(),o=Re(),s=function(){};process.env.NODE_ENV!==`production`&&(s=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}});function c(){return null}t.exports=function(e,t){var l=typeof Symbol==`function`&&Symbol.iterator,u=`@@iterator`;function d(e){var t=e&&(l&&e[l]||e[u]);if(typeof t==`function`)return t}var f=`<<anonymous>>`,p={array:_(`array`),bigint:_(`bigint`),bool:_(`boolean`),func:_(`function`),number:_(`number`),object:_(`object`),string:_(`string`),symbol:_(`symbol`),any:v(),arrayOf:y,element:b(),elementType:x(),instanceOf:S,node:E(),objectOf:w,oneOf:C,oneOfType:T,shape:O,exact:k};function m(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function h(e,t){this.message=e,this.data=t&&typeof t==`object`?t:{},this.stack=``}h.prototype=Error.prototype;function g(e){if(process.env.NODE_ENV!==`production`)var n={},r=0;function a(a,o,c,l,u,d,p){if(l||=f,d||=c,p!==i){if(t){var m=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 m.name=`Invariant Violation`,m}else if(process.env.NODE_ENV!==`production`&&typeof console<`u`){var g=l+`:`+c;!n[g]&&r<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+l+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[g]=!0,r++)}}return o[c]==null?a?o[c]===null?new h(`The `+u+" `"+d+"` is marked as required "+("in `"+l+"`, but its value is `null`.")):new h(`The `+u+" `"+d+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(o,c,l,u,d)}var o=a.bind(null,!1);return o.isRequired=a.bind(null,!0),o}function _(e){function t(t,n,r,i,a,o){var s=t[n];if(M(s)!==e){var c=N(s);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return g(t)}function v(){return g(c)}function y(e){function t(t,n,r,a,o){if(typeof e!=`function`)return new h("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var c=M(s);return new h(`Invalid `+a+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var u=e(s,l,r,a,o+`[`+l+`]`,i);if(u instanceof Error)return u}return null}return g(t)}function b(){function t(t,n,r,i,a){var o=t[n];if(!e(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return g(t)}function x(){function e(e,t,r,i,a){var o=e[t];if(!n.isValidElementType(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement type."))}return null}return g(e)}function S(e){function t(t,n,r,i,a){if(!(t[n]instanceof e)){var o=e.name||f,s=F(t[n]);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+o+"`."))}return null}return g(t)}function C(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&(arguments.length>1?s(`Invalid arguments supplied to oneOf, expected an array, got `+arguments.length+` arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).`):s(`Invalid argument supplied to oneOf, expected an array.`)),c;function t(t,n,r,i,a){for(var o=t[n],s=0;s<e.length;s++)if(m(o,e[s]))return null;var c=JSON.stringify(e,function(e,t){return N(t)===`symbol`?String(t):t});return new h(`Invalid `+i+" `"+a+"` of value `"+String(o)+"` "+("supplied to `"+r+"`, expected one of "+c+`.`))}return g(t)}function w(e){function t(t,n,r,o,s){if(typeof e!=`function`)return new h("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var c=t[n],l=M(c);if(l!==`object`)return new h(`Invalid `+o+" `"+s+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var u in c)if(a(c,u)){var d=e(c,u,r,o,s+`.`+u,i);if(d instanceof Error)return d}return null}return g(t)}function T(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&s(`Invalid argument supplied to oneOfType, expected an instance of array.`),c;for(var t=0;t<e.length;t++){var n=e[t];if(typeof n!=`function`)return s(`Invalid argument supplied to oneOfType. Expected an array of check functions, but received `+P(n)+` at index `+t+`.`),c}function r(t,n,r,o,s){for(var c=[],l=0;l<e.length;l++){var u=e[l],d=u(t,n,r,o,s,i);if(d==null)return null;d.data&&a(d.data,`expectedType`)&&c.push(d.data.expectedType)}var f=c.length>0?`, expected one of type [`+c.join(`, `)+`]`:``;return new h(`Invalid `+o+" `"+s+"` supplied to "+("`"+r+"`"+f+`.`))}return g(r)}function E(){function e(e,t,n,r,i){return A(e[t])?null:new h(`Invalid `+r+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return g(e)}function D(e,t,n,r,i){return new h((e||`React class`)+`: `+t+" type `"+n+`.`+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function O(e){function t(t,n,r,a,o){var s=t[n],c=M(s);if(c!==`object`)return new h(`Invalid `+a+" `"+o+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var u=e[l];if(typeof u!=`function`)return D(r,a,o,l,N(u));var d=u(s,l,r,a,o+`.`+l,i);if(d)return d}return null}return g(t)}function k(e){function t(t,n,o,s,c){var l=t[n],u=M(l);if(u!==`object`)return new h(`Invalid `+s+" `"+c+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var d in r({},t[n],e)){var f=e[d];if(a(e,d)&&typeof f!=`function`)return D(o,s,c,d,N(f));if(!f)return new h(`Invalid `+s+" `"+c+"` key `"+d+"` supplied to `"+o+`\`.
|
|
6
|
+
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),y=p(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=_():t.exports=v()}))();function b(e){if(!e)return null;let t=a;return t[e]?t[e]:t[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??null}function x(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var S=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],C=(0,i.forwardRef)(({schema:e,className:t,dataSource:o,onRefresh:s,recordCount:c,userActions:l,designMode:u,selectedWidgetId:d,onWidgetClick:f,modalHandler:p,scriptHandlers:m,...h},_)=>{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})(),C=v,w=e.gap||4,[T,E]=(0,i.useState)(!1),[D,O]=(0,i.useState)(!1),k=(0,i.useRef)(null),{executeAction:A,engine:j}=(0,n.useActionEngine)({actions:(0,i.useMemo)(()=>(e.header?.actions??[]).map(e=>({name:e.actionUrl||e.label,type:e.actionType||`url`,target:e.actionUrl,label:e.label})),[e.header?.actions])});(0,i.useEffect)(()=>{let e=j.getRunner();if(p&&e.setModalHandler(p),m)for(let[t,n]of Object.entries(m))e.registerScript(t,n)},[j,p,m]),(0,i.useEffect)(()=>{let e=()=>O(window.innerWidth<768);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let M=(0,i.useCallback)(()=>{s&&(E(!0),s(),setTimeout(()=>E(!1),600))},[s]);(0,i.useEffect)(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!s))return k.current=setInterval(M,e.refreshInterval*1e3),()=>{k.current&&clearInterval(k.current)}},[e.refreshInterval,s,M]);let N=(0,i.useCallback)((e,t)=>{!u||!f||!t||(e.stopPropagation(),f(t))},[u,f]),P=(0,i.useCallback)((t,n,r)=>{if(!u||!f)return;let i=e.widgets||[];if(t.key===`Enter`||t.key===` `)t.preventDefault(),f(n??null);else if(t.key===`ArrowRight`||t.key===`ArrowDown`){t.preventDefault();let e=r+1<i.length?i[r+1]:null;e?.id&&f(e.id)}else if(t.key===`ArrowLeft`||t.key===`ArrowUp`){t.preventDefault();let e=r-1>=0?i[r-1]:null;e?.id&&f(e.id)}else t.key===`Escape`&&(t.preventDefault(),f(null))},[u,f,e.widgets]),F=(0,i.useCallback)(e=>{!u||!f||e.target===e.currentTarget&&f(null)},[u,f]),I=(e,t,i)=>{let a=e.layout?{...e.layout,w:Math.min(e.layout.w,C)}:void 0,s=(()=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`metric`&&e.object){let t=n.data,r=g(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||(g(t)?t.object:void 0),aggregate:r,filter:(g(t)?t.filter:void 0)||e.filter,label:n.label||x(e.title)||``,fallbackValue:n.value,trend:n.trend,icon:n.icon,description:n.description,colorVariant:e.colorVariant}}if((t===`gauge`||t===`solid-gauge`)&&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||x(e.title)||``,fallbackValue:n.fallbackValue??n.value,icon:n.icon,description:n.description}}let r={funnel:`bar`,"horizontal-bar":`bar`}[t]||t;if(r===`bar`||r===`line`||r===`area`||r===`pie`||r===`donut`||r===`scatter`){let t=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(g(t)){let n=t.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:r,objectName:e.object||t.object,aggregate:o,xAxisKey:i,series:[{dataKey:s}],colors:S,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(!t&&e.object){let t=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`name`}:void 0;return{type:`object-chart`,chartType:r,objectName:e.object,aggregate:t,xAxisKey:i,series:[{dataKey:e.valueField||`value`}],colors:S,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}],colors:S,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(t===`table`){let t=e.data||n.data;if(g(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;if(g(t)){let{data:r,...i}=n;return{type:`object-pivot`,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter}}return!t&&e.object?{type:`object-pivot`,...n,objectName:e.object,filter:e.filter}:{type:`pivot`,...n,data:Array.isArray(t)?t:t?.items||[]}}return{...e,...n}})(),c=e.type===`metric`,l=x(e.title),f=x(e.description),p=e.id||l||`widget-${t}`,m=u&&d===e.id,h=u?{"data-testid":`dashboard-preview-widget-${e.id}`,"data-widget-id":e.id,role:`button`,tabIndex:0,"aria-selected":m,"aria-label":`Widget: ${l||`Widget ${t+1}`}`,onClick:t=>N(t,e.id),onKeyDown:n=>P(n,e.id,t)}:{},_=u?(0,r.cn)(`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;return c?(0,y.jsxs)(`div`,{className:(0,r.cn)(`h-full w-full`,u&&`relative`,_),style:!D&&a?{gridColumn:`span ${a.w}`,gridRow:`span ${a.h}`}:void 0,...h,children:[(0,y.jsx)(n.SchemaRenderer,{schema:s,className:(0,r.cn)(`h-full w-full`,u&&`pointer-events-none`),dataSource:o}),u&&(0,y.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]},p):(0,y.jsxs)(r.Card,{className:(0,r.cn)(`overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md`,`bg-card/50 backdrop-blur-sm`,i&&`w-full`,u&&`relative`,_),style:!D&&a?{gridColumn:`span ${a.w}`,gridRow:`span ${a.h}`}:void 0,...h,children:[l&&(0,y.jsxs)(r.CardHeader,{className:`pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6`,children:[(0,y.jsx)(r.CardTitle,{className:`text-sm sm:text-base font-medium tracking-tight truncate`,title:l,children:l}),f&&(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 line-clamp-2`,children:f})]}),(0,y.jsx)(r.CardContent,{className:`p-0`,children:(0,y.jsx)(`div`,{className:(0,r.cn)(`h-full w-full`,`p-3 sm:p-4 md:p-6`,u&&`pointer-events-none`),children:(0,y.jsx)(n.SchemaRenderer,{schema:s,dataSource:o})})}),u&&(0,y.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]},p)},L=e.header&&(0,y.jsxs)(`div`,{className:`col-span-full mb-4`,children:[e.header.showTitle!==!1&&e.title&&(0,y.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:x(e.title)}),e.header.showDescription!==!1&&e.description&&(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:x(e.description)}),e.header.actions&&e.header.actions.length>0&&(0,y.jsx)(`div`,{className:`flex gap-2 mt-3`,children:e.header.actions.map((e,t)=>{let n=b(e.icon);return(0,y.jsxs)(r.Button,{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 A(n||r);e?.success||console.warn(`[DashboardRenderer] action failed`,e?.error);return}console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`)},children:[n&&(0,y.jsx)(n,{className:`w-4 h-4 mr-1.5`}),e.label]},t)})})]}),R=c!==void 0&&(0,y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[c.toLocaleString(),` records`]}),z=l?JSON.stringify(l):void 0,B=s&&(0,y.jsxs)(`div`,{className:(0,r.cn)(`flex items-center justify-end gap-3 mb-2`,!D&&`col-span-full`),children:[R,(0,y.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:M,disabled:T,"aria-label":`Refresh dashboard`,children:[(0,y.jsx)(a.RefreshCw,{className:(0,r.cn)(`h-4 w-4 mr-2`,T&&`animate-spin`)}),T?`Refreshing…`:`Refresh All`]})]});if(D){let n=e.widgets?.filter(e=>e.type===`metric`)||[],i=e.widgets?.filter(e=>e.type!==`metric`)||[];return(0,y.jsxs)(`div`,{ref:_,className:(0,r.cn)(`flex flex-col gap-4 px-4`,t),"data-user-actions":z,onClick:F,...h,children:[L,B,n.length>0&&(0,y.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,onClick:F,children:n.map((e,t)=>I(e,t))}),i.length>0&&(0,y.jsx)(`div`,{className:`flex flex-col gap-4`,onClick:F,children:i.map((e,t)=>I(e,t,!0))})]})}let V=e.columns!=null||v!==4;return(0,y.jsxs)(`div`,{ref:_,className:(0,r.cn)(`grid auto-rows-min`,!V&&`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,t),style:{...V&&{gridTemplateColumns:`repeat(${C}, minmax(0, 1fr))`},gap:`${w*.25}rem`},"data-user-actions":z,onClick:F,...h,children:[L,B,e.widgets?.map((e,t)=>I(e,t))]})});function w(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function T(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function E(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=w(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=T(r,u,s[0]),f=T(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 D(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=w(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=A(d,0,s-r),f=A(f,0,l-i),{x:d,y:f}}function O(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=w(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function k(e,t,n){let{margin:r,rowHeight:i}=e,a=w(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 A(e,t,n){return Math.max(Math.min(e,n),t)}function j(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 M(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&j(r,t))return r}}function N(e,t){return e.filter(e=>j(e,t))}function P(e,t){return t===`horizontal`?I(e):t===`vertical`||t===`wrap`?F(e):[...e]}function F(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function I(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function L(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 R(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&r.i===t)return r}}function z(e){return e.filter(e=>e.static===!0)}function B(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 V(e){let t=Array(e.length);for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t[n]=B(r))}return t}function H(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 ee(e,t,n){let r=R(e,t);return r?(r=n(B(r)),[H(e,r),r]):[[...e],null]}function te(e,t){let n=z(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(;M(n,i);)i.y++}return e}function U(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=P(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=N(d,t),p=f.length>0;if(p&&c)return V(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?ne(m,n,t,i,o):ne(m,t,n,i,o)))}return m}function ne(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=M(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 U(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return U(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 U(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]:U(e,n,l,u,r,c,i)}function re(e,t,n){return Math.max(t,Math.min(n,e))}var ie=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:re(t,0,Math.max(0,r-e.w)),y:re(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:re(t,1,Math.max(1,o)),h:re(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:re(t,e.minW??1,e.maxW??1/0),h:re(n,e.minH??1,e.maxH??1/0)}}}];function ae(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 oe(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 se({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 ce({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function le(e){return e*100+`%`}function ue(e,t,n,r){return e+n>r?t:n}function de(e,t,n){return e<0?t:n}function fe(e){return Math.max(0,e)}function W(e){return Math.max(0,e)}var G=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:de(o,e.height,i),top:W(o)}},K=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:ue(e.left,e.width,o,n),left:fe(i)}},pe=(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:W(r),left:0}:{height:i,width:a,top:W(r),left:o}},me=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:de(r,e.height,a),top:W(r)}},q={n:G,ne:(e,t,n)=>G(e,K(e,t,n)),e:K,se:(e,t,n)=>me(e,K(e,t,n)),s:me,sw:(e,t,n)=>me(e,pe(e,t)),w:pe,nw:(e,t,n)=>G(e,pe(e,t))};function he(e,t,n,r){let i=q[e];return i?i(t,{...t,...n},r):n}var ge={type:`transform`,scale:1,calcStyle(e){return se(e)}},_e={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},ve={enabled:!0,bounded:!1,threshold:3},ye={enabled:!0,handles:[`se`]},be={enabled:!1,defaultItem:{w:1,h:1}};function xe(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??z(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;j(t,o)&&xe(e,o,n+t[a],r,s)}}t[r]=n}function Se(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&&!M(e,t);)t.y--;let i;for(;(i=M(e,t))!==void 0;)xe(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Ce(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!M(e,t);)t.x--;let i;for(;(i=M(e,t))!==void 0;)if(xe(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!M(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var J={type:`vertical`,allowOverlap:!1,compact(e,t){let n=z(e),r=L(n),i=F(e),a=Array(e.length);for(let t=0;t<i.length;t++){let o=i[t];if(o===void 0)continue;let s=B(o);s.static||(s=Se(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}},Y={type:`horizontal`,allowOverlap:!1,compact(e,t){let n=z(e),r=I(e),i=Array(e.length);for(let a=0;a<r.length;a++){let o=r[a];if(o===void 0)continue;let s=B(o);s.static||(s=Ce(n,s,t,r),n.push(s));let c=e.indexOf(o);i[c]=s,s.moved=!1}return i}},X={type:null,allowOverlap:!1,compact(e,t){return V(e)}},Z={...J,allowOverlap:!0,compact(e,t){return V(e)}},we={...Y,allowOverlap:!0,compact(e,t){return V(e)}},Te={...X,allowOverlap:!0};function Ee(e,t=!1,n=!1){let r;return r=t?e===`vertical`?Z:e===`horizontal`?we:Te:e===`vertical`?J:e===`horizontal`?Y:X,n?{...r,preventCollision:n}:r}function De(e){return Object.keys(e).sort((t,n)=>e[t]-e[n])}function Q(e,t){let n=De(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 Oe(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function ke(e,t,n,r,i,a){let o=e[n];if(o)return V(o);let s=e[r],c=De(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=te(V(s||[]),{cols:i});return(typeof a==`object`&&a?a:Ee(a)).compact(u,i)}function Ae(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 je=p(((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){"use strict";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 P=_(r(A,{createIsNestedEqual:function(){return o}}));function F(e,t){return P(e,t,void 0)}var I=_(j);function L(e,t){return I(e,t,new WeakMap)}var R=_(r(j,{createIsNestedEqual:function(){return o}}));function z(e,t){return R(e,t,new WeakMap)}function B(e){return _(r(A,e(A)))}function V(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=L,e.circularShallowEqual=z,e.createCustomCircularEqual=V,e.createCustomEqual=B,e.deepEqual=N,e.sameValueZeroEqual=o,e.shallowEqual=F,Object.defineProperty(e,`__esModule`,{value:!0})}))}));function Me(e={}){let{measureBeforeMount:t=!1,initialWidth:n=1280}=e,[r,a]=(0,i.useState)(n),[o,s]=(0,i.useState)(!t),c=(0,i.useRef)(null),l=(0,i.useRef)(null),u=(0,i.useCallback)(()=>{let e=c.current;if(e){let t=e.offsetWidth;a(t),o||s(!0)}},[o]);return(0,i.useEffect)(()=>{let e=c.current;if(e){if(u(),typeof ResizeObserver<`u`){let t=null;return l.current=new ResizeObserver(e=>{let n=e[0];if(n){let e=n.contentRect.width;t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{a(e),t=null})}}),l.current.observe(e),()=>{t!==null&&cancelAnimationFrame(t),l.current&&=(l.current.disconnect(),null)}}return()=>{l.current&&=(l.current.disconnect(),null)}}},[u]),{width:r,mounted:o,containerRef:c,measureWidth:u}}var Ne=p((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),Pe=p((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,E=n,D=d,O=i,k=h,A=m,j=r,M=o,N=a,P=f,F=!1;function I(e){return F||(F=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),L(e)||x(e)===l}function L(e){return x(e)===u}function R(e){return x(e)===c}function z(e){return x(e)===s}function B(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function V(e){return x(e)===d}function H(e){return x(e)===i}function ee(e){return x(e)===h}function te(e){return x(e)===m}function U(e){return x(e)===r}function ne(e){return x(e)===o}function re(e){return x(e)===a}function ie(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=E,e.ForwardRef=D,e.Fragment=O,e.Lazy=k,e.Memo=A,e.Portal=j,e.Profiler=M,e.StrictMode=N,e.Suspense=P,e.isAsyncMode=I,e.isConcurrentMode=L,e.isContextConsumer=R,e.isContextProvider=z,e.isElement=B,e.isForwardRef=V,e.isFragment=H,e.isLazy=ee,e.isMemo=te,e.isPortal=U,e.isProfiler=ne,e.isStrictMode=re,e.isSuspense=ie,e.isValidElementType=b,e.typeOf=x})()})),Fe=p(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Ne():t.exports=Pe()})),Ie=p(((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String(`abc`);if(e[5]=`de`,Object.getOwnPropertyNames(e)[0]===`5`)return!1;for(var t={},n=0;n<10;n++)t[`_`+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(``)!==`0123456789`)return!1;var r={};return`abcdefghijklmnopqrst`.split(``).forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join(``)===`abcdefghijklmnopqrst`}catch{return!1}}t.exports=o()?Object.assign:function(e,t){for(var o,s=a(e),c,l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]),o)r.call(o,u)&&(s[u]=o[u]);if(n){c=n(o);for(var d=0;d<c.length;d++)i.call(o,c[d])&&(s[c[d]]=o[c[d]])}}return s}})),Le=p(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Re=p(((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)})),$=p(((e,t)=>{var n=function(){};if(process.env.NODE_ENV!==`production`){var r=Le(),i={},a=Re();n=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}}}function o(e,t,o,s,c){if(process.env.NODE_ENV!==`production`){for(var l in e)if(a(e,l)){var u;try{if(typeof e[l]!=`function`){var d=Error((s||`React class`)+`: `+o+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name=`Invariant Violation`,d}u=e[l](t,l,s,o,null,r)}catch(e){u=e}if(u&&!(u instanceof Error)&&n((s||`React class`)+`: type specification of `+o+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+`. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).`),u instanceof Error&&!(u.message in i)){i[u.message]=!0;var f=c?c():``;n(`Failed `+o+` type: `+u.message+(f??``))}}}}o.resetWarningCache=function(){process.env.NODE_ENV!==`production`&&(i={})},t.exports=o})),ze=p(((e,t)=>{var n=Fe(),r=Ie(),i=Le(),a=Re(),o=$(),s=function(){};process.env.NODE_ENV!==`production`&&(s=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}});function c(){return null}t.exports=function(e,t){var l=typeof Symbol==`function`&&Symbol.iterator,u=`@@iterator`;function d(e){var t=e&&(l&&e[l]||e[u]);if(typeof t==`function`)return t}var f=`<<anonymous>>`,p={array:_(`array`),bigint:_(`bigint`),bool:_(`boolean`),func:_(`function`),number:_(`number`),object:_(`object`),string:_(`string`),symbol:_(`symbol`),any:v(),arrayOf:y,element:b(),elementType:x(),instanceOf:S,node:E(),objectOf:w,oneOf:C,oneOfType:T,shape:O,exact:k};function m(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function h(e,t){this.message=e,this.data=t&&typeof t==`object`?t:{},this.stack=``}h.prototype=Error.prototype;function g(e){if(process.env.NODE_ENV!==`production`)var n={},r=0;function a(a,o,c,l,u,d,p){if(l||=f,d||=c,p!==i){if(t){var m=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 m.name=`Invariant Violation`,m}else if(process.env.NODE_ENV!==`production`&&typeof console<`u`){var g=l+`:`+c;!n[g]&&r<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+l+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[g]=!0,r++)}}return o[c]==null?a?o[c]===null?new h(`The `+u+" `"+d+"` is marked as required "+("in `"+l+"`, but its value is `null`.")):new h(`The `+u+" `"+d+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(o,c,l,u,d)}var o=a.bind(null,!1);return o.isRequired=a.bind(null,!0),o}function _(e){function t(t,n,r,i,a,o){var s=t[n];if(M(s)!==e){var c=N(s);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return g(t)}function v(){return g(c)}function y(e){function t(t,n,r,a,o){if(typeof e!=`function`)return new h("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var c=M(s);return new h(`Invalid `+a+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var u=e(s,l,r,a,o+`[`+l+`]`,i);if(u instanceof Error)return u}return null}return g(t)}function b(){function t(t,n,r,i,a){var o=t[n];if(!e(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return g(t)}function x(){function e(e,t,r,i,a){var o=e[t];if(!n.isValidElementType(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement type."))}return null}return g(e)}function S(e){function t(t,n,r,i,a){if(!(t[n]instanceof e)){var o=e.name||f,s=F(t[n]);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+o+"`."))}return null}return g(t)}function C(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&(arguments.length>1?s(`Invalid arguments supplied to oneOf, expected an array, got `+arguments.length+` arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).`):s(`Invalid argument supplied to oneOf, expected an array.`)),c;function t(t,n,r,i,a){for(var o=t[n],s=0;s<e.length;s++)if(m(o,e[s]))return null;var c=JSON.stringify(e,function(e,t){return N(t)===`symbol`?String(t):t});return new h(`Invalid `+i+" `"+a+"` of value `"+String(o)+"` "+("supplied to `"+r+"`, expected one of "+c+`.`))}return g(t)}function w(e){function t(t,n,r,o,s){if(typeof e!=`function`)return new h("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var c=t[n],l=M(c);if(l!==`object`)return new h(`Invalid `+o+" `"+s+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var u in c)if(a(c,u)){var d=e(c,u,r,o,s+`.`+u,i);if(d instanceof Error)return d}return null}return g(t)}function T(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&s(`Invalid argument supplied to oneOfType, expected an instance of array.`),c;for(var t=0;t<e.length;t++){var n=e[t];if(typeof n!=`function`)return s(`Invalid argument supplied to oneOfType. Expected an array of check functions, but received `+P(n)+` at index `+t+`.`),c}function r(t,n,r,o,s){for(var c=[],l=0;l<e.length;l++){var u=e[l],d=u(t,n,r,o,s,i);if(d==null)return null;d.data&&a(d.data,`expectedType`)&&c.push(d.data.expectedType)}var f=c.length>0?`, expected one of type [`+c.join(`, `)+`]`:``;return new h(`Invalid `+o+" `"+s+"` supplied to "+("`"+r+"`"+f+`.`))}return g(r)}function E(){function e(e,t,n,r,i){return A(e[t])?null:new h(`Invalid `+r+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return g(e)}function D(e,t,n,r,i){return new h((e||`React class`)+`: `+t+" type `"+n+`.`+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function O(e){function t(t,n,r,a,o){var s=t[n],c=M(s);if(c!==`object`)return new h(`Invalid `+a+" `"+o+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var u=e[l];if(typeof u!=`function`)return D(r,a,o,l,N(u));var d=u(s,l,r,a,o+`.`+l,i);if(d)return d}return null}return g(t)}function k(e){function t(t,n,o,s,c){var l=t[n],u=M(l);if(u!==`object`)return new h(`Invalid `+s+" `"+c+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var d in r({},t[n],e)){var f=e[d];if(a(e,d)&&typeof f!=`function`)return D(o,s,c,d,N(f));if(!f)return new h(`Invalid `+s+" `"+c+"` key `"+d+"` supplied to `"+o+`\`.
|
|
7
7
|
Bad object: `+JSON.stringify(t[n],null,` `)+`
|
|
8
|
-
Valid keys: `+JSON.stringify(Object.keys(e),null,` `));var p=f(l,d,o,s,c+`.`+d,i);if(p)return p}return null}return g(t)}function A(t){switch(typeof t){case`number`:case`string`:case`undefined`:return!0;case`boolean`:return!t;case`object`:if(Array.isArray(t))return t.every(A);if(t===null||e(t))return!0;var n=d(t);if(n){var r=n.call(t),i;if(n!==t.entries){for(;!(i=r.next()).done;)if(!A(i.value))return!1}else for(;!(i=r.next()).done;){var a=i.value;if(a&&!A(a[1]))return!1}}else return!1;return!0;default:return!1}}function j(e,t){return e===`symbol`?!0:t?t[`@@toStringTag`]===`Symbol`||typeof Symbol==`function`&&t instanceof Symbol:!1}function M(e){var t=typeof e;return Array.isArray(e)?`array`:e instanceof RegExp?`object`:j(t,e)?`symbol`:t}function N(e){if(e==null)return``+e;var t=M(e);if(t===`object`){if(e instanceof Date)return`date`;if(e instanceof RegExp)return`regexp`}return t}function P(e){var t=N(e);switch(t){case`array`:case`object`:return`an `+t;case`boolean`:case`date`:case`regexp`:return`a `+t;default:return t}}function F(e){return!e.constructor||!e.constructor.name?f:e.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p}})),
|
|
8
|
+
Valid keys: `+JSON.stringify(Object.keys(e),null,` `));var p=f(l,d,o,s,c+`.`+d,i);if(p)return p}return null}return g(t)}function A(t){switch(typeof t){case`number`:case`string`:case`undefined`:return!0;case`boolean`:return!t;case`object`:if(Array.isArray(t))return t.every(A);if(t===null||e(t))return!0;var n=d(t);if(n){var r=n.call(t),i;if(n!==t.entries){for(;!(i=r.next()).done;)if(!A(i.value))return!1}else for(;!(i=r.next()).done;){var a=i.value;if(a&&!A(a[1]))return!1}}else return!1;return!0;default:return!1}}function j(e,t){return e===`symbol`?!0:t?t[`@@toStringTag`]===`Symbol`||typeof Symbol==`function`&&t instanceof Symbol:!1}function M(e){var t=typeof e;return Array.isArray(e)?`array`:e instanceof RegExp?`object`:j(t,e)?`symbol`:t}function N(e){if(e==null)return``+e;var t=M(e);if(t===`object`){if(e instanceof Date)return`date`;if(e instanceof RegExp)return`regexp`}return t}function P(e){var t=N(e);switch(t){case`array`:case`object`:return`an `+t;case`boolean`:case`date`:case`regexp`:return`a `+t;default:return t}}function F(e){return!e.constructor||!e.constructor.name?f:e.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p}})),Be=p(((e,t)=>{var n=Le();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}})),Ve=p(((e,t)=>{if(process.env.NODE_ENV!==`production`){var n=Fe();t.exports=ze()(n.isElement,!0)}else t.exports=Be()()})),He=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.dontSetMe=a,e.findInArray=t,e.int=i,e.isFunction=n,e.isNum=r;function t(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function n(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function r(e){return typeof e==`number`&&!isNaN(e)}function i(e){return parseInt(e,10)}function a(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}})),Ue=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.browserPrefixToKey=r,e.browserPrefixToStyle=i,e.default=void 0,e.getPrefix=n;var t=[`Moz`,`Webkit`,`O`,`ms`];function n(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`transform`;if(typeof window>`u`)return``;let n=window.document?.documentElement?.style;if(!n||e in n)return``;for(let i=0;i<t.length;i++)if(r(e,t[i])in n)return t[i];return``}function r(e,t){return t?`${t}${a(e)}`:e}function i(e,t){return t?`-${t.toLowerCase()}-${e}`:e}function a(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}e.default=n()})),We=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.addClassName=S,e.addEvent=s,e.addUserSelectStyles=y,e.createCSSTransform=m,e.createSVGTransform=h,e.getTouch=_,e.getTouchIdentifier=v,e.getTranslation=g,e.innerHeight=d,e.innerWidth=f,e.matchesSelector=a,e.matchesSelectorAndParentsTo=o,e.offsetXYFromParent=p,e.outerHeight=l,e.outerWidth=u,e.removeClassName=C,e.removeEvent=c,e.scheduleRemoveUserSelectStyles=b;var t=He(),n=r(Ue());function r(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,i=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(r=t?i:n){if(r.has(e))return r.get(e);r.set(e,o)}for(let t in e)t!==`default`&&{}.hasOwnProperty.call(e,t)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?r(o,t,a):o[t]=e[t]);return o})(e,t)}var i=``;function a(e,n){return i||=(0,t.findInArray)([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(n){return(0,t.isFunction)(e[n])}),(0,t.isFunction)(e[i])?e[i](n):!1}function o(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 s(e,t,n,r){if(!e)return;let i={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,i):e.attachEvent?e.attachEvent(`on`+t,n):e[`on`+t]=n}function c(e,t,n,r){if(!e)return;let i={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent?e.detachEvent(`on`+t,n):e[`on`+t]=null}function l(e){let n=e.clientHeight,r=e.ownerDocument.defaultView.getComputedStyle(e);return n+=(0,t.int)(r.borderTopWidth),n+=(0,t.int)(r.borderBottomWidth),n}function u(e){let n=e.clientWidth,r=e.ownerDocument.defaultView.getComputedStyle(e);return n+=(0,t.int)(r.borderLeftWidth),n+=(0,t.int)(r.borderRightWidth),n}function d(e){let n=e.clientHeight,r=e.ownerDocument.defaultView.getComputedStyle(e);return n-=(0,t.int)(r.paddingTop),n-=(0,t.int)(r.paddingBottom),n}function f(e){let n=e.clientWidth,r=e.ownerDocument.defaultView.getComputedStyle(e);return n-=(0,t.int)(r.paddingLeft),n-=(0,t.int)(r.paddingRight),n}function p(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 m(e,t){let r=g(e,t,`px`);return{[(0,n.browserPrefixToKey)(`transform`,n.default)]:r}}function h(e,t){return g(e,t,``)}function g(e,t,n){let{x:r,y:i}=e,a=`translate(${r}${n},${i}${n})`;return t&&(a=`translate(${`${typeof t.x==`string`?t.x:t.x+n}`}, ${`${typeof t.y==`string`?t.y:t.y+n}`})`+a),a}function _(e,n){return e.targetTouches&&(0,t.findInArray)(e.targetTouches,e=>n===e.identifier)||e.changedTouches&&(0,t.findInArray)(e.changedTouches,e=>n===e.identifier)}function v(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function y(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;}
|
|
9
9
|
`,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
10
|
-
`,e.getElementsByTagName(`head`)[0].appendChild(t)),e.body&&S(e.body,`react-draggable-transparent-selection`)}function b(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{x(e)}):x(e)}function x(e){if(e)try{if(e.body&&C(e.body,`react-draggable-transparent-selection`),e.selection)e.selection.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function S(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function C(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}})),We=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.canDragX=a,e.canDragY=o,e.createCoreData=c,e.createDraggableData=l,e.getBoundPosition=r,e.getControlPosition=s,e.snapToGrid=i;var t=Ve(),n=Ue();function r(e,r,i){if(!e.props.bounds)return[r,i];let{bounds:a}=e.props;a=typeof a==`string`?a:u(a);let o=d(e);if(typeof a==`string`){let{ownerDocument:e}=o,r=e.defaultView,i;if(i=a===`parent`?o.parentNode:o.getRootNode().querySelector(a),!(i instanceof r.HTMLElement))throw Error(`Bounds selector "`+a+`" could not find an element.`);let s=i,c=r.getComputedStyle(o),l=r.getComputedStyle(s);a={left:-o.offsetLeft+(0,t.int)(l.paddingLeft)+(0,t.int)(c.marginLeft),top:-o.offsetTop+(0,t.int)(l.paddingTop)+(0,t.int)(c.marginTop),right:(0,n.innerWidth)(s)-(0,n.outerWidth)(o)-o.offsetLeft+(0,t.int)(l.paddingRight)-(0,t.int)(c.marginRight),bottom:(0,n.innerHeight)(s)-(0,n.outerHeight)(o)-o.offsetTop+(0,t.int)(l.paddingBottom)-(0,t.int)(c.marginBottom)}}return(0,t.isNum)(a.right)&&(r=Math.min(r,a.right)),(0,t.isNum)(a.bottom)&&(i=Math.min(i,a.bottom)),(0,t.isNum)(a.left)&&(r=Math.max(r,a.left)),(0,t.isNum)(a.top)&&(i=Math.max(i,a.top)),[r,i]}function i(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function a(e){return e.props.axis===`both`||e.props.axis===`x`}function o(e){return e.props.axis===`both`||e.props.axis===`y`}function s(e,t,r){let i=typeof t==`number`?(0,n.getTouch)(e,t):null;if(typeof t==`number`&&!i)return null;let a=d(r),o=r.props.offsetParent||a.offsetParent||a.ownerDocument.body;return(0,n.offsetXYFromParent)(i||e,o,r.props.scale)}function c(e,n,r){let i=!(0,t.isNum)(e.lastX),a=d(e);return i?{node:a,deltaX:0,deltaY:0,lastX:n,lastY:r,x:n,y:r}:{node:a,deltaX:n-e.lastX,deltaY:r-e.lastY,lastX:e.lastX,lastY:e.lastY,x:n,y:r}}function l(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 u(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function d(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}})),Ge=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=t;function t(){}})),Ke=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var t=l(require(`react`)),n=c(Be()),r=c(require(`react-dom`)),i=Ue(),a=We(),o=Ve(),s=c(Ge());function c(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(l=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 u(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){var t=f(e,`string`);return typeof t==`symbol`?t:t+``}function f(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 p={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},m=p.mouse,h=class extends t.Component{constructor(){super(...arguments),u(this,`dragging`,!1),u(this,`lastX`,NaN),u(this,`lastY`,NaN),u(this,`touchIdentifier`,null),u(this,`mounted`,!1),u(this,`handleDragStart`,e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button==`number`&&e.button!==0)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&&!(0,i.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,i.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=(0,i.getTouchIdentifier)(e);this.touchIdentifier=r;let o=(0,a.getControlPosition)(e,r,this);if(o==null)return;let{x:c,y:l}=o,u=(0,a.createCoreData)(this,c,l);(0,s.default)(`DraggableCore: handleDragStart: %j`,u),(0,s.default)(`calling`,this.props.onStart),!(this.props.onStart(e,u)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,i.addUserSelectStyles)(n),this.dragging=!0,this.lastX=c,this.lastY=l,(0,i.addEvent)(n,m.move,this.handleDrag),(0,i.addEvent)(n,m.stop,this.handleDragStop))}),u(this,`handleDrag`,e=>{let t=(0,a.getControlPosition)(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]=(0,a.snapToGrid)(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=(0,a.createCoreData)(this,n,r);if((0,s.default)(`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}),u(this,`handleDragStop`,e=>{if(!this.dragging)return;let t=(0,a.getControlPosition)(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]=(0,a.snapToGrid)(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let o=(0,a.createCoreData)(this,n,r);if(this.props.onStop(e,o)===!1||this.mounted===!1)return!1;let c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,i.scheduleRemoveUserSelectStyles)(c.ownerDocument),(0,s.default)(`DraggableCore: handleDragStop: %j`,o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,s.default)(`DraggableCore: Removing handlers`),(0,i.removeEvent)(c.ownerDocument,m.move,this.handleDrag),(0,i.removeEvent)(c.ownerDocument,m.stop,this.handleDragStop))}),u(this,`onMouseDown`,e=>(m=p.mouse,this.handleDragStart(e))),u(this,`onMouseUp`,e=>(m=p.mouse,this.handleDragStop(e))),u(this,`onTouchStart`,e=>(m=p.touch,this.handleDragStart(e))),u(this,`onTouchEnd`,e=>(m=p.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&(0,i.addEvent)(e,p.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;(0,i.removeEvent)(t,p.mouse.move,this.handleDrag),(0,i.removeEvent)(t,p.touch.move,this.handleDrag),(0,i.removeEvent)(t,p.mouse.stop,this.handleDragStop),(0,i.removeEvent)(t,p.touch.stop,this.handleDragStop),(0,i.removeEvent)(e,p.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,i.scheduleRemoveUserSelectStyles)(t)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:r.default.findDOMNode(this)}render(){return t.cloneElement(t.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};e.default=h,u(h,`displayName`,`DraggableCore`),u(h,`propTypes`,{allowAnyClick:n.default.bool,allowMobileScroll:n.default.bool,children:n.default.node.isRequired,disabled:n.default.bool,enableUserSelectHack:n.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:n.default.arrayOf(n.default.number),handle:n.default.string,cancel:n.default.string,nodeRef:n.default.object,onStart:n.default.func,onDrag:n.default.func,onStop:n.default.func,onMouseDown:n.default.func,scale:n.default.number,className:o.dontSetMe,style:o.dontSetMe,transform:o.dontSetMe}),u(h,`defaultProps`,{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})})),qe=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),Object.defineProperty(e,`DraggableCore`,{enumerable:!0,get:function(){return c.default}}),e.default=void 0;var t=d(require(`react`)),n=u(Be()),r=u(require(`react-dom`)),i=require(`clsx`),a=Ue(),o=We(),s=Ve(),c=u(Ke()),l=u(Ge());function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(d=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 f(){return f=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},f.apply(null,arguments)}function p(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){var t=h(e,`string`);return typeof t==`symbol`?t:t+``}function h(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 g=class extends t.Component{static getDerivedStateFromProps(e,t){let{position:n}=e,{prevPropsPosition:r}=t;return n&&(!r||n.x!==r.x||n.y!==r.y)?((0,l.default)(`Draggable: getDerivedStateFromProps %j`,{position:n,prevPropsPosition:r}),{x:n.x,y:n.y,prevPropsPosition:{...n}}):null}constructor(e){super(e),p(this,`onDragStart`,(e,t)=>{if((0,l.default)(`Draggable: onDragStart: %j`,t),this.props.onStart(e,(0,o.createDraggableData)(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,`onDrag`,(e,t)=>{if(!this.state.dragging)return!1;(0,l.default)(`Draggable: onDrag: %j`,t);let n=(0,o.createDraggableData)(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]=(0,o.getBoundPosition)(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)}),p(this,`onDragStop`,(e,t)=>{if(!this.state.dragging||this.props.onStop(e,(0,o.createDraggableData)(this,t))===!1)return!1;(0,l.default)(`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.")}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??r.default.findDOMNode(this)}render(){let{axis:e,bounds:n,children:r,defaultPosition:s,defaultClassName:l,defaultClassNameDragging:u,defaultClassNameDragged:d,position:p,positionOffset:m,scale:h,...g}=this.props,_={},v=null,y=!p||this.state.dragging,b=p||s,x={x:(0,o.canDragX)(this)&&y?this.state.x:b.x,y:(0,o.canDragY)(this)&&y?this.state.y:b.y};this.state.isElementSVG?v=(0,a.createSVGTransform)(x,m):_=(0,a.createCSSTransform)(x,m);let S=(0,i.clsx)(r.props.className||``,l,{[u]:this.state.dragging,[d]:this.state.dragged});return t.createElement(c.default,f({},g,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(r),{className:S,style:{...r.props.style,..._},transform:v}))}};e.default=g,p(g,`displayName`,`Draggable`),p(g,`propTypes`,{...c.default.propTypes,axis:n.default.oneOf([`both`,`x`,`y`,`none`]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),p(g,`defaultProps`,{...c.default.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1})})),Je=p(((e,t)=>{var{default:n,DraggableCore:r}=qe();t.exports=n,t.exports.default=n,t.exports.DraggableCore=r})),Ye=p((e=>{e.__esModule=!0,e.cloneElement=c;var t=n(require(`react`));function n(e){return e&&e.__esModule?e:{default:e}}function r(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 i(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?r(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){var t=s(e,`string`);return typeof t==`symbol`?t:t+``}function s(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 c(e,n){return n.style&&e.props.style&&(n.style=i(i({},e.props.style),n.style)),n.className&&e.props.className&&(n.className=`${e.props.className} ${n.className}`),t.default.cloneElement(e,n)}})),Xe=p((e=>{e.__esModule=!0,e.resizableProps=void 0;var t=n(Be());Je();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(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];let[i]=n;return i.axis===`both`||i.axis===`y`?t.default.number.isRequired(...n):t.default.number(...n)},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(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];let[i]=n;return i.axis===`both`||i.axis===`x`?t.default.number.isRequired(...n):t.default.number(...n)}}})),Ze=p((e=>{e.__esModule=!0,e.default=void 0;var t=o(require(`react`)),n=Je(),r=Ye(),i=Xe(),a=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function o(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(o=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 s(){return s=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},s.apply(null,arguments)}function c(e,t){if(e==null)return{};var n,r,i=l(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}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{minConstraints:n,maxConstraints:r,lockAspectRatio:i}=this.props;if(!n&&!r&&!i)return[e,t];if(i){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[a,o]=[e,t],[s,c]=this.slack||[0,0];return e+=s,t+=c,n&&(e=Math.max(n[0],e),t=Math.max(n[1],t)),r&&(e=Math.min(r[0],e),t=Math.min(r[1],t)),this.slack=[s+(a-e),c+(o-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let{node:i,deltaX:a,deltaY:o}=r;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.props.width+(s?a/this.props.transformScale:0),p=this.props.height+(c?o/this.props.transformScale:0);[f,p]=this.runConstraints(f,p),e===`onResizeStop`&&this.lastSize&&({width:f,height:p}=this.lastSize);let m=f!==this.props.width||p!==this.props.height;e!==`onResizeStop`&&(this.lastSize={width:f,height:p});let h=typeof this.props[e]==`function`?this.props[e]:null;h&&!(e===`onResize`&&!m)&&(n.persist?.(),h(n,{node:i,size:{width:f,height:p},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,n){let{handle:r}=this.props;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,{children:i,className:o,draggableOpts:l,width:u,height:f,handle:p,handleSize:m,lockAspectRatio:h,axis:g,minConstraints:_,maxConstraints:v,onResize:y,onResizeStop:b,onResizeStart:x,resizeHandles:S,transformScale:C}=e,w=c(e,a);return(0,r.cloneElement)(i,d(d({},w),{},{className:`${o?`${o} `:``}react-resizable`,children:[...t.Children.toArray(i.props.children),...S.map(e=>{let r=this.handleRefs[e]??(this.handleRefs[e]=t.createRef());return t.createElement(n.DraggableCore,s({},l,{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=i.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),Qe=p((e=>{e.__esModule=!0,e.default=void 0;var t=s(require(`react`)),n=o(Be()),r=o(Ze()),i=Xe(),a=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function o(e){return e&&e.__esModule?e:{default:e}}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){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 u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?l(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){var t=p(e,`string`);return typeof t==`symbol`?t:t+``}function p(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 m(e,t){if(e==null)return{};var n,r,i=h(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}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{size:n}=t;this.props.onResize?(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,{handle:n,handleSize:i,onResize:o,onResizeStart:s,onResizeStop:l,draggableOpts:d,minConstraints:f,maxConstraints:p,lockAspectRatio:h,axis:g,width:_,height:v,resizeHandles:y,style:b,transformScale:x}=e,S=m(e,a);return t.createElement(r.default,{axis:g,draggableOpts:d,handle:n,handleSize:i,height:this.state.height,lockAspectRatio:h,maxConstraints:p,minConstraints:f,onResizeStart:s,onResize:this.onResize,onResizeStop:l,resizeHandles:y,transformScale:x,width:this.state.width},t.createElement(`div`,c({},S,{style:u(u({},b),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=u(u({},i.resizableProps),{},{children:n.default.element})})),$e=p(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Ze().default,t.exports.ResizableBox=Qe().default})),et=Je(),tt=$e(),nt=Ae();function rt(e){let{children:t,cols:n,containerWidth:r,margin:a,containerPadding:s,rowHeight:c,maxRows:l,isDraggable:u,isResizable:d,isBounded:f,static:p,useCSSTransforms:m=!0,usePercentages:h=!1,transformScale:g=1,positionStrategy:_,dragThreshold:v=0,droppingPosition:b,className:x=``,style:S,handle:E=``,cancel:A=``,x:j,y:M,w:N,h:P,minW:F=1,maxW:I=1/0,minH:L=1,maxH:R=1/0,i:z,resizeHandles:B,resizeHandle:V,constraints:H=re,layoutItem:U,layout:ee=[],onDragStart:te,onDrag:ne,onDragStop:le,onResizeStart:ue,onResize:de,onResizeStop:fe}=e,[W,G]=(0,i.useState)(!1),[K,pe]=(0,i.useState)(!1),me=(0,i.useRef)(null),q=(0,i.useRef)({left:0,top:0}),ge=(0,i.useRef)({top:0,left:0,width:0,height:0}),_e=(0,i.useRef)(void 0),ve=(0,i.useRef)(ee);ve.current=ee;let ye=(0,i.useRef)(null),be=(0,i.useRef)(null),xe=(0,i.useRef)(!1),Se=(0,i.useRef)({x:0,y:0}),Ce=(0,i.useRef)(!1),J=(0,i.useMemo)(()=>({cols:n,containerPadding:s,containerWidth:r,margin:a,maxRows:l,rowHeight:c}),[n,s,r,a,l,c]),Y=(0,i.useMemo)(()=>({cols:n,maxRows:l,containerWidth:r,containerHeight:0,rowHeight:c,margin:a,layout:[]}),[n,l,r,c,a]),X=(0,i.useCallback)(()=>({...Y,layout:ve.current}),[Y]),Z=(0,i.useMemo)(()=>U??{i:z,x:j,y:M,w:N,h:P,minW:F,maxW:I,minH:L,maxH:R},[U,z,j,M,N,P,F,I,L,R]),we=(0,i.useCallback)(e=>{if(_?.calcStyle)return _.calcStyle(e);if(m)return oe(e);let t=se(e);return h?{...t,left:ce(e.left/r),width:ce(e.width/r)}:t},[_,m,h,r]),Te=(0,i.useCallback)((e,{node:t})=>{if(!te)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/g,o=r.left/g,s=i.top/g,c=r.top/g,l;if(_?.calcDragPosition){let t=e;l=_.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(q.current=l,v>0){let t=e;Se.current={x:t.clientX,y:t.clientY},xe.current=!0,Ce.current=!1,G(!0);return}G(!0);let u=D(J,l.top,l.left),{x:d,y:f}=ie(H,Z,u.x,u.y,X());te(z,d,f,{e,node:t,newPosition:l})},[te,g,J,_,v,H,Z,X,z]),Ee=(0,i.useCallback)((e,{node:t,deltaX:n,deltaY:i})=>{if(!ne||!W)return;let o=e;if(xe.current&&!Ce.current){let n=o.clientX-Se.current.x,r=o.clientY-Se.current.y;if(Math.hypot(n,r)<v)return;if(Ce.current=!0,xe.current=!1,te){let n=D(J,q.current.top,q.current.left),{x:r,y:i}=ie(H,Z,n.x,n.y,X());te(z,r,i,{e,node:t,newPosition:q.current})}}let s=q.current.top+i,l=q.current.left+n;if(f){let{offsetParent:e}=t;if(e){let t=e.clientHeight-w(P,c,a[1]);s=k(s,0,t);let n=r-w(N,C(J),a[0]);l=k(l,0,n)}}let u={top:s,left:l};q.current=u;let d=D(J,s,l),{x:p,y:m}=ie(H,Z,d.x,d.y,X());ne(z,p,m,{e,node:t,newPosition:u})},[ne,te,W,v,f,P,c,a,J,r,N,z,H,Z,X]),De=(0,i.useCallback)((e,{node:t})=>{if(!le||!W)return;let n=xe.current;if(xe.current=!1,Ce.current=!1,Se.current={x:0,y:0},n){G(!1),q.current={left:0,top:0};return}let{left:r,top:i}=q.current,a={top:i,left:r};G(!1),q.current={left:0,top:0};let o=D(J,i,r),{x:s,y:c}=ie(H,Z,o.x,o.y,X());le(z,s,c,{e,node:t,newPosition:a})},[le,W,J,H,Z,X,z]);ye.current=Te,be.current=Ee;let Q=(0,i.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?ue:o===`onResize`?de:fe;if(!s)return;let c;c=t?he(i,a,n,r):{...n,top:a.top,left:a.left},ge.current=c;let l=O(J,c.width,c.height),{w:u,h:d}=ae(H,Z,l.w,l.h,i,X());s(z,u,d,{e:e.nativeEvent,node:t,size:c,handle:i})},[ue,de,fe,r,J,z,H,Z,X]),Oe=(0,i.useCallback)((e,t)=>{pe(!0);let n=T(J,j,M,N,P);Q(e,{...t,handle:t.handle},n,`onResizeStart`)},[Q,J,j,M,N,P]),ke=(0,i.useCallback)((e,t)=>{let n=T(J,j,M,N,P);Q(e,{...t,handle:t.handle},n,`onResize`)},[Q,J,j,M,N,P]),Ae=(0,i.useCallback)((e,t)=>{pe(!1),ge.current={top:0,left:0,width:0,height:0};let n=T(J,j,M,N,P);Q(e,{...t,handle:t.handle},n,`onResizeStop`)},[Q,J,j,M,N,P]);(0,i.useEffect)(()=>{if(!b)return;let e=me.current;if(!e)return;let t=_e.current||{left:0,top:0},n=W&&(b.left!==t.left||b.top!==t.top);if(!W){let t={node:e,deltaX:b.left,deltaY:b.top,lastX:0,lastY:0,x:b.left,y:b.top};ye.current?.(b.e,t)}else if(n){let t={node:e,deltaX:b.left-q.current.left,deltaY:b.top-q.current.top,lastX:q.current.left,lastY:q.current.top,x:b.left,y:b.top};be.current?.(b.e,t)}_e.current=b},[b,W,z]);let je=T(J,j,M,N,P,W?q.current:null,K?ge.current:null),Me=i.default.Children.only(t),Ne=C(J),Pe=[w(F,Ne,a[0]),w(L,c,a[1])],Fe=[w(I,Ne,a[0]),w(R,c,a[1])],Ie=Me.props,Le=Ie.className,Re=Ie.style,$=i.default.cloneElement(Me,{ref:me,className:(0,o.default)(`react-grid-item`,Le,x,{static:p,resizing:K,"react-draggable":u,"react-draggable-dragging":W,dropping:!!b,cssTransforms:m}),style:{...S,...Re,...we(je)}}),ze=V;return $=(0,y.jsx)(tt.Resizable,{draggableOpts:{disabled:!d},className:d?void 0:`react-resizable-hide`,width:je.width,height:je.height,minConstraints:Pe,maxConstraints:Fe,onResizeStart:Oe,onResize:ke,onResizeStop:Ae,transformScale:g,resizeHandles:B,handle:ze,children:$}),$=(0,y.jsx)(et.DraggableCore,{disabled:!u,onStart:Te,onDrag:Ee,onStop:De,handle:E,cancel:`.react-resizable-handle`+(A?`,`+A:``),scale:g,nodeRef:me,children:$}),$}var it=()=>{},at=`react-grid-layout`,ot=!1;try{ot=/firefox/i.test(navigator.userAgent)}catch{}function st(e,t){let n=i.default.Children.toArray(e),r=i.default.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 ct(e,t,n,r){let a=[],o=new Set;i.default.Children.forEach(t,t=>{if(!i.default.isValidElement(t)||t.key===null)return;let n=String(t.key);o.add(n);let r=e.find(e=>e.i===n);if(r)a.push(z(r));else{let e=t.props[`data-grid`];e?a.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}):a.push({i:n,x:0,y:I(a),w:1,h:1})}});let s=U(a,{cols:n});return r.compact(s,n)}function lt(e){let{children:t,width:n,gridConfig:r,dragConfig:a,resizeConfig:s,dropConfig:c,positionStrategy:l=q,compactor:u,constraints:d=re,layout:f=[],droppingItem:p,autoSize:m=!0,className:h=``,style:g={},innerRef:_,onLayoutChange:v=it,onDragStart:b=it,onDrag:x=it,onDragStop:S=it,onResizeStart:T=it,onResize:D=it,onResizeStop:O=it,onDrop:k=it,onDropDragOver:A=it}=e,j=(0,i.useMemo)(()=>({...ge,...r}),[r]),N=(0,i.useMemo)(()=>({..._e,...a}),[a]),P=(0,i.useMemo)(()=>({...ve,...s}),[s]),F=(0,i.useMemo)(()=>({...ye,...c}),[c]),{cols:R,rowHeight:B,maxRows:V,margin:U,containerPadding:te}=j,{enabled:ne,bounded:ie,handle:ae,cancel:oe,threshold:se}=N,{enabled:ce,handles:le,handleComponent:ue}=P,{enabled:de,defaultItem:fe,onDragOver:W}=F,G=u??Te(`vertical`),K=G.type,pe=G.allowOverlap,me=G.preventCollision??!1,he=(0,i.useMemo)(()=>p??{i:`__dropping-elem__`,...fe},[p,fe]),be=l.type===`transform`,xe=l.scale,Se=te??U,[Ce,J]=(0,i.useState)(!1),[Y,X]=(0,i.useState)(()=>ct(f,t,R,G)),[Z,we]=(0,i.useState)(null),[Ee,De]=(0,i.useState)(!1),[Q,Oe]=(0,i.useState)(null),[ke,Ae]=(0,i.useState)(),je=(0,i.useRef)(null),Me=(0,i.useRef)(null),Ne=(0,i.useRef)(null),Pe=(0,i.useRef)(0),Fe=(0,i.useRef)(Y),Ie=(0,i.useRef)(f),Le=(0,i.useRef)(t),Re=(0,i.useRef)(K),$=(0,i.useRef)(Y);$.current=Y,(0,i.useEffect)(()=>{J(!0),(0,nt.deepEqual)(Y,f)||v(Y)},[]),(0,i.useEffect)(()=>{if(Z||Q)return;let e=!(0,nt.deepEqual)(f,Ie.current),n=!st(t,Le.current),r=K!==Re.current;if(e||n||r){let n=ct(e?f:Y,t,R,G);(0,nt.deepEqual)(n,Y)||X(n)}Ie.current=f,Le.current=t,Re.current=K},[f,t,R,K,G,Z,Q,Y]),(0,i.useEffect)(()=>{!Z&&!(0,nt.deepEqual)(Y,Fe.current)&&(Fe.current=Y,v(Y.filter(e=>e.i!==he.i)))},[Y,Z,v,he.i]);let ze=(0,i.useMemo)(()=>{if(!m)return;let e=I(Y),t=Se[1];return e*B+(e-1)*U[1]+t*2+`px`},[m,Y,B,U,Se]),Be=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=L(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};je.current=z(a),Ne.current=i,we(o),b(i,a,a,null,r.e,r.node)},[b]),Ve=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=je.current,o=L(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=ee(i,o,t,n,!0,me,K,R,pe);x(c,a,o,s,r.e,r.node),X(G.compact(c,R)),we(s)},[me,K,R,pe,G,x]),He=(0,i.useCallback)((e,t,n,r)=>{if(!Z)return;let i=$.current,a=je.current,o=L(i,e);if(!o)return;let s=ee(i,o,t,n,!0,me,K,R,pe),c=G.compact(s,R);S(c,a,o,null,r.e,r.node);let l=Ne.current;je.current=null,Ne.current=null,we(null),X(c),l&&!(0,nt.deepEqual)(l,c)&&v(c)},[Z,me,K,R,pe,G,S,v]),Ue=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=L(i,e);a&&(Me.current=z(a),Ne.current=i,De(!0),T(i,a,a,null,r.e,r.node))},[T]),We=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=Me.current,{handle:o}=r,s=!1,c,l,[u,d]=H(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),me&&!pe&&M(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=ee(u,d,c,l,!0,me,K,R,pe));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};D(f,a,d,p,r.e,r.node),X(G.compact(f,R)),we(p)},[me,K,R,pe,G,D]),Ge=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=Me.current,o=L(i,e),s=G.compact(i,R);O(s,a,o??null,null,r.e,r.node);let c=Ne.current;Me.current=null,Ne.current=null,we(null),De(!1),X(s),c&&!(0,nt.deepEqual)(c,s)&&v(s)},[R,G,O,v]),Ke=(0,i.useCallback)(()=>{let e=$.current;if(!e.some(e=>e.i===he.i)){Oe(null),we(null),Ae(void 0);return}X(G.compact(e.filter(e=>e.i!==he.i),R)),Oe(null),we(null),Ae(void 0)},[he.i,R,G]),qe=(0,i.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),ot&&!e.nativeEvent.target?.classList.contains(at))return!1;let t=W?W(e.nativeEvent):A(e);if(t===!1)return Q&&Ke(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...he,...a},s=e.currentTarget.getBoundingClientRect(),c={cols:R,margin:U,maxRows:V,rowHeight:B,containerWidth:n,containerPadding:Se},l=C(c),u=w(o.w,l,U[0]),d=w(o.h,B,U[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/xe,top:_/xe,e:e.nativeEvent};if(Q)ke&&(ke.left!==v.left||ke.top!==v.top)&&Ae(v);else{let e=E(c,_,g,o.w,o.h);Oe((0,y.jsx)(`div`,{},o.i)),Ae(v),X([...$.current.filter(e=>e.i!==o.i),{...o,x:e.x,y:e.y,static:!1,isDraggable:!0}])}},[Q,ke,he,W,A,Ke,xe,R,U,V,B,n,Se]),Je=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Pe.current--,Pe.current<0&&(Pe.current=0),Pe.current===0&&Ke()},[Ke]),Ye=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Pe.current++},[]),Xe=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=$.current,n=t.find(e=>e.i===he.i);Pe.current=0,Ke(),k(t,n,e.nativeEvent)},[he.i,Ke,k]),Ze=(0,i.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=L(Y,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&ne,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ce,o=r.resizeHandles||[...le],s=i&&ie&&r.isBounded!==!1,c=ue;return(0,y.jsx)(rt,{containerWidth:n,cols:R,margin:U,containerPadding:Se,maxRows:V,rowHeight:B,cancel:oe,handle:ae,onDragStart:Be,onDrag:Ve,onDragStop:He,onResizeStart:Ue,onResize:We,onResizeStop:Ge,isDraggable:i,isResizable:a,isBounded:s,useCSSTransforms:be&&Ce,usePercentages:!Ce,transformScale:xe,positionStrategy:l,dragThreshold:se,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?ke:void 0,resizeHandles:o,resizeHandle:c,constraints:d,layoutItem:r,layout:Y,children:e},r.i)},[Y,n,R,U,Se,V,B,oe,ae,Be,Ve,He,Ue,We,Ge,ne,ce,ie,be,Ce,xe,l,se,ke,le,ue,d]),Qe=()=>Z?(0,y.jsx)(rt,{w:Z.w,h:Z.h,x:Z.x,y:Z.y,i:Z.i,className:`react-grid-placeholder ${Ee?`placeholder-resizing`:``}`,containerWidth:n,cols:R,margin:U,containerPadding:Se,maxRows:V,rowHeight:B,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:be,transformScale:xe,constraints:d,layout:Y,children:(0,y.jsx)(`div`,{})}):null;return(0,y.jsxs)(`div`,{ref:_,className:(0,o.default)(at,h),style:{height:ze,...g},onDrop:de?Xe:void 0,onDragLeave:de?Je:void 0,onDragEnter:de?Ye:void 0,onDragOver:de?qe:void 0,children:[i.default.Children.map(t,e=>i.default.isValidElement(e)?Ze(e):null),de&&Q&&Ze(Q,!0),Qe()]})}var ut={lg:1200,md:996,sm:768,xs:480,xxs:0},dt={lg:12,md:10,sm:6,xs:4,xxs:2},ft=()=>{};function pt(e,t,n,r){let a=[];i.default.Children.forEach(t,t=>{if(!i.default.isValidElement(t)||t.key===null)return;let n=String(t.key),r=e.find(e=>e.i===n);if(r)a.push({...r,i:n});else{let e=t.props[`data-grid`];e?a.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}):a.push({i:n,x:0,y:I(a),w:1,h:1})}});let o=U(a,{cols:n});return r.compact(o,n)}function mt(e){let{children:t,width:n,breakpoint:r,breakpoints:a=ut,cols:o=dt,layouts:s={},rowHeight:c=150,maxRows:l=1/0,margin:u=[10,10],containerPadding:d=null,compactor:f,onBreakpointChange:p=ft,onLayoutChange:m=ft,onWidthChange:h=ft,...g}=e,_=f??Te(`vertical`),v=_.type,b=_.allowOverlap,x=(0,i.useMemo)(()=>r??De(a,n),[]),S=(0,i.useMemo)(()=>Q(x,o),[x,o]),C=(0,i.useMemo)(()=>Oe(s,a,x,x,S,v),[]),[w,T]=(0,i.useState)(x),[E,D]=(0,i.useState)(S),[O,k]=(0,i.useState)(C),[A,j]=(0,i.useState)(s),M=(0,i.useRef)(n),N=(0,i.useRef)(r),P=(0,i.useRef)(a),F=(0,i.useRef)(o),I=(0,i.useRef)(s),L=(0,i.useRef)(v),R=(0,i.useRef)(A);(0,i.useEffect)(()=>{R.current=A},[A]);let z=(0,i.useMemo)(()=>(0,nt.deepEqual)(s,I.current)?null:Oe(s,a,w,w,E,_),[s,a,w,E,_]),V=z??O;(0,i.useEffect)(()=>{z!==null&&(k(z),j(s),R.current=s,I.current=s)},[z,s]),(0,i.useEffect)(()=>{if(v!==L.current){let e=_.compact(B(V),E),t={...R.current,[w]:e};k(e),j(t),R.current=t,m(e,t),L.current=v}},[v,_,V,E,b,w,m]),(0,i.useEffect)(()=>{let e=n!==M.current,i=r!==N.current,s=!(0,nt.deepEqual)(a,P.current),c=!(0,nt.deepEqual)(o,F.current);if(e||i||s||c){let e=r??De(a,n),i=Q(e,o),l=w;if(l!==e||s||c){let n={...R.current};n[l]||(n[l]=B(O));let r=Oe(n,a,e,l,i,_);r=pt(r,t,i,_),n[e]=r,T(e),D(i),k(r),j(n),R.current=n,p(e,i),m(r,n)}h(n,ke(u,e),i,d?ke(d,e):null),M.current=n,N.current=r,P.current=a,F.current=o}},[n,r,a,o,w,E,O,t,_,v,b,u,d,p,m,h]);let H=(0,i.useCallback)(e=>{let t={...R.current,[w]:e};k(e),j(t),R.current=t,m(e,t)},[w,m]),U=(0,i.useMemo)(()=>ke(u,w),[u,w]),ee=(0,i.useMemo)(()=>d===null?null:ke(d,w),[d,w]),te=(0,i.useMemo)(()=>({cols:E,rowHeight:c,maxRows:l,margin:U,containerPadding:ee}),[E,c,l,U,ee]);return(0,y.jsx)(lt,{...g,width:n,gridConfig:te,compactor:_,onLayoutChange:H,layout:V,children:t})}function ht({editMode:e}){let t=(0,n.useDnd)();return i.useEffect(()=>{if(e)return t.startDrag({id:`dashboard-layout`,type:`dashboard-widget`,data:{}}),()=>{t.endDrag()};t.endDrag(`dashboard`)},[e,t]),null}var gt=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],_t=({schema:e,className:t,onLayoutChange:o,persistLayoutKey:s=`dashboard-layout`,onRefresh:c})=>{let{width:l,containerRef:u,mounted:d}=je(),[f,p]=i.useState(!1),[m,h]=i.useState(!1),_=(0,n.useHasDndProvider)(),v=i.useRef(null),b=i.useCallback(()=>{c&&(h(!0),c(),setTimeout(()=>h(!1),600))},[c]);i.useEffect(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!c))return v.current=setInterval(b,e.refreshInterval*1e3),()=>{v.current&&clearInterval(v.current)}},[e.refreshInterval,c,b]);let[x,S]=i.useState(()=>{if(typeof window<`u`&&s){let e=localStorage.getItem(s);if(e)try{return JSON.parse(e)}catch(e){console.error(`Failed to parse saved layout:`,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}))||[]}}),C=i.useCallback((e,t)=>{S(t),o?.(e)},[o]),w=i.useCallback(()=>{typeof window<`u`&&s&&localStorage.setItem(s,JSON.stringify(x)),p(!1)},[x,s]),T=i.useCallback(()=>{S({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}))||[]}),typeof window<`u`&&s&&localStorage.removeItem(s)},[e.widgets,s]),E=i.useCallback(e=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`bar`||t===`line`||t===`area`||t===`pie`||t===`donut`||t===`scatter`){let r=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(g(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:gt,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:gt,className:`h-full`}}return{type:`chart`,chartType:t,data:Array.isArray(r)?r:r?.items||[],xAxisKey:i,series:[{dataKey:a}],colors:gt,className:`h-full`}}if(t===`table`){let t=e.data||n.data;if(g(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(g(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,y.jsxs)(`div`,{ref:u,className:(0,r.cn)(`w-full`,t),"data-testid":`grid-layout`,children:[_&&(0,y.jsx)(ht,{editMode:f}),(0,y.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,y.jsx)(`h2`,{className:`text-2xl font-bold`,children:e.title||`Dashboard`}),(0,y.jsx)(`div`,{className:`flex gap-2`,children:f?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(r.Button,{onClick:w,size:`sm`,variant:`default`,children:[(0,y.jsx)(a.Save,{className:`h-4 w-4 mr-2`}),`Save Layout`]}),(0,y.jsxs)(r.Button,{onClick:T,size:`sm`,variant:`outline`,children:[(0,y.jsx)(a.X,{className:`h-4 w-4 mr-2`}),`Reset`]}),(0,y.jsx)(r.Button,{onClick:()=>p(!1),size:`sm`,variant:`ghost`,children:`Cancel`})]}):(0,y.jsxs)(y.Fragment,{children:[c&&(0,y.jsxs)(r.Button,{onClick:b,size:`sm`,variant:`outline`,disabled:m,"aria-label":`Refresh dashboard`,children:[(0,y.jsx)(a.RefreshCw,{className:(0,r.cn)(`h-4 w-4 mr-2`,m&&`animate-spin`)}),m?`Refreshing…`:`Refresh All`]}),(0,y.jsxs)(r.Button,{onClick:()=>p(!0),size:`sm`,variant:`outline`,children:[(0,y.jsx)(a.Edit,{className:`h-4 w-4 mr-2`}),`Edit Layout`]})]})})]}),d&&(0,y.jsx)(mt,{className:`layout`,width:l,layouts:x,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:f,handle:`.drag-handle`},resizeConfig:{enabled:f},onLayoutChange:C,children:e.widgets?.map((e,t)=>{let i=e.id||`widget-${t}`,o=E(e);return(0,y.jsx)(`div`,{className:`h-full`,children:e.type===`metric`?(0,y.jsxs)(`div`,{className:`h-full w-full relative`,children:[f&&(0,y.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,y.jsx)(a.GripVertical,{className:`h-4 w-4`})}),(0,y.jsx)(n.SchemaRenderer,{schema:o,className:`h-full w-full`})]}):(0,y.jsxs)(r.Card,{className:(0,r.cn)(`h-full overflow-hidden border-border/50 shadow-sm transition-all`,`bg-card/50 backdrop-blur-sm`,f&&`ring-2 ring-primary/20`),children:[e.title&&(0,y.jsxs)(r.CardHeader,{className:`pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between`,children:[(0,y.jsx)(r.CardTitle,{className:`text-base font-medium tracking-tight truncate`,title:e.title,children:e.title}),f&&(0,y.jsx)(`div`,{className:`drag-handle cursor-move p-1 hover:bg-muted/40 rounded`,children:(0,y.jsx)(a.GripVertical,{className:`h-4 w-4`})})]}),(0,y.jsx)(r.CardContent,{className:`p-0 h-full`,children:(0,y.jsx)(`div`,{className:(0,r.cn)(`h-full w-full overflow-auto p-4`),children:(0,y.jsx)(n.SchemaRenderer,{schema:o})})})]})},i)})})]})};function vt(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var yt=({label:e,value:t,trend:n,icon:o,className:s,description:c,loading:l,error:u,...d})=>{let f=(0,i.useMemo)(()=>{if(typeof o==`string`){let e=a[o];return e?(0,y.jsx)(e,{className:`h-4 w-4 text-muted-foreground`}):null}return o},[o]);return(0,y.jsxs)(r.Card,{className:(0,r.cn)(`h-full overflow-hidden`,s),...d,children:[(0,y.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,y.jsx)(r.CardTitle,{className:`text-sm font-medium truncate`,children:vt(e)}),f&&(0,y.jsx)(`div`,{className:`h-4 w-4 text-muted-foreground shrink-0`,children:f})]}),(0,y.jsx)(r.CardContent,{children:l?(0,y.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,"data-testid":`metric-loading`,children:[(0,y.jsx)(a.Loader2,{className:`h-4 w-4 animate-spin`}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):u?(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`metric-error`,role:`alert`,children:[(0,y.jsx)(a.AlertCircle,{className:`h-4 w-4 text-destructive shrink-0`}),(0,y.jsx)(`span`,{className:`text-xs text-destructive truncate`,children:u})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`text-2xl font-bold truncate`,children:t}),(n||c)&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center mt-1 truncate`,children:[n&&(0,y.jsxs)(`span`,{className:(0,r.cn)(`flex items-center mr-2 shrink-0`,n.direction===`up`&&`text-green-500`,n.direction===`down`&&`text-red-500`,n.direction===`neutral`&&`text-yellow-500`),children:[n.direction===`up`&&(0,y.jsx)(a.ArrowUpIcon,{className:`h-3 w-3 mr-1`}),n.direction===`down`&&(0,y.jsx)(a.ArrowDownIcon,{className:`h-3 w-3 mr-1`}),n.direction===`neutral`&&(0,y.jsx)(a.MinusIcon,{className:`h-3 w-3 mr-1`}),n.value,`%`]}),(0,y.jsx)(`span`,{className:`truncate`,children:vt(c)||vt(n?.label)})]})]})})]})};function bt(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var xt=({title:e,value:t,icon:n,trend:i,trendValue:o,description:s,className:c,loading:l,error:u,...d})=>{let f=n&&a[n];return(0,y.jsxs)(r.Card,{className:(0,r.cn)(`h-full`,c),...d,children:[(0,y.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,y.jsx)(r.CardTitle,{className:`text-sm font-medium`,children:bt(e)}),f&&(0,y.jsx)(f,{className:`h-4 w-4 text-muted-foreground`})]}),(0,y.jsx)(r.CardContent,{children:l?(0,y.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,"data-testid":`metric-card-loading`,children:[(0,y.jsx)(a.Loader2,{className:`h-4 w-4 animate-spin`}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):u?(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`metric-card-error`,role:`alert`,children:[(0,y.jsx)(a.AlertCircle,{className:`h-4 w-4 text-destructive shrink-0`}),(0,y.jsx)(`span`,{className:`text-xs text-destructive truncate`,children:u})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`text-2xl font-bold`,children:t}),(i||o||s)&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center mt-1`,children:[i&&o&&(0,y.jsxs)(`span`,{className:(0,r.cn)(`flex items-center mr-2`,i===`up`&&`text-green-500`,i===`down`&&`text-red-500`,i===`neutral`&&`text-yellow-500`),children:[i===`up`&&(0,y.jsx)(a.ArrowUpIcon,{className:`h-3 w-3 mr-1`}),i===`down`&&(0,y.jsx)(a.ArrowDownIcon,{className:`h-3 w-3 mr-1`}),i===`neutral`&&(0,y.jsx)(a.MinusIcon,{className:`h-3 w-3 mr-1`}),o]}),bt(s)]})]})})]})},St=({objectName:e,aggregate:t,filter:r,label:a,fallbackValue:o,trend:s,icon:c,className:l,description:u,dataSource:d})=>{let f=(0,i.useContext)(n.SchemaRendererContext),p=d||f?.dataSource,[m,h]=(0,i.useState)(null),[g,_]=(0,i.useState)(!1),[v,b]=(0,i.useState)(null),x=(0,i.useCallback)(async(n,i)=>{if(!(!n||!e)){i.current&&(_(!0),b(null));try{let a;if(t&&typeof n.aggregate==`function`){let i=await n.aggregate(e,{field:t.field,function:t.function,groupBy:t.groupBy||`_all`,filter:r}),o=Array.isArray(i)?i:[];a=o.length===0?0:t.function===`count`?o.reduce((e,n)=>e+(Number(n[t.field])||Number(n.count)||0),0):o[0][t.field]??0}else if(typeof n.find==`function`){let t=await n.find(e,{$filter:r});a=(Array.isArray(t)?t:t?.data||t?.records||[]).length}else return;i.current&&h(a)}catch(e){console.error(`[ObjectMetricWidget] Fetch error:`,e),i.current&&b(e instanceof Error?e.message:`Failed to load metric`)}finally{i.current&&_(!1)}}},[e,t,r]);return(0,i.useEffect)(()=>{let t={current:!0};return p&&e?x(p,t):(h(null),b(null)),()=>{t.current=!1}},[p,e,x]),(0,y.jsx)(yt,{label:a,value:m===null?p?`—`:o??`—`:m,trend:s,icon:c,className:l,description:u,loading:g,error:v})};function Ct(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}function wt(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 Tt=({schema:e,className:t})=>{let{title:n,rowField:a,columnField:o,valueField:s,aggregation:c=`sum`,data:l=[],showRowTotals:u=!1,showColumnTotals:d=!1,format:f,columnColors:p}=e,m=Array.isArray(l)?l:[],{rowKeys:h,colKeys:g,matrix:_,rowTotals:v,colTotals:b,grandTotal:x}=(0,i.useMemo)(()=>{let e=new Map,t=new Map,n={};for(let r of m){let i=String(r[a]??``),c=String(r[o]??``),l=Number(r[s])||0;e.set(i,!0),t.set(c,!0),n[i]||(n[i]={}),n[i][c]||(n[i][c]=[]),n[i][c].push(l)}let r=Array.from(e.keys()),i=Array.from(t.keys()),l={},u={},d={};for(let e of r){l[e]={};let t=[];for(let r of i){let i=n[e]?.[r]??[],a=wt(i,c);l[e][r]=a,t.push(...i),!d[r]&&d[r]}u[e]=wt(t,c)}for(let e of i){let t=[];for(let i of r){let r=n[i]?.[e]??[];t.push(...r)}d[e]=wt(t,c)}let f=[];for(let e of m)f.push(Number(e[s])||0);return{rowKeys:r,colKeys:i,matrix:l,rowTotals:u,colTotals:d,grandTotal:wt(f,c)}},[m,a,o,s,c]),S=e=>Ct(e,f);return m.length===0?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,t),children:[n&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:n}),(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,"data-testid":`pivot-empty-state`,children:[(0,y.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,y.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`}),(0,y.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`}),(0,y.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`}),(0,y.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:`No data available`})]})]}):(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,t),children:[n&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:n}),(0,y.jsxs)(`table`,{className:`w-full text-sm border-collapse`,role:`table`,children:[(0,y.jsx)(`thead`,{children:(0,y.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,y.jsx)(`th`,{className:`text-left p-2 font-medium text-muted-foreground`,children:a}),g.map(e=>(0,y.jsx)(`th`,{className:(0,r.cn)(`text-right p-2 font-medium`,p?.[e]??`text-muted-foreground`),children:e},e)),u&&(0,y.jsx)(`th`,{className:`text-right p-2 font-semibold text-muted-foreground bg-muted/20`,children:`Total`})]})}),(0,y.jsx)(`tbody`,{children:h.map(e=>(0,y.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/30`,children:[(0,y.jsx)(`td`,{className:`p-2 font-medium`,children:e}),g.map(t=>(0,y.jsx)(`td`,{className:(0,r.cn)(`text-right p-2 tabular-nums`,p?.[t]),children:S(_[e]?.[t]??0)},t)),u&&(0,y.jsx)(`td`,{className:`text-right p-2 font-semibold tabular-nums bg-muted/20`,children:S(v[e]??0)})]},e))}),d&&(0,y.jsx)(`tfoot`,{children:(0,y.jsxs)(`tr`,{className:`border-t-2 border-border font-semibold bg-muted/40`,children:[(0,y.jsx)(`td`,{className:`p-2`,children:`Total`}),g.map(e=>(0,y.jsx)(`td`,{className:`text-right p-2 tabular-nums`,children:S(b[e]??0)},e)),u&&(0,y.jsx)(`td`,{className:`text-right p-2 tabular-nums font-bold`,children:S(x)})]})})]})]})},Et=({schema:e,dataSource:a,className:o})=>{let s=(0,i.useContext)(n.SchemaRendererContext),c=a||s?.dataSource,l=(0,n.useDataScope)(e.bind),[u,d]=(0,i.useState)([]),[f,p]=(0,i.useState)(!1),[m,h]=(0,i.useState)(null);(0,i.useEffect)(()=>{let n=!0;return e.objectName&&!l&&(!e.data||e.data.length===0)&&(async()=>{if(!(!c||!e.objectName)){n&&(p(!0),h(null));try{let r;if(typeof c.find==`function`)r=(0,t.extractRecords)(await c.find(e.objectName,{$filter:e.filter}));else return;n&&d(r)}catch(e){console.error(`[ObjectPivotTable] Fetch error:`,e),n&&h(e instanceof Error?e.message:`Failed to load data`)}finally{n&&p(!1)}}})(),()=>{n=!1}},[e.objectName,c,l,e.data,e.filter]);let g=l||e.data||u,_=Array.isArray(g)?g:[];return f&&_.length===0?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`pivot-loading`,children:[e.title&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,y.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-6 w-24`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-20`})]}),[1,2,3].map(e=>(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-5 w-24`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-20`})]},e))]})]}):m?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`pivot-error`,children:[e.title&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`pivot-error-message`,children:[(0,y.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,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,y.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,y.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:m})]})]}):!c&&e.objectName&&_.length===0?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,o),children:[e.title&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,y.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,y.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})]}):(0,y.jsx)(Tt,{schema:{...e,data:_},className:o})};function Dt(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)}var Ot=({schema:e,dataSource:a,className:o})=>{let s=(0,i.useContext)(n.SchemaRendererContext),c=a||s?.dataSource,l=(0,n.useDataScope)(e.bind),[u,d]=(0,i.useState)([]),[f,p]=(0,i.useState)(!1),[m,h]=(0,i.useState)(null);(0,i.useEffect)(()=>{let n=!0;return e.objectName&&!l&&(!e.data||e.data.length===0)&&(async()=>{if(!(!c||!e.objectName)){n&&(p(!0),h(null));try{let r;if(typeof c.find==`function`)r=(0,t.extractRecords)(await c.find(e.objectName,{$filter:e.filter}));else return;n&&d(r)}catch(e){console.error(`[ObjectDataTable] Fetch error:`,e),n&&h(e instanceof Error?e.message:`Failed to load data`)}finally{n&&p(!1)}}})(),()=>{n=!1}},[e.objectName,c,l,e.data,e.filter]);let g=l||e.data||u,_=Array.isArray(g)?g:[],v=(0,i.useMemo)(()=>e.columns&&e.columns.length>0?Dt(e.columns):_.length===0?[]:Object.keys(_[0]).filter(e=>!e.startsWith(`_`)).map(e=>({header:e.charAt(0).toUpperCase()+e.slice(1).replace(/([A-Z])/g,` $1`),accessorKey:e})),[e.columns,_]);return f&&_.length===0?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`table-loading`,children:(0,y.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`})]}),[1,2,3,4].map(e=>(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`})]},e))]})}):m?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`table-error`,children:(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`table-error-message`,children:[(0,y.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,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,y.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,y.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:m})]})}):!c&&e.objectName&&_.length===0?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),children:(0,y.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,y.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})}):_.length===0?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`table-empty-state`,children:(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:[(0,y.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,y.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,y.jsx)(`line`,{x1:`3`,y1:`9`,x2:`21`,y2:`9`}),(0,y.jsx)(`line`,{x1:`9`,y1:`21`,x2:`9`,y2:`9`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:`No data available`})]})}):(0,y.jsx)(n.SchemaRenderer,{schema:{...e,type:`data-table`,data:_,columns:v},className:o})},kt={breadcrumb:[`Dashboard`,`Configuration`],sections:[{key:`layout`,title:`Layout`,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`,type:`input`,defaultValue:`120`,placeholder:`e.g. 120`}]},{key:`data`,title:`Data`,collapsible:!0,fields:[{key:`refreshInterval`,label:`Refresh interval`,type:`select`,defaultValue:`0`,options:[{value:`0`,label:`Manual`},{value:`30`,label:`30s`},{value:`60`,label:`1 min`},{value:`300`,label:`5 min`}]}]},{key:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`title`,label:`Title`,type:`input`,placeholder:`Dashboard 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 At({open:e,onClose:t,config:n,onSave:i,onFieldChange:a}){let{draft:o,isDirty:s,updateField:c,discard:l}=(0,r.useConfigDraft)(n,{onUpdate:a});return(0,y.jsx)(r.ConfigPanelRenderer,{open:e,onClose:t,schema:kt,draft:o,isDirty:s,onFieldChange:c,onSave:()=>i(o),onDiscard:l})}var jt=[{value:`metric`,label:`Metric`},{value:`bar`,label:`Bar Chart`},{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:`table`,label:`Table`},{value:`pivot`,label:`Pivot Table`},{value:`list`,label:`List`},{value:`custom`,label:`Custom`}],Mt=[{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`}],Nt=[{value:`count`,label:`Count`},{value:`sum`,label:`Sum`},{value:`avg`,label:`Average`},{value:`min`,label:`Min`},{value:`max`,label:`Max`}],Pt=[`bar`,`line`,`area`,`pie`,`donut`,`scatter`];function Ft(e){return!!e&&Pt.includes(e)}var It=[{value:`group`,label:`Group`},{value:`value`,label:`Value`}],Lt=[{value:`asc`,label:`↑`},{value:`desc`,label:`↓`}];function Rt(e,t,n,i){return{key:e,label:t,type:`custom`,render:(a,o,s)=>(0,y.jsx)(r.ConfigRow,{label:t,children:(0,y.jsx)(`div`,{"data-testid":`config-field-${e}`,children:(0,y.jsx)(r.Combobox,{options:i??[],value:a??``,onValueChange:o,placeholder:n,searchPlaceholder:`Search fields…`,emptyText:`No fields found.`,className:`h-7 w-32 text-xs`,disabled:!s.object})})})}}function zt(e,t,n){let i=e&&e.length>0,a=i?{key:`object`,label:`Data source`,type:`custom`,render:(t,n)=>(0,y.jsx)(r.ConfigRow,{label:`Data source`,children:(0,y.jsx)(`div`,{"data-testid":`config-field-object`,children:(0,y.jsx)(r.Combobox,{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`},o=i?Rt(`categoryField`,`Category field`,`Select field…`,t):{key:`categoryField`,label:`Category field`,type:`input`,placeholder:`e.g. status`},s=i?Rt(`valueField`,`Value field`,`Select field…`,t):{key:`valueField`,label:`Value field`,type:`input`,placeholder:`e.g. amount`},c=i?Rt(`rowField`,`Field`,`Select row field…`,t):{key:`rowField`,label:`Field`,type:`input`,placeholder:`e.g. owner`},l=i?Rt(`columnField`,`Field`,`Select column field…`,t):{key:`columnField`,label:`Field`,type:`input`,placeholder:`e.g. stage`},u=i?Rt(`pivotValueField`,`Field`,`Select value field…`,t):{key:`pivotValueField`,label:`Field`,type:`input`,placeholder:`e.g. amount`};return{breadcrumb:[`Dashboard`,{pivot:`Pivot table`,table:`Table`}[n??``]??(Ft(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:jt,defaultValue:`metric`}]},{key:`data`,title:`Data Binding`,collapsible:!0,visibleWhen:e=>e.type!==`pivot`,fields:[a,o,s,{key:`aggregate`,label:`Aggregation`,type:`select`,options:Nt,defaultValue:`count`}]},{key:`pivot-data`,title:`Data`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[a]},{key:`pivot-rows`,title:`Rows`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[c,{key:`rowSortBy`,label:`Sort by`,type:`icon-group`,options:It,defaultValue:`group`},{key:`rowSortOrder`,label:`Sort order`,type:`icon-group`,options:Lt,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:[l,{key:`columnSortBy`,label:`Sort by`,type:`icon-group`,options:It,defaultValue:`group`},{key:`columnSortOrder`,label:`Sort order`,type:`icon-group`,options:Lt,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:[u,{key:`aggregation`,label:`Aggregation`,type:`select`,options:Nt,defaultValue:`sum`},{key:`format`,label:`Number format`,type:`input`,placeholder:`e.g. $,.2f`}]},{key:`chart-axis`,title:`Axis & Series`,collapsible:!0,visibleWhen:e=>Ft(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:`table-columns`,title:`Columns`,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:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`colorVariant`,label:`Color variant`,type:`select`,options:Mt,defaultValue:`default`},{key:`actionUrl`,label:`Action URL`,type:`input`,placeholder:`https://...`}]}]}}function Bt(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 Vt({open:e,onClose:t,config:n,onSave:a,onFieldChange:o,headerExtra:s,availableObjects:c,availableFields:l}){let{draft:u,isDirty:d,updateField:f,discard:p}=(0,r.useConfigDraft)(i.useMemo(()=>({...n,title:typeof n.title==`object`?Bt(n.title):n.title,description:typeof n.description==`object`?Bt(n.description):n.description}),[n]),{onUpdate:o});return(0,y.jsx)(r.ConfigPanelRenderer,{open:e,onClose:t,schema:i.useMemo(()=>zt(c,l,u.type),[c,l,u.type]),draft:u,isDirty:d,onFieldChange:f,onSave:()=>a(u),onDiscard:p,headerExtra:s})}function Ht({schema:e,config:t,onConfigSave:n,onWidgetSave:o,onRefresh:s,recordCount:c,defaultConfigOpen:l=!1,className:u}){let[d,f]=(0,i.useState)(l),[p,m]=(0,i.useState)(null),[h,g]=(0,i.useState)(e),[_,v]=(0,i.useState)(0);(0,i.useEffect)(()=>{g(e),v(e=>e+1)},[e]);let b=i.useMemo(()=>{if(!p||!h.widgets)return null;let e=h.widgets.find(e=>(e.id||e.title)===p);return e?{id:e.id??``,title:e.title??``,description:e.description??``,type:e.type??``,object:e.object??``,categoryField:e.categoryField??``,valueField:e.valueField??``,aggregate:e.aggregate??``,colorVariant:e.colorVariant??`default`,actionUrl:e.actionUrl??``,layoutW:e.layout?.w??1,layoutH:e.layout?.h??1}:null},[p,_]),x=(0,i.useCallback)(e=>{m(e),f(!0)},[]),C=(0,i.useCallback)(()=>{m(null)},[]),w=(0,i.useCallback)((e,t)=>{p&&g(n=>n.widgets?{...n,widgets:n.widgets.map(n=>(n.id||n.title)===p?e===`layoutW`?{...n,layout:{...n.layout||{},w:t}}:e===`layoutH`?{...n,layout:{...n.layout||{},h:t}}:{...n,[e]:t}:n)}:n)},[p]),T=(0,i.useCallback)(e=>{p&&o&&o(p,e),m(null),v(e=>e+1)},[p,o]),E=(0,i.useCallback)(()=>{f(e=>!e),m(null)},[]);return(0,y.jsxs)(`div`,{className:(0,r.cn)(`flex h-full w-full`,u),"data-testid":`dashboard-with-config`,children:[(0,y.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-auto relative`,children:[(0,y.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,y.jsxs)(r.Button,{size:`sm`,variant:d?`default`:`outline`,onClick:E,"data-testid":`dashboard-config-toggle`,children:[(0,y.jsx)(a.Settings,{className:`h-3.5 w-3.5 mr-1`}),`Settings`]})}),(0,y.jsx)(S,{schema:h,onRefresh:s,recordCount:c,designMode:d,selectedWidgetId:p,onWidgetClick:x})]}),d&&(0,y.jsx)(`div`,{className:`relative shrink-0`,children:p&&b?(0,y.jsx)(Vt,{open:!0,onClose:C,config:b,onSave:T,onFieldChange:w}):(0,y.jsx)(At,{open:!0,onClose:()=>f(!1),config:t,onSave:n})})]})}t.ComponentRegistry.register(`dashboard`,S,{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:[]}}),t.ComponentRegistry.register(`metric`,yt,{namespace:`plugin-dashboard`,label:`Metric Widget`,category:`Dashboard`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`value`,type:`string`,label:`Value`}]}),t.ComponentRegistry.register(`metric-card`,xt,{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`}}),t.ComponentRegistry.register(`object-metric`,St,{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`}}),t.ComponentRegistry.register(`pivot`,Tt,{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:[]}}),t.ComponentRegistry.register(`object-pivot`,Et,{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`}}),t.ComponentRegistry.register(`dashboard-grid`,_t,{namespace:`plugin-dashboard`,label:`Dashboard Grid (Editable)`,category:`Complex`,icon:`layout-grid`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`persistLayoutKey`,type:`string`,label:`Layout Storage Key`,defaultValue:`dashboard-layout`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Dashboard`,widgets:[],persistLayoutKey:`dashboard-layout`}}),t.ComponentRegistry.register(`object-data-table`,Ot,{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 Ut={DashboardRenderer:S,DashboardGridLayout:_t,MetricWidget:yt,MetricCard:xt,ObjectMetricWidget:St,PivotTable:Tt,ObjectPivotTable:Et,ObjectDataTable:Ot,DashboardConfigPanel:At,WidgetConfigPanel:Vt,DashboardWithConfig:Ht};e.DashboardConfigPanel=At,e.DashboardGridLayout=_t,e.DashboardRenderer=S,e.DashboardWithConfig=Ht,e.MetricCard=xt,e.MetricWidget=yt,e.ObjectDataTable=Ot,e.ObjectMetricWidget=St,e.ObjectPivotTable=Et,e.PivotTable=Tt,e.WidgetConfigPanel=Vt,e.dashboardComponents=Ut});
|
|
10
|
+
`,e.getElementsByTagName(`head`)[0].appendChild(t)),e.body&&S(e.body,`react-draggable-transparent-selection`)}function b(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{x(e)}):x(e)}function x(e){if(e)try{if(e.body&&C(e.body,`react-draggable-transparent-selection`),e.selection)e.selection.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function S(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function C(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}})),Ge=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.canDragX=a,e.canDragY=o,e.createCoreData=c,e.createDraggableData=l,e.getBoundPosition=r,e.getControlPosition=s,e.snapToGrid=i;var t=He(),n=We();function r(e,r,i){if(!e.props.bounds)return[r,i];let{bounds:a}=e.props;a=typeof a==`string`?a:u(a);let o=d(e);if(typeof a==`string`){let{ownerDocument:e}=o,r=e.defaultView,i;if(i=a===`parent`?o.parentNode:o.getRootNode().querySelector(a),!(i instanceof r.HTMLElement))throw Error(`Bounds selector "`+a+`" could not find an element.`);let s=i,c=r.getComputedStyle(o),l=r.getComputedStyle(s);a={left:-o.offsetLeft+(0,t.int)(l.paddingLeft)+(0,t.int)(c.marginLeft),top:-o.offsetTop+(0,t.int)(l.paddingTop)+(0,t.int)(c.marginTop),right:(0,n.innerWidth)(s)-(0,n.outerWidth)(o)-o.offsetLeft+(0,t.int)(l.paddingRight)-(0,t.int)(c.marginRight),bottom:(0,n.innerHeight)(s)-(0,n.outerHeight)(o)-o.offsetTop+(0,t.int)(l.paddingBottom)-(0,t.int)(c.marginBottom)}}return(0,t.isNum)(a.right)&&(r=Math.min(r,a.right)),(0,t.isNum)(a.bottom)&&(i=Math.min(i,a.bottom)),(0,t.isNum)(a.left)&&(r=Math.max(r,a.left)),(0,t.isNum)(a.top)&&(i=Math.max(i,a.top)),[r,i]}function i(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function a(e){return e.props.axis===`both`||e.props.axis===`x`}function o(e){return e.props.axis===`both`||e.props.axis===`y`}function s(e,t,r){let i=typeof t==`number`?(0,n.getTouch)(e,t):null;if(typeof t==`number`&&!i)return null;let a=d(r),o=r.props.offsetParent||a.offsetParent||a.ownerDocument.body;return(0,n.offsetXYFromParent)(i||e,o,r.props.scale)}function c(e,n,r){let i=!(0,t.isNum)(e.lastX),a=d(e);return i?{node:a,deltaX:0,deltaY:0,lastX:n,lastY:r,x:n,y:r}:{node:a,deltaX:n-e.lastX,deltaY:r-e.lastY,lastX:e.lastX,lastY:e.lastY,x:n,y:r}}function l(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 u(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function d(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}})),Ke=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=t;function t(){}})),qe=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var t=l(require(`react`)),n=c(Ve()),r=c(require(`react-dom`)),i=We(),a=Ge(),o=He(),s=c(Ke());function c(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(l=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 u(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){var t=f(e,`string`);return typeof t==`symbol`?t:t+``}function f(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 p={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},m=p.mouse,h=class extends t.Component{constructor(){super(...arguments),u(this,`dragging`,!1),u(this,`lastX`,NaN),u(this,`lastY`,NaN),u(this,`touchIdentifier`,null),u(this,`mounted`,!1),u(this,`handleDragStart`,e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button==`number`&&e.button!==0)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&&!(0,i.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,i.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=(0,i.getTouchIdentifier)(e);this.touchIdentifier=r;let o=(0,a.getControlPosition)(e,r,this);if(o==null)return;let{x:c,y:l}=o,u=(0,a.createCoreData)(this,c,l);(0,s.default)(`DraggableCore: handleDragStart: %j`,u),(0,s.default)(`calling`,this.props.onStart),!(this.props.onStart(e,u)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,i.addUserSelectStyles)(n),this.dragging=!0,this.lastX=c,this.lastY=l,(0,i.addEvent)(n,m.move,this.handleDrag),(0,i.addEvent)(n,m.stop,this.handleDragStop))}),u(this,`handleDrag`,e=>{let t=(0,a.getControlPosition)(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]=(0,a.snapToGrid)(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=(0,a.createCoreData)(this,n,r);if((0,s.default)(`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}),u(this,`handleDragStop`,e=>{if(!this.dragging)return;let t=(0,a.getControlPosition)(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]=(0,a.snapToGrid)(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let o=(0,a.createCoreData)(this,n,r);if(this.props.onStop(e,o)===!1||this.mounted===!1)return!1;let c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,i.scheduleRemoveUserSelectStyles)(c.ownerDocument),(0,s.default)(`DraggableCore: handleDragStop: %j`,o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,s.default)(`DraggableCore: Removing handlers`),(0,i.removeEvent)(c.ownerDocument,m.move,this.handleDrag),(0,i.removeEvent)(c.ownerDocument,m.stop,this.handleDragStop))}),u(this,`onMouseDown`,e=>(m=p.mouse,this.handleDragStart(e))),u(this,`onMouseUp`,e=>(m=p.mouse,this.handleDragStop(e))),u(this,`onTouchStart`,e=>(m=p.touch,this.handleDragStart(e))),u(this,`onTouchEnd`,e=>(m=p.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&(0,i.addEvent)(e,p.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;(0,i.removeEvent)(t,p.mouse.move,this.handleDrag),(0,i.removeEvent)(t,p.touch.move,this.handleDrag),(0,i.removeEvent)(t,p.mouse.stop,this.handleDragStop),(0,i.removeEvent)(t,p.touch.stop,this.handleDragStop),(0,i.removeEvent)(e,p.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,i.scheduleRemoveUserSelectStyles)(t)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:r.default.findDOMNode(this)}render(){return t.cloneElement(t.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};e.default=h,u(h,`displayName`,`DraggableCore`),u(h,`propTypes`,{allowAnyClick:n.default.bool,allowMobileScroll:n.default.bool,children:n.default.node.isRequired,disabled:n.default.bool,enableUserSelectHack:n.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:n.default.arrayOf(n.default.number),handle:n.default.string,cancel:n.default.string,nodeRef:n.default.object,onStart:n.default.func,onDrag:n.default.func,onStop:n.default.func,onMouseDown:n.default.func,scale:n.default.number,className:o.dontSetMe,style:o.dontSetMe,transform:o.dontSetMe}),u(h,`defaultProps`,{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})})),Je=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),Object.defineProperty(e,`DraggableCore`,{enumerable:!0,get:function(){return c.default}}),e.default=void 0;var t=d(require(`react`)),n=u(Ve()),r=u(require(`react-dom`)),i=require(`clsx`),a=We(),o=Ge(),s=He(),c=u(qe()),l=u(Ke());function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(d=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 f(){return f=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},f.apply(null,arguments)}function p(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){var t=h(e,`string`);return typeof t==`symbol`?t:t+``}function h(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 g=class extends t.Component{static getDerivedStateFromProps(e,t){let{position:n}=e,{prevPropsPosition:r}=t;return n&&(!r||n.x!==r.x||n.y!==r.y)?((0,l.default)(`Draggable: getDerivedStateFromProps %j`,{position:n,prevPropsPosition:r}),{x:n.x,y:n.y,prevPropsPosition:{...n}}):null}constructor(e){super(e),p(this,`onDragStart`,(e,t)=>{if((0,l.default)(`Draggable: onDragStart: %j`,t),this.props.onStart(e,(0,o.createDraggableData)(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,`onDrag`,(e,t)=>{if(!this.state.dragging)return!1;(0,l.default)(`Draggable: onDrag: %j`,t);let n=(0,o.createDraggableData)(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]=(0,o.getBoundPosition)(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)}),p(this,`onDragStop`,(e,t)=>{if(!this.state.dragging||this.props.onStop(e,(0,o.createDraggableData)(this,t))===!1)return!1;(0,l.default)(`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.")}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??r.default.findDOMNode(this)}render(){let{axis:e,bounds:n,children:r,defaultPosition:s,defaultClassName:l,defaultClassNameDragging:u,defaultClassNameDragged:d,position:p,positionOffset:m,scale:h,...g}=this.props,_={},v=null,y=!p||this.state.dragging,b=p||s,x={x:(0,o.canDragX)(this)&&y?this.state.x:b.x,y:(0,o.canDragY)(this)&&y?this.state.y:b.y};this.state.isElementSVG?v=(0,a.createSVGTransform)(x,m):_=(0,a.createCSSTransform)(x,m);let S=(0,i.clsx)(r.props.className||``,l,{[u]:this.state.dragging,[d]:this.state.dragged});return t.createElement(c.default,f({},g,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(r),{className:S,style:{...r.props.style,..._},transform:v}))}};e.default=g,p(g,`displayName`,`Draggable`),p(g,`propTypes`,{...c.default.propTypes,axis:n.default.oneOf([`both`,`x`,`y`,`none`]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),p(g,`defaultProps`,{...c.default.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1})})),Ye=p(((e,t)=>{var{default:n,DraggableCore:r}=Je();t.exports=n,t.exports.default=n,t.exports.DraggableCore=r})),Xe=p((e=>{e.__esModule=!0,e.cloneElement=c;var t=n(require(`react`));function n(e){return e&&e.__esModule?e:{default:e}}function r(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 i(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?r(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){var t=s(e,`string`);return typeof t==`symbol`?t:t+``}function s(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 c(e,n){return n.style&&e.props.style&&(n.style=i(i({},e.props.style),n.style)),n.className&&e.props.className&&(n.className=`${e.props.className} ${n.className}`),t.default.cloneElement(e,n)}})),Ze=p((e=>{e.__esModule=!0,e.resizableProps=void 0;var t=n(Ve());Ye();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(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];let[i]=n;return i.axis===`both`||i.axis===`y`?t.default.number.isRequired(...n):t.default.number(...n)},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(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];let[i]=n;return i.axis===`both`||i.axis===`x`?t.default.number.isRequired(...n):t.default.number(...n)}}})),Qe=p((e=>{e.__esModule=!0,e.default=void 0;var t=o(require(`react`)),n=Ye(),r=Xe(),i=Ze(),a=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function o(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(o=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 s(){return s=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},s.apply(null,arguments)}function c(e,t){if(e==null)return{};var n,r,i=l(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}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{minConstraints:n,maxConstraints:r,lockAspectRatio:i}=this.props;if(!n&&!r&&!i)return[e,t];if(i){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[a,o]=[e,t],[s,c]=this.slack||[0,0];return e+=s,t+=c,n&&(e=Math.max(n[0],e),t=Math.max(n[1],t)),r&&(e=Math.min(r[0],e),t=Math.min(r[1],t)),this.slack=[s+(a-e),c+(o-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let{node:i,deltaX:a,deltaY:o}=r;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.props.width+(s?a/this.props.transformScale:0),p=this.props.height+(c?o/this.props.transformScale:0);[f,p]=this.runConstraints(f,p),e===`onResizeStop`&&this.lastSize&&({width:f,height:p}=this.lastSize);let m=f!==this.props.width||p!==this.props.height;e!==`onResizeStop`&&(this.lastSize={width:f,height:p});let h=typeof this.props[e]==`function`?this.props[e]:null;h&&!(e===`onResize`&&!m)&&(n.persist?.(),h(n,{node:i,size:{width:f,height:p},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,n){let{handle:r}=this.props;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,{children:i,className:o,draggableOpts:l,width:u,height:f,handle:p,handleSize:m,lockAspectRatio:h,axis:g,minConstraints:_,maxConstraints:v,onResize:y,onResizeStop:b,onResizeStart:x,resizeHandles:S,transformScale:C}=e,w=c(e,a);return(0,r.cloneElement)(i,d(d({},w),{},{className:`${o?`${o} `:``}react-resizable`,children:[...t.Children.toArray(i.props.children),...S.map(e=>{let r=this.handleRefs[e]??(this.handleRefs[e]=t.createRef());return t.createElement(n.DraggableCore,s({},l,{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=i.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),$e=p((e=>{e.__esModule=!0,e.default=void 0;var t=s(require(`react`)),n=o(Ve()),r=o(Qe()),i=Ze(),a=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function o(e){return e&&e.__esModule?e:{default:e}}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){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 u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?l(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){var t=p(e,`string`);return typeof t==`symbol`?t:t+``}function p(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 m(e,t){if(e==null)return{};var n,r,i=h(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}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{size:n}=t;this.props.onResize?(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,{handle:n,handleSize:i,onResize:o,onResizeStart:s,onResizeStop:l,draggableOpts:d,minConstraints:f,maxConstraints:p,lockAspectRatio:h,axis:g,width:_,height:v,resizeHandles:y,style:b,transformScale:x}=e,S=m(e,a);return t.createElement(r.default,{axis:g,draggableOpts:d,handle:n,handleSize:i,height:this.state.height,lockAspectRatio:h,maxConstraints:p,minConstraints:f,onResizeStart:s,onResize:this.onResize,onResizeStop:l,resizeHandles:y,transformScale:x,width:this.state.width},t.createElement(`div`,c({},S,{style:u(u({},b),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=u(u({},i.resizableProps),{},{children:n.default.element})})),et=p(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Qe().default,t.exports.ResizableBox=$e().default})),tt=Ye(),nt=et(),rt=je();function it(e){let{children:t,cols:n,containerWidth:r,margin:a,containerPadding:s,rowHeight:c,maxRows:l,isDraggable:u,isResizable:d,isBounded:f,static:p,useCSSTransforms:m=!0,usePercentages:h=!1,transformScale:g=1,positionStrategy:_,dragThreshold:v=0,droppingPosition:b,className:x=``,style:S,handle:C=``,cancel:D=``,x:j,y:M,w:N,h:P,minW:F=1,maxW:I=1/0,minH:L=1,maxH:R=1/0,i:z,resizeHandles:B,resizeHandle:V,constraints:H=ie,layoutItem:ee,layout:te=[],onDragStart:U,onDrag:ne,onDragStop:re,onResizeStart:ue,onResize:de,onResizeStop:fe}=e,[W,G]=(0,i.useState)(!1),[K,pe]=(0,i.useState)(!1),me=(0,i.useRef)(null),q=(0,i.useRef)({left:0,top:0}),ge=(0,i.useRef)({top:0,left:0,width:0,height:0}),_e=(0,i.useRef)(void 0),ve=(0,i.useRef)(te);ve.current=te;let ye=(0,i.useRef)(null),be=(0,i.useRef)(null),xe=(0,i.useRef)(!1),Se=(0,i.useRef)({x:0,y:0}),Ce=(0,i.useRef)(!1),J=(0,i.useMemo)(()=>({cols:n,containerPadding:s,containerWidth:r,margin:a,maxRows:l,rowHeight:c}),[n,s,r,a,l,c]),Y=(0,i.useMemo)(()=>({cols:n,maxRows:l,containerWidth:r,containerHeight:0,rowHeight:c,margin:a,layout:[]}),[n,l,r,c,a]),X=(0,i.useCallback)(()=>({...Y,layout:ve.current}),[Y]),Z=(0,i.useMemo)(()=>ee??{i:z,x:j,y:M,w:N,h:P,minW:F,maxW:I,minH:L,maxH:R},[ee,z,j,M,N,P,F,I,L,R]),we=(0,i.useCallback)(e=>{if(_?.calcStyle)return _.calcStyle(e);if(m)return se(e);let t=ce(e);return h?{...t,left:le(e.left/r),width:le(e.width/r)}:t},[_,m,h,r]),Te=(0,i.useCallback)((e,{node:t})=>{if(!U)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/g,o=r.left/g,s=i.top/g,c=r.top/g,l;if(_?.calcDragPosition){let t=e;l=_.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(q.current=l,v>0){let t=e;Se.current={x:t.clientX,y:t.clientY},xe.current=!0,Ce.current=!1,G(!0);return}G(!0);let u=O(J,l.top,l.left),{x:d,y:f}=ae(H,Z,u.x,u.y,X());U(z,d,f,{e,node:t,newPosition:l})},[U,g,J,_,v,H,Z,X,z]),Ee=(0,i.useCallback)((e,{node:t,deltaX:n,deltaY:i})=>{if(!ne||!W)return;let o=e;if(xe.current&&!Ce.current){let n=o.clientX-Se.current.x,r=o.clientY-Se.current.y;if(Math.hypot(n,r)<v)return;if(Ce.current=!0,xe.current=!1,U){let n=O(J,q.current.top,q.current.left),{x:r,y:i}=ae(H,Z,n.x,n.y,X());U(z,r,i,{e,node:t,newPosition:q.current})}}let s=q.current.top+i,l=q.current.left+n;if(f){let{offsetParent:e}=t;if(e){let t=e.clientHeight-T(P,c,a[1]);s=A(s,0,t);let n=r-T(N,w(J),a[0]);l=A(l,0,n)}}let u={top:s,left:l};q.current=u;let d=O(J,s,l),{x:p,y:m}=ae(H,Z,d.x,d.y,X());ne(z,p,m,{e,node:t,newPosition:u})},[ne,U,W,v,f,P,c,a,J,r,N,z,H,Z,X]),De=(0,i.useCallback)((e,{node:t})=>{if(!re||!W)return;let n=xe.current;if(xe.current=!1,Ce.current=!1,Se.current={x:0,y:0},n){G(!1),q.current={left:0,top:0};return}let{left:r,top:i}=q.current,a={top:i,left:r};G(!1),q.current={left:0,top:0};let o=O(J,i,r),{x:s,y:c}=ae(H,Z,o.x,o.y,X());re(z,s,c,{e,node:t,newPosition:a})},[re,W,J,H,Z,X,z]);ye.current=Te,be.current=Ee;let Q=(0,i.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?ue:o===`onResize`?de:fe;if(!s)return;let c;c=t?he(i,a,n,r):{...n,top:a.top,left:a.left},ge.current=c;let l=k(J,c.width,c.height),{w:u,h:d}=oe(H,Z,l.w,l.h,i,X());s(z,u,d,{e:e.nativeEvent,node:t,size:c,handle:i})},[ue,de,fe,r,J,z,H,Z,X]),Oe=(0,i.useCallback)((e,t)=>{pe(!0);let n=E(J,j,M,N,P);Q(e,{...t,handle:t.handle},n,`onResizeStart`)},[Q,J,j,M,N,P]),ke=(0,i.useCallback)((e,t)=>{let n=E(J,j,M,N,P);Q(e,{...t,handle:t.handle},n,`onResize`)},[Q,J,j,M,N,P]),Ae=(0,i.useCallback)((e,t)=>{pe(!1),ge.current={top:0,left:0,width:0,height:0};let n=E(J,j,M,N,P);Q(e,{...t,handle:t.handle},n,`onResizeStop`)},[Q,J,j,M,N,P]);(0,i.useEffect)(()=>{if(!b)return;let e=me.current;if(!e)return;let t=_e.current||{left:0,top:0},n=W&&(b.left!==t.left||b.top!==t.top);if(!W){let t={node:e,deltaX:b.left,deltaY:b.top,lastX:0,lastY:0,x:b.left,y:b.top};ye.current?.(b.e,t)}else if(n){let t={node:e,deltaX:b.left-q.current.left,deltaY:b.top-q.current.top,lastX:q.current.left,lastY:q.current.top,x:b.left,y:b.top};be.current?.(b.e,t)}_e.current=b},[b,W,z]);let je=E(J,j,M,N,P,W?q.current:null,K?ge.current:null),Me=i.default.Children.only(t),Ne=w(J),Pe=[T(F,Ne,a[0]),T(L,c,a[1])],Fe=[T(I,Ne,a[0]),T(R,c,a[1])],Ie=Me.props,Le=Ie.className,Re=Ie.style,$=i.default.cloneElement(Me,{ref:me,className:(0,o.default)(`react-grid-item`,Le,x,{static:p,resizing:K,"react-draggable":u,"react-draggable-dragging":W,dropping:!!b,cssTransforms:m}),style:{...S,...Re,...we(je)}}),ze=V;return $=(0,y.jsx)(nt.Resizable,{draggableOpts:{disabled:!d},className:d?void 0:`react-resizable-hide`,width:je.width,height:je.height,minConstraints:Pe,maxConstraints:Fe,onResizeStart:Oe,onResize:ke,onResizeStop:Ae,transformScale:g,resizeHandles:B,handle:ze,children:$}),$=(0,y.jsx)(tt.DraggableCore,{disabled:!u,onStart:Te,onDrag:Ee,onStop:De,handle:C,cancel:`.react-resizable-handle`+(D?`,`+D:``),scale:g,nodeRef:me,children:$}),$}var at=()=>{},ot=`react-grid-layout`,st=!1;try{st=/firefox/i.test(navigator.userAgent)}catch{}function ct(e,t){let n=i.default.Children.toArray(e),r=i.default.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 lt(e,t,n,r){let a=[],o=new Set;i.default.Children.forEach(t,t=>{if(!i.default.isValidElement(t)||t.key===null)return;let n=String(t.key);o.add(n);let r=e.find(e=>e.i===n);if(r)a.push(B(r));else{let e=t.props[`data-grid`];e?a.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}):a.push({i:n,x:0,y:L(a),w:1,h:1})}});let s=te(a,{cols:n});return r.compact(s,n)}function ut(e){let{children:t,width:n,gridConfig:r,dragConfig:a,resizeConfig:s,dropConfig:c,positionStrategy:l=ge,compactor:u,constraints:d=ie,layout:f=[],droppingItem:p,autoSize:m=!0,className:h=``,style:g={},innerRef:_,onLayoutChange:v=at,onDragStart:b=at,onDrag:x=at,onDragStop:S=at,onResizeStart:C=at,onResize:E=at,onResizeStop:O=at,onDrop:k=at,onDropDragOver:A=at}=e,j=(0,i.useMemo)(()=>({..._e,...r}),[r]),M=(0,i.useMemo)(()=>({...ve,...a}),[a]),P=(0,i.useMemo)(()=>({...ye,...s}),[s]),F=(0,i.useMemo)(()=>({...be,...c}),[c]),{cols:I,rowHeight:z,maxRows:V,margin:H,containerPadding:te}=j,{enabled:ne,bounded:re,handle:ae,cancel:oe,threshold:se}=M,{enabled:ce,handles:le,handleComponent:ue}=P,{enabled:de,defaultItem:fe,onDragOver:W}=F,G=u??Ee(`vertical`),K=G.type,pe=G.allowOverlap,me=G.preventCollision??!1,q=(0,i.useMemo)(()=>p??{i:`__dropping-elem__`,...fe},[p,fe]),he=l.type===`transform`,xe=l.scale,Se=te??H,[Ce,J]=(0,i.useState)(!1),[Y,X]=(0,i.useState)(()=>lt(f,t,I,G)),[Z,we]=(0,i.useState)(null),[Te,De]=(0,i.useState)(!1),[Q,Oe]=(0,i.useState)(null),[ke,Ae]=(0,i.useState)(),je=(0,i.useRef)(null),Me=(0,i.useRef)(null),Ne=(0,i.useRef)(null),Pe=(0,i.useRef)(0),Fe=(0,i.useRef)(Y),Ie=(0,i.useRef)(f),Le=(0,i.useRef)(t),Re=(0,i.useRef)(K),$=(0,i.useRef)(Y);$.current=Y,(0,i.useEffect)(()=>{J(!0),(0,rt.deepEqual)(Y,f)||v(Y)},[]),(0,i.useEffect)(()=>{if(Z||Q)return;let e=!(0,rt.deepEqual)(f,Ie.current),n=!ct(t,Le.current),r=K!==Re.current;if(e||n||r){let n=lt(e?f:Y,t,I,G);(0,rt.deepEqual)(n,Y)||X(n)}Ie.current=f,Le.current=t,Re.current=K},[f,t,I,K,G,Z,Q,Y]),(0,i.useEffect)(()=>{!Z&&!(0,rt.deepEqual)(Y,Fe.current)&&(Fe.current=Y,v(Y.filter(e=>e.i!==q.i)))},[Y,Z,v,q.i]);let ze=(0,i.useMemo)(()=>{if(!m)return;let e=L(Y),t=Se[1];return e*z+(e-1)*H[1]+t*2+`px`},[m,Y,z,H,Se]),Be=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=R(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};je.current=B(a),Ne.current=i,we(o),b(i,a,a,null,r.e,r.node)},[b]),Ve=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=je.current,o=R(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=U(i,o,t,n,!0,me,K,I,pe);x(c,a,o,s,r.e,r.node),X(G.compact(c,I)),we(s)},[me,K,I,pe,G,x]),He=(0,i.useCallback)((e,t,n,r)=>{if(!Z)return;let i=$.current,a=je.current,o=R(i,e);if(!o)return;let s=U(i,o,t,n,!0,me,K,I,pe),c=G.compact(s,I);S(c,a,o,null,r.e,r.node);let l=Ne.current;je.current=null,Ne.current=null,we(null),X(c),l&&!(0,rt.deepEqual)(l,c)&&v(c)},[Z,me,K,I,pe,G,S,v]),Ue=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=R(i,e);a&&(Me.current=B(a),Ne.current=i,De(!0),C(i,a,a,null,r.e,r.node))},[C]),We=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=Me.current,{handle:o}=r,s=!1,c,l,[u,d]=ee(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),me&&!pe&&N(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=U(u,d,c,l,!0,me,K,I,pe));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};E(f,a,d,p,r.e,r.node),X(G.compact(f,I)),we(p)},[me,K,I,pe,G,E]),Ge=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=Me.current,o=R(i,e),s=G.compact(i,I);O(s,a,o??null,null,r.e,r.node);let c=Ne.current;Me.current=null,Ne.current=null,we(null),De(!1),X(s),c&&!(0,rt.deepEqual)(c,s)&&v(s)},[I,G,O,v]),Ke=(0,i.useCallback)(()=>{let e=$.current;if(!e.some(e=>e.i===q.i)){Oe(null),we(null),Ae(void 0);return}X(G.compact(e.filter(e=>e.i!==q.i),I)),Oe(null),we(null),Ae(void 0)},[q.i,I,G]),qe=(0,i.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),st&&!e.nativeEvent.target?.classList.contains(ot))return!1;let t=W?W(e.nativeEvent):A(e);if(t===!1)return Q&&Ke(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...q,...a},s=e.currentTarget.getBoundingClientRect(),c={cols:I,margin:H,maxRows:V,rowHeight:z,containerWidth:n,containerPadding:Se},l=w(c),u=T(o.w,l,H[0]),d=T(o.h,z,H[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/xe,top:_/xe,e:e.nativeEvent};if(Q)ke&&(ke.left!==v.left||ke.top!==v.top)&&Ae(v);else{let e=D(c,_,g,o.w,o.h);Oe((0,y.jsx)(`div`,{},o.i)),Ae(v),X([...$.current.filter(e=>e.i!==o.i),{...o,x:e.x,y:e.y,static:!1,isDraggable:!0}])}},[Q,ke,q,W,A,Ke,xe,I,H,V,z,n,Se]),Je=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Pe.current--,Pe.current<0&&(Pe.current=0),Pe.current===0&&Ke()},[Ke]),Ye=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Pe.current++},[]),Xe=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=$.current,n=t.find(e=>e.i===q.i);Pe.current=0,Ke(),k(t,n,e.nativeEvent)},[q.i,Ke,k]),Ze=(0,i.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=R(Y,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&ne,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ce,o=r.resizeHandles||[...le],s=i&&re&&r.isBounded!==!1,c=ue;return(0,y.jsx)(it,{containerWidth:n,cols:I,margin:H,containerPadding:Se,maxRows:V,rowHeight:z,cancel:oe,handle:ae,onDragStart:Be,onDrag:Ve,onDragStop:He,onResizeStart:Ue,onResize:We,onResizeStop:Ge,isDraggable:i,isResizable:a,isBounded:s,useCSSTransforms:he&&Ce,usePercentages:!Ce,transformScale:xe,positionStrategy:l,dragThreshold:se,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?ke:void 0,resizeHandles:o,resizeHandle:c,constraints:d,layoutItem:r,layout:Y,children:e},r.i)},[Y,n,I,H,Se,V,z,oe,ae,Be,Ve,He,Ue,We,Ge,ne,ce,re,he,Ce,xe,l,se,ke,le,ue,d]),Qe=()=>Z?(0,y.jsx)(it,{w:Z.w,h:Z.h,x:Z.x,y:Z.y,i:Z.i,className:`react-grid-placeholder ${Te?`placeholder-resizing`:``}`,containerWidth:n,cols:I,margin:H,containerPadding:Se,maxRows:V,rowHeight:z,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:he,transformScale:xe,constraints:d,layout:Y,children:(0,y.jsx)(`div`,{})}):null;return(0,y.jsxs)(`div`,{ref:_,className:(0,o.default)(ot,h),style:{height:ze,...g},onDrop:de?Xe:void 0,onDragLeave:de?Je:void 0,onDragEnter:de?Ye:void 0,onDragOver:de?qe:void 0,children:[i.default.Children.map(t,e=>i.default.isValidElement(e)?Ze(e):null),de&&Q&&Ze(Q,!0),Qe()]})}var dt={lg:1200,md:996,sm:768,xs:480,xxs:0},ft={lg:12,md:10,sm:6,xs:4,xxs:2},pt=()=>{};function mt(e,t,n,r){let a=[];i.default.Children.forEach(t,t=>{if(!i.default.isValidElement(t)||t.key===null)return;let n=String(t.key),r=e.find(e=>e.i===n);if(r)a.push({...r,i:n});else{let e=t.props[`data-grid`];e?a.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}):a.push({i:n,x:0,y:L(a),w:1,h:1})}});let o=te(a,{cols:n});return r.compact(o,n)}function ht(e){let{children:t,width:n,breakpoint:r,breakpoints:a=dt,cols:o=ft,layouts:s={},rowHeight:c=150,maxRows:l=1/0,margin:u=[10,10],containerPadding:d=null,compactor:f,onBreakpointChange:p=pt,onLayoutChange:m=pt,onWidthChange:h=pt,...g}=e,_=f??Ee(`vertical`),v=_.type,b=_.allowOverlap,x=(0,i.useMemo)(()=>r??Q(a,n),[]),S=(0,i.useMemo)(()=>Oe(x,o),[x,o]),C=(0,i.useMemo)(()=>ke(s,a,x,x,S,v),[]),[w,T]=(0,i.useState)(x),[E,D]=(0,i.useState)(S),[O,k]=(0,i.useState)(C),[A,j]=(0,i.useState)(s),M=(0,i.useRef)(n),N=(0,i.useRef)(r),P=(0,i.useRef)(a),F=(0,i.useRef)(o),I=(0,i.useRef)(s),L=(0,i.useRef)(v),R=(0,i.useRef)(A);(0,i.useEffect)(()=>{R.current=A},[A]);let z=(0,i.useMemo)(()=>(0,rt.deepEqual)(s,I.current)?null:ke(s,a,w,w,E,_),[s,a,w,E,_]),B=z??O;(0,i.useEffect)(()=>{z!==null&&(k(z),j(s),R.current=s,I.current=s)},[z,s]),(0,i.useEffect)(()=>{if(v!==L.current){let e=_.compact(V(B),E),t={...R.current,[w]:e};k(e),j(t),R.current=t,m(e,t),L.current=v}},[v,_,B,E,b,w,m]),(0,i.useEffect)(()=>{let e=n!==M.current,i=r!==N.current,s=!(0,rt.deepEqual)(a,P.current),c=!(0,rt.deepEqual)(o,F.current);if(e||i||s||c){let e=r??Q(a,n),i=Oe(e,o),l=w;if(l!==e||s||c){let n={...R.current};n[l]||(n[l]=V(O));let r=ke(n,a,e,l,i,_);r=mt(r,t,i,_),n[e]=r,T(e),D(i),k(r),j(n),R.current=n,p(e,i),m(r,n)}h(n,Ae(u,e),i,d?Ae(d,e):null),M.current=n,N.current=r,P.current=a,F.current=o}},[n,r,a,o,w,E,O,t,_,v,b,u,d,p,m,h]);let H=(0,i.useCallback)(e=>{let t={...R.current,[w]:e};k(e),j(t),R.current=t,m(e,t)},[w,m]),ee=(0,i.useMemo)(()=>Ae(u,w),[u,w]),te=(0,i.useMemo)(()=>d===null?null:Ae(d,w),[d,w]),U=(0,i.useMemo)(()=>({cols:E,rowHeight:c,maxRows:l,margin:ee,containerPadding:te}),[E,c,l,ee,te]);return(0,y.jsx)(ut,{...g,width:n,gridConfig:U,compactor:_,onLayoutChange:H,layout:B,children:t})}function gt({editMode:e}){let t=(0,n.useDnd)();return i.useEffect(()=>{if(e)return t.startDrag({id:`dashboard-layout`,type:`dashboard-widget`,data:{}}),()=>{t.endDrag()};t.endDrag(`dashboard`)},[e,t]),null}var _t=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],vt=({schema:e,className:t,onLayoutChange:o,persistLayoutKey:s=`dashboard-layout`,onRefresh:c})=>{let{width:l,containerRef:u,mounted:d}=Me(),[f,p]=i.useState(!1),[m,h]=i.useState(!1),_=(0,n.useHasDndProvider)(),v=i.useRef(null),b=i.useCallback(()=>{c&&(h(!0),c(),setTimeout(()=>h(!1),600))},[c]);i.useEffect(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!c))return v.current=setInterval(b,e.refreshInterval*1e3),()=>{v.current&&clearInterval(v.current)}},[e.refreshInterval,c,b]);let[x,S]=i.useState(()=>{if(typeof window<`u`&&s){let e=localStorage.getItem(s);if(e)try{return JSON.parse(e)}catch(e){console.error(`Failed to parse saved layout:`,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}))||[]}}),C=i.useCallback((e,t)=>{S(t),o?.(e)},[o]),w=i.useCallback(()=>{typeof window<`u`&&s&&localStorage.setItem(s,JSON.stringify(x)),p(!1)},[x,s]),T=i.useCallback(()=>{S({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}))||[]}),typeof window<`u`&&s&&localStorage.removeItem(s)},[e.widgets,s]),E=i.useCallback(e=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`bar`||t===`line`||t===`area`||t===`pie`||t===`donut`||t===`scatter`){let r=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(g(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:_t,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:_t,className:`h-full`}}return{type:`chart`,chartType:t,data:Array.isArray(r)?r:r?.items||[],xAxisKey:i,series:[{dataKey:a}],colors:_t,className:`h-full`}}if(t===`table`){let t=e.data||n.data;if(g(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(g(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,y.jsxs)(`div`,{ref:u,className:(0,r.cn)(`w-full`,t),"data-testid":`grid-layout`,children:[_&&(0,y.jsx)(gt,{editMode:f}),(0,y.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,y.jsx)(`h2`,{className:`text-2xl font-bold`,children:e.title||`Dashboard`}),(0,y.jsx)(`div`,{className:`flex gap-2`,children:f?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(r.Button,{onClick:w,size:`sm`,variant:`default`,children:[(0,y.jsx)(a.Save,{className:`h-4 w-4 mr-2`}),`Save Layout`]}),(0,y.jsxs)(r.Button,{onClick:T,size:`sm`,variant:`outline`,children:[(0,y.jsx)(a.X,{className:`h-4 w-4 mr-2`}),`Reset`]}),(0,y.jsx)(r.Button,{onClick:()=>p(!1),size:`sm`,variant:`ghost`,children:`Cancel`})]}):(0,y.jsxs)(y.Fragment,{children:[c&&(0,y.jsxs)(r.Button,{onClick:b,size:`sm`,variant:`outline`,disabled:m,"aria-label":`Refresh dashboard`,children:[(0,y.jsx)(a.RefreshCw,{className:(0,r.cn)(`h-4 w-4 mr-2`,m&&`animate-spin`)}),m?`Refreshing…`:`Refresh All`]}),(0,y.jsxs)(r.Button,{onClick:()=>p(!0),size:`sm`,variant:`outline`,children:[(0,y.jsx)(a.Edit,{className:`h-4 w-4 mr-2`}),`Edit Layout`]})]})})]}),d&&(0,y.jsx)(ht,{className:`layout`,width:l,layouts:x,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:f,handle:`.drag-handle`},resizeConfig:{enabled:f},onLayoutChange:C,children:e.widgets?.map((e,t)=>{let i=e.id||`widget-${t}`,o=E(e);return(0,y.jsx)(`div`,{className:`h-full`,children:e.type===`metric`?(0,y.jsxs)(`div`,{className:`h-full w-full relative`,children:[f&&(0,y.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,y.jsx)(a.GripVertical,{className:`h-4 w-4`})}),(0,y.jsx)(n.SchemaRenderer,{schema:o,className:`h-full w-full`})]}):(0,y.jsxs)(r.Card,{className:(0,r.cn)(`h-full overflow-hidden border-border/50 shadow-sm transition-all`,`bg-card/50 backdrop-blur-sm`,f&&`ring-2 ring-primary/20`),children:[e.title&&(0,y.jsxs)(r.CardHeader,{className:`pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between`,children:[(0,y.jsx)(r.CardTitle,{className:`text-base font-medium tracking-tight truncate`,title:e.title,children:e.title}),f&&(0,y.jsx)(`div`,{className:`drag-handle cursor-move p-1 hover:bg-muted/40 rounded`,children:(0,y.jsx)(a.GripVertical,{className:`h-4 w-4`})})]}),(0,y.jsx)(r.CardContent,{className:`p-0 h-full`,children:(0,y.jsx)(`div`,{className:(0,r.cn)(`h-full w-full overflow-auto p-4`),children:(0,y.jsx)(n.SchemaRenderer,{schema:o})})})]})},i)})})]})};function yt(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var bt={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`},xt=({label:e,value:t,trend:n,icon:o,className:s,description:c,loading:l,error:u,colorVariant:d=`default`,...f})=>{let p=bt[d]||bt.default,m=(0,i.useMemo)(()=>{if(typeof o==`string`){let e=a[o];return e?(0,y.jsx)(e,{className:`h-4 w-4`}):null}return o},[o]);return(0,y.jsxs)(r.Card,{className:(0,r.cn)(`h-full overflow-hidden`,s),...f,children:[(0,y.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,y.jsx)(r.CardTitle,{className:`text-sm font-medium truncate`,children:yt(e)}),m&&(0,y.jsx)(`div`,{className:(0,r.cn)(`flex h-8 w-8 items-center justify-center rounded-md shrink-0`,p),children:m})]}),(0,y.jsx)(r.CardContent,{children:l?(0,y.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,"data-testid":`metric-loading`,children:[(0,y.jsx)(a.Loader2,{className:`h-4 w-4 animate-spin`}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):u?(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`metric-error`,role:`alert`,children:[(0,y.jsx)(a.AlertCircle,{className:`h-4 w-4 text-destructive shrink-0`}),(0,y.jsx)(`span`,{className:`text-xs text-destructive truncate`,children:u})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`text-2xl font-bold truncate`,children:t}),(n||c)&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center mt-1 truncate`,children:[n&&(0,y.jsxs)(`span`,{className:(0,r.cn)(`flex items-center mr-2 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,y.jsx)(a.ArrowUpIcon,{className:`h-3 w-3 mr-1`}),n.direction===`down`&&(0,y.jsx)(a.ArrowDownIcon,{className:`h-3 w-3 mr-1`}),n.direction===`neutral`&&(0,y.jsx)(a.MinusIcon,{className:`h-3 w-3 mr-1`}),n.value,`%`]}),(0,y.jsx)(`span`,{className:`truncate`,children:yt(c)||yt(n?.label)})]})]})})]})};function St(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var Ct=({title:e,value:t,icon:n,trend:i,trendValue:o,description:s,className:c,loading:l,error:u,...d})=>{let f=n&&a[n];return(0,y.jsxs)(r.Card,{className:(0,r.cn)(`h-full`,c),...d,children:[(0,y.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,y.jsx)(r.CardTitle,{className:`text-sm font-medium`,children:St(e)}),f&&(0,y.jsx)(f,{className:`h-4 w-4 text-muted-foreground`})]}),(0,y.jsx)(r.CardContent,{children:l?(0,y.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,"data-testid":`metric-card-loading`,children:[(0,y.jsx)(a.Loader2,{className:`h-4 w-4 animate-spin`}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):u?(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`metric-card-error`,role:`alert`,children:[(0,y.jsx)(a.AlertCircle,{className:`h-4 w-4 text-destructive shrink-0`}),(0,y.jsx)(`span`,{className:`text-xs text-destructive truncate`,children:u})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`text-2xl font-bold`,children:t}),(i||o||s)&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center mt-1`,children:[i&&o&&(0,y.jsxs)(`span`,{className:(0,r.cn)(`flex items-center mr-2`,i===`up`&&`text-green-500`,i===`down`&&`text-red-500`,i===`neutral`&&`text-yellow-500`),children:[i===`up`&&(0,y.jsx)(a.ArrowUpIcon,{className:`h-3 w-3 mr-1`}),i===`down`&&(0,y.jsx)(a.ArrowDownIcon,{className:`h-3 w-3 mr-1`}),i===`neutral`&&(0,y.jsx)(a.MinusIcon,{className:`h-3 w-3 mr-1`}),o]}),St(s)]})]})})]})},wt=({objectName:e,aggregate:t,filter:r,label:a,fallbackValue:o,trend:s,icon:c,className:l,description:u,dataSource:d,colorVariant:f})=>{let p=(0,i.useContext)(n.SchemaRendererContext),m=d||p?.dataSource,[h,g]=(0,i.useState)(null),[_,v]=(0,i.useState)(!1),[b,x]=(0,i.useState)(null),S=(0,i.useCallback)(async(n,i)=>{if(!(!n||!e)){i.current&&(v(!0),x(null));try{let a;if(t&&typeof n.aggregate==`function`){let i=await n.aggregate(e,{field:t.field,function:t.function,groupBy:t.groupBy||`_all`,filter:r}),o=Array.isArray(i)?i:[];a=o.length===0?0:t.function===`count`?o.reduce((e,n)=>e+(Number(n[t.field])||Number(n.count)||0),0):o[0][t.field]??0}else if(typeof n.find==`function`){let t=await n.find(e,{$filter:r});a=(Array.isArray(t)?t:t?.data||t?.records||[]).length}else return;i.current&&g(a)}catch(e){console.error(`[ObjectMetricWidget] Fetch error:`,e),i.current&&x(e instanceof Error?e.message:`Failed to load metric`)}finally{i.current&&v(!1)}}},[e,t,r]);return(0,i.useEffect)(()=>{let t={current:!0};return m&&e?S(m,t):(g(null),x(null)),()=>{t.current=!1}},[m,e,S]),(0,y.jsx)(xt,{label:a,value:h===null?m?`—`:o??`—`:h,trend:s,icon:c,className:l,description:u,loading:_,error:b,colorVariant:f})};function Tt(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}function Et(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 Dt=({schema:e,className:t})=>{let{title:n,rowField:a,columnField:o,valueField:s,aggregation:c=`sum`,data:l=[],showRowTotals:u=!1,showColumnTotals:d=!1,format:f,columnColors:p}=e,m=Array.isArray(l)?l:[],{rowKeys:h,colKeys:g,matrix:_,rowTotals:v,colTotals:b,grandTotal:x}=(0,i.useMemo)(()=>{let e=new Map,t=new Map,n={};for(let r of m){let i=String(r[a]??``),c=String(r[o]??``),l=Number(r[s])||0;e.set(i,!0),t.set(c,!0),n[i]||(n[i]={}),n[i][c]||(n[i][c]=[]),n[i][c].push(l)}let r=Array.from(e.keys()),i=Array.from(t.keys()),l={},u={},d={};for(let e of r){l[e]={};let t=[];for(let r of i){let i=n[e]?.[r]??[],a=Et(i,c);l[e][r]=a,t.push(...i),!d[r]&&d[r]}u[e]=Et(t,c)}for(let e of i){let t=[];for(let i of r){let r=n[i]?.[e]??[];t.push(...r)}d[e]=Et(t,c)}let f=[];for(let e of m)f.push(Number(e[s])||0);return{rowKeys:r,colKeys:i,matrix:l,rowTotals:u,colTotals:d,grandTotal:Et(f,c)}},[m,a,o,s,c]),S=e=>Tt(e,f);return m.length===0?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,t),children:[n&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:n}),(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,"data-testid":`pivot-empty-state`,children:[(0,y.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,y.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`}),(0,y.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`}),(0,y.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`}),(0,y.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:`No data available`})]})]}):(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,t),children:[n&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:n}),(0,y.jsxs)(`table`,{className:`w-full text-sm border-collapse`,role:`table`,children:[(0,y.jsx)(`thead`,{children:(0,y.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,y.jsx)(`th`,{className:`text-left p-2 font-medium text-muted-foreground`,children:a}),g.map(e=>(0,y.jsx)(`th`,{className:(0,r.cn)(`text-right p-2 font-medium`,p?.[e]??`text-muted-foreground`),children:e},e)),u&&(0,y.jsx)(`th`,{className:`text-right p-2 font-semibold text-muted-foreground bg-muted/20`,children:`Total`})]})}),(0,y.jsx)(`tbody`,{children:h.map(e=>(0,y.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/30`,children:[(0,y.jsx)(`td`,{className:`p-2 font-medium`,children:e}),g.map(t=>(0,y.jsx)(`td`,{className:(0,r.cn)(`text-right p-2 tabular-nums`,p?.[t]),children:S(_[e]?.[t]??0)},t)),u&&(0,y.jsx)(`td`,{className:`text-right p-2 font-semibold tabular-nums bg-muted/20`,children:S(v[e]??0)})]},e))}),d&&(0,y.jsx)(`tfoot`,{children:(0,y.jsxs)(`tr`,{className:`border-t-2 border-border font-semibold bg-muted/40`,children:[(0,y.jsx)(`td`,{className:`p-2`,children:`Total`}),g.map(e=>(0,y.jsx)(`td`,{className:`text-right p-2 tabular-nums`,children:S(b[e]??0)},e)),u&&(0,y.jsx)(`td`,{className:`text-right p-2 tabular-nums font-bold`,children:S(x)})]})})]})]})},Ot=({schema:e,dataSource:a,className:o})=>{let s=(0,i.useContext)(n.SchemaRendererContext),c=a||s?.dataSource,l=(0,n.useDataScope)(e.bind),[u,d]=(0,i.useState)([]),[f,p]=(0,i.useState)(!1),[m,h]=(0,i.useState)(null);(0,i.useEffect)(()=>{let n=!0;return e.objectName&&!l&&(!e.data||e.data.length===0)&&(async()=>{if(!(!c||!e.objectName)){n&&(p(!0),h(null));try{let r;if(typeof c.find==`function`)r=(0,t.extractRecords)(await c.find(e.objectName,{$filter:e.filter}));else return;n&&d(r)}catch(e){console.error(`[ObjectPivotTable] Fetch error:`,e),n&&h(e instanceof Error?e.message:`Failed to load data`)}finally{n&&p(!1)}}})(),()=>{n=!1}},[e.objectName,c,l,e.data,e.filter]);let g=l||e.data||u,_=Array.isArray(g)?g:[];return f&&_.length===0?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`pivot-loading`,children:[e.title&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,y.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-6 w-24`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-20`})]}),[1,2,3].map(e=>(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-5 w-24`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-20`})]},e))]})]}):m?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`pivot-error`,children:[e.title&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`pivot-error-message`,children:[(0,y.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,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,y.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,y.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:m})]})]}):!c&&e.objectName&&_.length===0?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,o),children:[e.title&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,y.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,y.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})]}):(0,y.jsx)(Dt,{schema:{...e,data:_},className:o})};function kt(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)}var At=({schema:e,dataSource:a,className:o})=>{let s=(0,i.useContext)(n.SchemaRendererContext),c=a||s?.dataSource,l=(0,n.useDataScope)(e.bind),[u,d]=(0,i.useState)([]),[f,p]=(0,i.useState)(!1),[m,h]=(0,i.useState)(null);(0,i.useEffect)(()=>{let n=!0;return e.objectName&&!l&&(!e.data||e.data.length===0)&&(async()=>{if(!(!c||!e.objectName)){n&&(p(!0),h(null));try{let r;if(typeof c.find==`function`)r=(0,t.extractRecords)(await c.find(e.objectName,{$filter:e.filter}));else return;n&&d(r)}catch(e){console.error(`[ObjectDataTable] Fetch error:`,e),n&&h(e instanceof Error?e.message:`Failed to load data`)}finally{n&&p(!1)}}})(),()=>{n=!1}},[e.objectName,c,l,e.data,e.filter]);let g=l||e.data||u,_=Array.isArray(g)?g:[],v=(0,i.useMemo)(()=>e.columns&&e.columns.length>0?kt(e.columns):_.length===0?[]:Object.keys(_[0]).filter(e=>!e.startsWith(`_`)).map(e=>({header:e.charAt(0).toUpperCase()+e.slice(1).replace(/([A-Z])/g,` $1`),accessorKey:e})),[e.columns,_]);return f&&_.length===0?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`table-loading`,children:(0,y.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`})]}),[1,2,3,4].map(e=>(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`})]},e))]})}):m?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`table-error`,children:(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`table-error-message`,children:[(0,y.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,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,y.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,y.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:m})]})}):!c&&e.objectName&&_.length===0?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),children:(0,y.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,y.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})}):_.length===0?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`table-empty-state`,children:(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:[(0,y.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,y.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,y.jsx)(`line`,{x1:`3`,y1:`9`,x2:`21`,y2:`9`}),(0,y.jsx)(`line`,{x1:`9`,y1:`21`,x2:`9`,y2:`9`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:`No data available`})]})}):(0,y.jsx)(n.SchemaRenderer,{schema:{...e,type:`data-table`,data:_,columns:v},className:o})},jt={breadcrumb:[`Dashboard`,`Configuration`],sections:[{key:`layout`,title:`Layout`,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`,type:`input`,defaultValue:`120`,placeholder:`e.g. 120`}]},{key:`data`,title:`Data`,collapsible:!0,fields:[{key:`refreshInterval`,label:`Refresh interval`,type:`select`,defaultValue:`0`,options:[{value:`0`,label:`Manual`},{value:`30`,label:`30s`},{value:`60`,label:`1 min`},{value:`300`,label:`5 min`}]}]},{key:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`title`,label:`Title`,type:`input`,placeholder:`Dashboard 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 Mt({open:e,onClose:t,config:n,onSave:i,onFieldChange:a}){let{draft:o,isDirty:s,updateField:c,discard:l}=(0,r.useConfigDraft)(n,{onUpdate:a});return(0,y.jsx)(r.ConfigPanelRenderer,{open:e,onClose:t,schema:jt,draft:o,isDirty:s,onFieldChange:c,onSave:()=>i(o),onDiscard:l})}var Nt=[{value:`metric`,label:`Metric`},{value:`bar`,label:`Bar Chart`},{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:`table`,label:`Table`},{value:`pivot`,label:`Pivot Table`},{value:`list`,label:`List`},{value:`custom`,label:`Custom`}],Pt=[{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`}],Ft=[{value:`count`,label:`Count`},{value:`sum`,label:`Sum`},{value:`avg`,label:`Average`},{value:`min`,label:`Min`},{value:`max`,label:`Max`}],It=[`bar`,`line`,`area`,`pie`,`donut`,`scatter`];function Lt(e){return!!e&&It.includes(e)}var Rt=[{value:`group`,label:`Group`},{value:`value`,label:`Value`}],zt=[{value:`asc`,label:`↑`},{value:`desc`,label:`↓`}];function Bt(e,t,n,i){return{key:e,label:t,type:`custom`,render:(a,o,s)=>(0,y.jsx)(r.ConfigRow,{label:t,children:(0,y.jsx)(`div`,{"data-testid":`config-field-${e}`,children:(0,y.jsx)(r.Combobox,{options:i??[],value:a??``,onValueChange:o,placeholder:n,searchPlaceholder:`Search fields…`,emptyText:`No fields found.`,className:`h-7 w-32 text-xs`,disabled:!s.object})})})}}function Vt(e,t,n){let i=e&&e.length>0,a=i?{key:`object`,label:`Data source`,type:`custom`,render:(t,n)=>(0,y.jsx)(r.ConfigRow,{label:`Data source`,children:(0,y.jsx)(`div`,{"data-testid":`config-field-object`,children:(0,y.jsx)(r.Combobox,{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`},o=i?Bt(`categoryField`,`Category field`,`Select field…`,t):{key:`categoryField`,label:`Category field`,type:`input`,placeholder:`e.g. status`},s=i?Bt(`valueField`,`Value field`,`Select field…`,t):{key:`valueField`,label:`Value field`,type:`input`,placeholder:`e.g. amount`},c=i?Bt(`rowField`,`Field`,`Select row field…`,t):{key:`rowField`,label:`Field`,type:`input`,placeholder:`e.g. owner`},l=i?Bt(`columnField`,`Field`,`Select column field…`,t):{key:`columnField`,label:`Field`,type:`input`,placeholder:`e.g. stage`},u=i?Bt(`pivotValueField`,`Field`,`Select value field…`,t):{key:`pivotValueField`,label:`Field`,type:`input`,placeholder:`e.g. amount`};return{breadcrumb:[`Dashboard`,{pivot:`Pivot table`,table:`Table`}[n??``]??(Lt(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:Nt,defaultValue:`metric`}]},{key:`data`,title:`Data Binding`,collapsible:!0,visibleWhen:e=>e.type!==`pivot`,fields:[a,o,s,{key:`aggregate`,label:`Aggregation`,type:`select`,options:Ft,defaultValue:`count`}]},{key:`pivot-data`,title:`Data`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[a]},{key:`pivot-rows`,title:`Rows`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[c,{key:`rowSortBy`,label:`Sort by`,type:`icon-group`,options:Rt,defaultValue:`group`},{key:`rowSortOrder`,label:`Sort order`,type:`icon-group`,options:zt,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:[l,{key:`columnSortBy`,label:`Sort by`,type:`icon-group`,options:Rt,defaultValue:`group`},{key:`columnSortOrder`,label:`Sort order`,type:`icon-group`,options:zt,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:[u,{key:`aggregation`,label:`Aggregation`,type:`select`,options:Ft,defaultValue:`sum`},{key:`format`,label:`Number format`,type:`input`,placeholder:`e.g. $,.2f`}]},{key:`chart-axis`,title:`Axis & Series`,collapsible:!0,visibleWhen:e=>Lt(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:`table-columns`,title:`Columns`,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:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`colorVariant`,label:`Color variant`,type:`select`,options:Pt,defaultValue:`default`},{key:`actionUrl`,label:`Action URL`,type:`input`,placeholder:`https://...`}]}]}}function Ht(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 Ut({open:e,onClose:t,config:n,onSave:a,onFieldChange:o,headerExtra:s,availableObjects:c,availableFields:l}){let{draft:u,isDirty:d,updateField:f,discard:p}=(0,r.useConfigDraft)(i.useMemo(()=>({...n,title:typeof n.title==`object`?Ht(n.title):n.title,description:typeof n.description==`object`?Ht(n.description):n.description}),[n]),{onUpdate:o});return(0,y.jsx)(r.ConfigPanelRenderer,{open:e,onClose:t,schema:i.useMemo(()=>Vt(c,l,u.type),[c,l,u.type]),draft:u,isDirty:d,onFieldChange:f,onSave:()=>a(u),onDiscard:p,headerExtra:s})}function Wt({schema:e,config:t,onConfigSave:n,onWidgetSave:o,onRefresh:s,recordCount:c,defaultConfigOpen:l=!1,className:u}){let[d,f]=(0,i.useState)(l),[p,m]=(0,i.useState)(null),[h,g]=(0,i.useState)(e),[_,v]=(0,i.useState)(0);(0,i.useEffect)(()=>{g(e),v(e=>e+1)},[e]);let b=i.useMemo(()=>{if(!p||!h.widgets)return null;let e=h.widgets.find(e=>(e.id||e.title)===p);return e?{id:e.id??``,title:e.title??``,description:e.description??``,type:e.type??``,object:e.object??``,categoryField:e.categoryField??``,valueField:e.valueField??``,aggregate:e.aggregate??``,colorVariant:e.colorVariant??`default`,actionUrl:e.actionUrl??``,layoutW:e.layout?.w??1,layoutH:e.layout?.h??1}:null},[p,_]),x=(0,i.useCallback)(e=>{m(e),f(!0)},[]),S=(0,i.useCallback)(()=>{m(null)},[]),w=(0,i.useCallback)((e,t)=>{p&&g(n=>n.widgets?{...n,widgets:n.widgets.map(n=>(n.id||n.title)===p?e===`layoutW`?{...n,layout:{...n.layout||{},w:t}}:e===`layoutH`?{...n,layout:{...n.layout||{},h:t}}:{...n,[e]:t}:n)}:n)},[p]),T=(0,i.useCallback)(e=>{p&&o&&o(p,e),m(null),v(e=>e+1)},[p,o]),E=(0,i.useCallback)(()=>{f(e=>!e),m(null)},[]);return(0,y.jsxs)(`div`,{className:(0,r.cn)(`flex h-full w-full`,u),"data-testid":`dashboard-with-config`,children:[(0,y.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-auto relative`,children:[(0,y.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,y.jsxs)(r.Button,{size:`sm`,variant:d?`default`:`outline`,onClick:E,"data-testid":`dashboard-config-toggle`,children:[(0,y.jsx)(a.Settings,{className:`h-3.5 w-3.5 mr-1`}),`Settings`]})}),(0,y.jsx)(C,{schema:h,onRefresh:s,recordCount:c,designMode:d,selectedWidgetId:p,onWidgetClick:x})]}),d&&(0,y.jsx)(`div`,{className:`relative shrink-0`,children:p&&b?(0,y.jsx)(Ut,{open:!0,onClose:S,config:b,onSave:T,onFieldChange:w}):(0,y.jsx)(Mt,{open:!0,onClose:()=>f(!1),config:t,onSave:n})})]})}t.ComponentRegistry.register(`dashboard`,C,{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:[]}}),t.ComponentRegistry.register(`metric`,xt,{namespace:`plugin-dashboard`,label:`Metric Widget`,category:`Dashboard`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`value`,type:`string`,label:`Value`}]}),t.ComponentRegistry.register(`metric-card`,Ct,{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`}}),t.ComponentRegistry.register(`object-metric`,wt,{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`}}),t.ComponentRegistry.register(`pivot`,Dt,{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:[]}}),t.ComponentRegistry.register(`object-pivot`,Ot,{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`}}),t.ComponentRegistry.register(`dashboard-grid`,vt,{namespace:`plugin-dashboard`,label:`Dashboard Grid (Editable)`,category:`Complex`,icon:`layout-grid`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`persistLayoutKey`,type:`string`,label:`Layout Storage Key`,defaultValue:`dashboard-layout`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Dashboard`,widgets:[],persistLayoutKey:`dashboard-layout`}}),t.ComponentRegistry.register(`object-data-table`,At,{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 Gt={DashboardRenderer:C,DashboardGridLayout:vt,MetricWidget:xt,MetricCard:Ct,ObjectMetricWidget:wt,PivotTable:Dt,ObjectPivotTable:Ot,ObjectDataTable:At,DashboardConfigPanel:Mt,WidgetConfigPanel:Ut,DashboardWithConfig:Wt};e.DashboardConfigPanel=Mt,e.DashboardGridLayout=vt,e.DashboardRenderer=C,e.DashboardWithConfig=Wt,e.MetricCard=Ct,e.MetricWidget=xt,e.ObjectDataTable=At,e.ObjectMetricWidget=wt,e.ObjectPivotTable=Ot,e.PivotTable=Dt,e.WidgetConfigPanel=Ut,e.dashboardComponents=Gt});
|