@senitix/ui 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/{command-BPtg-XK3.cjs → command-BEpaOk-5.cjs} +2 -2
  2. package/dist/{command-BPtg-XK3.cjs.map → command-BEpaOk-5.cjs.map} +1 -1
  3. package/dist/{command-VraXPLVI.js → command-CYhMM7gX.js} +2 -2
  4. package/dist/{command-VraXPLVI.js.map → command-CYhMM7gX.js.map} +1 -1
  5. package/dist/components/builders/index.cjs.js +1 -1
  6. package/dist/components/builders/index.es.js +1 -1
  7. package/dist/components/data-display/index.cjs.js +1 -1
  8. package/dist/components/data-display/index.es.js +1 -1
  9. package/dist/components/forms/index.cjs.js +1 -1
  10. package/dist/components/forms/index.es.js +2 -2
  11. package/dist/components/layouts/index.cjs.js +1 -1
  12. package/dist/components/layouts/index.es.js +1 -1
  13. package/dist/components/navigation/index.cjs.js +1 -1
  14. package/dist/components/navigation/index.es.js +1 -1
  15. package/dist/components/ui/index.cjs.js +1 -1
  16. package/dist/components/ui/index.es.js +4 -4
  17. package/dist/{dialog-DO5i1PED.cjs → dialog-Cr9SYCaD.cjs} +2 -2
  18. package/dist/{dialog-DO5i1PED.cjs.map → dialog-Cr9SYCaD.cjs.map} +1 -1
  19. package/dist/{dialog-BFBDL8_i.js → dialog-MYAx3Qrc.js} +25 -20
  20. package/dist/{dialog-BFBDL8_i.js.map → dialog-MYAx3Qrc.js.map} +1 -1
  21. package/dist/{form-preview-C6WfeXyD.js → form-preview-Bm5xHtkw.js} +3 -3
  22. package/dist/{form-preview-C6WfeXyD.js.map → form-preview-Bm5xHtkw.js.map} +1 -1
  23. package/dist/{form-preview-BGdea5K7.cjs → form-preview-IPEZdspX.cjs} +2 -2
  24. package/dist/{form-preview-BGdea5K7.cjs.map → form-preview-IPEZdspX.cjs.map} +1 -1
  25. package/dist/full-calendar-4Ut52QNO.cjs +18 -0
  26. package/dist/full-calendar-4Ut52QNO.cjs.map +1 -0
  27. package/dist/{full-calendar-CjaDgutS.js → full-calendar-DD_tBy69.js} +288 -288
  28. package/dist/full-calendar-DD_tBy69.js.map +1 -0
  29. package/dist/{global-search-msFICB8l.cjs → global-search-DcBKVaM4.cjs} +2 -2
  30. package/dist/{global-search-msFICB8l.cjs.map → global-search-DcBKVaM4.cjs.map} +1 -1
  31. package/dist/{global-search-Dhv8goH8.js → global-search-Dul9CD6-.js} +3 -3
  32. package/dist/{global-search-Dhv8goH8.js.map → global-search-Dul9CD6-.js.map} +1 -1
  33. package/dist/index.cjs.js +1 -1
  34. package/dist/index.es.js +10 -10
  35. package/dist/{locale-selector-D0jV4-90.cjs → locale-selector-CRC0VBKl.cjs} +2 -2
  36. package/dist/{locale-selector-D0jV4-90.cjs.map → locale-selector-CRC0VBKl.cjs.map} +1 -1
  37. package/dist/{locale-selector-n75sM9qA.js → locale-selector-HuzfE0zZ.js} +4 -4
  38. package/dist/{locale-selector-n75sM9qA.js.map → locale-selector-HuzfE0zZ.js.map} +1 -1
  39. package/dist/{multi-select-DxN_LuXC.cjs → multi-select-Bj_kIDHE.cjs} +2 -2
  40. package/dist/{multi-select-DxN_LuXC.cjs.map → multi-select-Bj_kIDHE.cjs.map} +1 -1
  41. package/dist/{multi-select-D9akBt7B.js → multi-select-CPF7w871.js} +2 -2
  42. package/dist/{multi-select-D9akBt7B.js.map → multi-select-CPF7w871.js.map} +1 -1
  43. package/dist/{permission-matrix-CTQ1OiTO.js → permission-matrix-BRqw2RPb.js} +3 -3
  44. package/dist/{permission-matrix-CTQ1OiTO.js.map → permission-matrix-BRqw2RPb.js.map} +1 -1
  45. package/dist/{permission-matrix-DRu-cV44.cjs → permission-matrix-CqE8q8Hi.cjs} +2 -2
  46. package/dist/{permission-matrix-DRu-cV44.cjs.map → permission-matrix-CqE8q8Hi.cjs.map} +1 -1
  47. package/dist/{record-dialog-footer-CQPnqhfv.js → record-dialog-footer-DbH9A6eA.js} +3 -3
  48. package/dist/{record-dialog-footer-CQPnqhfv.js.map → record-dialog-footer-DbH9A6eA.js.map} +1 -1
  49. package/dist/{record-dialog-footer-DLH96eAV.cjs → record-dialog-footer-DpDxH5wX.cjs} +2 -2
  50. package/dist/{record-dialog-footer-DLH96eAV.cjs.map → record-dialog-footer-DpDxH5wX.cjs.map} +1 -1
  51. package/dist/{sheet-C0-aBGln.cjs → sheet-DTimb4SJ.cjs} +2 -2
  52. package/dist/{sheet-C0-aBGln.cjs.map → sheet-DTimb4SJ.cjs.map} +1 -1
  53. package/dist/{sheet-Cyq_eDFW.js → sheet-DgpAPCAp.js} +2 -2
  54. package/dist/{sheet-Cyq_eDFW.js.map → sheet-DgpAPCAp.js.map} +1 -1
  55. package/dist/styles.css +1 -1
  56. package/package.json +1 -1
  57. package/dist/full-calendar-CZMK_rPy.cjs +0 -18
  58. package/dist/full-calendar-CZMK_rPy.cjs.map +0 -1
  59. package/dist/full-calendar-CjaDgutS.js.map +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";const l=require("react/jsx-runtime"),ee=require("react"),j=require("./index-Dy_9oyP3.cjs"),A=require("./locale-provider-BScpm-eC.cjs"),X=require("./tooltip-Dd7le9EO.cjs"),U=require("./input-UBp7V7li.cjs"),V=require("./select-CEsYpjPi.cjs"),P=require("./button-CPuCii0R.cjs"),hn=require("./calendar-CSJ060ym.cjs"),te=require("./popover-Bba1ELMX.cjs"),fn=require("./use-formatters-Bb0fX1lW.cjs"),pt=require("./calendar-BH-AuyiB.cjs"),J=require("./checkbox-BmugT50K.cjs"),ge=require("./multi-select-DxN_LuXC.cjs"),L=require("./badge-BZcdBG5J.cjs"),ue=require("./x-D-El5XAY.cjs"),Be=require("./pencil-BJULwaDl.cjs"),pn=require("react-dom"),D=require("./dropdown-menu-ejikFvg2.cjs"),H=require("./scroll-area-HsTSI_58.cjs"),xt=require("./ellipsis-Dk7Wfc4i.cjs"),me=require("./card-CToWUN1K.cjs"),vt=require("./trending-up-mLgmkp--.cjs"),xn=require("./minus-BUFkTM0k.cjs"),ne=require("./avatar-Cl38Ye4J.cjs"),vn=require("./eye-Cved4eAo.cjs"),Se=require("./use-controllable-state-3ATd6Fqd.cjs"),ce=require("./command-BPtg-XK3.cjs"),wt=require("./trash-2-DWEeKlWT.cjs"),rt=require("./plus-Bcuujcqd.cjs"),wn=require("./chevron-up-Bq55Db6X.cjs"),ie=require("./skeleton-D3YsjVWD.cjs"),Cn=require("./sparkline-chart-D6SLZVjp.cjs"),he=require("./progress-BrzjVhWG.cjs"),Ct=require("./arrow-right-vDxRZOfm.cjs"),Sn=require("./switch-AEZvZSRV.cjs"),jn=require("./label-F0zGAiI2.cjs"),yn=require("./upload-2tm-XihE.cjs"),lt=require("./file-spreadsheet-CpySxI0-.cjs"),bn=require("./chevron-right-D-TdAZ7l.cjs");function Nn(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return s.default=e,Object.freeze(s)}const C=Nn(ee);/**
1
+ "use strict";const l=require("react/jsx-runtime"),ee=require("react"),j=require("./index-Dy_9oyP3.cjs"),A=require("./locale-provider-BScpm-eC.cjs"),X=require("./tooltip-Dd7le9EO.cjs"),U=require("./input-UBp7V7li.cjs"),V=require("./select-CEsYpjPi.cjs"),P=require("./button-CPuCii0R.cjs"),hn=require("./calendar-CSJ060ym.cjs"),te=require("./popover-Bba1ELMX.cjs"),fn=require("./use-formatters-Bb0fX1lW.cjs"),pt=require("./calendar-BH-AuyiB.cjs"),J=require("./checkbox-BmugT50K.cjs"),ge=require("./multi-select-Bj_kIDHE.cjs"),L=require("./badge-BZcdBG5J.cjs"),ue=require("./x-D-El5XAY.cjs"),Be=require("./pencil-BJULwaDl.cjs"),pn=require("react-dom"),D=require("./dropdown-menu-ejikFvg2.cjs"),H=require("./scroll-area-HsTSI_58.cjs"),xt=require("./ellipsis-Dk7Wfc4i.cjs"),me=require("./card-CToWUN1K.cjs"),vt=require("./trending-up-mLgmkp--.cjs"),xn=require("./minus-BUFkTM0k.cjs"),ne=require("./avatar-Cl38Ye4J.cjs"),vn=require("./eye-Cved4eAo.cjs"),Se=require("./use-controllable-state-3ATd6Fqd.cjs"),ce=require("./command-BEpaOk-5.cjs"),wt=require("./trash-2-DWEeKlWT.cjs"),rt=require("./plus-Bcuujcqd.cjs"),wn=require("./chevron-up-Bq55Db6X.cjs"),ie=require("./skeleton-D3YsjVWD.cjs"),Cn=require("./sparkline-chart-D6SLZVjp.cjs"),he=require("./progress-BrzjVhWG.cjs"),Ct=require("./arrow-right-vDxRZOfm.cjs"),Sn=require("./switch-AEZvZSRV.cjs"),jn=require("./label-F0zGAiI2.cjs"),yn=require("./upload-2tm-XihE.cjs"),lt=require("./file-spreadsheet-CpySxI0-.cjs"),bn=require("./chevron-right-D-TdAZ7l.cjs");function Nn(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return s.default=e,Object.freeze(s)}const C=Nn(ee);/**
2
2
  * @license lucide-react v0.441.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -90,4 +90,4 @@
90
90
  font-size: .6rem;
91
91
  font-weight: bold;
92
92
  color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,t==null?void 0:t.key)}return t!=null&&t.onChange&&!(o&&t.skipInitialOnChange)&&t.onChange(r),o=!1,r}return i.updateDeps=a=>{n=a},i}function ut(e,s){if(e===void 0)throw new Error("Unexpected undefined");return e}const Gs=(e,s)=>Math.abs(e-s)<1.01,Bs=(e,s,t)=>{let n;return function(...r){e.clearTimeout(n),n=e.setTimeout(()=>s.apply(this,r),t)}},ct=e=>{const{offsetWidth:s,offsetHeight:t}=e;return{width:s,height:t}},Hs=e=>e,qs=e=>{const s=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),n=[];for(let r=s;r<=t;r++)n.push(r);return n},Ks=(e,s)=>{const t=e.scrollElement;if(!t)return;const n=e.targetWindow;if(!n)return;const r=i=>{const{width:a,height:d}=i;s({width:Math.round(a),height:Math.round(d)})};if(r(ct(t)),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(i=>{const a=()=>{const d=i[0];if(d!=null&&d.borderBoxSize){const u=d.borderBoxSize[0];if(u){r({width:u.inlineSize,height:u.blockSize});return}}r(ct(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},dt={passive:!0},gt=typeof window>"u"?!0:"onscrollend"in window,Us=(e,s)=>{const t=e.scrollElement;if(!t)return;const n=e.targetWindow;if(!n)return;let r=0;const o=e.options.useScrollendEvent&&gt?()=>{}:Bs(n,()=>{s(r,!1)},e.options.isScrollingResetDelay),i=h=>()=>{const{horizontal:f,isRtl:g}=e.options;r=f?t.scrollLeft*(g&&-1||1):t.scrollTop,o(),s(r,h)},a=i(!0),d=i(!1);t.addEventListener("scroll",a,dt);const u=e.options.useScrollendEvent&&gt;return u&&t.addEventListener("scrollend",d,dt),()=>{t.removeEventListener("scroll",a),u&&t.removeEventListener("scrollend",d)}},Ws=(e,s,t)=>{if(s!=null&&s.borderBoxSize){const n=s.borderBoxSize[0];if(n)return Math.round(n[t.options.horizontal?"inlineSize":"blockSize"])}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},Xs=(e,{adjustments:s=0,behavior:t},n)=>{var r,o;const i=e+s;(o=(r=n.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[n.options.horizontal?"left":"top"]:i,behavior:t})};class Ys{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const n=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{const i=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),t=null},observe:r=>{var o;return(o=n())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=n())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([n,r])=>{typeof r>"u"&&delete t[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Hs,rangeExtractor:qs,onChange:()=>{},measureElement:Ws,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var n,r;(r=(n=this.options).onChange)==null||r.call(n,this,t)},this.maybeNotify=de(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=o,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,n)=>{const r=new Map,o=new Map;for(let i=n-1;i>=0;i--){const a=t[i];if(r.has(a.lane))continue;const d=o.get(a.lane);if(d==null||a.end>d.end?o.set(a.lane,a):a.end<d.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=de(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(t,n,r,o,i,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:n,scrollMargin:r,getItemKey:o,enabled:i,lanes:a}),{key:!1}),this.getMeasurements=de(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:n,scrollMargin:r,getItemKey:o,enabled:i,lanes:a},d)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const g of this.laneAssignments.keys())g>=t&&this.laneAssignments.delete(g);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(g=>{this.itemSizeCache.set(g.key,g.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,u),f=new Array(a).fill(void 0);for(let g=0;g<u;g++){const c=h[g];c&&(f[c.lane]=g)}for(let g=u;g<t;g++){const c=o(g),m=this.laneAssignments.get(g);let p,x;if(m!==void 0&&this.options.lanes>1){p=m;const $=f[p],O=$!==void 0?h[$]:void 0;x=O?O.end+this.options.gap:n+r}else{const $=this.options.lanes===1?h[g-1]:this.getFurthestMeasurement(h,g);x=$?$.end+this.options.gap:n+r,p=$?$.lane:g%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(g,p)}const v=d.get(c),w=typeof v=="number"?v:this.options.estimateSize(g),M=x+w;h[g]={index:g,start:x,size:w,end:M,key:c,lane:p},f[p]=g}return this.measurementsCache=h,h},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=de(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,r,o)=>this.range=t.length>0&&n>0?Js({measurements:t,outerSize:n,scrollOffset:r,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=de(()=>{let t=null,n=null;const r=this.calculateRange();return r&&(t=r.startIndex,n=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,n]},(t,n,r,o,i)=>o===null||i===null?[]:t({startIndex:o,endIndex:i,overscan:n,count:r}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const n=this.options.indexAttribute,r=t.getAttribute(n);return r?parseInt(r,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(t,n)=>{const r=this.indexFromElement(t),o=this.measurementsCache[r];if(!o)return;const i=o.key,a=this.elementsCache.get(i);a!==t&&(a&&this.observer.unobserve(a),this.observer.observe(t),this.elementsCache.set(i,t)),t.isConnected&&this.resizeItem(r,this.options.measureElement(t,n,this))},this.resizeItem=(t,n)=>{const r=this.measurementsCache[t];if(!r)return;const o=this.itemSizeCache.get(r.key)??r.size,i=n-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,i,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,n)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((n,r)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(r))});return}this._measureElement(t,void 0)},this.getVirtualItems=de(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{const r=[];for(let o=0,i=t.length;o<i;o++){const a=t[o],d=n[a];r.push(d)}return r},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const n=this.getMeasurements();if(n.length!==0)return ut(n[Ot(0,n.length-1,r=>ut(n[r]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,n,r=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),i=this.getScrollOffset();n==="auto"&&(n=t>=i+o?"end":"start"),n==="center"?t+=(r-o)/2:n==="end"&&(t-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,n="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const r=this.measurementsCache[t];if(!r)return;const o=this.getSize(),i=this.getScrollOffset();if(n==="auto")if(r.end>=i+o-this.options.scrollPaddingEnd)n="end";else if(r.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];if(n==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),n];const a=n==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,r.size),n]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:n="start",behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,n),{adjustments:void 0,behavior:r})},this.scrollToIndex=(t,{align:n="auto",behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1)),this.currentScrollToIndex=t;let o=0;const i=10,a=u=>{if(!this.targetWindow)return;const h=this.getOffsetForIndex(t,u);if(!h){console.warn("Failed to get offset for index:",t);return}const[f,g]=h;this._scrollToOffset(f,{adjustments:void 0,behavior:r}),this.targetWindow.requestAnimationFrame(()=>{const c=()=>{if(this.currentScrollToIndex!==t)return;const m=this.getScrollOffset(),p=this.getOffsetForIndex(t,g);if(!p){console.warn("Failed to get offset for index:",t);return}Gs(p[0],m)||d(g)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(c):c()})},d=u=>{this.targetWindow&&this.currentScrollToIndex===t&&(o++,o<i?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",o,i),this.targetWindow.requestAnimationFrame(()=>a(u))):console.warn(`Failed to scroll to index ${t} after ${i} attempts.`))};a(n)},this.scrollBy=(t,{behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var t;const n=this.getMeasurements();let r;if(n.length===0)r=this.options.paddingStart;else if(this.options.lanes===1)r=((t=n[n.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let i=n.length-1;for(;i>=0&&o.some(a=>a===null);){const a=n[i];o[a.lane]===null&&(o[a.lane]=a.end),i--}r=Math.max(...o.filter(a=>a!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:n,behavior:r})=>{this.options.scrollToFn(t,{behavior:r,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(s)}}const Ot=(e,s,t,n)=>{for(;e<=s;){const r=(e+s)/2|0,o=t(r);if(o<n)e=r+1;else if(o>n)s=r-1;else return r}return e>0?e-1:0};function Js({measurements:e,outerSize:s,scrollOffset:t,lanes:n}){const r=e.length-1,o=d=>e[d].start;if(e.length<=n)return{startIndex:0,endIndex:r};let i=Ot(0,r,o,t),a=i;if(n===1)for(;a<r&&e[a].end<t+s;)a++;else if(n>1){const d=Array(n).fill(0);for(;a<r&&d.some(h=>h<t+s);){const h=e[a];d[h.lane]=h.end,a++}const u=Array(n).fill(t+s);for(;i>=0&&u.some(h=>h>=t);){const h=e[i];u[h.lane]=h.start,i--}i=Math.max(0,i-i%n),a=Math.min(r,a+(n-1-a%n))}return{startIndex:i,endIndex:a}}const mt=typeof document<"u"?C.useLayoutEffect:C.useEffect;function Qs({useFlushSync:e=!0,...s}){const t=C.useReducer(()=>({}),{})[1],n={...s,onChange:(o,i)=>{var a;e&&i?pn.flushSync(t):t(),(a=s.onChange)==null||a.call(s,o,i)}},[r]=C.useState(()=>new Ys(n));return r.setOptions(n),mt(()=>r._didMount(),[]),mt(()=>r._willUpdate()),r}function Zs(e){return Qs({observeElementRect:Ks,observeElementOffset:Us,scrollToFn:Xs,...e})}function zt({columns:e,data:s,searchKey:t,searchPlaceholder:n,showColumnToggle:r=!0,showRowSelection:o=!1,onRowClick:i,className:a,editable:d=!1,onCellEdit:u,onCellValidate:h,enableColumnResizing:f=!1,columnResizeMode:g="onChange",stickyHeader:c=!0,emptyState:m,height:p=500,estimateRowHeight:x=48,overscan:v=10}){var _,se,pe;const{t:w}=A.useLocale(),[M,$]=C.useState([]),[O,F]=C.useState([]),[E,G]=C.useState({}),[y,I]=C.useState({}),k=C.useMemo(()=>o?[{id:"select",header:({table:T})=>l.jsx(J.Checkbox,{checked:T.getIsAllPageRowsSelected()||T.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:z=>T.toggleAllPageRowsSelected(!!z),"aria-label":w("table.selectAllRows")}),cell:({row:T})=>l.jsx(J.Checkbox,{checked:T.getIsSelected(),onCheckedChange:z=>T.toggleSelected(!!z),"aria-label":w("table.selectRow")}),enableSorting:!1,enableHiding:!1,enableResizing:!1},...e]:e,[e,o,w]),b=Vt({data:s,columns:k,onSortingChange:$,onColumnFiltersChange:F,getCoreRowModel:kt(),getSortedRowModel:Dt(),getFilteredRowModel:Et(),onColumnVisibilityChange:G,onRowSelectionChange:I,enableColumnResizing:f,columnResizeMode:g,state:{sorting:M,columnFilters:O,columnVisibility:E,rowSelection:y},meta:d?{onCellEdit:u,onCellValidate:h}:void 0}),{rows:q}=b.getRowModel(),Q=C.useRef(null),S=Zs({count:q.length,getScrollElement:()=>Q.current,estimateSize:()=>x,overscan:v});return l.jsxs("div",{className:j.cn("w-full",a),children:[l.jsxs("div",{className:"flex items-center gap-4 py-4",children:[t&&l.jsx(U.Input,{placeholder:n??w("table.searchPlaceholder"),value:((_=b.getColumn(t))==null?void 0:_.getFilterValue())??"",onChange:T=>{var z;return(z=b.getColumn(t))==null?void 0:z.setFilterValue(T.target.value)},className:"max-w-sm"}),r&&l.jsxs(D.DropdownMenu,{children:[l.jsx(D.DropdownMenuTrigger,{asChild:!0,children:l.jsxs(P.Button,{variant:"outline",className:"ml-auto",children:[w("table.columns")," ",l.jsx(U.ChevronDown,{className:"ml-2 h-4 w-4"})]})}),l.jsx(D.DropdownMenuContent,{align:"end",children:b.getAllColumns().filter(T=>T.getCanHide()).map(T=>l.jsx(D.DropdownMenuCheckboxItem,{className:"capitalize",checked:T.getIsVisible(),onCheckedChange:z=>T.toggleVisibility(!!z),children:T.id},T.id))})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsx("div",{ref:Q,className:"overflow-auto",style:{height:p},children:l.jsxs(Ie,{style:f?{width:b.getCenterTotalSize()}:void 0,children:[l.jsx(ke,{className:c?"sticky top-0 z-20 bg-background":void 0,children:b.getHeaderGroups().map(T=>l.jsx(le,{children:T.headers.map(z=>l.jsxs(De,{style:f?{width:z.getSize()}:void 0,className:f?"relative":void 0,children:[z.isPlaceholder?null:_e(z.column.columnDef.header,z.getContext()),f&&z.column.getCanResize()&&l.jsx("div",{onMouseDown:z.getResizeHandler(),onTouchStart:z.getResizeHandler(),className:j.cn("absolute right-0 top-0 h-full w-1 cursor-col-resize select-none touch-none bg-transparent hover:bg-primary/50 transition-colors",z.column.getIsResizing()&&"bg-primary")})]},z.id))},T.id))}),l.jsx(Ee,{children:q.length?l.jsxs(l.Fragment,{children:[S.getVirtualItems().length>0&&l.jsx("tr",{style:{height:((se=S.getVirtualItems()[0])==null?void 0:se.start)??0}}),S.getVirtualItems().map(T=>{const z=q[T.index];return l.jsx(le,{"data-index":T.index,ref:B=>S.measureElement(B),"data-state":z.getIsSelected()&&"selected",onClick:()=>i==null?void 0:i(z.original),className:i?"cursor-pointer":"",children:z.getVisibleCells().map(B=>l.jsx(fe,{style:f?{width:B.column.getSize()}:void 0,children:_e(B.column.columnDef.cell,B.getContext())},B.id))},z.id)}),S.getVirtualItems().length>0&&l.jsx("tr",{style:{height:S.getTotalSize()-(((pe=S.getVirtualItems().at(-1))==null?void 0:pe.end)??0)}})]}):l.jsx(le,{children:l.jsx(fe,{colSpan:k.length,className:"h-24 text-center",children:m??l.jsxs("div",{className:"flex flex-col items-center justify-center py-4 text-muted-foreground",children:[l.jsx(D.Search,{className:"mb-2 h-8 w-8 opacity-40"}),l.jsx("p",{className:"text-sm font-medium",children:w("table.noResults")}),l.jsx("p",{className:"text-xs",children:w("table.adjustSearchOrFilter")})]})})})})]})})}),l.jsxs("div",{className:"flex items-center justify-between py-2",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:w("table.rowsTotal",{count:q.length})}),o&&l.jsx("p",{className:"text-sm text-muted-foreground",children:w("table.rowsSelected",{selected:b.getFilteredSelectedRowModel().rows.length,total:q.length})})]})]})}zt.displayName="VirtualDataTable";const At=C.forwardRef(({className:e,title:s,value:t,description:n,trend:r,icon:o,loading:i=!1,...a},d)=>{const u=(r==null?void 0:r.direction)||(r!=null&&r.value&&r.value>0?"up":r!=null&&r.value&&r.value<0?"down":"neutral"),h=u==="up"?vt.TrendingUp:u==="down"?St:xn.Minus,f=u==="up"?"text-success":u==="down"?"text-destructive":"text-muted-foreground";return l.jsxs(me.Card,{ref:d,className:j.cn("",e),...a,children:[l.jsxs(me.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(me.CardTitle,{className:"text-sm font-medium",children:s}),o&&l.jsx("div",{className:"text-muted-foreground",children:o})]}),l.jsx(me.CardContent,{children:i?l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"h-8 w-24 animate-pulse rounded bg-muted"}),l.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-2xl font-bold",children:t}),(n||r)&&l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r&&l.jsxs("span",{className:j.cn("flex items-center gap-1",f),children:[l.jsx(h,{className:"h-3 w-3"}),Math.abs(r.value),"%",r.label&&l.jsx("span",{children:r.label})]}),n&&l.jsx("span",{children:n})]})]})})]})});At.displayName="KPICard";const Tt=C.forwardRef(({className:e,title:s,value:t,subtitle:n,icon:r,iconBackground:o="bg-primary/10",loading:i=!1,...a},d)=>l.jsx(me.Card,{ref:d,className:j.cn("",e),...a,children:l.jsxs(me.CardContent,{className:"flex items-center gap-4 p-6",children:[r&&l.jsx("div",{className:j.cn("flex h-12 w-12 items-center justify-center rounded-full",o),children:r}),l.jsx("div",{className:"flex-1",children:i?l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"h-4 w-20 animate-pulse rounded bg-muted"}),l.jsx("div",{className:"h-6 w-16 animate-pulse rounded bg-muted"})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:s}),l.jsx("p",{className:"text-2xl font-bold",children:t}),n&&l.jsx("p",{className:"text-xs text-muted-foreground",children:n})]})})]})}));Tt.displayName="StatCard";const Lt=C.forwardRef(({className:e,icon:s,title:t,description:n,action:r,...o},i)=>l.jsxs("div",{ref:i,className:j.cn("flex min-h-[400px] flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center",e),...o,children:[s&&l.jsx("div",{className:"mb-4 flex h-20 w-20 items-center justify-center rounded-full bg-muted",children:s}),l.jsx("h3",{className:"mb-2 text-lg font-semibold",children:t}),n&&l.jsx("p",{className:"mb-6 max-w-sm text-sm text-muted-foreground",children:n}),r&&l.jsx("div",{children:r})]}));Lt.displayName="EmptyState";const Gt=C.forwardRef(({className:e,items:s,...t},n)=>l.jsx("div",{ref:n,className:j.cn("relative space-y-0",e),...t,children:s.map((r,o)=>l.jsxs("div",{className:"relative pb-8 last:pb-0",children:[o!==s.length-1&&l.jsx("span",{className:"absolute left-4 top-4 -ml-px h-full w-0.5 bg-border","aria-hidden":"true"}),l.jsxs("div",{className:"relative flex items-start space-x-4",children:[l.jsx("div",{className:j.cn("relative flex h-8 w-8 items-center justify-center rounded-full border-2",r.status==="completed"&&"border-primary bg-primary text-primary-foreground",r.status==="current"&&"border-primary bg-background",r.status==="upcoming"&&"border-muted bg-background",!r.status&&"border-muted bg-background"),children:r.icon||l.jsx("div",{className:j.cn("h-2.5 w-2.5 rounded-full",r.status==="completed"&&"bg-primary-foreground",r.status==="current"&&"bg-primary",r.status==="upcoming"&&"bg-muted-foreground",!r.status&&"bg-muted-foreground")})}),l.jsxs("div",{className:"min-w-0 flex-1 pt-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{className:j.cn("text-sm font-medium",r.status==="upcoming"&&"text-muted-foreground"),children:r.title}),r.date&&l.jsx("time",{className:"text-xs text-muted-foreground",children:r.date})]}),r.description&&l.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:r.description})]})]})]},r.id))}));Gt.displayName="Timeline";const Bt=C.forwardRef(({className:e,items:s,showAvatar:t=!0,...n},r)=>l.jsx("div",{ref:r,className:j.cn("space-y-4",e),...n,children:s.map(o=>l.jsxs("div",{className:"flex gap-4",children:[t&&l.jsxs(ne.Avatar,{className:"h-8 w-8",children:[o.user.avatar&&l.jsx(ne.AvatarImage,{src:o.user.avatar,alt:o.user.name}),l.jsx(ne.AvatarFallback,{children:o.user.initials||o.user.name.charAt(0).toUpperCase()})]}),l.jsxs("div",{className:"flex-1 space-y-1",children:[l.jsxs("p",{className:"text-sm",children:[l.jsx("span",{className:"font-medium",children:o.user.name})," ",l.jsx("span",{className:"text-muted-foreground",children:o.action}),o.target&&l.jsxs("span",{className:"font-medium",children:[" ",o.target]})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:o.timestamp})]}),o.icon&&l.jsx("div",{className:"text-muted-foreground",children:o.icon})]},o.id))}));Bt.displayName="ActivityFeed";const Ht=C.forwardRef(({columns:e,onChange:s,showSelectAll:t=!0,maxHeight:n=300,className:r},o)=>{const{t:i}=A.useLocale(),a=e.filter(g=>g.visible).length,d=e.length,u=g=>{const c=e.map(m=>m.id===g&&!m.locked?{...m,visible:!m.visible}:m);s(c)},h=()=>{const g=e.every(m=>m.visible||m.locked),c=e.map(m=>m.locked?m:{...m,visible:!g});s(c)},f=()=>{const g=e.map(c=>({...c,visible:!0}));s(g)};return l.jsxs(D.DropdownMenu,{children:[l.jsx(D.DropdownMenuTrigger,{asChild:!0,children:l.jsxs(P.Button,{ref:o,variant:"outline",size:"sm",className:j.cn("gap-2",r),children:[l.jsx(Pn,{className:"h-4 w-4"}),l.jsx("span",{children:i("column.columns")}),l.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",a,"/",d,")"]})]})}),l.jsxs(D.DropdownMenuContent,{align:"end",className:"w-56",children:[l.jsxs(D.DropdownMenuLabel,{className:"flex items-center justify-between",children:[l.jsx("span",{children:i("column.toggleColumns")}),l.jsx(P.Button,{variant:"ghost",size:"sm",className:"h-auto p-1 text-xs",onClick:f,children:i("column.reset")})]}),l.jsx(D.DropdownMenuSeparator,{}),t&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[l.jsx(J.Checkbox,{id:"select-all",checked:e.every(g=>g.visible||g.locked),onCheckedChange:h}),l.jsx("label",{htmlFor:"select-all",className:"flex-1 cursor-pointer text-sm font-medium",children:i("column.selectAll")})]}),l.jsx(D.DropdownMenuSeparator,{})]}),l.jsx(H.ScrollArea,{style:{maxHeight:n},children:l.jsx("div",{className:"space-y-1 p-1",children:e.map(g=>l.jsxs("div",{className:j.cn("flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors hover:bg-muted",g.locked&&"opacity-50"),children:[l.jsx(J.Checkbox,{id:g.id,checked:g.visible,onCheckedChange:()=>u(g.id),disabled:g.locked}),l.jsxs("label",{htmlFor:g.id,className:j.cn("flex flex-1 cursor-pointer items-center gap-2 text-sm",g.locked&&"cursor-not-allowed"),children:[g.visible?l.jsx(vn.Eye,{className:"h-3.5 w-3.5 text-muted-foreground"}):l.jsx(En,{className:"h-3.5 w-3.5 text-muted-foreground"}),g.label]})]},g.id))})})]})]})});Ht.displayName="ColumnVisibility";const qt=C.forwardRef(({selectedCount:e,selectedIds:s,onClearSelection:t,actions:n,maxVisibleActions:r=3,className:o},i)=>{if(e===0)return null;const a=n.slice(0,r),d=n.slice(r);return l.jsxs("div",{ref:i,className:j.cn("flex items-center gap-2 rounded-lg border bg-muted/50 px-3 py-2",o),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(P.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:t,children:l.jsx(ue.X,{className:"h-4 w-4"})}),l.jsxs("span",{className:"text-sm font-medium",children:[e," selected"]})]}),l.jsx("div",{className:"mx-2 h-6 w-px bg-border"}),l.jsxs("div",{className:"flex items-center gap-1",children:[a.map(u=>l.jsxs(P.Button,{variant:u.variant==="destructive"?"destructive":"ghost",size:"sm",className:"gap-2",onClick:()=>u.onClick(s),disabled:u.disabled,children:[u.icon,l.jsx("span",{children:u.label})]},u.id)),d.length>0&&l.jsxs(D.DropdownMenu,{children:[l.jsx(D.DropdownMenuTrigger,{asChild:!0,children:l.jsx(P.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:l.jsx(xt.Ellipsis,{className:"h-4 w-4"})})}),l.jsx(D.DropdownMenuContent,{align:"end",children:d.map(u=>l.jsxs(D.DropdownMenuItem,{onClick:()=>u.onClick(s),disabled:u.disabled,className:j.cn("flex items-center gap-2",u.variant==="destructive"&&"text-destructive"),children:[u.icon,l.jsx("span",{children:u.label})]},u.id))})]})]})]})});qt.displayName="BulkActionsToolbar";const Kt=C.forwardRef(({value:e,onChange:s,options:t=[10,20,50,100],label:n,className:r},o)=>{const{t:i}=A.useLocale(),a=n??i("table.rowsPerPage");return l.jsxs("div",{className:j.cn("flex items-center gap-2",r),children:[l.jsx("span",{className:"text-sm text-muted-foreground",children:a}),l.jsxs(V.Select,{value:e.toString(),onValueChange:d=>s(parseInt(d,10)),children:[l.jsx(V.SelectTrigger,{ref:o,size:"sm",width:"sm",children:l.jsx(V.SelectValue,{})}),l.jsx(V.SelectContent,{align:"end",children:t.map(d=>l.jsx(V.SelectItem,{value:d.toString(),children:d},d))})]})]})});Kt.displayName="PerPageSelector";const Ut=C.forwardRef(({className:e,filters:s,onClearAll:t,...n},r)=>{const o=s.reduce((i,a)=>i+a.value.length,0);return l.jsxs("div",{ref:r,className:j.cn("flex flex-wrap items-center gap-2",e),...n,children:[s.map(i=>l.jsxs(D.DropdownMenu,{children:[l.jsx(D.DropdownMenuTrigger,{asChild:!0,children:l.jsxs(P.Button,{variant:i.value.length>0?"secondary":"outline",size:"sm",className:"gap-1",children:[i.label,i.value.length>0&&l.jsx(L.Badge,{variant:"default",className:"ml-1 h-5 px-1.5",children:i.value.length}),l.jsx(U.ChevronDown,{className:"h-3.5 w-3.5 opacity-50"})]})}),l.jsxs(D.DropdownMenuContent,{align:"start",className:"w-48",children:[l.jsx(D.DropdownMenuLabel,{children:i.label}),l.jsx(D.DropdownMenuSeparator,{}),i.options.map(a=>l.jsxs(D.DropdownMenuCheckboxItem,{checked:i.value.includes(a.value),onCheckedChange:d=>{if(i.multiple!==!1){const u=d?[...i.value,a.value]:i.value.filter(h=>h!==a.value);i.onChange(u)}else i.onChange(d?[a.value]:[])},children:[l.jsx("span",{className:"flex-1",children:a.label}),a.count!==void 0&&l.jsx("span",{className:"text-xs text-muted-foreground",children:a.count})]},a.value))]})]},i.id)),o>0&&t&&l.jsxs(P.Button,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground",onClick:t,children:[l.jsx(ue.X,{className:"h-3.5 w-3.5"}),"Clear all"]})]})});Ut.displayName="QuickFilters";const Wt=C.forwardRef(({className:e,tags:s,onRemove:t,onClearAll:n,maxVisible:r=5,showAll:o,defaultShowAll:i=!1,onShowAllChange:a,...d},u)=>{const{t:h}=A.useLocale(),[f,g]=Se.useControllableState({value:o,defaultValue:i,onChange:a});if(s.length===0)return null;const c=f?s:s.slice(0,r),m=s.length-r;return l.jsxs("div",{ref:u,className:j.cn("flex flex-wrap items-center gap-2",e),...d,children:[l.jsx("span",{className:"text-sm text-muted-foreground",children:h("filter.activeFilters")}),c.map(p=>l.jsxs(L.Badge,{variant:"secondary",className:"gap-1 pr-1",children:[p.category&&l.jsxs("span",{className:"text-muted-foreground",children:[p.category,":"]}),l.jsx("span",{children:p.label}),l.jsx("button",{onClick:()=>t(p.id),className:"ml-1 rounded-full p-0.5 hover:bg-muted-foreground/20",children:l.jsx(ue.X,{className:"h-3 w-3"})})]},p.id)),!f&&m>0&&l.jsx(P.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>g(!0),children:h("filter.more",{count:m})}),f&&m>0&&l.jsx(P.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>g(!1),children:h("filter.showLess")}),n&&s.length>1&&l.jsxs(P.Button,{variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs text-muted-foreground",onClick:n,children:[l.jsx(ue.X,{className:"h-3 w-3"}),h("common.clearAll")]})]})});Wt.displayName="FilterTags";function er({fields:e,value:s,onChange:t,className:n}){const{t:r}=A.useLocale(),[o,i]=C.useState(!1),a=e.find(d=>d.id===s);return l.jsxs(te.Popover,{open:o,onOpenChange:i,children:[l.jsx(te.PopoverTrigger,{asChild:!0,children:l.jsxs(P.Button,{variant:"outline",role:"combobox","aria-expanded":o,className:j.cn("w-[180px] justify-between font-normal",n),size:"sm",children:[l.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[a==null?void 0:a.icon,(a==null?void 0:a.label)??r("filter.selectField")]}),l.jsx(ge.ChevronsUpDown,{className:"ml-1 h-3 w-3 shrink-0 opacity-50"})]})}),l.jsx(te.PopoverContent,{className:"w-[220px] p-0",align:"start",children:l.jsxs(ce.Command,{children:[l.jsx(ce.CommandInput,{placeholder:r("filter.searchFields")}),l.jsxs(ce.CommandList,{children:[l.jsx(ce.CommandEmpty,{children:r("filter.noFieldFound")}),l.jsx(ce.CommandGroup,{children:e.map(d=>l.jsxs(ce.CommandItem,{value:d.id,onSelect:()=>{t(d.id),i(!1)},children:[l.jsx(L.Check,{className:j.cn("mr-2 h-4 w-4",s===d.id?"opacity-100":"opacity-0")}),l.jsxs("span",{className:"flex items-center gap-1.5",children:[d.icon,d.label]})]},d.id))})]})]})})]})}const Xe={text:[{operator:"contains",label:"Contains",labelKey:"filter.operator.contains"},{operator:"not_contains",label:"Does not contain",labelKey:"filter.operator.notContains"},{operator:"equals",label:"Equals",labelKey:"filter.operator.equals"},{operator:"not_equals",label:"Does not equal",labelKey:"filter.operator.notEquals"},{operator:"starts_with",label:"Starts with",labelKey:"filter.operator.startsWith"},{operator:"ends_with",label:"Ends with",labelKey:"filter.operator.endsWith"},{operator:"is_empty",label:"Is empty",labelKey:"filter.operator.isEmpty"},{operator:"is_not_empty",label:"Is not empty",labelKey:"filter.operator.isNotEmpty"}],number:[{operator:"equals",label:"Equals",labelKey:"filter.operator.equals"},{operator:"not_equals",label:"Does not equal",labelKey:"filter.operator.notEquals"},{operator:"gt",label:"Greater than",labelKey:"filter.operator.greaterThan"},{operator:"gte",label:"Greater than or equal",labelKey:"filter.operator.greaterThanOrEqual"},{operator:"lt",label:"Less than",labelKey:"filter.operator.lessThan"},{operator:"lte",label:"Less than or equal",labelKey:"filter.operator.lessThanOrEqual"},{operator:"between",label:"Between",labelKey:"filter.operator.between"},{operator:"is_empty",label:"Is empty",labelKey:"filter.operator.isEmpty"},{operator:"is_not_empty",label:"Is not empty",labelKey:"filter.operator.isNotEmpty"}],date:[{operator:"date_equals",label:"Is",labelKey:"filter.operator.is"},{operator:"before",label:"Before",labelKey:"filter.operator.before"},{operator:"after",label:"After",labelKey:"filter.operator.after"},{operator:"date_between",label:"Between",labelKey:"filter.operator.between"},{operator:"is_empty",label:"Is empty",labelKey:"filter.operator.isEmpty"},{operator:"is_not_empty",label:"Is not empty",labelKey:"filter.operator.isNotEmpty"}],boolean:[{operator:"is_true",label:"Is true",labelKey:"filter.operator.isTrue"},{operator:"is_false",label:"Is false",labelKey:"filter.operator.isFalse"}],select:[{operator:"equals",label:"Is",labelKey:"filter.operator.is"},{operator:"not_equals",label:"Is not",labelKey:"filter.operator.isNot"},{operator:"is_empty",label:"Is empty",labelKey:"filter.operator.isEmpty"},{operator:"is_not_empty",label:"Is not empty",labelKey:"filter.operator.isNotEmpty"}],"multi-select":[{operator:"in",label:"Includes any of",labelKey:"filter.operator.includesAny"},{operator:"not_in",label:"Does not include",labelKey:"filter.operator.doesNotInclude"},{operator:"is_empty",label:"Is empty",labelKey:"filter.operator.isEmpty"},{operator:"is_not_empty",label:"Is not empty",labelKey:"filter.operator.isNotEmpty"}]},Xt=["is_empty","is_not_empty","is_true","is_false"];function tr({fieldType:e,value:s,onChange:t,renderOperatorLabel:n,className:r}){const{t:o}=A.useLocale(),i=Xe[e]??Xe.text;return C.useEffect(()=>{i.some(a=>a.operator===s)||t(i[0].operator)},[e,i,s,t]),l.jsxs(V.Select,{value:s,onValueChange:a=>t(a),children:[l.jsx(V.SelectTrigger,{size:"sm",className:j.cn("w-[160px]",r),children:l.jsx(V.SelectValue,{})}),l.jsx(V.SelectContent,{children:i.map(a=>l.jsx(V.SelectItem,{value:a.operator,children:n?n(a):o(a.labelKey)===a.labelKey?a.label:o(a.labelKey)},a.operator))})]})}function nr({field:e,operator:s,value:t,valueTo:n,onChange:r}){var a,d;const{t:o}=A.useLocale();if(Xt.includes(s))return null;const i=s==="between"||s==="date_between";switch(e.type){case"text":return l.jsx(U.Input,{value:String(t??""),onChange:u=>r(u.target.value),placeholder:o("filter.value"),className:"h-8 w-[160px]"});case"number":return i?l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(U.Input,{type:"number",value:t!=null?String(t):"",onChange:u=>r(u.target.value?Number(u.target.value):void 0,n),placeholder:o("filter.from"),className:"h-8 w-[100px]"}),l.jsx("span",{className:"text-xs text-muted-foreground",children:o("filter.to").toLowerCase()}),l.jsx(U.Input,{type:"number",value:n!=null?String(n):"",onChange:u=>r(t,u.target.value?Number(u.target.value):void 0),placeholder:o("filter.to"),className:"h-8 w-[100px]"})]}):l.jsx(U.Input,{type:"number",value:t!=null?String(t):"",onChange:u=>r(u.target.value?Number(u.target.value):void 0),placeholder:o("filter.value"),className:"h-8 w-[160px]"});case"date":return i?l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(ge.DatePicker,{value:t instanceof Date?t:t?new Date(t):void 0,onChange:u=>r(u,n),className:"h-8 w-[140px] text-xs"}),l.jsx("span",{className:"text-xs text-muted-foreground",children:o("filter.to").toLowerCase()}),l.jsx(ge.DatePicker,{value:n instanceof Date?n:n?new Date(n):void 0,onChange:u=>r(t,u),className:"h-8 w-[140px] text-xs"})]}):l.jsx(ge.DatePicker,{value:t instanceof Date?t:t?new Date(t):void 0,onChange:u=>r(u),className:"h-8 w-[160px] text-xs"});case"select":return l.jsxs(V.Select,{value:String(t??""),onValueChange:u=>r(u),children:[l.jsx(V.SelectTrigger,{size:"sm",className:"w-[160px]",children:l.jsx(V.SelectValue,{placeholder:o("filter.select")})}),l.jsx(V.SelectContent,{children:(a=e.options)==null?void 0:a.map(u=>l.jsx(V.SelectItem,{value:u.value,children:u.label},u.value))})]});case"multi-select":return l.jsx(ge.MultiSelect,{options:((d=e.options)==null?void 0:d.map(u=>({value:u.value,label:u.label})))??[],value:Array.isArray(t)?t:[],onChange:u=>r(u),placeholder:o("filter.select"),className:"h-8 w-[200px]"});case"boolean":return null;default:return l.jsx(U.Input,{value:String(t??""),onChange:u=>r(u.target.value),placeholder:o("filter.value"),className:"h-8 w-[160px]"})}}function sr({rule:e,fields:s,onUpdate:t,onRemove:n,showRemove:r=!0,className:o}){const i=s.find(d=>d.id===e.fieldId),a=d=>{s.find(h=>h.id===d)&&t({fieldId:d,operator:"contains",value:"",valueTo:void 0})};return l.jsxs("div",{className:j.cn("flex items-center gap-2 flex-wrap",o),children:[l.jsx(er,{fields:s,value:e.fieldId,onChange:a}),i&&l.jsxs(l.Fragment,{children:[l.jsx(tr,{fieldType:i.type,value:e.operator,onChange:d=>t({operator:d})}),l.jsx(nr,{field:i,operator:e.operator,value:e.value,valueTo:e.valueTo,onChange:(d,u)=>t({value:d,valueTo:u})})]}),r&&l.jsx(P.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 text-muted-foreground hover:text-destructive",onClick:n,children:l.jsx(ue.X,{className:"h-3.5 w-3.5"})})]})}function Yt({group:e,fields:s,depth:t,maxDepth:n,onAddRule:r,onUpdateRule:o,onRemoveRule:i,onAddGroup:a,onRemoveGroup:d,onSetGroupLogic:u,showRemove:h=!1,onRemove:f,className:g}){const{t:c}=A.useLocale(),m=["border-l-primary","border-l-blue-500","border-l-orange-500"],p=m[t%m.length];return l.jsxs("div",{className:j.cn("rounded-lg border border-l-2 bg-background p-3 space-y-2",p,g),children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:c("filter.match")}),l.jsx("button",{type:"button",onClick:()=>u(e.id,e.logic==="and"?"or":"and"),className:"focus:outline-none",children:l.jsx(L.Badge,{variant:e.logic==="and"?"default":"secondary",className:"cursor-pointer select-none uppercase text-[10px] px-2 py-0",children:e.logic==="and"?c("filter.and"):c("filter.or")})}),l.jsx("span",{className:"text-xs text-muted-foreground",children:c("filter.ofFollowing")})]}),h&&f&&l.jsx(P.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive",onClick:f,children:l.jsx(wt.Trash2,{className:"h-3 w-3"})})]}),l.jsx("div",{className:"space-y-2",children:e.rules.map(x=>l.jsx(sr,{rule:x,fields:s,onUpdate:v=>o(e.id,x.id,v),onRemove:()=>i(e.id,x.id),showRemove:e.rules.length>1||e.groups.length>0},x.id))}),e.groups.length>0&&l.jsx("div",{className:"space-y-2 pl-2",children:e.groups.map(x=>l.jsx(Yt,{group:x,fields:s,depth:t+1,maxDepth:n,onAddRule:r,onUpdateRule:o,onRemoveRule:i,onAddGroup:a,onRemoveGroup:d,onSetGroupLogic:u,showRemove:!0,onRemove:()=>d(e.id,x.id)},x.id))}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs(P.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>r(e.id),children:[l.jsx(rt.Plus,{className:"mr-1 h-3 w-3"}),c("filter.addRule")]}),t<n&&l.jsxs(P.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>a(e.id,t),children:[l.jsx(rt.Plus,{className:"mr-1 h-3 w-3"}),c("filter.addGroup")]})]})]})}function rr({presets:e,onLoad:s,onSave:t,onDelete:n,className:r}){const{t:o}=A.useLocale(),[i,a]=C.useState(!1),[d,u]=C.useState(""),h=()=>{d.trim()&&(t(d.trim()),u(""),a(!1))};return l.jsxs("div",{className:j.cn("flex items-center gap-1",r),children:[e.length>0&&l.jsxs(D.DropdownMenu,{children:[l.jsx(D.DropdownMenuTrigger,{asChild:!0,children:l.jsxs(P.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1",children:[l.jsx(_n,{className:"h-3 w-3"}),o("filter.presets")]})}),l.jsxs(D.DropdownMenuContent,{align:"start",children:[l.jsx(D.DropdownMenuLabel,{className:"text-xs",children:o("filter.savedFilters")}),l.jsx(D.DropdownMenuSeparator,{}),e.map(f=>l.jsxs(D.DropdownMenuItem,{className:"flex items-center justify-between gap-4",children:[l.jsx("span",{className:"flex-1 cursor-pointer",onClick:()=>s(f.id),children:f.name}),l.jsx("button",{className:"text-muted-foreground hover:text-destructive",onClick:g=>{g.stopPropagation(),n(f.id)},children:l.jsx(wt.Trash2,{className:"h-3 w-3"})})]},f.id))]})]}),l.jsxs(te.Popover,{open:i,onOpenChange:a,children:[l.jsx(te.PopoverTrigger,{asChild:!0,children:l.jsxs(P.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1",children:[l.jsx(Vn,{className:"h-3 w-3"}),o("filter.save")]})}),l.jsx(te.PopoverContent,{className:"w-[240px] p-3",align:"start",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-xs font-medium",children:o("filter.savePreset")}),l.jsx(U.Input,{value:d,onChange:f=>u(f.target.value),placeholder:o("filter.presetName"),className:"h-8",onKeyDown:f=>{f.key==="Enter"&&h()}}),l.jsx(P.Button,{size:"sm",className:"w-full h-7 text-xs",onClick:h,disabled:!d.trim(),children:o("filter.save")})]})})]})]})}let lr=0;function tt(){return`filter_${Date.now()}_${++lr}`}function nt(e){return{id:tt(),fieldId:e??"",operator:"contains",value:""}}function Fe(e="and"){return{id:tt(),logic:e,rules:[nt()],groups:[]}}function Jt({value:e,defaultValue:s,onChange:t,maxDepth:n=3,presets:r,onPresetsChange:o}){const[i,a]=C.useState(s??Fe()),[d,u]=C.useState([]),h=e??i,f=r??d,g=C.useCallback(y=>{const I=typeof y=="function"?y(h):y;e||a(I),t==null||t(I)},[h,e,t]),c=C.useCallback((y,I)=>{const k=b=>b.id===y?I(b):{...b,groups:b.groups.map(k)};g(b=>k(b))},[g]),m=C.useCallback(y=>{c(y,I=>({...I,rules:[...I.rules,nt()]}))},[c]),p=C.useCallback((y,I,k)=>{c(y,b=>({...b,rules:b.rules.map(q=>q.id===I?{...q,...k}:q)}))},[c]),x=C.useCallback((y,I)=>{c(y,k=>({...k,rules:k.rules.filter(b=>b.id!==I)}))},[c]),v=C.useCallback((y,I)=>{I>=n||c(y,k=>({...k,groups:[...k.groups,Fe(k.logic==="and"?"or":"and")]}))},[c,n]),w=C.useCallback((y,I)=>{c(y,k=>({...k,groups:k.groups.filter(b=>b.id!==I)}))},[c]),M=C.useCallback((y,I)=>{c(y,k=>({...k,logic:I}))},[c]),$=C.useCallback(()=>{g(Fe())},[g]),O=C.useCallback(y=>{const I={id:tt(),name:y,filter:JSON.parse(JSON.stringify(h))},k=[...f,I];return r||u(k),o==null||o(k),I},[h,f,r,o]),F=C.useCallback(y=>{const I=f.find(k=>k.id===y);I&&g(JSON.parse(JSON.stringify(I.filter)))},[f,g]),E=C.useCallback(y=>{const I=f.filter(k=>k.id!==y);r||u(I),o==null||o(I)},[f,r,o]),G=C.useMemo(()=>{const y=I=>I.rules.filter(k=>k.fieldId).length+I.groups.reduce((k,b)=>k+y(b),0);return y(h)},[h]);return{filter:h,setFilter:g,addRule:m,updateRule:p,removeRule:x,addGroup:v,removeGroup:w,setGroupLogic:M,clearAll:$,presets:f,savePreset:O,loadPreset:F,deletePreset:E,ruleCount:G,maxDepth:n}}function Qt({fields:e,compact:s=!1,expanded:t,defaultExpanded:n,onExpandedChange:r,label:o,className:i,...a}){const{t:d}=A.useLocale(),u=o??d("filter.filters"),{filter:h,addRule:f,updateRule:g,removeRule:c,addGroup:m,removeGroup:p,setGroupLogic:x,clearAll:v,presets:w,savePreset:M,loadPreset:$,deletePreset:O,ruleCount:F,maxDepth:E}=Jt(a),[G,y]=Se.useControllableState({value:t,defaultValue:n??!s,onChange:r}),I=l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Be.Filter,{className:"h-4 w-4 text-muted-foreground"}),l.jsx("span",{className:"text-sm font-medium",children:d("filter.filterRules")}),F>0&&l.jsx(L.Badge,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:F})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(rr,{presets:w,onLoad:$,onSave:M,onDelete:O}),F>0&&l.jsxs(P.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground",onClick:v,children:[l.jsx(Dn,{className:"mr-1 h-3 w-3"}),d("filter.clear")]})]})]}),l.jsx(Yt,{group:h,fields:e,depth:0,maxDepth:E,onAddRule:f,onUpdateRule:g,onRemoveRule:c,onAddGroup:m,onRemoveGroup:p,onSetGroupLogic:x})]});return s?l.jsxs("div",{className:j.cn("rounded-lg border bg-background",i),children:[l.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-3 py-2 text-sm hover:bg-muted/50 transition-colors",onClick:()=>y(!G),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Be.Filter,{className:"h-4 w-4 text-muted-foreground"}),l.jsx("span",{className:"font-medium",children:u}),F>0&&l.jsxs(L.Badge,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:[F," ",d("filter.active")]})]}),G?l.jsx(wn.ChevronUp,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(U.ChevronDown,{className:"h-4 w-4 text-muted-foreground"})]}),G&&l.jsx("div",{className:"border-t px-3 py-3",children:I})]}):l.jsx("div",{className:j.cn("space-y-3",i),children:I})}Qt.displayName="QueryFilterBuilder";const Zt={closed:{label:"Closed Won",color:"text-emerald-700",bgColor:"bg-emerald-50",borderColor:"border-emerald-200"},commit:{label:"Commit",color:"text-blue-700",bgColor:"bg-blue-50",borderColor:"border-blue-200"},bestCase:{label:"Best Case",color:"text-amber-700",bgColor:"bg-amber-50",borderColor:"border-amber-200"},pipeline:{label:"Pipeline",color:"text-muted-foreground",bgColor:"bg-muted",borderColor:"border-border"}};function or(e,s="USD",t="en-US"){return new Intl.NumberFormat(t,{style:"currency",currency:s,notation:e>=1e6?"compact":"standard",maximumFractionDigits:e>=1e6?1:0}).format(e)}function ir(e,s){if(s===0)return{value:0,direction:"neutral"};const t=(e-s)/s*100;return{value:Math.abs(Math.round(t)),direction:t>0?"up":t<0?"down":"neutral"}}function en({bucket:e,currency:s,locale:t,onClick:n,className:r}){const o=Zt[e.category],{t:i}=A.useLocale(),a=e.previousValue!=null?ir(e.value,e.previousValue):void 0,d=e.target&&e.target>0?Math.round(e.value/e.target*100):void 0;return l.jsxs("button",{type:"button",onClick:n,disabled:!n,className:j.cn("flex flex-col rounded-lg border p-4 text-left transition-all duration-200",o.bgColor,o.borderColor,n&&"cursor-pointer hover:shadow-md active:scale-[0.99]",!n&&"cursor-default",r),children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:j.cn("text-xs font-semibold uppercase tracking-wider",o.color),children:e.label||o.label}),l.jsx("span",{className:"text-[10px] text-muted-foreground",children:i("forecast.deals",{count:e.dealCount})})]}),l.jsx("div",{className:"mt-2 text-2xl font-bold tracking-tight",children:or(e.value,s,t)}),l.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[a&&a.direction!=="neutral"&&l.jsxs("span",{className:j.cn("flex items-center gap-0.5 text-xs font-medium",a.direction==="up"?"text-emerald-600":"text-red-600"),children:[a.direction==="up"?l.jsx(vt.TrendingUp,{className:"h-3 w-3"}):l.jsx(St,{className:"h-3 w-3"}),a.value,"%"]}),d!=null&&l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[d,i("forecast.ofTarget")]})]}),e.trend&&e.trend.length>1&&l.jsx("div",{className:"mt-3",children:l.jsx(Cn.SparklineChart,{data:e.trend,height:32,width:"100%",color:e.category==="closed"?"hsl(var(--chart-2))":e.category==="commit"?"hsl(var(--chart-1))":e.category==="bestCase"?"hsl(var(--chart-3))":"hsl(var(--chart-4))"})})]})}function ve(e,s="USD",t="en-US"){return new Intl.NumberFormat(t,{style:"currency",currency:s,notation:e>=1e6?"compact":"standard",maximumFractionDigits:e>=1e6?1:0}).format(e)}function tn({buckets:e,target:s,currency:t,locale:n,periodLabel:r,className:o}){var c;const{t:i}=A.useLocale(),a=e.reduce((m,p)=>m+p.value,0),d=e.reduce((m,p)=>m+p.dealCount,0),u=((c=e.find(m=>m.category==="closed"))==null?void 0:c.value)??0,h=a-u,f=s&&s>0?Math.min(Math.round(a/s*100),100):void 0,g=s&&s>0?Math.min(Math.round(u/s*100),100):void 0;return l.jsx("div",{className:j.cn("rounded-lg border bg-card p-4",o),children:l.jsx("div",{className:"flex items-center justify-between gap-4",children:l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[r&&l.jsx("span",{className:"text-sm font-semibold",children:r}),l.jsx("span",{className:"text-xs text-muted-foreground",children:i("forecast.totalDeals",{count:d})})]}),s!=null&&l.jsxs("div",{className:"mt-2 space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between text-xs",children:[l.jsxs("span",{className:"text-muted-foreground",children:[i("forecast.total")," ",ve(a,t,n)]}),l.jsxs("span",{className:"flex items-center gap-1 font-medium",children:[l.jsx(On,{className:"h-3 w-3"}),ve(s,t,n)]})]}),l.jsx(he.Progress,{value:f??0,className:"h-2"}),l.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[l.jsxs("span",{children:[i("forecast.closed")," ",ve(u,t,n)," (",g??0,"%)"]}),l.jsxs("span",{children:[i("forecast.openPipeline")," ",ve(h,t,n)]})]})]}),s==null&&l.jsx("div",{className:"mt-1 text-lg font-bold",children:ve(a,t,n)})]})})})}function ar(){return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ie.Skeleton,{className:"h-5 w-32"}),l.jsx(ie.Skeleton,{className:"h-8 w-40"})]}),l.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:Array.from({length:4}).map((e,s)=>l.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[l.jsx(ie.Skeleton,{className:"h-3 w-20"}),l.jsx(ie.Skeleton,{className:"h-7 w-28"}),l.jsx(ie.Skeleton,{className:"h-3 w-16"}),l.jsx(ie.Skeleton,{className:"h-8 w-full"})]},s))}),l.jsx(ie.Skeleton,{className:"h-20 w-full rounded-lg"})]})}function ur(e){return e.split(" ").map(s=>s[0]).join("").toUpperCase().slice(0,2)}function nn({buckets:e,target:s,currency:t,locale:n,periodLabel:r,owners:o,selectedOwnerId:i,onOwnerChange:a,onBucketClick:d,loading:u,className:h}){const{t:f}=A.useLocale();return u?l.jsx(ar,{}):l.jsxs("div",{className:j.cn("space-y-4",h),children:[(r||o&&o.length>0)&&l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r&&l.jsxs("h3",{className:"text-sm font-semibold",children:[r," ",f("forecast.forecast")]}),o&&o.length>0&&a&&l.jsxs(V.Select,{value:i??"all",onValueChange:g=>a(g==="all"?void 0:g),children:[l.jsx(V.SelectTrigger,{className:"h-8 w-[200px] text-xs",children:l.jsx(V.SelectValue,{placeholder:f("forecast.allOwners")})}),l.jsxs(V.SelectContent,{children:[l.jsx(V.SelectItem,{value:"all",children:f("forecast.allOwners")}),o.map(g=>l.jsx(V.SelectItem,{value:g.id,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(ne.Avatar,{className:"h-4 w-4",children:[l.jsx(ne.AvatarImage,{src:g.avatar,alt:g.name}),l.jsx(ne.AvatarFallback,{className:"text-[7px]",children:ur(g.name)})]}),g.name]})},g.id))]})]})]}),l.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:e.map(g=>l.jsx(en,{bucket:g,currency:t,locale:n,onClick:d?()=>d(g.category):void 0},g.category))}),l.jsx(tn,{buckets:e,target:s,currency:t,locale:n,periodLabel:r})]})}nn.displayName="ForecastBoard";function sn({sourceColumns:e,targetFields:s,mappings:t,onMappingsChange:n,previewData:r,className:o}){const i=(c,m)=>{const p=t.map(x=>x.sourceColumn===c?{...x,targetField:m}:x);t.find(x=>x.sourceColumn===c)||p.push({sourceColumn:c,targetField:m,preview:r==null?void 0:r.slice(0,3).map(x=>String(x[c]??""))}),n(p)},a=c=>{var m;return((m=t.find(p=>p.sourceColumn===c))==null?void 0:m.targetField)??null},d=new Set(t.map(c=>c.targetField).filter(Boolean)),{t:u}=A.useLocale(),h=t.filter(c=>c.targetField).length,g=s.filter(c=>c.required).filter(c=>!t.some(m=>m.targetField===c.id));return l.jsxs("div",{className:j.cn("space-y-4",o),children:[l.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[l.jsx(L.Badge,{variant:"secondary",children:u("bulkOps.mapped",{mapped:h,total:e.length})}),g.length>0&&l.jsx(L.Badge,{variant:"destructive",children:u("bulkOps.requiredUnmapped",{count:g.length})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"grid grid-cols-[1fr_32px_1fr] gap-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground px-1",children:[l.jsx("span",{children:u("bulkOps.sourceColumn")}),l.jsx("span",{}),l.jsx("span",{children:u("bulkOps.targetField")})]}),e.map(c=>{const m=a(c),p=r==null?void 0:r.slice(0,2).map(x=>String(x[c]??""));return l.jsxs("div",{className:"grid grid-cols-[1fr_32px_1fr] items-center gap-2 rounded-lg border bg-card p-2.5",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:c}),p&&p.length>0&&l.jsx("p",{className:"mt-0.5 truncate text-[10px] text-muted-foreground",children:p.join(", ")})]}),l.jsx("div",{className:"flex justify-center",children:l.jsx(Ct.ArrowRight,{className:"h-4 w-4 text-muted-foreground/50"})}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsxs(V.Select,{value:m??"__none__",onValueChange:x=>i(c,x==="__none__"?null:x),children:[l.jsx(V.SelectTrigger,{className:"h-8 text-xs",children:l.jsx(V.SelectValue,{placeholder:u("bulkOps.skipColumn")})}),l.jsxs(V.SelectContent,{children:[l.jsx(V.SelectItem,{value:"__none__",children:l.jsx("span",{className:"text-muted-foreground",children:u("bulkOps.skip")})}),s.map(x=>l.jsxs(V.SelectItem,{value:x.id,disabled:d.has(x.id)&&m!==x.id,children:[x.label,x.required&&l.jsx("span",{className:"ml-1 text-destructive",children:"*"})]},x.id))]})]}),m&&l.jsx(P.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>i(c,null),children:l.jsx(ue.X,{className:"h-3 w-3"})})]})]},c)})]})]})}const ht={error:{icon:l.jsx(he.CircleAlert,{className:"h-3 w-3"}),color:"text-destructive"},warning:{icon:l.jsx(he.TriangleAlert,{className:"h-3 w-3"}),color:"text-amber-600"},info:{icon:l.jsx(he.Info,{className:"h-3 w-3"}),color:"text-blue-600"}};function rn({rows:e,fields:s,mappings:t,onFixValue:n,onToggleSkip:r,showOnlyIssues:o,onShowOnlyIssuesChange:i,className:a}){const d=t.filter(f=>f.targetField).map(f=>{const g=s.find(c=>c.id===f.targetField);return{sourceColumn:f.sourceColumn,field:g}}).filter(f=>f.field),{t:u}=A.useLocale(),h=o?e.filter(f=>f._issues.length>0):e;return l.jsxs("div",{className:j.cn("space-y-3",a),children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[l.jsx(L.Badge,{variant:"secondary",children:u("bulkOps.rows",{count:e.length})}),l.jsx(L.Badge,{variant:"outline",className:"text-destructive border-destructive/30",children:u("bulkOps.errors",{count:e.filter(f=>f._status==="error").length})}),l.jsx(L.Badge,{variant:"outline",className:"text-amber-600 border-amber-300",children:u("bulkOps.warnings",{count:e.filter(f=>f._status==="warning").length})})]}),i&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Sn.Switch,{checked:o,onCheckedChange:i,id:"show-issues"}),l.jsx(jn.Label,{htmlFor:"show-issues",className:"text-xs",children:u("bulkOps.showOnlyIssues")})]})]}),l.jsx(H.ScrollArea,{className:"rounded-lg border",children:l.jsx(X.TooltipProvider,{children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{className:"sticky top-0 z-10 bg-muted/50",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-3 py-2 text-left text-[10px] font-semibold uppercase tracking-wider text-muted-foreground w-12",children:"#"}),l.jsx("th",{className:"px-3 py-2 text-left text-[10px] font-semibold uppercase tracking-wider text-muted-foreground w-16",children:u("bulkOps.status")}),d.map(({field:f})=>l.jsxs("th",{className:"px-3 py-2 text-left text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[f.label,f.required&&l.jsx("span",{className:"ml-0.5 text-destructive",children:"*"})]},f.id)),r&&l.jsx("th",{className:"px-3 py-2 text-center text-[10px] font-semibold uppercase tracking-wider text-muted-foreground w-16",children:u("bulkOps.skip")})]})}),l.jsx("tbody",{children:h.map(f=>{const g=new Map(f._issues.map(c=>[c.column,c]));return l.jsxs("tr",{className:j.cn("border-t transition-colors",f._status==="skipped"&&"opacity-40",f._status==="error"&&"bg-destructive/5",f._status==="warning"&&"bg-amber-50/50"),children:[l.jsx("td",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:f._rowIndex+1}),l.jsxs("td",{className:"px-3 py-1.5",children:[f._status==="valid"&&l.jsx(L.Badge,{variant:"secondary",className:"text-[9px] px-1.5 py-0",children:u("bulkOps.ok")}),f._status==="error"&&l.jsx(L.Badge,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:u("bulkOps.error")}),f._status==="warning"&&l.jsx(L.Badge,{variant:"outline",className:"text-[9px] px-1.5 py-0 text-amber-600 border-amber-300",children:u("bulkOps.warn")}),f._status==="skipped"&&l.jsx(L.Badge,{variant:"outline",className:"text-[9px] px-1.5 py-0",children:u("bulkOps.skip")})]}),d.map(({field:c})=>{const m=g.get(c.id),p=f[c.id];return l.jsx("td",{className:"px-3 py-1.5",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:j.cn("truncate text-xs",(m==null?void 0:m.severity)==="error"&&"text-destructive font-medium",(m==null?void 0:m.severity)==="warning"&&"text-amber-600"),children:p!=null?String(p):l.jsx("span",{className:"text-muted-foreground",children:"—"})}),m&&l.jsxs(X.Tooltip,{children:[l.jsx(X.TooltipTrigger,{asChild:!0,children:l.jsx("span",{className:j.cn("shrink-0",ht[m.severity].color),children:ht[m.severity].icon})}),l.jsxs(X.TooltipContent,{side:"top",className:"max-w-[200px]",children:[l.jsx("p",{className:"text-xs",children:m.message}),m.suggestedValue!=null&&n&&l.jsx(P.Button,{size:"sm",variant:"outline",className:"mt-1 h-5 text-[10px]",onClick:()=>n(f._rowIndex,c.id,m.suggestedValue),children:u("bulkOps.fix",{value:String(m.suggestedValue)})})]})]})]})},c.id)}),r&&l.jsx("td",{className:"px-3 py-1.5 text-center",children:l.jsx(P.Button,{variant:"ghost",size:"icon",className:j.cn("h-6 w-6",f._status==="skipped"&&"text-muted-foreground"),onClick:()=>r(f._rowIndex),children:l.jsx($n,{className:"h-3 w-3"})})})]},f._rowIndex)})})]})})})]})}const ft=["upload","map","validate","confirm"];function ln({step:e,sourceColumns:s=[],targetFields:t,mappings:n=[],onMappingsChange:r,previewData:o,validatedRows:i=[],onFixValue:a,onToggleSkip:d,onNext:u,onBack:h,onFileUpload:f,onConfirm:g,progress:c,summary:m,stepLabels:p,summaryLabels:x,renderConfirmSummary:v,showOnlyIssues:w,defaultShowOnlyIssues:M=!1,onShowOnlyIssuesChange:$,className:O}){const F=ee.useRef(null),[E,G]=Se.useControllableState({value:w,defaultValue:M,onChange:$}),{t:y}=A.useLocale(),I={upload:(p==null?void 0:p.upload)??y("bulkOps.upload"),map:(p==null?void 0:p.map)??y("bulkOps.mapFields"),validate:(p==null?void 0:p.validate)??y("bulkOps.validate"),confirm:(p==null?void 0:p.confirm)??y("bulkOps.import")},k={valid:(x==null?void 0:x.valid)??"valid",warnings:(x==null?void 0:x.warnings)??"warnings",skipped:(x==null?void 0:x.skipped)??"skipped"},b=ft.findIndex(S=>S===e),q=S=>{S.preventDefault();const _=S.dataTransfer.files[0];_&&(f==null||f(_))},Q=S=>{var se;const _=(se=S.target.files)==null?void 0:se[0];_&&(f==null||f(_))};return l.jsxs("div",{className:j.cn("space-y-6",O),children:[l.jsx("div",{className:"flex items-center gap-2",children:ft.map((S,_)=>l.jsxs("div",{className:"flex items-center gap-2",children:[_>0&&l.jsx("div",{className:"h-px w-8 bg-border"}),l.jsxs("div",{className:j.cn("flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-medium transition-colors",_===b&&"bg-primary text-primary-foreground",_<b&&"bg-primary/10 text-primary",_>b&&"bg-muted text-muted-foreground"),children:[l.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full text-[10px]",children:_<b?l.jsx(L.Check,{className:"h-3 w-3"}):_+1}),I[S]]})]},S))}),l.jsxs("div",{className:"min-h-[300px]",children:[e==="upload"&&l.jsxs("div",{onDragOver:S=>S.preventDefault(),onDrop:q,className:"flex min-h-[300px] flex-col items-center justify-center rounded-lg border-2 border-dashed bg-muted/30 p-8 text-center transition-colors hover:border-primary/30 hover:bg-muted/50",children:[l.jsx(yn.Upload,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),l.jsx("p",{className:"text-sm font-medium",children:y("bulkOps.dropFile")}),l.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:y("bulkOps.supportedFormats")}),l.jsx("input",{ref:F,type:"file",accept:".csv,.xlsx,.xls,.json",className:"hidden",onChange:Q}),l.jsxs(P.Button,{variant:"outline",size:"sm",className:"mt-4",onClick:()=>{var S;return(S=F.current)==null?void 0:S.click()},children:[l.jsx(lt.FileSpreadsheet,{className:"mr-1.5 h-3.5 w-3.5"}),y("bulkOps.browseFiles")]})]}),e==="map"&&r&&l.jsx(sn,{sourceColumns:s,targetFields:t,mappings:n,onMappingsChange:r,previewData:o}),e==="validate"&&l.jsx(rn,{rows:i,fields:t,mappings:n,onFixValue:a,onToggleSkip:d,showOnlyIssues:E,onShowOnlyIssuesChange:G}),e==="confirm"&&l.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:c!=null&&c<100?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-sm font-medium",children:y("bulkOps.importing")}),l.jsx(he.Progress,{value:c,className:"mt-4 h-2 w-[300px]"}),l.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:[c,y("bulkOps.complete")]})]}):c===100?l.jsxs(l.Fragment,{children:[l.jsx(L.Check,{className:"mb-3 h-10 w-10 text-emerald-600"}),l.jsx("p",{className:"text-sm font-medium",children:y("bulkOps.importComplete")})]}):m?v?v(m):l.jsxs(l.Fragment,{children:[l.jsx(lt.FileSpreadsheet,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),l.jsx("p",{className:"text-sm font-medium",children:y("bulkOps.readyToImport")}),l.jsxs("div",{className:"mt-4 flex items-center gap-4 text-sm",children:[l.jsxs("span",{className:"text-emerald-600 font-medium",children:[m.valid," ",k.valid]}),m.warnings>0&&l.jsxs("span",{className:"text-amber-600",children:[m.warnings," ",k.warnings]}),m.errors>0&&l.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[l.jsx(he.CircleAlert,{className:"h-3 w-3"}),m.errors," ",y("bulkOps.errorsSkipped")]}),m.skipped>0&&l.jsxs("span",{className:"text-muted-foreground",children:[m.skipped," ",k.skipped]})]})]}):null})]}),l.jsxs("div",{className:"flex items-center justify-between border-t pt-4",children:[l.jsxs(P.Button,{variant:"outline",size:"sm",onClick:h,disabled:b===0,children:[l.jsx(Rn,{className:"mr-1.5 h-3.5 w-3.5"}),y("bulkOps.back")]}),e==="confirm"?l.jsx(P.Button,{size:"sm",onClick:g,disabled:c!=null&&c<100,children:y(c===100?"bulkOps.done":"bulkOps.startImport")}):l.jsxs(P.Button,{size:"sm",onClick:u,children:[y("bulkOps.next"),l.jsx(Ct.ArrowRight,{className:"ml-1.5 h-3.5 w-3.5"})]})]})]})}ln.displayName="BulkDataOps";function cr({records:e,conflicts:s,onResolveConflict:t,primaryRecordId:n,onPrimaryRecordChange:r,className:o}){const i=s.filter(d=>d.resolvedValue!==void 0).length,{t:a}=A.useLocale();return l.jsxs("div",{className:j.cn("space-y-4",o),children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(L.Badge,{variant:"secondary",children:a("bulkOps.recordsToMerge",{count:e.length})}),l.jsx(L.Badge,{variant:i===s.length?"default":"outline",children:a("bulkOps.conflictsResolved",{resolved:i,total:s.length})})]}),r&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"text-xs font-semibold text-muted-foreground",children:a("bulkOps.primaryRecord")}),l.jsx("div",{className:"flex items-center gap-2",children:e.map(d=>l.jsx(P.Button,{variant:n===d.id?"default":"outline",size:"sm",className:"text-xs",onClick:()=>r(d.id),children:d.label},d.id))})]}),l.jsx(H.ScrollArea,{className:"max-h-[400px]",children:l.jsx("div",{className:"space-y-3",children:s.map(d=>l.jsxs("div",{className:"rounded-lg border p-3",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[l.jsx("span",{className:"text-sm font-medium",children:d.fieldLabel}),d.resolvedValue!==void 0&&l.jsx(L.Check,{className:"h-4 w-4 text-emerald-600"})]}),l.jsx("div",{className:"space-y-1.5",children:d.values.map(({recordId:u,value:h})=>{const f=e.find(c=>c.id===u),g=d.resolvedValue!==void 0&&JSON.stringify(d.resolvedValue)===JSON.stringify(h);return l.jsxs("button",{type:"button",onClick:()=>t(d.fieldId,h),className:j.cn("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors",g?"bg-primary/10 border border-primary/30 text-primary":"border bg-card hover:bg-muted"),children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("p",{className:"truncate font-medium",children:h!=null?String(h):a("bulkOps.empty")}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("bulkOps.fromRecord",{label:(f==null?void 0:f.label)??u})})]}),g&&l.jsx(L.Check,{className:"h-3.5 w-3.5 shrink-0"})]},u)})})]},d.fieldId))})})]})}function dr(e){return e.split(" ").map(s=>s[0]).join("").toUpperCase().slice(0,2)}function on({task:e,depth:s,rowHeight:t,onToggleCollapse:n,onTaskClick:r}){const o=e.children&&e.children.length>0;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center border-b px-2 hover:bg-muted/50 transition-colors cursor-pointer",style:{height:t,paddingLeft:8+s*16},onClick:()=>r==null?void 0:r(e),children:[o?l.jsx("button",{type:"button",className:"mr-1 flex h-4 w-4 shrink-0 items-center justify-center rounded hover:bg-muted",onClick:i=>{i.stopPropagation(),n==null||n(e.id)},children:e.collapsed?l.jsx(bn.ChevronRight,{className:"h-3 w-3"}):l.jsx(U.ChevronDown,{className:"h-3 w-3"})}):l.jsx("span",{className:"mr-1 w-4 shrink-0"}),e.milestone&&l.jsx(kn,{className:"mr-1.5 h-3 w-3 shrink-0 text-amber-500"}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:e.name}),e.assignee&&l.jsxs(ne.Avatar,{className:"ml-1.5 h-5 w-5 shrink-0",children:[l.jsx(ne.AvatarImage,{src:e.assignee.avatar,alt:e.assignee.name}),l.jsx(ne.AvatarFallback,{className:"text-[7px]",children:dr(e.assignee.name)})]})]}),o&&!e.collapsed&&e.children.map(i=>l.jsx(on,{task:i,depth:s+1,rowHeight:t,onToggleCollapse:n,onTaskClick:r},i.id))]})}function an({tasks:e,rowHeight:s,width:t,onToggleCollapse:n,onTaskClick:r,className:o}){const{t:i}=A.useLocale();return l.jsxs("div",{className:j.cn("shrink-0 overflow-hidden border-r bg-background",o),style:{width:t},children:[l.jsx("div",{className:"flex items-center border-b bg-muted/30 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",style:{height:48},children:i("gantt.taskName")}),l.jsx("div",{className:"overflow-y-auto",children:e.map(a=>l.jsx(on,{task:a,depth:0,rowHeight:s,onToggleCollapse:n,onTaskClick:r},a.id))})]})}function gr({bar:e,rowHeight:s,onClick:t}){const{task:n,x:r,width:o,y:i}=e,a=n.milestone?12:s*.5,d=i+(s-a)/2;if(n.milestone){const g=r+6,c=d+6;return l.jsxs("g",{className:"cursor-pointer",onClick:t,children:[l.jsx("polygon",{points:`${g},${c-6} ${g+6},${c} ${g},${c+6} ${g-6},${c}`,fill:n.color??"hsl(var(--warning))",stroke:n.color??"hsl(var(--warning))",strokeWidth:1,opacity:.9}),l.jsx("title",{children:n.name})]})}const u=n.progress??0,h=o*u/100,f=4;return l.jsxs("g",{className:"cursor-pointer transition-opacity hover:opacity-80",onClick:t,children:[l.jsx("rect",{x:r,y:d,width:o,height:a,rx:f,fill:n.color??"hsl(var(--primary))",opacity:.2}),u>0&&l.jsx("rect",{x:r,y:d,width:Math.min(h,o),height:a,rx:f,fill:n.color??"hsl(var(--primary))",opacity:.7}),l.jsx("rect",{x:r,y:d,width:o,height:a,rx:f,fill:"none",stroke:n.color??"hsl(var(--primary))",strokeWidth:1,opacity:.5}),o>50&&l.jsx("text",{x:r+6,y:d+a/2,dominantBaseline:"central",fill:"currentColor",fontSize:10,fontWeight:500,className:"pointer-events-none",children:n.name}),l.jsxs("title",{children:[n.name," (",u,"%)"]})]})}function un({columns:e,barPositions:s,totalWidth:t,totalHeight:n,todayX:r,rowHeight:o,showTodayMarker:i,onTaskClick:a,className:d}){const u=ee.useRef(null);return l.jsxs("div",{ref:u,className:j.cn("flex-1 overflow-auto",d),children:[l.jsx("div",{className:"sticky top-0 z-10 flex border-b bg-muted/30",style:{width:t,height:48},children:e.map((h,f)=>l.jsxs("div",{className:j.cn("flex shrink-0 flex-col items-center justify-center border-r text-center",h.isWeekend&&"bg-muted/40",h.isToday&&"bg-primary/5"),style:{width:h.width},children:[l.jsx("span",{className:"text-[10px] font-semibold",children:h.label}),h.subLabel&&l.jsx("span",{className:"text-[9px] text-muted-foreground",children:h.subLabel})]},f))}),l.jsxs("div",{style:{width:t,position:"relative"},children:[l.jsxs("svg",{width:t,height:n,className:"absolute inset-0",children:[e.map((h,f)=>{const g=e.slice(0,f).reduce((c,m)=>c+m.width,0);return l.jsxs("g",{children:[l.jsx("line",{x1:g,y1:0,x2:g,y2:n,stroke:"hsl(var(--border))",strokeWidth:.5}),h.isWeekend&&l.jsx("rect",{x:g,y:0,width:h.width,height:n,fill:"hsl(var(--muted))",opacity:.3})]},f)}),s.map((h,f)=>l.jsx("line",{x1:0,y1:(f+1)*o,x2:t,y2:(f+1)*o,stroke:"hsl(var(--border))",strokeWidth:.5},`h-${f}`)),i&&l.jsx("line",{x1:r,y1:0,x2:r,y2:n,stroke:"hsl(var(--destructive))",strokeWidth:1.5,strokeDasharray:"4 2"}),s.map(h=>l.jsx(gr,{bar:h,rowHeight:o,onClick:()=>a==null?void 0:a(h.task)},h.task.id))]}),l.jsx("div",{style:{height:n}})]})]})}function Ne(e){return e instanceof Date?e:new Date(e)}function ae(e){const s=new Date(e);return s.setHours(0,0,0,0),s}function we(e,s){const t=new Date(e);return t.setDate(t.getDate()+s),t}function Le(e,s){return Math.round((e.getTime()-s.getTime())/864e5)}function mr(e){const s=e.getDay();return s===0||s===6}function hr(e,s){return e.getFullYear()===s.getFullYear()&&e.getMonth()===s.getMonth()&&e.getDate()===s.getDate()}function cn(e){const s=[];for(const t of e)s.push(t),t.children&&!t.collapsed&&s.push(...cn(t.children));return s}function Ge(e){switch(e){case"day":return 40;case"week":return 80;case"month":return 120}}function fr(e,s){switch(s){case"day":return{label:e.toLocaleDateString("en-US",{day:"numeric"}),subLabel:e.toLocaleDateString("en-US",{weekday:"short"})};case"week":return{label:`W${pr(e)}`,subLabel:e.toLocaleDateString("en-US",{month:"short",day:"numeric"})};case"month":return{label:e.toLocaleDateString("en-US",{month:"short"}),subLabel:e.getFullYear().toString()}}}function pr(e){const s=new Date(e.getFullYear(),0,1),t=Math.ceil((e.getTime()-s.getTime())/864e5);return Math.ceil((t+s.getDay())/7)}function Re(e){switch(e){case"day":return 1;case"week":return 7;case"month":return 30}}function dn(e,s,t){const n=ee.useMemo(()=>cn(e),[e]),r=ee.useMemo(()=>{if(n.length===0){const g=ae(new Date);return{start:we(g,-7),end:we(g,30)}}let u=1/0,h=-1/0;for(const g of n){const c=Ne(g.start).getTime(),m=Ne(g.end).getTime();c<u&&(u=c),m>h&&(h=m)}const f=Re(s)*2;return{start:we(ae(new Date(u)),-f),end:we(ae(new Date(h)),f)}},[n,s]),o=ee.useMemo(()=>{const u=[],h=Ge(s),f=Re(s),g=ae(new Date);let c=new Date(r.start);for(;c<=r.end;){const{label:m,subLabel:p}=fr(c,s);u.push({date:new Date(c),label:m,subLabel:p,width:h,isToday:hr(c,g),isWeekend:mr(c)}),c=we(c,f)}return u},[r,s]),i=ee.useMemo(()=>o.reduce((u,h)=>u+h.width,0),[o]),a=ee.useMemo(()=>{const u=Ge(s),h=Re(s),f=r.start;return n.map((g,c)=>{const m=ae(Ne(g.start)),p=ae(Ne(g.end)),x=Le(m,f)/h,v=Math.max(Le(p,m)/h,.5);return{task:g,x:x*u,width:Math.max(v*u,g.milestone?16:20),y:c*t}})},[n,r,s,t]),d=ee.useMemo(()=>{const u=ae(new Date),h=Ge(s),f=Re(s);return Le(u,r.start)/f*h},[r,s]);return{flatTasks:n,columns:o,totalWidth:i,barPositions:a,todayX:d,dateRange:r}}const xr=[{mode:"day",icon:l.jsx(pt.Calendar,{className:"h-3.5 w-3.5"})},{mode:"week",icon:l.jsx(Mn,{className:"h-3.5 w-3.5"})},{mode:"month",icon:l.jsx(In,{className:"h-3.5 w-3.5"})}];function gn({tasks:e,defaultTasks:s,onTasksChange:t,viewMode:n,defaultViewMode:r="week",onViewModeChange:o,viewModeLabels:i,hideToolbar:a=!1,renderToolbar:d,onTaskChange:u,onTaskClick:h,showTodayMarker:f=!0,rowHeight:g=40,readOnly:c=!1,sidebarWidth:m=240,height:p=500,className:x}){const{t:v}=A.useLocale(),[w,M]=Se.useControllableState({value:n,defaultValue:r,onChange:o}),[$,O]=Se.useControllableState({value:e,defaultValue:s??e??[],onChange:t}),F=S=>{M(S)},E=S=>(i==null?void 0:i[S])??v(`gantt.${S}`),G=S=>{const _=z=>z.map(B=>B.id===S?{...B,collapsed:!B.collapsed}:B.children?{...B,children:_(B.children)}:B),se=_($);O(se);const pe=z=>{for(const B of z){if(B.id===S)return B;if(B.children){const st=pe(B.children);if(st)return st}}},T=pe(se);T&&!c&&(u==null||u(T))},{flatTasks:y,columns:I,totalWidth:k,barPositions:b,todayX:q}=dn($,w,g),Q=y.length*g;return l.jsxs("div",{className:j.cn("flex flex-col overflow-hidden rounded-lg border bg-background",x),style:{height:p},children:[!a&&(d?l.jsx("div",{className:"border-b px-3 py-2",children:d({viewMode:w,setViewMode:F,taskCount:y.length})}):l.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[l.jsx("span",{className:"text-sm font-semibold",children:v("gantt.tasks",{count:y.length})}),l.jsx(X.TooltipProvider,{children:l.jsx("div",{className:"flex items-center gap-1 rounded-lg border bg-muted/30 p-0.5",children:xr.map(({mode:S,icon:_})=>l.jsxs(X.Tooltip,{children:[l.jsx(X.TooltipTrigger,{asChild:!0,children:l.jsxs(P.Button,{variant:w===S?"default":"ghost",size:"sm",className:j.cn("h-7 px-2.5 text-xs",w!==S&&"hover:bg-background"),onClick:()=>F(S),children:[_,l.jsx("span",{className:"ml-1",children:E(S)})]})}),l.jsx(X.TooltipContent,{children:v("gantt.viewMode",{mode:E(S)})})]},S))})})]})),l.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[l.jsx(an,{tasks:$,rowHeight:g,width:m,onToggleCollapse:G,onTaskClick:h}),l.jsx(un,{columns:I,barPositions:b,totalWidth:k,totalHeight:Q,todayX:q,rowHeight:g,showTodayMarker:f,onTaskClick:h,readOnly:c})]})]})}gn.displayName="GanttPlanner";function vr(e){const s=[],t=new Map;for(const n of e){const r=n.group??"",o=t.get(r);o!==void 0?s[o].items.push(n):(t.set(r,s.length),s.push({label:r,items:[n]}))}return s}function mn({roles:e,permissions:s,values:t,onChange:n,onBulkToggleRole:r,onBulkTogglePermission:o,readOnly:i=!1,className:a}){const d=C.useMemo(()=>vr(s),[s]),{t:u}=A.useLocale(),h=C.useMemo(()=>s.map(x=>x.id),[s]),f=(x,v)=>{var w;return((w=t[x])==null?void 0:w.includes(v))??!1},g=x=>h.length>0&&h.every(v=>f(x,v)),c=x=>e.length>0&&e.every(v=>f(v.id,x)),m="flex items-center justify-center h-10 min-w-[80px] border-b border-r px-2",p="flex flex-col items-center justify-center gap-1 h-14 min-w-[80px] border-b border-r px-2 bg-muted/40";return l.jsxs(H.ScrollArea,{className:j.cn("rounded-lg border bg-background",a),children:[l.jsxs("table",{className:"w-max border-collapse",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"sticky top-0 z-10 bg-background",children:[l.jsx("th",{className:"sticky left-0 z-20 border-b border-r bg-muted/40 min-w-[180px] h-14"}),l.jsx("th",{className:j.cn(p,"sticky left-[180px] z-20 bg-muted/40"),children:l.jsx("span",{className:"text-[10px] font-medium text-muted-foreground",children:u("permission.all")})}),e.map(x=>l.jsxs("th",{className:j.cn(p),children:[l.jsx("span",{className:"text-xs font-semibold truncate max-w-[72px]",children:x.name}),!i&&l.jsx(J.Checkbox,{size:"sm",checked:g(x.id),onCheckedChange:v=>r==null?void 0:r(x.id,v===!0),"aria-label":u("permission.toggleAllForRole",{role:x.name})})]},x.id))]})}),l.jsx("tbody",{children:d.map(x=>l.jsxs(C.Fragment,{children:[x.label&&l.jsx("tr",{children:l.jsx("td",{colSpan:e.length+2,className:"sticky left-0 bg-muted/20 border-b px-3 py-1.5 text-xs font-semibold text-muted-foreground tracking-wide uppercase",children:x.label})}),x.items.map(v=>l.jsxs("tr",{className:"hover:bg-accent/30 transition-colors",children:[l.jsx("td",{className:"sticky left-0 z-10 bg-background border-b border-r px-3 min-w-[180px] text-sm font-medium truncate",children:v.name}),l.jsx("td",{className:j.cn(m,"sticky left-[180px] z-10 bg-background"),children:!i&&l.jsx(J.Checkbox,{size:"sm",checked:c(v.id),onCheckedChange:w=>o==null?void 0:o(v.id,w===!0),"aria-label":u("permission.toggleForAllRoles",{permission:v.name})})}),e.map(w=>l.jsx("td",{className:j.cn(m),children:l.jsx(J.Checkbox,{size:"sm",checked:f(w.id,v.id),onCheckedChange:M=>n==null?void 0:n(w.id,v.id,M===!0),disabled:i,"aria-label":u("permission.toggleSingle",{permission:v.name,role:w.name})})},w.id))]},v.id))]},x.label))})]}),l.jsx(H.ScrollBar,{orientation:"horizontal"})]})}mn.displayName="PermissionMatrix";exports.ActivityFeed=Bt;exports.BulkActionsToolbar=qt;exports.BulkDataOps=ln;exports.ColumnVisibility=Ht;exports.DataTable=Es;exports.EditableCell=et;exports.EmptyState=Lt;exports.FORECAST_CATEGORY_CONFIG=Zt;exports.FilterTags=Wt;exports.ForecastBoard=nn;exports.ForecastBucket=en;exports.ForecastSummary=tn;exports.GanttChart=un;exports.GanttPlanner=gn;exports.GanttSidebar=an;exports.ImportMapper=sn;exports.KPICard=At;exports.MergePreview=cr;exports.NO_VALUE_OPERATORS=Xt;exports.OPERATORS_BY_FIELD_TYPE=Xe;exports.PerPageSelector=Kt;exports.PermissionMatrix=mn;exports.QueryFilterBuilder=Qt;exports.QuickFilters=Ut;exports.StatCard=Tt;exports.Table=Ie;exports.TableBody=Ee;exports.TableCaption=$t;exports.TableCell=fe;exports.TableFooter=Pt;exports.TableHead=De;exports.TableHeader=ke;exports.TableRow=le;exports.Timeline=Gt;exports.ValidationTable=rn;exports.VirtualDataTable=zt;exports.createActionsCell=Vs;exports.createEditableCell=Ts;exports.createEmptyGroup=Fe;exports.createEmptyRule=nt;exports.createSortableHeader=Ds;exports.exportToCsv=Ls;exports.useFilterBuilder=Jt;exports.useGanttPlanner=dn;
93
- //# sourceMappingURL=permission-matrix-DRu-cV44.cjs.map
93
+ //# sourceMappingURL=permission-matrix-CqE8q8Hi.cjs.map