@wakastellar/ui 3.5.0 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor.cjs.js +2 -2
- package/dist/editor.es.js +4 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +6826 -6826
- package/dist/src/blocks/login/index.d.ts +4 -4
- package/dist/src/stories/editor/EditorStoryWrapper.d.ts +11 -0
- package/dist/waka-editor-plugins-CGojOMS5.js +1 -0
- package/dist/{waka-editor-plugins-DR6tpsUC.mjs → waka-editor-plugins-Dwh4Vreq.mjs} +1 -1
- package/package.json +1 -1
- package/src/blocks/footer/index.tsx +4 -4
- package/src/blocks/login/index.tsx +14 -14
- package/src/blocks/profile/index.tsx +5 -6
- package/src/blocks/sidebar/index.tsx +0 -2
- package/src/components/dropdown-menu/DropdownMenu.stories.tsx +2 -2
- package/src/components/editor/waka-dnd-editor.tsx +1 -1
- package/src/components/editor/waka-document-editor.tsx +1 -1
- package/src/components/editor/waka-editor-plugins.ts +1 -1
- package/src/components/waka-approval-chain/WakaApprovalChain.stories.tsx +15 -17
- package/src/components/waka-compare-period/WakaComparePeriod.stories.tsx +35 -19
- package/src/components/waka-content-recommendation/WakaContentRecommendation.stories.tsx +18 -5
- package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +11 -34
- package/src/components/waka-streak-counter/WakaStreakCounter.stories.tsx +30 -30
- package/dist/waka-editor-plugins-sGSh9hn2.js +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2651,6 +2651,6 @@ LIMIT 10;`,planningTime:.125,executionTime:45.32,totalCost:1250.5,rootNode:{id:`
|
|
|
2651
2651
|
animation: feed-item-in 0.35s ease-out forwards;
|
|
2652
2652
|
animation-delay: var(--stagger-delay, 0ms);
|
|
2653
2653
|
}
|
|
2654
|
-
`})]})}t.n();var QM=[{value:`day`,label:`Day`},{value:`week`,label:`Week`},{value:`month`,label:`Month`},{value:`year`,label:`Year`}],$M=`#3b82f6`,eN=`#94a3b8`;function tN(e,t){return!t||t.length===0?e.map(e=>({date:e.date,value:e.value})):e.map((e,n)=>({date:e.date,value:e.value,compareValue:t[n]?.value}))}function nN(e){return e.toLocaleString(`en-US`)}function rN({active:e,payload:t,label:n,formatValue:r}){return!e||!t||t.length===0?null:(0,g.jsxs)(`div`,{className:`rounded-lg border bg-popover px-3 py-2 shadow-md`,children:[(0,g.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,g.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full`,style:{backgroundColor:e.color}}),(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.name,`:`]}),(0,g.jsx)(`span`,{className:`font-semibold tabular-nums`,children:r(e.value)})]},e.dataKey))]})}function iN({period:e,onPeriodChange:n}){return(0,g.jsx)(`div`,{className:`mb-4 flex gap-1 rounded-lg bg-muted p-1`,children:QM.map(r=>(0,g.jsx)(`button`,{type:`button`,onClick:()=>n(r.value),className:t.t(`rounded-md px-3 py-1.5 text-xs font-medium transition-colors`,e===r.value?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value))})}function aN({data:e,compareWith:n,period:r=`month`,stacked:i=!1,height:a=300,showLegend:o=!1,showGrid:s=!0,animated:c=!0,color:l=$M,compareColor:u=eN,formatValue:f=nN,onPeriodChange:p,className:m}){let h=d.useMemo(()=>tN(e,n),[e,n]),_=d.useId(),v=d.useId(),y=`usage-gradient-${_.replace(/:/g,``)}`,b=`compare-gradient-${v.replace(/:/g,``)}`,x=n&&n.length>0;return(0,g.jsxs)(`div`,{className:t.t(`w-full`,m),children:[p&&(0,g.jsx)(iN,{period:r,onPeriodChange:p}),(0,g.jsx)(q.ResponsiveContainer,{width:`100%`,height:a,children:(0,g.jsxs)(q.AreaChart,{data:h,margin:{top:4,right:4,left:0,bottom:0},children:[(0,g.jsxs)(`defs`,{children:[(0,g.jsxs)(`linearGradient`,{id:y,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,g.jsx)(`stop`,{offset:`5%`,stopColor:l,stopOpacity:.4}),(0,g.jsx)(`stop`,{offset:`95%`,stopColor:l,stopOpacity:.05})]}),x&&(0,g.jsxs)(`linearGradient`,{id:b,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,g.jsx)(`stop`,{offset:`5%`,stopColor:u,stopOpacity:.15}),(0,g.jsx)(`stop`,{offset:`95%`,stopColor:u,stopOpacity:.02})]})]}),s&&(0,g.jsx)(q.CartesianGrid,{strokeDasharray:`3 3`,vertical:!1,className:`stroke-border/50`}),(0,g.jsx)(q.XAxis,{dataKey:`date`,axisLine:!1,tickLine:!1,tick:{fontSize:12},className:`fill-muted-foreground`,dy:8}),(0,g.jsx)(q.YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12},className:`fill-muted-foreground`,tickFormatter:e=>f(e),width:60}),(0,g.jsx)(q.Tooltip,{content:(0,g.jsx)(rN,{formatValue:f}),cursor:{stroke:`hsl(var(--border))`,strokeWidth:1}}),o&&(0,g.jsx)(q.Legend,{verticalAlign:`bottom`,align:`center`,wrapperStyle:{paddingTop:16},iconType:`circle`}),x&&(0,g.jsx)(q.Area,{dataKey:`compareValue`,name:`Previous Period`,type:`monotone`,stroke:u,strokeWidth:1.5,strokeDasharray:`6 3`,fill:`url(#${b})`,fillOpacity:1,stackId:i?`stack`:void 0,isAnimationActive:c,animationDuration:800,dot:!1,activeDot:{r:3,fill:u,stroke:`white`,strokeWidth:1.5}}),(0,g.jsx)(q.Area,{dataKey:`value`,name:`Current Period`,type:`monotone`,stroke:l,strokeWidth:2,fill:`url(#${y})`,fillOpacity:1,stackId:i?`stack`:void 0,isAnimationActive:c,animationDuration:800,dot:!1,activeDot:{r:4,fill:l,stroke:`white`,strokeWidth:2}})]})})]})}t.n();function oN(e){if(e.length===0)return 0;let t=e.slice(-7);return t.reduce((e,t)=>e+t.value,0)/t.length}function sN(e,t){return t<=0?1/0:Math.floor(e/t)}function cN(e){if(!isFinite(e)||e<=0)return null;let t=new Date;return t.setDate(t.getDate()+e),t}function lN(e){return e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function uN(e){return e<7?{stroke:`#ef4444`,text:`text-red-600`,bg:`bg-red-100 dark:bg-red-950`,label:`Critical`}:e<=30?{stroke:`#f59e0b`,text:`text-amber-600`,bg:`bg-amber-100 dark:bg-amber-950`,label:`Warning`}:{stroke:`#22c55e`,text:`text-green-600`,bg:`bg-green-100 dark:bg-green-950`,label:`Healthy`}}function dN({dailyUsage:e,avgBurnRate:n,width:r,height:i,showProjection:a,projectionDays:o,statusColor:s,animated:c}){let[l,u]=d.useState(0),[f,p]=d.useState(!c),m=d.useRef(null),h=r-4,_=i-4,v=e.length+(a?o:0),y=e.map(e=>e.value),b=a?Array.from({length:o},()=>n):[],x=[...y,...b],S=Math.min(...x,0),C=Math.max(...x,1)-S||1,w=e.map((e,t)=>`${2+t/(v-1)*h},${2+_-(e.value-S)/C*_}`),T=[];if(a&&e.length>0){let t=e.length-1,r=2+t/(v-1)*h,i=2+_-(e[t].value-S)/C*_;T.push(`${r},${i}`);for(let t=1;t<=o;t++){let r=2+(e.length-1+t)/(v-1)*h,i=2+_-(n-S)/C*_;T.push(`${r},${i}`)}}return d.useEffect(()=>{m.current&&u(m.current.getTotalLength())},[e]),d.useEffect(()=>{if(c&&l>0){let e=setTimeout(()=>p(!0),50);return()=>clearTimeout(e)}},[c,l]),e.length<2?(0,g.jsx)(`svg`,{width:r,height:i,children:(0,g.jsx)(`text`,{x:r/2,y:i/2,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-xs fill-muted-foreground`,children:`Not enough data`})}):(0,g.jsxs)(`svg`,{width:r,height:i,className:`overflow-visible`,children:[(0,g.jsx)(`polyline`,{ref:m,points:w.join(` `),fill:`none`,stroke:s,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:c&&l>0?{strokeDasharray:l,strokeDashoffset:f?0:l,transition:`stroke-dashoffset 1s ease-out`}:void 0}),a&&T.length>1&&(0,g.jsx)(`polyline`,{points:T.join(` `),fill:`none`,stroke:s,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeDasharray:`4,3`,opacity:`0.5`,className:t.t(c&&`transition-opacity duration-500`,c&&(f?`opacity-50`:`opacity-0`))}),e.length>0&&(0,g.jsx)(`circle`,{cx:parseFloat(w[w.length-1].split(`,`)[0]),cy:parseFloat(w[w.length-1].split(`,`)[1]),r:`2.5`,fill:s,stroke:`white`,strokeWidth:`1`,className:t.t(c&&`transition-opacity duration-500`,c&&(f?`opacity-100`:`opacity-0`))})]})}function fN({dailyUsage:e,avgBurnRate:n,daysRemaining:r,width:i,height:a,showProjection:o,projectionDays:s,animated:c,className:l}){let u=uN(r);return(0,g.jsxs)(`div`,{className:t.t(`inline-flex items-center gap-2`,l),children:[(0,g.jsx)(dN,{dailyUsage:e,avgBurnRate:n,width:i,height:a,showProjection:o,projectionDays:s,statusColor:u.stroke,animated:c}),(0,g.jsx)(`span`,{className:t.t(`text-xs font-medium tabular-nums`,u.text),children:isFinite(r)?`${r}d`:`--`})]})}function pN({dailyUsage:e,balance:n,avgBurnRate:r,daysRemaining:i,depletionDate:a,width:o,height:s,showProjection:c,projectionDays:l,animated:u,className:d}){let f=uN(i);return(0,g.jsxs)(`div`,{className:t.t(`rounded-lg border bg-card p-4 space-y-4`,d),children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,g.jsx)(p.TrendingDown,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{children:`Credit Burn Rate`})]}),(0,g.jsx)(`div`,{className:t.t(`px-2 py-0.5 rounded-full text-xs font-medium`,f.bg,f.text),children:f.label})]}),(0,g.jsx)(`div`,{className:`flex justify-center`,children:(0,g.jsx)(dN,{dailyUsage:e,avgBurnRate:r,width:o,height:s,showProjection:c,projectionDays:l,statusColor:f.stroke,animated:u})}),(0,g.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Burn Rate`}),(0,g.jsx)(`div`,{className:`text-lg font-bold tabular-nums`,children:r.toFixed(1)}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`credits/day`})]}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,g.jsx)(p.Clock,{className:`h-3 w-3`}),(0,g.jsx)(`span`,{children:`Days Left`})]}),(0,g.jsx)(`div`,{className:t.t(`text-lg font-bold tabular-nums`,f.text),children:isFinite(i)?i:`--`}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[n.toLocaleString(),` credits`]})]}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Depleted By`}),(0,g.jsx)(`div`,{className:t.t(`text-sm font-semibold`,f.text),children:a?lN(a):`--`}),i<7&&isFinite(i)&&(0,g.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-red-600`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-3 w-3`}),(0,g.jsx)(`span`,{children:`Critical`})]})]})]})]})}function mN({dailyUsage:e,balance:n,showProjection:r=!1,projectionDays:i=7,width:a=120,height:o=32,animated:s=!0,variant:c=`sparkline`,className:l}){let u=d.useMemo(()=>oN(e),[e]),f=d.useMemo(()=>sN(n,u),[n,u]),p=d.useMemo(()=>cN(f),[f]);return!e||e.length===0?(0,g.jsx)(`div`,{className:t.t(`inline-flex items-center gap-2 text-muted-foreground text-sm`,l),children:`No data`}):c===`card`?(0,g.jsx)(pN,{dailyUsage:e,balance:n,avgBurnRate:u,daysRemaining:f,depletionDate:p,width:Math.max(a,200),height:Math.max(o,48),showProjection:r,projectionDays:i,animated:s,className:l}):(0,g.jsx)(fN,{dailyUsage:e,avgBurnRate:u,daysRemaining:f,width:a,height:o,showProjection:r,projectionDays:i,animated:s,className:l})}t.n();var hN=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`,`hsl(var(--primary))`,`hsl(var(--info))`,`hsl(var(--warning))`,`hsl(var(--success))`,`hsl(var(--destructive))`];function gN(e){return e.map((e,t)=>({...e,color:e.color||hN[t%hN.length]}))}function _N(e){return e.reduce((e,t)=>e+t.value,0)}function vN(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function yN({active:e,payload:n,total:r,formatter:i}){if(!e||!n||!n.length)return null;let a=n[0],o=r>0?(a.value/r*100).toFixed(1):`0`;return(0,g.jsxs)(`div`,{className:t.t(`px-3 py-2 text-sm rounded-lg shadow-lg`,`bg-foreground text-background`,`pointer-events-none min-w-[140px]`),children:[(0,g.jsxs)(`div`,{className:`font-semibold mb-1 flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full flex-shrink-0`,style:{backgroundColor:a.payload.color}}),a.name]}),(0,g.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,g.jsx)(`span`,{className:`opacity-70`,children:`Value:`}),(0,g.jsx)(`span`,{className:`font-medium`,children:i(a.value)})]}),(0,g.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,g.jsx)(`span`,{className:`opacity-70`,children:`Share:`}),(0,g.jsxs)(`span`,{children:[o,`%`]})]})]})}function bN({cx:e,cy:t,midAngle:n,innerRadius:r,outerRadius:i,percent:a}){let o=Math.PI/180,s=r+(i-r)*.5+20,c=e+s*Math.cos(-n*o),l=t+s*Math.sin(-n*o);return a<.05?null:(0,g.jsx)(`text`,{x:c,y:l,fill:`currentColor`,textAnchor:c>e?`start`:`end`,dominantBaseline:`central`,className:`text-xs fill-foreground`,children:`${(a*100).toFixed(0)}%`})}function xN({viewBox:e,total:t,formatter:n}){if(!e)return null;let{cx:r,cy:i}=e;return(0,g.jsxs)(`g`,{children:[(0,g.jsx)(`text`,{x:r,y:i-10,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-xs fill-muted-foreground`,children:`Total`}),(0,g.jsx)(`text`,{x:r,y:i+12,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-base font-bold fill-foreground`,children:n(t)})]})}function SN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){return(0,g.jsx)(q.ResponsiveContainer,{width:`100%`,height:n,children:(0,g.jsxs)(q.PieChart,{children:[(0,g.jsx)(q.Pie,{data:e,dataKey:`value`,nameKey:`name`,cx:`50%`,cy:`50%`,outerRadius:n/2-40,isAnimationActive:r,animationDuration:800,label:i?bN:!1,labelLine:!1,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:e.map(e=>(0,g.jsx)(q.Cell,{fill:e.color},e.id))}),(0,g.jsx)(q.Tooltip,{content:(0,g.jsx)(yN,{total:t,formatter:o})}),a&&(0,g.jsx)(q.Legend,{verticalAlign:`bottom`,formatter:e=>(0,g.jsx)(`span`,{className:`text-sm text-foreground`,children:e})})]})})}function CN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){let c=n/2-40;return(0,g.jsx)(q.ResponsiveContainer,{width:`100%`,height:n,children:(0,g.jsxs)(q.PieChart,{children:[(0,g.jsxs)(q.Pie,{data:e,dataKey:`value`,nameKey:`name`,cx:`50%`,cy:`50%`,innerRadius:c*.55,outerRadius:c,isAnimationActive:r,animationDuration:800,paddingAngle:2,label:i?bN:!1,labelLine:!1,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:[e.map(e=>(0,g.jsx)(q.Cell,{fill:e.color},e.id)),(0,g.jsx)(xN,{total:t,formatter:o})]}),(0,g.jsx)(q.Tooltip,{content:(0,g.jsx)(yN,{total:t,formatter:o})}),a&&(0,g.jsx)(q.Legend,{verticalAlign:`bottom`,formatter:e=>(0,g.jsx)(`span`,{className:`text-sm text-foreground`,children:e})})]})})}function wN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){return(0,g.jsx)(q.ResponsiveContainer,{width:`100%`,height:n,children:(0,g.jsxs)(q.BarChart,{data:e.map(e=>({...e,percentage:t>0?(e.value/t*100).toFixed(1):`0`})),layout:`vertical`,barCategoryGap:`20%`,children:[(0,g.jsx)(q.XAxis,{type:`number`,tickFormatter:e=>i?`${t>0?(e/t*100).toFixed(0):0}%`:o(e),axisLine:!1,tickLine:!1,tick:{className:`text-xs fill-muted-foreground`}}),(0,g.jsx)(q.YAxis,{dataKey:`name`,type:`category`,width:100,axisLine:!1,tickLine:!1,tick:{className:`text-sm fill-foreground`}}),(0,g.jsx)(q.Tooltip,{content:(0,g.jsx)(yN,{total:t,formatter:o})}),a&&(0,g.jsx)(q.Legend,{verticalAlign:`bottom`,formatter:e=>(0,g.jsx)(`span`,{className:`text-sm text-foreground`,children:e})}),(0,g.jsx)(q.Bar,{dataKey:`value`,name:`Credits`,radius:[0,4,4,0],isAnimationActive:r,animationDuration:800,barSize:24,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:e.map(e=>(0,g.jsx)(q.Cell,{fill:e.color},e.id))})]})})}function TN({data:e,variant:n=`pie`,showPercentages:r=!1,showLegend:i=!0,height:a=300,animated:o=!0,onSegmentClick:s,formatValue:c,className:l}){let u=d.useMemo(()=>gN(e),[e]),f={data:u,total:d.useMemo(()=>_N(u),[u]),height:a,animated:o,showPercentages:r,showLegend:i,formatter:c||vN,onSegmentClick:s};return(0,g.jsxs)(`div`,{className:t.t(`w-full`,l),children:[n===`pie`&&(0,g.jsx)(SN,{...f}),n===`donut`&&(0,g.jsx)(CN,{...f}),n===`bar`&&(0,g.jsx)(wN,{...f})]})}t.n();function EN(e){return new Date(e)}function DN(e){return EN(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function ON(e,t){let n=EN(e);return n.setDate(n.getDate()+t),n.toISOString().split(`T`)[0]}function kN(e){if(e.length<2)return 0;let t=[...e].sort((e,t)=>EN(e.date).getTime()-EN(t.date).getTime()),n=t[0],r=t[t.length-1],i=(EN(r.date).getTime()-EN(n.date).getTime())/(1e3*60*60*24);return i===0?0:(n.value-r.value)/i}function AN(e,t,n,r){let i=[...e].sort((e,t)=>EN(e.date).getTime()-EN(t.date).getTime()),a=kN(i),o=i.map(e=>({date:e.date,historical:e.value})),s=i.length>0?i[i.length-1].date:new Date().toISOString().split(`T`)[0],c=null;i.length>0&&(o[o.length-1].projected=t,r&&(o[o.length-1].upperBound=t,o[o.length-1].lowerBound=t));for(let e=1;e<=n;e++){let i=ON(s,e),l=Math.max(0,t-a*e),u=e/n*.2,d=Math.max(0,t-a*e*(1-u)),f=Math.max(0,t-a*e*(1+u)),p={date:i,projected:l};r&&(p.upperBound=d,p.lowerBound=f),o.push(p),c===null&&l<=0&&(c=i)}return{chartData:o,depletionDate:c}}function jN({active:e,payload:t,label:n}){if(!e||!t||t.length===0||!n)return null;let r=t.find(e=>e.dataKey===`historical`),i=t.find(e=>e.dataKey===`projected`),a=t.find(e=>e.dataKey===`upperBound`),o=t.find(e=>e.dataKey===`lowerBound`);return(0,g.jsxs)(`div`,{className:`rounded-lg border bg-background px-3 py-2 shadow-md`,children:[(0,g.jsx)(`p`,{className:`text-xs font-medium text-foreground mb-1`,children:DN(n)}),r&&r.value!=null&&(0,g.jsxs)(`p`,{className:`text-xs text-blue-600`,children:[`Balance: `,r.value.toLocaleString()]}),i&&i.value!=null&&(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Projected: `,i.value.toLocaleString()]}),a&&o&&a.value!=null&&o.value!=null&&(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground/70`,children:[`Range: `,o.value.toLocaleString(),` - `,a.value.toLocaleString()]})]})}function MN({depletionDate:e}){return e?(0,g.jsxs)(`div`,{className:`mt-2 text-sm text-red-600 font-medium text-center`,children:[`Estimated depletion: `,DN(e)]}):null}function NN({historicalData:e,balance:n,projectionDays:r=30,confidenceInterval:i=!1,height:a=300,animated:o=!0,className:s}){let{chartData:c,depletionDate:l}=d.useMemo(()=>AN(e,n,r,i),[e,n,r,i]);return e.length===0?(0,g.jsx)(`div`,{className:t.t(`flex items-center justify-center text-muted-foreground text-sm border border-dashed border-border rounded-lg`,s),style:{height:a},children:`No historical data available`}):(0,g.jsxs)(`div`,{className:t.t(`w-full`,s),children:[(0,g.jsx)(q.ResponsiveContainer,{width:`100%`,height:a,children:(0,g.jsxs)(q.AreaChart,{data:c,margin:{top:10,right:30,left:10,bottom:0},children:[(0,g.jsxs)(`defs`,{children:[(0,g.jsxs)(`linearGradient`,{id:`historicalGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,g.jsx)(`stop`,{offset:`5%`,stopColor:`#3b82f6`,stopOpacity:.3}),(0,g.jsx)(`stop`,{offset:`95%`,stopColor:`#3b82f6`,stopOpacity:.05})]}),(0,g.jsxs)(`linearGradient`,{id:`confidenceGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,g.jsx)(`stop`,{offset:`5%`,stopColor:`#9ca3af`,stopOpacity:.2}),(0,g.jsx)(`stop`,{offset:`95%`,stopColor:`#9ca3af`,stopOpacity:.05})]})]}),(0,g.jsx)(q.CartesianGrid,{strokeDasharray:`3 3`,stroke:`#e5e7eb`,vertical:!1}),(0,g.jsx)(q.XAxis,{dataKey:`date`,tickFormatter:DN,tick:{fontSize:12,fill:`#6b7280`},axisLine:{stroke:`#d1d5db`},tickLine:{stroke:`#d1d5db`}}),(0,g.jsx)(q.YAxis,{tick:{fontSize:12,fill:`#6b7280`},axisLine:{stroke:`#d1d5db`},tickLine:{stroke:`#d1d5db`},tickFormatter:e=>e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}),(0,g.jsx)(q.Tooltip,{content:(0,g.jsx)(jN,{})}),(0,g.jsx)(q.ReferenceLine,{y:0,stroke:`#ef4444`,strokeWidth:2}),i&&(0,g.jsx)(q.Area,{type:`monotone`,dataKey:`upperBound`,stroke:`none`,fill:`url(#confidenceGradient)`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3}),i&&(0,g.jsx)(q.Area,{type:`monotone`,dataKey:`lowerBound`,stroke:`none`,fill:`#ffffff`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3}),(0,g.jsx)(q.Area,{type:`monotone`,dataKey:`historical`,stroke:`#3b82f6`,strokeWidth:2,fill:`url(#historicalGradient)`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3,connectNulls:!1}),(0,g.jsx)(q.Line,{type:`monotone`,dataKey:`projected`,stroke:`#6b7280`,strokeWidth:2,strokeDasharray:`6 3`,dot:!1,isAnimationActive:o,animationDuration:1e3,connectNulls:!1})]})}),(0,g.jsx)(MN,{depletionDate:l})]})}t.n();function PN(e){return e.toLocaleString(`en-US`)}function FN(e,t){return Number.isInteger(e)?`${e}${t}`:`${e.toFixed(2)}${t}`}function IN(e,t){return`${e.toFixed(4).replace(/0+$/,``).replace(/\.$/,``)}${t}/credit`}function LN({pack:e,selected:n,onSelect:a,currency:o}){let s=e.currency||o;return(0,g.jsxs)(Y,{className:t.t(`relative flex flex-col transition-all duration-200 cursor-pointer`,n&&[`border-primary shadow-lg shadow-primary/10`,`ring-2 ring-primary/30`],e.highlighted&&!n&&`bg-muted/30`,!n&&!e.highlighted&&`hover:border-muted-foreground/30`),onClick:()=>a(e),children:[e.highlighted&&e.highlightLabel&&(0,g.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2 z-10`,children:(0,g.jsxs)(r.t,{className:`inline-flex items-center gap-1 rounded-full px-3 py-1 shadow-sm`,children:[(0,g.jsx)(p.Sparkles,{className:`h-3 w-3`}),e.highlightLabel]})}),(0,g.jsx)(X,{className:t.t(`pb-2`,e.highlighted&&`pt-8`),children:(0,g.jsx)(`h3`,{className:`text-lg font-bold text-foreground`,children:e.name})}),(0,g.jsxs)(Q,{className:`flex flex-1 flex-col gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Coins,{className:`h-5 w-5 text-primary`}),(0,g.jsx)(`span`,{className:`text-3xl font-bold text-foreground`,children:PN(e.credits)}),(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`credits`})]}),(0,g.jsx)(`div`,{className:`text-2xl font-semibold text-foreground`,children:FN(e.price,s)}),e.unitPrice!=null&&e.unitPrice>0&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:IN(e.unitPrice,s)}),e.bonusPercent!=null&&e.bonusPercent>0&&(0,g.jsxs)(r.t,{variant:`secondary`,className:`w-fit rounded-full`,children:[`+`,e.bonusPercent,`% bonus`]}),(0,g.jsx)(`div`,{className:`flex-1`}),(0,g.jsx)(i.n,{type:`button`,variant:n?`default`:`outline`,className:`mt-2 w-full`,onClick:t=>{t.stopPropagation(),a(e)},children:n?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Check,{className:`h-4 w-4`}),`Selected`]}):`Select`})]})]})}function RN({packs:e,selectedId:n,onSelect:r,currency:i=`€`,columns:a=3,className:o}){return(0,g.jsx)(`div`,{className:t.t(`grid gap-6`,{2:`grid-cols-1 md:grid-cols-2`,3:`grid-cols-1 md:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 md:grid-cols-2 lg:grid-cols-4`}[a],o),children:e.map(e=>(0,g.jsx)(LN,{pack:e,selected:e.id===n,onSelect:r,currency:i},e.id))})}t.n();var zN=.01,BN=100,VN=5e4;function HN(e,t){if(t.length===0)return e*zN;let n=[...t].sort((e,t)=>e.credits-t.credits);if(e<=n[0].credits){let t=n[0].price/n[0].credits;return Math.round(e*t*100)/100}if(e>=n[n.length-1].credits){let t=n[n.length-1].price/n[n.length-1].credits;return Math.round(e*t*100)/100}for(let t=0;t<n.length-1;t++)if(e>=n[t].credits&&e<=n[t+1].credits){let r=n[t],i=n[t+1],a=(e-r.credits)/(i.credits-r.credits),o=r.price+a*(i.price-r.price);return Math.round(o*100)/100}return e*zN}function UN(e,t){return`${e.toFixed(2)} ${t}`}function WN(e){return e.toLocaleString(`en-US`)}function GN({pack:e,selected:n,currency:r,onSelect:i}){return(0,g.jsxs)(`button`,{type:`button`,onClick:i,className:t.t(`relative flex flex-col items-center gap-2 rounded-lg border p-4 text-left transition-all`,`hover:border-primary/50 hover:shadow-sm`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,n?`border-primary bg-primary/5 shadow-sm ring-1 ring-primary`:`border-border bg-card`,e.highlighted&&!n&&`border-primary/30`),children:[e.highlighted&&e.highlightLabel&&(0,g.jsx)(`span`,{className:`absolute -top-2.5 left-1/2 -translate-x-1/2 rounded-full bg-primary px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground whitespace-nowrap`,children:e.highlightLabel}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(p.Coins,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`text-lg font-bold tabular-nums`,children:WN(e.credits)})]}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground font-medium`,children:e.name}),(0,g.jsx)(`span`,{className:`text-sm font-semibold`,children:UN(e.price,e.currency??r)}),e.bonusPercent!=null&&e.bonusPercent>0&&(0,g.jsxs)(`span`,{className:`rounded-full bg-green-100 dark:bg-green-900/30 px-2 py-0.5 text-[10px] font-semibold text-green-700 dark:text-green-400`,children:[`+`,e.bonusPercent,`% bonus`]}),e.unitPrice!=null&&(0,g.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[e.unitPrice.toFixed(4),` `,e.currency??r,`/credit`]})]})}function KN({packs:e,currentBalance:n,customAmount:r=!1,minAmount:a=BN,maxAmount:o=VN,currency:c=`EUR`,onPurchase:l,onCancel:u,className:f}){let[m,h]=d.useState(null),[_,v]=d.useState(!1),[y,b]=d.useState(a),x=e.find(e=>e.id===m)??null,S=HN(y,e),C=x!==null||_&&y>=a,w=_?y:x?.credits??0,T=_?S:x?.price??0;function E(e){h(e),v(!1)}function D(){v(!0),h(null)}function O(e){b(Math.max(a,Math.min(o,Math.round(e))))}function k(e){let t=e.target.value;if(t===``){b(a);return}let n=parseInt(t,10);isNaN(n)||O(n)}function A(e){e[0]!=null&&O(e[0])}function j(){C&&(_?l({credits:y,price:S}):x&&l(x))}return(0,g.jsx)(Y,{className:t.t(`w-full`,f),children:(0,g.jsxs)(Q,{className:`p-6 space-y-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10`,children:(0,g.jsx)(p.ShoppingCart,{className:`h-5 w-5 text-primary`})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Top Up Credits`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a pack or enter a custom amount`})]})]}),(0,g.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:e.map(e=>(0,g.jsx)(GN,{pack:e,selected:m===e.id&&!_,currency:c,onSelect:()=>E(e.id)},e.id))}),r&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(i.t,{}),(0,g.jsx)(`span`,{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-card px-3 text-xs text-muted-foreground font-medium`,children:`Or enter custom amount`})]}),(0,g.jsx)(`div`,{className:`space-y-4`,children:_?(0,g.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`label`,{htmlFor:`custom-credits`,className:`text-sm font-medium`,children:`Credits`}),(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:UN(S,c)})]}),(0,g.jsx)(s.t,{id:`custom-credits`,type:`number`,min:a,max:o,step:100,value:y,onChange:k,className:`tabular-nums`}),(0,g.jsx)(lr,{value:[y],onValueChange:A,min:a,max:o,step:100}),(0,g.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground tabular-nums`,children:[(0,g.jsx)(`span`,{children:WN(a)}),(0,g.jsx)(`span`,{children:WN(o)})]})]}):(0,g.jsxs)(i.n,{variant:`outline`,className:`w-full`,onClick:D,children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4`}),`Enter custom amount`]})})]}),C&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(i.t,{}),(0,g.jsxs)(`div`,{className:`space-y-2 rounded-lg bg-muted/50 p-4`,children:[(0,g.jsx)(`h4`,{className:`text-sm font-semibold`,children:`Summary`}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Credits`}),(0,g.jsx)(`span`,{className:`font-medium tabular-nums`,children:WN(w)})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Price`}),(0,g.jsx)(`span`,{className:`font-medium tabular-nums`,children:UN(T,c)})]}),n!=null&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(i.t,{className:`my-1`}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Current balance`}),(0,g.jsx)(`span`,{className:`tabular-nums`,children:WN(n)})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm font-semibold`,children:[(0,g.jsx)(`span`,{children:`New balance`}),(0,g.jsx)(`span`,{className:`tabular-nums text-green-600 dark:text-green-400`,children:WN(n+w)})]})]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[u&&(0,g.jsx)(i.n,{variant:`outline`,onClick:u,children:`Cancel`}),(0,g.jsxs)(i.n,{onClick:j,disabled:!C,children:[(0,g.jsx)(p.ShoppingCart,{className:`h-4 w-4`}),`Purchase`]})]})]})})}t.n();function qN(e){return(typeof e==`string`?new Date(e):e).toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function JN(e){return`${e>=0?`+`:``}${e.toLocaleString(`en-US`)}`}function YN(e){return e.toLocaleString(`en-US`,{style:`currency`,currency:`EUR`})}function XN(e){switch(e){case`credit`:return`default`;case`debit`:return`secondary`;case`refund`:return`destructive`;case`bonus`:return`default`;case`expiry`:return`outline`;default:return`secondary`}}function ZN(e){switch(e){case`completed`:return`default`;case`pending`:return`outline`;case`failed`:return`destructive`;case`cancelled`:return`secondary`;default:return`outline`}}function QN(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $N({label:e,children:t}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-between py-1.5 print:py-1`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground print:text-gray-500`,children:e}),(0,g.jsx)(`div`,{className:`text-sm font-medium text-right`,children:t})]})}function eP({transaction:e,organization:n,downloadable:a=!1,onDownload:o,className:s}){return(0,g.jsxs)(Y,{className:t.t(`w-full max-w-md print:shadow-none print:border-gray-300`,s),children:[(0,g.jsxs)(X,{className:`pb-4 print:pb-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Receipt,{className:`h-5 w-5 text-muted-foreground print:text-gray-500`}),(0,g.jsx)(Z,{className:`text-lg print:text-base`,children:`Receipt`})]}),(0,g.jsx)(p.CheckCircle,{className:`h-5 w-5 text-green-500 print:text-gray-700`})]}),(0,g.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground mt-1 print:text-gray-400`,children:e.id})]}),(0,g.jsx)(i.t,{className:`print:bg-gray-300`}),(0,g.jsxs)(Q,{className:`pt-4 print:pt-2`,children:[(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)($N,{label:`Date`,children:qN(e.timestamp)}),(0,g.jsx)($N,{label:`Type`,children:(0,g.jsx)(r.t,{variant:XN(e.type),className:`print:border-gray-400 print:bg-transparent print:text-gray-700`,children:QN(e.type)})}),e.credits!==void 0&&(0,g.jsx)($N,{label:`Credits`,children:(0,g.jsxs)(`span`,{className:t.t(`tabular-nums font-semibold`,e.credits>=0?`text-green-600 dark:text-green-400 print:text-gray-900`:`text-red-600 dark:text-red-400 print:text-gray-900`),children:[JN(e.credits),` credits`]})}),e.price!==void 0&&(0,g.jsx)($N,{label:`Amount`,children:(0,g.jsx)(`span`,{className:`tabular-nums`,children:YN(e.price)})}),e.paymentMethod&&(0,g.jsx)($N,{label:`Payment`,children:(0,g.jsx)(`span`,{className:`font-mono text-xs`,children:e.paymentMethod})}),(0,g.jsx)($N,{label:`Status`,children:(0,g.jsx)(r.t,{variant:ZN(e.status),className:`print:border-gray-400 print:bg-transparent print:text-gray-700`,children:QN(e.status)})}),n&&(0,g.jsx)($N,{label:`Organization`,children:n.name}),e.description&&(0,g.jsx)($N,{label:`Description`,children:(0,g.jsx)(`span`,{className:`max-w-[200px] truncate inline-block`,children:e.description})})]}),a&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(i.t,{className:`my-4 print:hidden`}),(0,g.jsx)(`div`,{className:`print:hidden`,children:(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,className:`w-full`,onClick:o,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Download PDF`]})})]})]})]})}t.n();function tP(e,t,n,r,i){let a={};e?i&&e===i&&(a.destination=`Destination must be different from source organization`):a.destination=`Please select a destination organization`;let o=parseFloat(t);return t?isNaN(o)||o<=0?a.amount=`Amount must be greater than 0`:o>r&&(a.amount=`Amount cannot exceed ${r.toLocaleString()} credits`):a.amount=`Amount is required`,n.trim()||(a.reason=`Please provide a reason for the transfer`),a}function nP({message:e}){return e?(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1.5`,children:[(0,g.jsx)(p.AlertCircle,{className:`h-3.5 w-3.5 text-destructive flex-shrink-0`}),(0,g.jsx)(`span`,{className:`text-xs text-destructive`,children:e})]}):null}function rP({maxAmount:e,organizations:n,sourceOrganization:r,onTransfer:c,onCancel:l,loading:u=!1,className:f}){let[m,h]=d.useState(``),[_,v]=d.useState(``),[y,b]=d.useState(``),[x,S]=d.useState({}),[C,w]=d.useState({}),T=d.useMemo(()=>r?n.filter(e=>e.id!==r.id):n,[n,r]),E=d.useMemo(()=>n.find(e=>e.id===m),[n,m]);d.useEffect(()=>{if(Object.keys(C).length===0)return;let t=tP(m,_,y,e,r?.id),n={};C.destination&&t.destination&&(n.destination=t.destination),C.amount&&t.amount&&(n.amount=t.amount),C.reason&&t.reason&&(n.reason=t.reason),S(n)},[m,_,y,e,r?.id,C]);let D=e=>{w(t=>({...t,[e]:!0}))},O=t=>{t.preventDefault(),w({destination:!0,amount:!0,reason:!0});let n=tP(m,_,y,e,r?.id);if(Object.keys(n).length>0){S(n);return}c({toOrgId:m,amount:parseFloat(_),reason:y.trim()})},k=parseFloat(_),A=E&&!isNaN(k)&&k>0&&k<=e&&r;return(0,g.jsxs)(Y,{className:t.t(`w-full`,f),children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`flex items-center gap-2 text-lg`,children:[(0,g.jsx)(p.Send,{className:`h-5 w-5`}),`Transfer Credits`]})}),(0,g.jsxs)(`form`,{onSubmit:O,children:[(0,g.jsxs)(Q,{className:`space-y-4`,children:[r&&(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Source Organization`}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-input bg-muted/50 px-3 py-2 text-sm`,children:[(0,g.jsx)(p.Building2,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,g.jsx)(`span`,{className:`font-medium`,children:r.name}),r.balance!==void 0&&(0,g.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[r.balance.toLocaleString(),` credits`]})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`destination-org`,children:`Destination Organization`}),(0,g.jsxs)(a.d,{value:m,onValueChange:e=>{h(e),w(e=>({...e,destination:!0}))},disabled:u,children:[(0,g.jsx)(a.y,{id:`destination-org`,className:t.t(x.destination&&`border-destructive focus:ring-destructive`),onBlur:()=>D(`destination`),children:(0,g.jsx)(a.b,{placeholder:`Select an organization`})}),(0,g.jsx)(a.f,{children:T.map(e=>(0,g.jsx)(a.m,{value:e.id,children:(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Building2,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,g.jsx)(`span`,{children:e.name}),e.balance!==void 0&&(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.balance.toLocaleString(),` credits)`]})]})},e.id))})]}),(0,g.jsx)(nP,{message:x.destination})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`transfer-amount`,children:`Amount`}),(0,g.jsx)(`div`,{className:`relative`,children:(0,g.jsx)(s.t,{id:`transfer-amount`,type:`number`,min:1,max:e,step:1,placeholder:`Max: ${e.toLocaleString()} credits`,value:_,onChange:e=>v(e.target.value),onBlur:()=>D(`amount`),disabled:u,className:t.t(x.amount&&`border-destructive focus-visible:ring-destructive`)})}),(0,g.jsx)(nP,{message:x.amount})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`transfer-reason`,children:`Reason`}),(0,g.jsx)(o.t,{id:`transfer-reason`,placeholder:`Describe the reason for this transfer...`,value:y,onChange:e=>b(e.target.value),onBlur:()=>D(`reason`),disabled:u,rows:3,className:t.t(x.reason&&`border-destructive focus-visible:ring-destructive`)}),(0,g.jsx)(nP,{message:x.reason})]}),A&&(0,g.jsx)(`div`,{className:`rounded-md border bg-muted/30 p-3`,children:(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-2 flex-wrap`,children:[`Transfer`,` `,(0,g.jsxs)(`span`,{className:`font-semibold text-foreground`,children:[k.toLocaleString(),` credits`]}),` `,`from`,` `,(0,g.jsx)(`span`,{className:`font-semibold text-foreground`,children:r.name}),(0,g.jsx)(p.ArrowRight,{className:`h-3.5 w-3.5 flex-shrink-0`}),(0,g.jsx)(`span`,{className:`font-semibold text-foreground`,children:E.name})]})})]}),(0,g.jsxs)(xe,{className:`gap-2 justify-end`,children:[l&&(0,g.jsx)(i.n,{type:`button`,variant:`outline`,onClick:l,disabled:u,children:`Cancel`}),(0,g.jsx)(i.n,{type:`submit`,disabled:u,children:u?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}),`Transferring...`]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Send,{className:`h-4 w-4`}),`Transfer`]})})]})]})]})}var iP=d.createContext(void 0);function aP({children:e,languages:t,defaultLanguage:n=`fr`,s3Config:r,onLanguageChange:i}){let{i18n:a}=(0,U.useTranslation)(),[o,s]=d.useState(n),[c,l]=d.useState(!0),[u,f]=d.useState(new Set),[p,m]=d.useState(!1),h=d.useCallback(async e=>{if(!r)throw Error(`S3 configuration not provided`);let{baseUrl:t,prefix:n=``,extension:i=`json`,headers:a={}}=r,o=`${t.replace(/\/$/,``)}/${n}${e}.${i}`;console.log(`[LanguageProvider] Loading translations from S3: ${o}`);try{let t=await fetch(o,{headers:{Accept:`application/json`,...a}});if(!t.ok)throw Error(`Failed to load translations: ${t.status} ${t.statusText}`);let n=await t.json();return console.log(`[LanguageProvider] ✓ Translations loaded for ${e}`),n}catch(t){throw console.error(`[LanguageProvider] ✗ Error loading translations for ${e}:`,t),t}},[r]);d.useEffect(()=>{p||!a||!r||(async()=>{try{let e=typeof window<`u`?localStorage.getItem(`language`):null,r=e&&t.some(t=>t.code===e)?e:n;console.log(`[LanguageProvider] Initializing with language: ${r}`);let i=await h(r);a.addResourceBundle&&a.addResourceBundle(r,`translation`,i,!0,!0),await a.changeLanguage(r),s(r),f(new Set([r])),m(!0),console.log(`[LanguageProvider] ✓ Initialized with ${r}`)}catch(e){console.error(`[LanguageProvider] Error initializing:`,e),m(!0)}finally{l(!1)}})()},[p,a,r,n,t,h]);let _={currentLanguage:o,languages:t,changeLanguage:d.useCallback(async e=>{if(e!==o){if(!a?.changeLanguage){console.error(`[LanguageProvider] i18next is not initialized`);return}if(!r){console.error(`[LanguageProvider] S3 config not provided`);return}l(!0);try{if(!u.has(e)){console.log(`[LanguageProvider] Loading ${e} from S3...`);let t=await h(e);a.addResourceBundle&&a.addResourceBundle(e,`translation`,t,!0,!0),f(t=>new Set([...t,e]))}await a.changeLanguage(e),s(e),typeof window<`u`&&localStorage.setItem(`language`,e),i?.(e),console.log(`[LanguageProvider] ✓ Language changed to: ${e}`)}catch(e){throw console.error(`[LanguageProvider] ✗ Error changing language:`,e),e}finally{l(!1)}}},[o,u,r,h,a,i]),isLoading:c,loadedLanguages:u};return(0,g.jsx)(iP.Provider,{value:_,children:e})}function oP(){let e=d.useContext(iP);if(!e)throw Error(`useLanguage must be used within a LanguageProvider`);return e}var sP=d.createContext(void 0);function cP({children:e,config:t}){let{defaultTheme:n=`light`,storageKey:r=`waka-ui-theme`,themes:i,enableSystem:a=!0,s3Config:o}=t||{},[s,c]=d.useState(n),[l,u]=d.useState(),[f,p]=d.useState([]),[m,h]=d.useState(!0),[_,v]=d.useState(`fallback`);d.useEffect(()=>{(async()=>{if(h(!0),i&&i.length>0){let e=lP(i);p(e),v(`config`),h(!1),console.log(`[ThemeProvider] Using themes from config:`,e.length);return}if(o?.baseUrl)try{let e=await uP(o.baseUrl);if(e.length>0){p(e),v(`s3`),h(!1),console.log(`[ThemeProvider] Loaded themes from S3:`,e.length);return}}catch(e){console.error(`[ThemeProvider] Failed to load themes from S3:`,e)}p([{id:`light`,label:`Clair`,previewColor:`#3b82f6`},{id:`dark`,label:`Sombre`,previewColor:`#1e293b`}]),v(`fallback`),h(!1),console.log(`[ThemeProvider] Using fallback themes`)})()},[i,o]),d.useEffect(()=>{if(!a)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=e=>{u(e.matches?`dark`:`light`)};return u(e.matches?`dark`:`light`),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[a]),d.useEffect(()=>{if(f.length===0)return;let e=localStorage.getItem(r),t=f.map(e=>e.id);e&&t.includes(e)&&c(e)},[r,f]),d.useEffect(()=>{if(f.length===0)return;let e=document.documentElement,t=s===`system`&&l?l:s;f.forEach(t=>e.classList.remove(t.id)),e.classList.add(t),e.setAttribute(`data-theme`,t),process.env.NODE_ENV===`development`&&console.log(`[WakaUI] Theme applied: ${t}`)},[s,l,f]);let y=d.useCallback(e=>{let t=f.map(e=>e.id);if(!t.includes(e)&&e!==`system`){console.warn(`[WakaUI] Theme "${e}" is not in the list of available themes:`,t);return}c(e),localStorage.setItem(r,e)},[f,r]),b=d.useMemo(()=>({theme:s,setTheme:y,themes:f,systemTheme:l,isLoadingThemes:m,themesSource:_}),[s,y,f,l,m,_]);return(0,g.jsx)(sP.Provider,{value:b,children:e})}function lP(e){return e.length===0?[]:typeof e[0]==`string`?e.map(e=>({id:e,label:dP(e),previewColor:fP(e)})):e}async function uP(e){try{let e=await fetch(`/api/themes/list`,{cache:`no-store`});if(!e.ok)throw Error(`HTTP ${e.status}`);return(await e.json()).themes||[]}catch(e){return console.error(`[ThemeProvider] Failed to fetch themes from S3:`,e),[]}}function dP(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function fP(e){return{light:`#3b82f6`,dark:`#1e293b`,forest:`#10b981`,sunset:`#f59e0b`,twilight:`#8b5cf6`,monochrome:`#6b7280`,perpetuity:`#ec4899`}[e]||`#3b82f6`}function pP(){let e=d.useContext(sP);if(!e)throw Error(`useTheme must be used within a ThemeProvider`);return e}function mP({children:e,config:t}){let[n]=d.useState(()=>K.default.createInstance()),[r,i]=d.useState(!1);return d.useEffect(()=>{(async()=>{try{await n.use(U.initReactI18next).init({lng:t.language.defaultLanguage,fallbackLng:t.language.defaultLanguage,supportedLngs:t.language.supportedLanguages,resources:t.language.resources||{},interpolation:{escapeValue:!1},react:{useSuspense:!1},debug:t.debug}),t.language.s3Config&&await hP(n,t.language.s3Config,t.language.supportedLanguages),i(!0),t.debug&&console.log(`[WakaUI] i18n initialized successfully`)}catch(e){console.error(`[WakaUI] Failed to initialize i18n:`,e),i(!0)}})()},[n,t]),d.useEffect(()=>{if(!r)return;let e=t.language.storageKey||`waka-ui-language`,i=localStorage.getItem(e);i&&t.language.supportedLanguages.includes(i)&&n.changeLanguage(i);let a=n=>{localStorage.setItem(e,n),t.debug&&console.log(`[WakaUI] Language changed to: ${n}`)};return n.on(`languageChanged`,a),()=>{n.off(`languageChanged`,a)}},[r,n,t]),r?(0,g.jsx)(U.I18nextProvider,{i18n:n,children:(0,g.jsx)(aP,{languages:t.language.languages||[],defaultLanguage:t.language.defaultLanguage,s3Config:t.language.s3Config?{baseUrl:t.language.s3Config.bucketUrl,prefix:t.language.s3Config.translationsPath?`${t.language.s3Config.translationsPath}/`:``,extension:`json`}:void 0,children:(0,g.jsx)(wr,{themes:t.theme?.themes||[{id:`default`,label:`Default`}],defaultTheme:t.theme?.defaultTheme||`default`,s3Config:t.theme?.s3Config,enableDarkMode:t.theme?.enableSystem,children:e})})}):(0,g.jsx)(`div`,{style:{padding:`20px`,textAlign:`center`},children:`Loading WakaUI...`})}async function hP(e,t,n){if(!t)return;let{bucketUrl:r,translationsPath:i=`translations`}=t;try{await Promise.all(n.map(async t=>{try{let n=`${r}/${i}/${t}.json`,a=await fetch(n);if(!a.ok){console.warn(`[WakaUI] Failed to load translations for ${t} from S3`);return}let o=await a.json();e.addResourceBundle(t,`translation`,o,!0,!0),process.env.NODE_ENV===`development`&&console.log(`[WakaUI] Loaded translations for ${t} from S3`)}catch(e){console.warn(`[WakaUI] Error loading translations for ${t}:`,e)}}))}catch(e){console.error(`[WakaUI] Error loading translations from S3:`,e)}}function gP(){let{i18n:e,t}=(0,U.useTranslation)(),n=oP(),r=Er();return{currentLanguage:e.language||n.currentLanguage,changeLanguage:async t=>{await n.changeLanguage(t),await e.changeLanguage(t)},languages:n.languages,isLanguageLoading:n.isLoading,currentTheme:r.currentTheme,changeTheme:r.changeTheme,themes:r.themes,isThemeLoading:r.isLoading,preloadTheme:r.preloadTheme,isThemeLoaded:r.isThemeLoaded,t}}var _P=d.createContext(void 0);function vP({children:e,initialSelection:t,onSelectionChange:n,persistKey:r=`admincrumb-selection`}){let[i,a]=d.useState(()=>{if(typeof window<`u`&&r){let e=localStorage.getItem(r);if(e)try{return JSON.parse(e)}catch(e){console.error(`Failed to parse stored admincrumb selection`,e)}}return t||{}});d.useEffect(()=>{typeof window<`u`&&r&&localStorage.setItem(r,JSON.stringify(i))},[i,r]),d.useEffect(()=>{n?.(i)},[i,n]);let o=d.useCallback(e=>{a({partner:e,network:void 0,customer:void 0})},[]),s=d.useCallback(e=>{a(t=>({...t,network:e,customer:void 0}))},[]),c=d.useCallback(e=>{a(t=>({...t,customer:e}))},[]),l=d.useCallback(()=>{a({})},[]),u=d.useMemo(()=>!!(i.partner||i.network||i.customer),[i]),f=d.useCallback(()=>({...i.partner?.id&&{partnerId:i.partner.id},...i.network?.id&&{networkId:i.network.id},...i.customer?.id&&{customerId:i.customer.id}}),[i]),p=d.useMemo(()=>({selection:i,setPartner:o,setNetwork:s,setCustomer:c,reset:l,isFiltered:u,getFilterQuery:f}),[i,o,s,c,l,u,f]);return(0,g.jsx)(_P.Provider,{value:p,children:e})}function yP(){let e=d.useContext(_P);if(!e)throw Error(`useAdmincrumbContext must be used within AdmincrumbProvider`);return e}function bP(){return d.useContext(_P)}var xP={github:p.Github,twitter:p.Twitter,linkedin:p.Linkedin,email:p.Mail};function SP({columns:e=[],socialLinks:n=[],copyright:r=`© 2024 Tous droits réservés.`,className:a}){return(0,g.jsx)(`footer`,{className:t.t(`bg-muted/40`,a),children:(0,g.jsxs)(`div`,{className:`container mx-auto px-4 py-12`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4`,children:[e.map((e,t)=>(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.title}),(0,g.jsx)(`ul`,{className:`space-y-2`,children:e.links.map((e,t)=>(0,g.jsx)(`li`,{children:(0,g.jsx)(`a`,{href:e.href,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:e.label})},t))})]},t)),n.length>0&&(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Suivez-nous`}),(0,g.jsx)(`div`,{className:`flex space-x-4`,children:n.map((e,t)=>{let n=xP[e.platform];return(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-8 w-8`,children:(0,g.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e.platform,children:(0,g.jsx)(n,{className:`h-4 w-4`})})},t)})})]})]}),(0,g.jsx)(i.t,{className:`my-8`}),(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-between space-y-4 md:flex-row md:space-y-0`,children:[(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}),(0,g.jsxs)(`div`,{className:`flex space-x-6`,children:[(0,g.jsx)(`a`,{href:`/privacy`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:`Politique de confidentialité`}),(0,g.jsx)(`a`,{href:`/terms`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:`Conditions d'utilisation`})]})]})]})})}function CP({items:e,defaultActiveId:n,variant:r=`default`,size:i=`md`,className:a,onTabChange:o}){let[s,c]=d.useState(n||e[0]?.id||``),l=e=>{c(e),o?.(e)},u={sm:`h-8 px-3 text-sm`,md:`h-10 px-4 text-sm`,lg:`h-12 px-6 text-base`};return(0,g.jsx)(`div`,{className:t.t(`w-full`,a),children:(0,g.jsxs)(yr,{value:s,onValueChange:l,children:[(0,g.jsx)(br,{className:t.t(`grid w-full`,r===`pills`&&`grid-cols-auto`,r!==`pills`&&`grid-cols-${e.length}`,{default:`bg-background`,pills:`bg-muted rounded-full`,underline:`bg-transparent border-b-2 border-transparent data-[state=active]:border-primary`}[r]),children:e.map(e=>(0,g.jsx)(xr,{value:e.id,disabled:e.disabled,className:t.t(u[i],r===`underline`&&`rounded-none border-b-2 border-transparent data-[state=active]:border-primary`,r===`pills`&&`rounded-full`),children:e.label},e.id))}),e.map(e=>(0,g.jsx)(Sr,{value:e.id,className:`mt-6`,children:e.content},e.id))]})})}function wP({items:e,separator:n=`/`,className:r}){return(0,g.jsx)(`nav`,{className:t.t(`flex items-center space-x-1 text-sm text-muted-foreground`,r),children:e.map((e,t)=>(0,g.jsxs)(d.Fragment,{children:[t>0&&(0,g.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:n}),e.href?(0,g.jsx)(`a`,{href:e.href,className:`hover:text-foreground transition-colors`,children:e.label}):(0,g.jsx)(`span`,{className:`text-foreground font-medium`,children:e.label})]},t))})}function TP({variant:e=`dropdown`,showFlags:n=!0,className:r}){let{currentLanguage:o,languages:s,changeLanguage:c,isLoading:l}=oP(),u=s.find(e=>e.code===o);return e===`select`?(0,g.jsxs)(a.d,{value:o,onValueChange:c,disabled:l,children:[(0,g.jsx)(a.y,{className:t.t(`w-[180px]`,r),children:(0,g.jsxs)(a.b,{children:[n&&u?.flagEmoji&&(0,g.jsx)(`span`,{className:`mr-2`,children:u.flagEmoji}),u?.label]})}),(0,g.jsx)(a.f,{children:s.map(e=>(0,g.jsxs)(a.m,{value:e.code,children:[n&&e.flagEmoji&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.flagEmoji}),e.label]},e.code))})]}):(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,className:t.t(`gap-2`,r),disabled:l,children:[(0,g.jsx)(p.Globe,{className:`h-4 w-4`}),n&&u?.flagEmoji&&(0,g.jsx)(`span`,{children:u.flagEmoji}),u?.label]})}),(0,g.jsx)(nn,{align:`end`,children:s.map(e=>(0,g.jsxs)($,{onClick:()=>c(e.code),className:`cursor-pointer`,children:[n&&e.flagEmoji&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.flagEmoji}),e.label]},e.code))})]})}function EP({children:e,header:n,sidebar:r,footer:a,collapsible:o=!1,className:s}){let[c,l]=d.useState(!1);return(0,g.jsxs)(`div`,{className:t.t(`min-h-screen bg-background`,s),children:[n&&(0,g.jsx)(`header`,{className:`sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,g.jsxs)(`div`,{className:`container flex h-14 max-w-screen-2xl items-center`,children:[o&&r&&(0,g.jsxs)(Qn,{open:c,onOpenChange:l,children:[(0,g.jsx)($n,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`ghost`,size:`icon`,className:`md:hidden`,children:[(0,g.jsx)(p.Menu,{className:`h-5 w-5`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Ouvrir le menu`})]})}),(0,g.jsx)(ir,{side:`left`,className:`w-72 p-0`,children:(0,g.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between p-4`,children:[(0,g.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Navigation`}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:()=>l(!1),children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]}),(0,g.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:r})]})})]}),n]})}),(0,g.jsxs)(`div`,{className:`flex`,children:[r&&!o&&(0,g.jsx)(`aside`,{className:`hidden w-64 border-r bg-muted/40 md:block`,children:(0,g.jsx)(`div`,{className:`h-full overflow-y-auto p-4`,children:r})}),(0,g.jsx)(`main`,{className:`flex-1`,children:(0,g.jsx)(`div`,{className:`container mx-auto p-4`,children:e})})]}),a&&(0,g.jsx)(`footer`,{className:`border-t bg-muted/40`,children:(0,g.jsx)(`div`,{className:`container mx-auto p-4`,children:a})})]})}function DP({config:e,onSubmit:n,onForgotPassword:r,onSignUp:a,onSSOGoogle:c,onSSOMicrosoft:l,onSSOApple:u,onSSOLinkedIn:f,onSSOGithub:m,onSSOFacebook:h,onSSOInstagram:_,onSSOFranceConnect:v,showSocialLogin:y=!1,className:b}){let x=!1;try{x=Er().isDarkMode}catch{}let S=e?.theme_json?.dark_mode??x,[C,w]=d.useState({email:``,password:``,rememberMe:!1}),[T,E]=d.useState(!1),D=d.useMemo(()=>e?.assets?S?e.assets.theme_logo_dark:e.assets.theme_logo_light:null,[e?.assets,S]),O=d.useMemo(()=>e?.color_json?{"--login-primary":e.color_json.primary,"--login-secondary":e.color_json.secondary,"--login-accent":e.color_json.accent}:{},[e?.color_json]),k=d.useMemo(()=>{let t=[];if(!e?.signup_options)return y&&(m&&t.push({id:`github`,label:`GitHub`,icon:(0,g.jsx)(p.Github,{className:`h-4 w-4`}),onClick:m}),c&&t.push({id:`google`,label:`Google`,icon:(0,g.jsx)(p.Mail,{className:`h-4 w-4`}),onClick:c})),t;let n=e.signup_options;return n.allow_sso_google&&t.push({id:`google`,label:`Google`,icon:(0,g.jsx)(p.Mail,{className:`h-4 w-4`}),onClick:c}),n.allow_sso_microsoft&&t.push({id:`microsoft`,label:`Microsoft`,icon:(0,g.jsx)(p.Mail,{className:`h-4 w-4`}),onClick:l}),n.allow_sso_apple&&t.push({id:`apple`,label:`Apple`,icon:(0,g.jsx)(p.Apple,{className:`h-4 w-4`}),onClick:u}),n.allow_sso_linkedIn&&t.push({id:`linkedin`,label:`LinkedIn`,icon:(0,g.jsx)(p.Linkedin,{className:`h-4 w-4`}),onClick:f}),n.allow_sso_github&&t.push({id:`github`,label:`GitHub`,icon:(0,g.jsx)(p.Github,{className:`h-4 w-4`}),onClick:m}),n.allow_sso_facebook&&t.push({id:`facebook`,label:`Facebook`,icon:(0,g.jsx)(p.Facebook,{className:`h-4 w-4`}),onClick:h}),n.allow_sso_instagram&&t.push({id:`instagram`,label:`Instagram`,icon:(0,g.jsx)(p.Instagram,{className:`h-4 w-4`}),onClick:_}),n.allow_sso_france_connect&&t.push({id:`france-connect`,label:`France Connect`,icon:(0,g.jsx)(p.Mail,{className:`h-4 w-4`}),onClick:v}),t},[e?.signup_options,y,c,l,u,f,m,h,_,v]),A=e?.signup_options?.allow_login!==!1,j=async e=>{e.preventDefault(),E(!0);try{await n?.(C)}finally{E(!1)}},M=e=>t=>{w(n=>({...n,[e]:e===`rememberMe`?t.target.checked:t.target.value}))};return(0,g.jsx)(`div`,{className:t.t(`flex items-center justify-center p-4`,b),style:O,children:(0,g.jsxs)(Y,{className:`w-full max-w-md`,children:[(0,g.jsxs)(X,{className:`space-y-1`,children:[D&&(0,g.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,g.jsx)(`img`,{src:D,alt:e?.theme_json?.name||`Logo`,className:`max-h-16 max-w-full object-contain`})}),(0,g.jsx)(Z,{className:`text-2xl text-center`,children:`Connexion`}),(0,g.jsx)(be,{className:`text-center`,children:`Entrez vos identifiants pour accéder à votre compte`})]}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[k.length>0&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:t.t(`grid gap-4`,k.length===1?`grid-cols-1`:`grid-cols-2`),children:k.map(e=>(0,g.jsxs)(i.n,{variant:`outline`,className:`w-full`,onClick:e.onClick,type:`button`,children:[e.icon,e.label]},e.id))}),A&&(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,g.jsx)(i.t,{className:`w-full`})}),(0,g.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,g.jsx)(`span`,{className:`bg-background px-2 text-muted-foreground`,children:`Ou continuez avec`})})]})]}),A&&(0,g.jsxs)(`form`,{onSubmit:j,className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`email`,children:`Email`}),(0,g.jsx)(s.t,{id:`email`,type:`email`,placeholder:`votre@email.com`,value:C.email,onChange:M(`email`),required:!0})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`password`,children:`Mot de passe`}),(0,g.jsx)(s.t,{id:`password`,type:`password`,placeholder:`••••••••`,value:C.password,onChange:M(`password`),required:!0})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,g.jsx)(`input`,{id:`remember`,type:`checkbox`,checked:C.rememberMe,onChange:M(`rememberMe`),className:`h-4 w-4 rounded border-gray-300`}),(0,g.jsx)(o.n,{htmlFor:`remember`,className:`text-sm`,children:`Se souvenir de moi`})]}),r&&(0,g.jsx)(i.n,{type:`button`,variant:`link`,className:`px-0 text-sm`,onClick:r,children:`Mot de passe oublié ?`})]}),(0,g.jsx)(i.n,{type:`submit`,className:`w-full`,disabled:T,style:e?.color_json?.primary?{backgroundColor:e.color_json.primary,color:e.color_json.secondary}:void 0,children:T?`Connexion...`:`Se connecter`})]}),a&&(0,g.jsxs)(`div`,{className:`text-center text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Pas encore de compte ? `}),(0,g.jsx)(i.n,{type:`button`,variant:`link`,className:`px-0 text-sm`,onClick:a,children:`S'inscrire`})]}),e?.waka_powered&&(0,g.jsx)(`div`,{className:`text-center text-xs text-muted-foreground mt-4 pt-4 border-t`,children:`Powered by Waka`})]})]})})}var OP=d.createContext(null);function kP(){let e=d.useContext(OP);if(!e)throw Error(`Sidebar components must be used within WakaSidebar`);return e}function AP({config:e}){let{LinkComponent:t}=kP(),n=e.component?e.component:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.src&&(0,g.jsx)(`img`,{src:e.src,alt:e.alt||`Logo`,className:`h-8 w-auto object-contain`}),e.title&&(0,g.jsx)(`span`,{className:`text-lg font-bold tracking-wide`,children:e.title})]});return e.href?t?(0,g.jsx)(t,{href:e.href,className:`block`,onClick:e.onClick,children:n}):(0,g.jsx)(`a`,{href:e.href,className:`block`,onClick:e.onClick,children:n}):e.onClick?(0,g.jsx)(`button`,{type:`button`,onClick:e.onClick,className:`block text-left`,children:n}):(0,g.jsx)(`div`,{children:n})}function jP({item:e,isChild:n=!1,renderItem:r}){let{activeId:i,setActiveId:a,expandedIds:o,toggleExpanded:s,isMobile:c,closeOnNavigate:l,onClose:u,LinkComponent:d}=kP(),f=e.children&&e.children.length>0,m=o.includes(e.id),h=i===e.id||e.active,_=()=>{e.disabled||(f?s(e.id):(a(e.id),e.onClick?.(),c&&l&&u()))};if(r)return(0,g.jsx)(g.Fragment,{children:r(e,n)});let v=(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200`,`hover:bg-white/10`,h&&!f&&`bg-sidebar-active text-sidebar-active-foreground`,n&&`ml-6 text-[13px]`,e.disabled&&`opacity-50 cursor-not-allowed`),children:[e.icon&&(0,g.jsx)(`span`,{className:t.t(`flex-shrink-0`,n?`h-4 w-4`:`h-5 w-5`),children:e.icon}),(0,g.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.badge!==void 0&&(0,g.jsx)(`span`,{className:`ml-auto flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold text-primary-foreground`,children:e.badge}),f&&(0,g.jsx)(p.ChevronDown,{className:t.t(`h-4 w-4 transition-transform duration-200`,m&&`rotate-180`)})]});if(f)return(0,g.jsxs)(dt,{open:m,onOpenChange:()=>s(e.id),children:[(0,g.jsx)(ft,{asChild:!0,children:(0,g.jsx)(`button`,{type:`button`,className:`w-full text-left`,disabled:e.disabled,children:v})}),(0,g.jsx)(pt,{className:`space-y-1 pt-1`,children:e.children?.map(e=>(0,g.jsx)(jP,{item:e,isChild:!0,renderItem:r},e.id))})]});if(e.href){let t={href:e.href,className:`block`,onClick:t=>{if(e.disabled){t.preventDefault();return}_()}};return d?(0,g.jsx)(d,{...t,children:v}):(0,g.jsx)(`a`,{...t,children:v})}return(0,g.jsx)(`button`,{type:`button`,className:`w-full text-left`,disabled:e.disabled,onClick:_,children:v})}function MP({config:e}){let{LinkComponent:r}=kP(),i=e.initials||e.name.split(` `).map(e=>e[0]).join(``).slice(0,2).toUpperCase(),a=[{id:`profile`,label:`Profil`,icon:(0,g.jsx)(p.User,{className:`h-4 w-4`})},{id:`settings`,label:`Paramètres`,icon:(0,g.jsx)(p.Settings,{className:`h-4 w-4`})},{id:`logout`,label:`Déconnexion`,icon:(0,g.jsx)(p.LogOut,{className:`h-4 w-4`}),variant:`destructive`}],o=e.actions??a;return(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-lg p-2 text-left transition-colors hover:bg-white/10`,children:[(0,g.jsxs)(n.m,{className:`h-10 w-10 border-2 border-sidebar-active`,children:[(0,g.jsx)(n.g,{src:e.avatarUrl,alt:e.name}),(0,g.jsx)(n.h,{className:`bg-sidebar-active text-sidebar-active-foreground text-sm font-medium`,children:i})]}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.name}),e.email&&(0,g.jsx)(`p`,{className:`text-xs text-sidebar-foreground/70 truncate`,children:e.email})]}),(0,g.jsx)(p.ChevronDown,{className:`h-4 w-4 flex-shrink-0 opacity-70`})]})}),(0,g.jsx)(nn,{align:`end`,className:`w-56`,children:o.map((e,n)=>(0,g.jsxs)(d.Fragment,{children:[e.variant===`destructive`&&n>0&&(0,g.jsx)(sn,{}),(0,g.jsx)($,{onClick:e.onClick,className:t.t(e.variant===`destructive`&&`text-destructive focus:text-destructive`),asChild:!!e.href,children:e.href?r?(0,g.jsxs)(r,{href:e.href,className:`flex items-center gap-2`,children:[e.icon,e.label]}):(0,g.jsxs)(`a`,{href:e.href,className:`flex items-center gap-2`,children:[e.icon,e.label]}):(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,e.label]})})]},e.id))})]})}function NP({logo:e,menu:t,user:r,userPosition:i=`bottom`,header:a,footer:o,renderItem:s}){return(0,g.jsxs)(`div`,{className:`flex h-full flex-col`,children:[e&&(0,g.jsx)(`div`,{className:`flex-shrink-0 p-4 pb-2`,children:(0,g.jsx)(AP,{config:e})}),a&&(0,g.jsx)(`div`,{className:`flex-shrink-0 px-4 py-2`,children:a}),r&&i===`top`&&(0,g.jsx)(`div`,{className:`flex-shrink-0 px-3 py-2 border-b border-white/10`,children:(0,g.jsx)(MP,{config:r})}),(0,g.jsx)(n.f,{className:`flex-1 px-3 py-4`,children:(0,g.jsx)(`nav`,{className:`space-y-1`,children:t.map(e=>(0,g.jsx)(jP,{item:e,renderItem:s},e.id))})}),o&&(0,g.jsx)(`div`,{className:`flex-shrink-0 px-4 py-2 border-t border-white/10`,children:o}),r&&i===`bottom`&&(0,g.jsx)(`div`,{className:`flex-shrink-0 p-3 border-t border-white/10`,children:(0,g.jsx)(MP,{config:r})})]})}function PP({logo:e,menu:n,user:r,width:a=260,mobileBreakpoint:o=768,open:s,onOpenChange:c,className:l,contentClassName:u,backgroundColor:f,textColor:m,activeColor:h,hoverColor:_,userPosition:v=`bottom`,showHamburger:y=!0,hamburgerPosition:b=`left`,renderItem:x,footer:S,header:C,position:w=`fixed`,LinkComponent:T}){let[E,D]=d.useState(!1),O=s!==void 0,k=O?s:E,A=O?c:D,[j,M]=d.useState(!1);d.useEffect(()=>{let e=()=>{M(window.innerWidth<o)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]);let[N,P]=d.useState(()=>{let e=t=>{for(let n of t){if(n.active)return n.id;if(n.children){let t=e(n.children);if(t)return t}}return null};return e(n)}),[F,I]=d.useState(()=>{let e=(t,n=[])=>{for(let r of t){if(r.active)return n;if(r.children){let t=e(r.children,[...n,r.id]);if(t.length>n.length)return t}}return[]};return e(n)}),L={activeId:N,setActiveId:P,expandedIds:F,toggleExpanded:d.useCallback(e=>{I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),isMobile:j,closeOnNavigate:!0,onClose:()=>A(!1),LinkComponent:T},R={"--sidebar-bg":f||`hsl(var(--sidebar-background, var(--card)))`,"--sidebar-text":m||`hsl(var(--sidebar-foreground, var(--muted-foreground)))`,"--sidebar-active":h||`hsl(var(--sidebar-primary, var(--primary)))`,"--sidebar-active-foreground":`hsl(var(--sidebar-primary-foreground, var(--primary-foreground)))`,"--sidebar-hover":_||`hsl(var(--sidebar-accent, var(--accent)))`},z=t.t(`bg-[var(--sidebar-bg)] text-[var(--sidebar-text)]`,`[&_.bg-sidebar-active]:bg-[var(--sidebar-active)]`,`[&_.text-sidebar-active-foreground]:text-[var(--sidebar-active-foreground)]`,`[&_.text-sidebar-foreground\\/70]:text-[var(--sidebar-text)]`,`[&_.text-sidebar-foreground\\/70]:opacity-70`,`[&_.border-sidebar-active]:border-[var(--sidebar-active)]`,u),B=(0,g.jsx)(OP.Provider,{value:L,children:(0,g.jsx)(`div`,{className:t.t(`h-full`,z),style:R,children:(0,g.jsx)(NP,{logo:e,menu:n,user:r,userPosition:v,header:C,footer:S,renderItem:x})})});return(0,g.jsxs)(g.Fragment,{children:[y&&j&&(0,g.jsxs)(i.n,{variant:`ghost`,size:`icon`,className:t.t(`fixed top-3 z-50`,b===`left`?`left-3`:`right-3`),onClick:()=>A(!0),children:[(0,g.jsx)(p.Menu,{className:`h-6 w-6`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Ouvrir le menu`})]}),!j&&(0,g.jsx)(`aside`,{className:t.t(w===`fixed`?`fixed left-0 top-0 h-screen z-40`:`relative h-full`,l),style:{width:a},children:B}),j&&(0,g.jsx)(Qn,{open:k,onOpenChange:A,children:(0,g.jsxs)(ir,{side:`left`,className:t.t(`w-[280px] p-0 border-0`,l),style:R,"aria-describedby":`sidebar-description`,children:[(0,g.jsx)(sr,{className:`sr-only`,children:`Menu de navigation`}),(0,g.jsx)(cr,{id:`sidebar-description`,className:`sr-only`,children:`Menu principal de l'application`}),B]})})]})}function FP(){let[e,t]=d.useState(!1);return{isOpen:e,setIsOpen:t,open:d.useCallback(()=>t(!0),[]),close:d.useCallback(()=>t(!1),[]),toggle:d.useCallback(()=>t(e=>!e),[])}}function IP({sidebar:e,children:n,sidebarWidth:r=260,className:i,contentClassName:a}){let[o,s]=d.useState(!1),c=e.mobileBreakpoint||768;return d.useEffect(()=>{let e=()=>s(window.innerWidth<c);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[c]),(0,g.jsxs)(`div`,{className:t.t(`min-h-screen bg-background`,i),children:[(0,g.jsx)(PP,{...e,width:r}),(0,g.jsx)(`main`,{className:t.t(`min-h-screen transition-all duration-300`,a),style:{marginLeft:o?0:r},children:n})]})}t.n();function LP({title:e,subtitle:o,showSearch:c=!0,searchPlaceholder:l=`Rechercher...`,searchValue:u,onSearchChange:f,onSearchSubmit:m,primaryAction:h,secondaryActions:_,filters:v,notifications:y,unreadCount:b=0,onNotificationsClick:x,userMenu:S,leftContent:C,rightContent:w,filterContent:T,className:E,mainBarClassName:D,filterBarClassName:O,sticky:k=!0}){let[A,j]=d.useState(u||``),M=e=>{let t=e.target.value;j(t),f?.(t)},N=e=>{e.key===`Enter`&&m?.(A)},P=v&&v.length>0||T;return(0,g.jsxs)(`header`,{className:t.t(`w-full bg-background border-b`,k&&`sticky top-0 z-50`,E),children:[(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-4 px-4 py-2 min-h-[56px]`,D),children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[h&&(0,g.jsxs)(i.n,{variant:h.variant||`default`,size:`sm`,onClick:h.onClick,className:`gap-2`,children:[h.icon||(0,g.jsx)(p.Plus,{className:`h-4 w-4`}),h.label]}),c&&(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{type:`search`,placeholder:l,value:A,onChange:M,onKeyDown:N,className:`pl-9 w-[200px] h-9 bg-muted/50`})]}),C]}),(e||o)&&(0,g.jsxs)(`div`,{className:`flex-1 text-center`,children:[e&&(0,g.jsx)(`h1`,{className:`text-lg font-semibold leading-none`,children:e}),o&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:o})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0 ml-auto`,children:[_?.map(e=>(0,g.jsxs)(i.n,{variant:e.variant||`ghost`,size:`sm`,onClick:e.onClick,className:`gap-2`,children:[e.icon,e.label]},e.id)),w,(y||x)&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`ghost`,size:`icon`,className:`relative`,onClick:y?void 0:x,children:[(0,g.jsx)(p.Bell,{className:`h-5 w-5`}),b>0&&(0,g.jsx)(r.t,{variant:`destructive`,className:`absolute -top-1 -right-1 h-5 w-5 p-0 flex items-center justify-center text-xs`,children:b>9?`9+`:b})]})}),y&&y.length>0&&(0,g.jsxs)(nn,{align:`end`,className:`w-80`,children:[(0,g.jsx)(`div`,{className:`p-2 font-semibold border-b`,children:`Notifications`}),y.slice(0,5).map(e=>(0,g.jsxs)($,{onClick:e.onClick,className:t.t(`flex flex-col items-start gap-1 p-3`,!e.read&&`bg-muted/50`),children:[(0,g.jsx)(`div`,{className:`font-medium`,children:e.title}),e.description&&(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.description}),e.time&&(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.time})]},e.id))]})]}),S&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`ghost`,size:`sm`,className:`gap-2`,children:[(0,g.jsxs)(n.m,{className:`h-7 w-7`,children:[S.avatar&&(0,g.jsx)(n.g,{src:S.avatar,alt:S.name}),(0,g.jsx)(n.h,{className:`text-xs`,children:S.initials||S.name.slice(0,2).toUpperCase()})]}),(0,g.jsx)(p.ChevronDown,{className:`h-4 w-4`})]})}),(0,g.jsxs)(nn,{align:`end`,className:`w-56`,children:[(0,g.jsxs)(`div`,{className:`p-2`,children:[(0,g.jsx)(`p`,{className:`font-medium`,children:S.name}),S.email&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.email})]}),(0,g.jsx)(sn,{}),S.items.map((e,t)=>e.separator?(0,g.jsx)(sn,{},t):(0,g.jsxs)($,{onClick:e.onClick,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]},t))]})]})]})]}),P&&(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-2 px-4 py-2 border-t bg-muted/30`,O),children:[v?.map(e=>(0,g.jsxs)(a.d,{value:e.value,onValueChange:e.onChange,children:[(0,g.jsxs)(a.y,{className:`w-auto h-8 gap-2 bg-muted/50 border-0`,children:[e.icon,(0,g.jsx)(a.b,{placeholder:e.placeholder||e.label})]}),(0,g.jsx)(a.f,{children:e.options.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]},e.id)),T]})]})}var RP=d.createContext({});function zP(){return d.useContext(RP)}function BP({title:e=`Tableau de bord`,description:n,period:r,onPeriodChange:a,periods:o=[{value:`today`,label:`Aujourd'hui`},{value:`week`,label:`Cette semaine`},{value:`month`,label:`Ce mois`},{value:`year`,label:`Cette année`}],onRefresh:s,loading:c,quickActions:l}){return(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),n&&(0,g.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:n})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[a&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,children:[(0,g.jsx)(p.Calendar,{className:`mr-2 h-4 w-4`}),o.find(e=>e.value===r)?.label||`Période`]})}),(0,g.jsx)(nn,{align:`end`,children:o.map(e=>(0,g.jsx)($,{onClick:()=>a(e.value),className:t.t(r===e.value&&`bg-muted`),children:e.label},e.value))})]}),s&&(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:s,disabled:c,children:(0,g.jsx)(p.RefreshCw,{className:t.t(`h-4 w-4`,c&&`animate-spin`)})}),l?.map(e=>{let{LinkComponent:t}=zP();return(0,g.jsx)(i.n,{variant:e.variant||`default`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?t?(0,g.jsxs)(t,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(g.Fragment,{children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},e.id)})]})]})}function VP({stats:e,layout:t=`grid`,columns:n=4,loading:r}){return(0,g.jsx)(Io,{layout:t,columns:n,gap:`md`,children:e.map(e=>(0,g.jsx)(Fo,{label:e.label,value:e.value,trend:e.trend,trendValue:e.trendValue,trendText:e.trendText,icon:e.icon,color:e.color,variant:`card`,loading:r},e.id))})}function HP({config:e}){return(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,g.jsx)(be,{children:e.description})]}),e.actions&&e.actions.length>0&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsx)(nn,{align:`end`,children:e.actions.map((e,t)=>(0,g.jsx)($,{onClick:e.onClick,children:e.label},t))})]})]}),(0,g.jsx)(Q,{children:e.chart})]})}function UP({config:e}){let{LinkComponent:t}=zP();return(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,g.jsx)(be,{children:e.description})]}),e.actions&&e.actions.length>0&&(0,g.jsx)(`div`,{className:`flex gap-2`,children:e.actions.map((e,n)=>(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?t?(0,g.jsxs)(t,{href:e.href,children:[e.label,(0,g.jsx)(p.ArrowUpRight,{className:`ml-1 h-3 w-3`})]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.label,(0,g.jsx)(p.ArrowUpRight,{className:`ml-1 h-3 w-3`})]}):e.label},n))})]}),(0,g.jsx)(Q,{children:e.table})]})}function WP({activities:e}){let n=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24);return r<1?`À l'instant`:r<60?`Il y a ${r} min`:i<24?`Il y a ${i}h`:a<7?`Il y a ${a}j`:t.toLocaleDateString(`fr-FR`)},r={info:`bg-blue-500`,success:`bg-green-500`,warning:`bg-yellow-500`,error:`bg-red-500`};return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsx)(Z,{className:`text-base`,children:`Activité récente`})}),(0,g.jsx)(Q,{children:(0,g.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full mt-2 flex-shrink-0`,r[e.type||`info`])}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),e.description&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0`,children:n(e.timestamp)})]},e.id))})})]})}function GP({title:e=`Tableau de bord`,description:n,stats:r,charts:i,tables:a,activities:o,quickActions:s,showHeader:c=!0,onRefresh:l,loading:u=!1,period:f=`month`,onPeriodChange:p,periods:m,statsLayout:h=`grid`,statsColumns:_=4,className:v,LinkComponent:y}){let b=d.useMemo(()=>({LinkComponent:y}),[y]);return(0,g.jsx)(RP.Provider,{value:b,children:(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,v),children:[c&&(0,g.jsx)(BP,{title:e,description:n,period:f,onPeriodChange:p,periods:m,onRefresh:l,loading:u,quickActions:s}),r&&r.length>0&&(0,g.jsx)(VP,{stats:r,layout:h,columns:_,loading:u}),i&&i.length>0&&(0,g.jsx)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:i.map(e=>(0,g.jsx)(HP,{config:e},e.id))}),(0,g.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3`,children:[a&&a.length>0&&(0,g.jsx)(`div`,{className:t.t(`space-y-6`,o?`lg:col-span-2`:`lg:col-span-3`),children:a.map(e=>(0,g.jsx)(UP,{config:e},e.id))}),o&&o.length>0&&(0,g.jsx)(`div`,{className:t.t(!a||a.length===0?`lg:col-span-3`:``),children:(0,g.jsx)(WP,{activities:o})})]})]})})}var KP=[{id:`revenue`,label:`Revenus`,value:`€45,231.89`,trend:`up`,trendValue:`+20.1%`,trendText:`vs mois dernier`,icon:(0,g.jsx)(p.DollarSign,{className:`h-5 w-5`}),color:`success`},{id:`users`,label:`Utilisateurs`,value:`2,350`,trend:`up`,trendValue:`+180`,trendText:`cette semaine`,icon:(0,g.jsx)(p.Users,{className:`h-5 w-5`}),color:`blue`},{id:`orders`,label:`Commandes`,value:`12,234`,trend:`down`,trendValue:`-4.3%`,trendText:`vs mois dernier`,icon:(0,g.jsx)(p.ShoppingCart,{className:`h-5 w-5`}),color:`purple`},{id:`performance`,label:`Performance`,value:`94.2%`,trend:`up`,trendValue:`+2.4%`,icon:(0,g.jsx)(p.Activity,{className:`h-5 w-5`}),color:`primary`}];function qP({field:e,value:t,onChange:n}){let r=e=>{n?.(e)};return e.type===`custom`&&e.customComponent?(0,g.jsx)(`div`,{className:`space-y-2`,children:e.customComponent}):(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(o.n,{htmlFor:e.id,className:`text-sm font-medium`,children:[e.label,e.required&&(0,g.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),e.type===`switch`&&(0,g.jsx)(ur,{id:e.id,checked:t,onCheckedChange:r,disabled:e.disabled})]}),e.description&&e.type!==`switch`&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),e.type===`switch`&&e.description&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),e.type===`text`&&(0,g.jsx)(s.t,{id:e.id,type:`text`,value:t||``,onChange:e=>r(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`email`&&(0,g.jsx)(s.t,{id:e.id,type:`email`,value:t||``,onChange:e=>r(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`password`&&(0,g.jsx)(s.t,{id:e.id,type:`password`,value:t||``,onChange:e=>r(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`textarea`&&(0,g.jsx)(o.t,{id:e.id,value:t||``,onChange:e=>r(e.target.value),placeholder:e.placeholder,disabled:e.disabled,rows:3}),e.type===`select`&&e.options&&(0,g.jsxs)(a.d,{value:t,onValueChange:r,disabled:e.disabled,children:[(0,g.jsx)(a.y,{id:e.id,children:(0,g.jsx)(a.b,{placeholder:e.placeholder||`Sélectionner...`})}),(0,g.jsx)(a.f,{children:e.options.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]})]})}function JP({section:e,values:t,onChange:n}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,g.jsx)(be,{children:e.description})]})]})}),(0,g.jsx)(Q,{className:`space-y-6`,children:e.fields.map((r,a)=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsx)(qP,{field:r,value:t?.[r.id],onChange:e=>n?.(r.id,e)}),a<e.fields.length-1&&(0,g.jsx)(i.t,{className:`my-4`})]},r.id))})]})}function YP({title:e=`Paramètres`,description:n=`Gérez les paramètres de votre compte et de l'application.`,tabs:r,sections:a,useTabs:o=!0,defaultTab:s,values:c={},onChange:l,onSave:u,saving:f=!1,showSaveButton:m=!0,showDeleteAccount:h=!1,onDeleteAccount:_,className:v}){let[y,b]=d.useState(c),[x,S]=d.useState(!1);d.useEffect(()=>{b(c)},[c]);let C=(e,t)=>{b(n=>({...n,[e]:t})),S(!0),l?.(e,t)},w=async()=>{await u?.(y),S(!1)},T=e=>(0,g.jsx)(`div`,{className:`space-y-6`,children:e.map(e=>(0,g.jsx)(JP,{section:e,values:y,onChange:C},e.id))});return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,v),children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),n&&(0,g.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:n})]}),m&&u&&(0,g.jsxs)(i.n,{onClick:w,disabled:f||!x,children:[f?(0,g.jsx)(p.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}):(0,g.jsx)(p.Save,{className:`mr-2 h-4 w-4`}),`Enregistrer`]})]}),o&&r&&r.length>0?(0,g.jsxs)(yr,{defaultValue:s||r[0].id,className:`space-y-6`,children:[(0,g.jsx)(br,{className:`grid w-full grid-cols-2 md:w-auto md:inline-flex`,children:r.map(e=>(0,g.jsxs)(xr,{value:e.id,className:`gap-2`,children:[e.icon,e.label]},e.id))}),r.map(e=>(0,g.jsx)(Sr,{value:e.id,className:`space-y-6`,children:T(e.sections)},e.id))]}):a&&T(a),h&&_&&(0,g.jsxs)(Y,{className:`border-destructive`,children:[(0,g.jsxs)(X,{children:[(0,g.jsxs)(Z,{className:`text-base text-destructive flex items-center gap-2`,children:[(0,g.jsx)(p.Trash2,{className:`h-4 w-4`}),`Zone dangereuse`]}),(0,g.jsx)(be,{children:`Actions irréversibles concernant votre compte.`})]}),(0,g.jsx)(Q,{children:(0,g.jsxs)(re,{children:[(0,g.jsx)(ie,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer mon compte`]})}),(0,g.jsxs)(se,{children:[(0,g.jsxs)(ce,{children:[(0,g.jsx)(ue,{children:`Êtes-vous sûr ?`}),(0,g.jsx)(de,{children:`Cette action est irréversible. Toutes vos données seront définitivement supprimées et ne pourront pas être récupérées.`})]}),(0,g.jsxs)(le,{children:[(0,g.jsx)(pe,{children:`Annuler`}),(0,g.jsx)(fe,{onClick:_,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer définitivement`})]})]})]})})]})]})}var XP=[{id:`profile`,label:`Profil`,icon:(0,g.jsx)(p.User,{className:`h-4 w-4`}),sections:[{id:`personal`,title:`Informations personnelles`,description:`Mettez à jour vos informations personnelles.`,icon:(0,g.jsx)(p.User,{className:`h-5 w-5`}),fields:[{id:`name`,label:`Nom complet`,type:`text`,placeholder:`Jean Dupont`,required:!0},{id:`email`,label:`Adresse email`,type:`email`,placeholder:`jean@exemple.com`,required:!0},{id:`bio`,label:`Bio`,type:`textarea`,placeholder:`Parlez-nous de vous...`}]}]},{id:`notifications`,label:`Notifications`,icon:(0,g.jsx)(p.Bell,{className:`h-4 w-4`}),sections:[{id:`email-notifs`,title:`Notifications par email`,description:`Gérez vos préférences de notification par email.`,icon:(0,g.jsx)(p.Mail,{className:`h-5 w-5`}),fields:[{id:`notif-marketing`,label:`Marketing`,description:`Recevoir des emails marketing et promotionnels.`,type:`switch`},{id:`notif-security`,label:`Sécurité`,description:`Recevoir des alertes de sécurité importantes.`,type:`switch`},{id:`notif-updates`,label:`Mises à jour`,description:`Recevoir les mises à jour de produit.`,type:`switch`}]}]},{id:`security`,label:`Sécurité`,icon:(0,g.jsx)(p.Shield,{className:`h-4 w-4`}),sections:[{id:`password`,title:`Mot de passe`,description:`Changez votre mot de passe.`,icon:(0,g.jsx)(p.Lock,{className:`h-5 w-5`}),fields:[{id:`current-password`,label:`Mot de passe actuel`,type:`password`,placeholder:`••••••••`},{id:`new-password`,label:`Nouveau mot de passe`,type:`password`,placeholder:`••••••••`},{id:`confirm-password`,label:`Confirmer le mot de passe`,type:`password`,placeholder:`••••••••`}]},{id:`two-factor`,title:`Authentification à deux facteurs`,description:`Ajoutez une couche de sécurité supplémentaire.`,icon:(0,g.jsx)(p.Smartphone,{className:`h-5 w-5`}),fields:[{id:`2fa-enabled`,label:`Activer la 2FA`,description:`Utilisez une application d'authentification.`,type:`switch`}]}]},{id:`preferences`,label:`Préférences`,icon:(0,g.jsx)(p.Palette,{className:`h-4 w-4`}),sections:[{id:`appearance`,title:`Apparence`,description:`Personnalisez l'apparence de l'application.`,icon:(0,g.jsx)(p.Palette,{className:`h-5 w-5`}),fields:[{id:`theme`,label:`Thème`,type:`select`,options:[{value:`light`,label:`Clair`},{value:`dark`,label:`Sombre`},{value:`system`,label:`Système`}]},{id:`language`,label:`Langue`,type:`select`,options:[{value:`fr`,label:`Français`},{value:`en`,label:`English`},{value:`es`,label:`Español`}]}]}]}];function ZP({url:e,name:r,size:a=`lg`,editable:o,onAvatarChange:s}){let c=d.useRef(null),l={sm:`h-12 w-12`,md:`h-16 w-16`,lg:`h-24 w-24`,xl:`h-32 w-32`},u=r.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,g.jsxs)(`div`,{className:`relative inline-block`,children:[(0,g.jsxs)(n.m,{className:t.t(l[a],`border-4 border-background shadow-lg`),children:[(0,g.jsx)(n.g,{src:e,alt:r}),(0,g.jsx)(n.h,{className:`text-lg font-medium`,children:u})]}),o&&s&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`input`,{ref:c,type:`file`,accept:`image/*`,onChange:e=>{let t=e.target.files?.[0];t&&s&&s(t)},className:`hidden`}),(0,g.jsx)(i.n,{size:`icon`,variant:`secondary`,className:`absolute bottom-0 right-0 h-8 w-8 rounded-full shadow-md`,onClick:()=>c.current?.click(),children:(0,g.jsx)(p.Camera,{className:`h-4 w-4`})})]})]})}function QP({field:e,value:n,onChange:r,isEditing:i}){if(!i)return(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,g.jsx)(`span`,{className:t.t(!n&&`text-muted-foreground italic`),children:n||`Non renseigné`})]});let c={id:e.id,value:n||``,onChange:e=>r(e.target.value),placeholder:e.placeholder,disabled:e.disabled};return e.type===`textarea`?(0,g.jsx)(o.t,{...c,rows:3}):e.type===`select`&&e.options?(0,g.jsxs)(a.d,{value:n,onValueChange:r,disabled:e.disabled,children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{placeholder:e.placeholder||`Sélectionner...`})}),(0,g.jsx)(a.f,{children:e.options.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]}):(0,g.jsx)(s.t,{type:e.type||`text`,...c})}function $P({section:e,values:t,onChange:n,isEditing:r}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,g.jsx)(be,{children:e.description})]})]})}),(0,g.jsx)(Q,{className:`space-y-4`,children:e.fields.map((a,s)=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(o.n,{htmlFor:a.id,className:`text-sm font-medium`,children:[a.label,a.required&&(0,g.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,g.jsx)(QP,{field:a,value:t[a.id]||``,onChange:e=>n(a.id,e),isEditing:r})]}),s<e.fields.length-1&&r&&(0,g.jsx)(i.t,{className:`my-4`})]},a.id))})]})}function eF({links:e,isEditing:t}){let n=e=>{switch(e){case`twitter`:return(0,g.jsx)(p.Twitter,{className:`h-4 w-4`});case`github`:return(0,g.jsx)(p.Github,{className:`h-4 w-4`});case`linkedin`:return(0,g.jsx)(p.Linkedin,{className:`h-4 w-4`});case`website`:return(0,g.jsx)(p.Globe,{className:`h-4 w-4`});default:return(0,g.jsx)(p.Link,{className:`h-4 w-4`})}};return t?(0,g.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n(e.type),(0,g.jsx)(s.t,{value:e.url,className:`flex-1`,readOnly:!0})]},e.id))}):(0,g.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:e.map(e=>(0,g.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted rounded-full text-sm hover:bg-muted/80 transition-colors`,children:[n(e.type),(0,g.jsx)(`span`,{children:e.label||e.type})]},e.id))})}function tF({profile:e,editable:n=!1,isEditing:r,onEditToggle:a,onChange:o,onSave:s,saving:c=!1,onAvatarChange:l,customSections:u,showSocialLinks:f=!0,showStats:m=!1,stats:h,layout:_=`card`,useTabs:v=!1,className:y}){let[b,x]=d.useState(!1),[S,C]=d.useState(e),w=r??b;d.useEffect(()=>{C(e)},[e]);let T=t=>{a?a(t):x(t),t||C(e)},E=(e,t)=>{C(n=>({...n,[e]:t})),o?.(e,t)},D=async()=>{await s?.(S),T(!1)},O=[{id:`personal`,title:`Informations personnelles`,icon:(0,g.jsx)(p.User,{className:`h-5 w-5`}),fields:[{id:`firstName`,label:`Prénom`,value:S.firstName||``,type:`text`,placeholder:`Jean`,icon:(0,g.jsx)(p.User,{className:`h-4 w-4`})},{id:`lastName`,label:`Nom`,value:S.lastName||``,type:`text`,placeholder:`Dupont`},{id:`email`,label:`Email`,value:S.email,type:`email`,placeholder:`jean@exemple.com`,required:!0,icon:(0,g.jsx)(p.Mail,{className:`h-4 w-4`})},{id:`phone`,label:`Téléphone`,value:S.phone||``,type:`tel`,placeholder:`+33 6 12 34 56 78`,icon:(0,g.jsx)(p.Phone,{className:`h-4 w-4`})},{id:`bio`,label:`Bio`,value:S.bio||``,type:`textarea`,placeholder:`Parlez-nous de vous...`}]},{id:`professional`,title:`Informations professionnelles`,icon:(0,g.jsx)(p.Briefcase,{className:`h-5 w-5`}),fields:[{id:`role`,label:`Poste`,value:S.role||``,type:`text`,placeholder:`Développeur Senior`,icon:(0,g.jsx)(p.Briefcase,{className:`h-4 w-4`})},{id:`department`,label:`Département`,value:S.department||``,type:`text`,placeholder:`Engineering`},{id:`company`,label:`Entreprise`,value:S.company||``,type:`text`,placeholder:`Acme Inc.`,icon:(0,g.jsx)(p.Building,{className:`h-4 w-4`})},{id:`location`,label:`Localisation`,value:S.location||``,type:`text`,placeholder:`Paris, France`,icon:(0,g.jsx)(p.MapPin,{className:`h-4 w-4`})},{id:`website`,label:`Site web`,value:S.website||``,type:`url`,placeholder:`https://exemple.com`,icon:(0,g.jsx)(p.Globe,{className:`h-4 w-4`})}]}],k=u||O,A={firstName:S.firstName||``,lastName:S.lastName||``,email:S.email,phone:S.phone||``,bio:S.bio||``,role:S.role||``,department:S.department||``,company:S.company||``,location:S.location||``,website:S.website||``,...S.customFields};if(_===`compact`)return(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-4`,y),children:[(0,g.jsx)(ZP,{url:S.avatarUrl,name:S.displayName,size:`md`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`font-semibold`,children:S.displayName}),S.role&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.role}),S.email&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.email})]})]});let j=()=>(0,g.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 md:flex-row md:text-left`,children:[(0,g.jsx)(ZP,{url:S.avatarUrl,name:S.displayName,size:`xl`,editable:n&&w,onAvatarChange:l}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-start md:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-bold`,children:S.displayName}),S.role&&(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:S.role}),S.company&&(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,g.jsx)(p.Building,{className:`h-3 w-3`}),S.company]}),S.location&&(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,g.jsx)(p.MapPin,{className:`h-3 w-3`}),S.location]})]}),n&&(0,g.jsx)(`div`,{className:`flex gap-2`,children:w?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>T(!1),disabled:c,children:[(0,g.jsx)(p.X,{className:`mr-2 h-4 w-4`}),`Annuler`]}),(0,g.jsxs)(i.n,{size:`sm`,onClick:D,disabled:c,children:[c?(0,g.jsx)(p.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}):(0,g.jsx)(p.Save,{className:`mr-2 h-4 w-4`}),`Enregistrer`]})]}):(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>T(!0),children:[(0,g.jsx)(p.Edit3,{className:`mr-2 h-4 w-4`}),`Modifier`]})})]}),m&&h&&h.length>0&&(0,g.jsx)(`div`,{className:`flex gap-6 mt-4`,children:h.map((e,t)=>(0,g.jsxs)(`div`,{className:`text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:e.value}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.label})]},t))}),f&&S.socialLinks&&S.socialLinks.length>0&&(0,g.jsx)(`div`,{className:`mt-4`,children:(0,g.jsx)(eF,{links:S.socialLinks,isEditing:w})}),S.joinedAt&&(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-4 flex items-center gap-1`,children:[(0,g.jsx)(p.Calendar,{className:`h-3 w-3`}),`Membre depuis`,` `,new Date(S.joinedAt).toLocaleDateString(`fr-FR`,{month:`long`,year:`numeric`})]})]})]}),M=()=>(0,g.jsx)(`div`,{className:`space-y-6`,children:k.map(e=>(0,g.jsx)($P,{section:e,values:A,onChange:E,isEditing:w},e.id))});return _===`card`?(0,g.jsx)(Y,{className:y,children:(0,g.jsx)(Q,{className:`pt-6`,children:(0,g.jsxs)(`div`,{className:`space-y-6`,children:[j(),(0,g.jsx)(i.t,{}),M()]})})}):(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,y),children:[j(),v?(0,g.jsxs)(yr,{defaultValue:k[0]?.id,className:`space-y-6`,children:[(0,g.jsx)(br,{children:k.map(e=>(0,g.jsxs)(xr,{value:e.id,className:`gap-2`,children:[e.icon,e.title]},e.id))}),k.map(e=>(0,g.jsx)(Sr,{value:e.id,children:(0,g.jsx)($P,{section:e,values:A,onChange:E,isEditing:w})},e.id))]}):M()]})}var nF={displayName:`Jean Dupont`,firstName:`Jean`,lastName:`Dupont`,email:`jean.dupont@exemple.com`,phone:`+33 6 12 34 56 78`,bio:`Développeur passionné avec plus de 10 ans d'expérience dans le développement web et mobile.`,avatarUrl:``,role:`Lead Developer`,department:`Engineering`,company:`Acme Inc.`,location:`Paris, France`,website:`https://jeandupont.dev`,joinedAt:new Date(`2023-01-15`),socialLinks:[{id:`1`,type:`twitter`,url:`https://twitter.com/jeandupont`,label:`@jeandupont`},{id:`2`,type:`github`,url:`https://github.com/jeandupont`,label:`jeandupont`},{id:`3`,type:`linkedin`,url:`https://linkedin.com/in/jeandupont`,label:`Jean Dupont`}]},rF=[{value:`admin`,label:`Administrateur`,color:`destructive`},{value:`moderator`,label:`Modérateur`,color:`warning`},{value:`user`,label:`Utilisateur`,color:`default`},{value:`guest`,label:`Invité`,color:`secondary`}],iF={active:{label:`Actif`,color:`bg-green-500`,icon:p.CheckCircle},inactive:{label:`Inactif`,color:`bg-gray-500`,icon:p.XCircle},pending:{label:`En attente`,color:`bg-yellow-500`,icon:p.Mail},banned:{label:`Banni`,color:`bg-red-500`,icon:p.Ban}};function aF({user:e,size:t=`sm`}){let r={sm:`h-8 w-8`,md:`h-10 w-10`},i=e.displayName.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,g.jsxs)(n.m,{className:r[t],children:[(0,g.jsx)(n.g,{src:e.avatarUrl,alt:e.displayName}),(0,g.jsx)(n.h,{className:`text-xs`,children:i})]})}function oF({role:e,roles:t=rF}){let n=t.find(t=>t.value===e),i=e===`admin`?p.ShieldAlert:e===`moderator`?p.ShieldCheck:p.Shield;return(0,g.jsxs)(r.t,{variant:n?.color,children:[(0,g.jsx)(i,{className:`h-3 w-3 mr-1`}),n?.label||e]})}function sF({status:e}){let n=iF[e];return(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,n.color)}),(0,g.jsx)(`span`,{className:`text-sm`,children:n.label})]})}function cF({open:e,onOpenChange:t,user:n,roles:r,permissions:c,onSubmit:l,loading:u}){let[f,m]=d.useState({email:``,displayName:``,firstName:``,lastName:``,role:`user`,status:`pending`,permissions:[]});d.useEffect(()=>{m(n?{email:n.email,displayName:n.displayName,firstName:n.firstName||``,lastName:n.lastName||``,role:n.role,status:n.status,permissions:n.permissions||[]}:{email:``,displayName:``,firstName:``,lastName:``,role:`user`,status:`pending`,permissions:[]})},[n,e]);let h=async e=>{e.preventDefault(),await l(f),t(!1)},_=e=>{m(t=>({...t,permissions:t.permissions?.includes(e)?t.permissions.filter(t=>t!==e):[...t.permissions||[],e]}))};return(0,g.jsx)(mt,{open:e,onOpenChange:t,children:(0,g.jsx)(yt,{className:`sm:max-w-[500px]`,children:(0,g.jsxs)(`form`,{onSubmit:h,children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:n?`Modifier l'utilisateur`:`Créer un utilisateur`}),(0,g.jsx)(Ct,{children:n?`Modifiez les informations de l'utilisateur.`:`Remplissez les informations pour créer un nouvel utilisateur.`})]}),(0,g.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`firstName`,children:`Prénom`}),(0,g.jsx)(s.t,{id:`firstName`,value:f.firstName,onChange:e=>m(t=>({...t,firstName:e.target.value})),placeholder:`Jean`})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`lastName`,children:`Nom`}),(0,g.jsx)(s.t,{id:`lastName`,value:f.lastName,onChange:e=>m(t=>({...t,lastName:e.target.value})),placeholder:`Dupont`})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`displayName`,children:`Nom d'affichage *`}),(0,g.jsx)(s.t,{id:`displayName`,value:f.displayName,onChange:e=>m(t=>({...t,displayName:e.target.value})),placeholder:`Jean Dupont`,required:!0})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`email`,children:`Email *`}),(0,g.jsx)(s.t,{id:`email`,type:`email`,value:f.email,onChange:e=>m(t=>({...t,email:e.target.value})),placeholder:`jean@exemple.com`,required:!0})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`role`,children:`Rôle`}),(0,g.jsxs)(a.d,{value:f.role,onValueChange:e=>m(t=>({...t,role:e})),children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{})}),(0,g.jsx)(a.f,{children:r.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`status`,children:`Statut`}),(0,g.jsxs)(a.d,{value:f.status,onValueChange:e=>m(t=>({...t,status:e})),children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{})}),(0,g.jsx)(a.f,{children:Object.entries(iF).map(([e,t])=>(0,g.jsx)(a.m,{value:e,children:t.label},e))})]})]})]}),c&&c.length>0&&(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Permissions`}),(0,g.jsx)(`div`,{className:`border rounded-md p-3 space-y-2 max-h-[150px] overflow-y-auto`,children:c.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,g.jsx)(Se,{id:e.id,checked:f.permissions?.includes(e.id),onCheckedChange:()=>_(e.id)}),(0,g.jsx)(`label`,{htmlFor:e.id,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:e.name})]},e.id))})]})]}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Annuler`}),(0,g.jsxs)(i.n,{type:`submit`,disabled:u,children:[u&&(0,g.jsx)(p.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),n?`Enregistrer`:`Créer`]})]})]})})})}function lF({user:e,onEdit:t,onDelete:n,onResetPassword:r,onStatusChange:a,onRoleChange:o,roles:s}){return(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[t&&(0,g.jsxs)($,{onClick:t,children:[(0,g.jsx)(p.Edit,{className:`mr-2 h-4 w-4`}),`Modifier`]}),r&&(0,g.jsxs)($,{onClick:r,children:[(0,g.jsx)(p.Key,{className:`mr-2 h-4 w-4`}),`Réinitialiser le mot de passe`]}),o&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sn,{}),(0,g.jsx)(on,{children:`Changer le rôle`}),s.map(t=>(0,g.jsx)($,{onClick:()=>o(t.value),disabled:e.role===t.value,children:t.label},t.value))]}),a&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sn,{}),(0,g.jsx)(on,{children:`Changer le statut`}),Object.entries(iF).map(([t,n])=>(0,g.jsx)($,{onClick:()=>a(t),disabled:e.status===t,children:n.label},t))]}),n&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:n,className:`text-destructive focus:text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})}function uF({users:e,roles:n=rF,permissions:r,selectedUsers:o=[],onSelectionChange:c,onCreate:l,onEdit:u,onDelete:f,onBulkDelete:m,onRoleChange:h,onStatusChange:_,onResetPassword:v,onExport:y,onRefresh:b,loading:x=!1,actionLoading:S=!1,searchQuery:C=``,onSearchChange:w,roleFilter:T=`all`,onRoleFilterChange:E,statusFilter:D=`all`,onStatusFilterChange:O,showBulkActions:k=!0,showCreateButton:A=!0,title:j=`Gestion des utilisateurs`,description:M=`Gérez les utilisateurs, leurs rôles et permissions.`,className:N}){let[P,F]=d.useState(!1),[I,L]=d.useState(null),[R,z]=d.useState(null),[B,V]=d.useState(!1),H=d.useMemo(()=>e.filter(e=>{if(C){let t=C.toLowerCase();if(!(e.displayName.toLowerCase().includes(t)||e.email.toLowerCase().includes(t)))return!1}return!(T!==`all`&&e.role!==T||D!==`all`&&e.status!==D)}),[e,C,T,D]),U=e=>{e?c?.(H.map(e=>e.id)):c?.([])},W=(e,t)=>{t?c?.([...o,e]):c?.(o.filter(t=>t!==e))},G=async e=>{await l?.(e)},K=async e=>{I&&(await u?.(I.id,e),L(null))},q=async()=>{R&&(await f?.(R.id),z(null))},ee=async()=>{await m?.(o),c?.([]),V(!1)},J=e=>(typeof e==`string`?new Date(e):e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`,year:`numeric`});return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,N),children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h1`,{className:`text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,g.jsx)(p.Users,{className:`h-6 w-6`}),j]}),M&&(0,g.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:M})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b&&(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:b,disabled:x,children:(0,g.jsx)(p.RefreshCw,{className:t.t(`h-4 w-4`,x&&`animate-spin`)})}),y&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:y,children:[(0,g.jsx)(p.Download,{className:`mr-2 h-4 w-4`}),`Exporter`]}),A&&l&&(0,g.jsxs)(i.n,{size:`sm`,onClick:()=>F(!0),children:[(0,g.jsx)(p.UserPlus,{className:`mr-2 h-4 w-4`}),`Ajouter`]})]})]}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`pt-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center`,children:[w&&(0,g.jsxs)(`div`,{className:`relative flex-1`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher un utilisateur...`,value:C,onChange:e=>w(e.target.value),className:`pl-9`})]}),E&&(0,g.jsxs)(a.d,{value:T,onValueChange:e=>E(e),children:[(0,g.jsxs)(a.y,{className:`w-[180px]`,children:[(0,g.jsx)(p.Filter,{className:`mr-2 h-4 w-4`}),(0,g.jsx)(a.b,{placeholder:`Rôle`})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`Tous les rôles`}),n.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))]})]}),O&&(0,g.jsxs)(a.d,{value:D,onValueChange:e=>O(e),children:[(0,g.jsxs)(a.y,{className:`w-[180px]`,children:[(0,g.jsx)(p.Filter,{className:`mr-2 h-4 w-4`}),(0,g.jsx)(a.b,{placeholder:`Statut`})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`Tous les statuts`}),Object.entries(iF).map(([e,t])=>(0,g.jsx)(a.m,{value:e,children:t.label},e))]})]})]}),k&&o.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-4 mt-4 p-3 bg-muted rounded-lg`,children:[(0,g.jsxs)(`span`,{className:`text-sm font-medium`,children:[o.length,` utilisateur(s) sélectionné(s)`]}),m&&(0,g.jsxs)(i.n,{variant:`destructive`,size:`sm`,onClick:()=>V(!0),children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]}),(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:()=>c?.([]),children:`Désélectionner`})]})]})}),(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`p-0`,children:(0,g.jsxs)(dr,{children:[(0,g.jsx)(fr,{children:(0,g.jsxs)(hr,{children:[c&&(0,g.jsx)(gr,{className:`w-[50px]`,children:(0,g.jsx)(Se,{checked:H.length>0&&o.length===H.length,onCheckedChange:U})}),(0,g.jsx)(gr,{children:`Utilisateur`}),(0,g.jsx)(gr,{children:`Rôle`}),(0,g.jsx)(gr,{children:`Statut`}),(0,g.jsx)(gr,{children:`Inscrit le`}),(0,g.jsx)(gr,{children:`Dernière connexion`}),(0,g.jsx)(gr,{className:`w-[50px]`})]})}),(0,g.jsx)(pr,{children:x?(0,g.jsx)(hr,{children:(0,g.jsx)(_r,{colSpan:c?7:6,className:`text-center py-8`,children:(0,g.jsx)(p.Loader2,{className:`h-6 w-6 animate-spin mx-auto`})})}):H.length===0?(0,g.jsx)(hr,{children:(0,g.jsx)(_r,{colSpan:c?7:6,className:`text-center py-8 text-muted-foreground`,children:`Aucun utilisateur trouvé`})}):H.map(e=>(0,g.jsxs)(hr,{children:[c&&(0,g.jsx)(_r,{children:(0,g.jsx)(Se,{checked:o.includes(e.id),onCheckedChange:t=>W(e.id,t)})}),(0,g.jsx)(_r,{children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(aF,{user:e}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`font-medium`,children:e.displayName}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.email})]})]})}),(0,g.jsx)(_r,{children:(0,g.jsx)(oF,{role:e.role,roles:n})}),(0,g.jsx)(_r,{children:(0,g.jsx)(sF,{status:e.status})}),(0,g.jsx)(_r,{className:`text-muted-foreground`,children:J(e.createdAt)}),(0,g.jsx)(_r,{className:`text-muted-foreground`,children:e.lastLogin?J(e.lastLogin):`-`}),(0,g.jsx)(_r,{children:(0,g.jsx)(lF,{user:e,roles:n,onEdit:u?()=>L(e):void 0,onDelete:f?()=>z(e):void 0,onResetPassword:v?()=>v(e.id):void 0,onRoleChange:h?t=>h(e.id,t):void 0,onStatusChange:_?t=>_(e.id,t):void 0})})]},e.id))})]})})}),(0,g.jsx)(cF,{open:P,onOpenChange:F,roles:n,permissions:r,onSubmit:G,loading:S}),(0,g.jsx)(cF,{open:!!I,onOpenChange:e=>!e&&L(null),user:I||void 0,roles:n,permissions:r,onSubmit:K,loading:S}),(0,g.jsx)(re,{open:!!R,onOpenChange:e=>!e&&z(null),children:(0,g.jsxs)(se,{children:[(0,g.jsxs)(ce,{children:[(0,g.jsx)(ue,{children:`Supprimer l'utilisateur ?`}),(0,g.jsxs)(de,{children:[`Êtes-vous sûr de vouloir supprimer `,R?.displayName,` ? Cette action est irréversible.`]})]}),(0,g.jsxs)(le,{children:[(0,g.jsx)(pe,{children:`Annuler`}),(0,g.jsx)(fe,{onClick:q,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer`})]})]})}),(0,g.jsx)(re,{open:B,onOpenChange:V,children:(0,g.jsxs)(se,{children:[(0,g.jsxs)(ce,{children:[(0,g.jsx)(ue,{children:`Supprimer les utilisateurs ?`}),(0,g.jsxs)(de,{children:[`Êtes-vous sûr de vouloir supprimer `,o.length,` utilisateur(s) ? Cette action est irréversible.`]})]}),(0,g.jsxs)(le,{children:[(0,g.jsx)(pe,{children:`Annuler`}),(0,g.jsx)(fe,{onClick:ee,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer`})]})]})})]})}var dF=[{id:`1`,email:`admin@exemple.com`,displayName:`Admin User`,firstName:`Admin`,lastName:`User`,role:`admin`,status:`active`,createdAt:new Date(`2023-01-01`),lastLogin:new Date(`2024-01-15`)},{id:`2`,email:`moderator@exemple.com`,displayName:`Marie Modérateur`,firstName:`Marie`,lastName:`Modérateur`,role:`moderator`,status:`active`,createdAt:new Date(`2023-03-15`),lastLogin:new Date(`2024-01-14`)},{id:`3`,email:`user@exemple.com`,displayName:`Jean Utilisateur`,firstName:`Jean`,lastName:`Utilisateur`,role:`user`,status:`active`,createdAt:new Date(`2023-06-01`),lastLogin:new Date(`2024-01-10`)},{id:`4`,email:`pending@exemple.com`,displayName:`Paul Pending`,firstName:`Paul`,lastName:`Pending`,role:`user`,status:`pending`,createdAt:new Date(`2024-01-10`)},{id:`5`,email:`banned@exemple.com`,displayName:`Bob Banni`,firstName:`Bob`,lastName:`Banni`,role:`guest`,status:`banned`,createdAt:new Date(`2023-09-01`),lastLogin:new Date(`2023-12-01`)}],fF=[{id:`read`,name:`Lecture`,description:`Accès en lecture`,category:`Base`},{id:`write`,name:`Écriture`,description:`Accès en écriture`,category:`Base`},{id:`delete`,name:`Suppression`,description:`Accès suppression`,category:`Base`},{id:`admin`,name:`Administration`,description:`Accès admin`,category:`Admin`},{id:`users`,name:`Gestion utilisateurs`,description:`Gérer les utilisateurs`,category:`Admin`}],pF={created:{icon:p.Plus,color:`text-green-500`,label:`créé`},updated:{icon:p.Edit,color:`text-blue-500`,label:`modifié`},deleted:{icon:p.Trash2,color:`text-red-500`,label:`supprimé`},commented:{icon:p.MessageSquare,color:`text-purple-500`,label:`commenté`},uploaded:{icon:p.Upload,color:`text-cyan-500`,label:`uploadé`},downloaded:{icon:p.Download,color:`text-gray-500`,label:`téléchargé`},shared:{icon:p.User,color:`text-orange-500`,label:`partagé`},approved:{icon:p.Check,color:`text-green-500`,label:`approuvé`},rejected:{icon:p.X,color:`text-red-500`,label:`rejeté`},mentioned:{icon:p.Bell,color:`text-yellow-500`,label:`mentionné`},assigned:{icon:p.User,color:`text-indigo-500`,label:`assigné`},completed:{icon:p.Check,color:`text-green-500`,label:`terminé`},custom:{icon:p.AlertCircle,color:`text-gray-500`,label:``}};function mF({user:e,size:t=`sm`}){let r={sm:`h-8 w-8`,md:`h-10 w-10`},i=e.name.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,g.jsxs)(n.m,{className:r[t],children:[(0,g.jsx)(n.g,{src:e.avatar,alt:e.name}),(0,g.jsx)(n.h,{className:`text-xs`,children:i})]})}function hF({type:e,customIcon:n,customColor:r}){let i=pF[e],a=i.icon;return(0,g.jsx)(`div`,{className:t.t(`flex h-8 w-8 items-center justify-center rounded-full bg-background border-2 shadow-sm`,r||i.color),children:n||(0,g.jsx)(a,{className:`h-4 w-4`})})}function gF({activity:e,showAvatar:t,relativeTime:n,layout:i,isLast:a}){let o=e=>{let t=typeof e==`string`?new Date(e):e;if(n){let e=new Date().getTime()-t.getTime(),n=Math.floor(e/6e4),r=Math.floor(n/60),i=Math.floor(r/24);if(n<1)return`À l'instant`;if(n<60)return`Il y a ${n} min`;if(r<24)return`Il y a ${r}h`;if(i<7)return`Il y a ${i}j`}return t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`})},s=pF[e.type];return i===`compact`?(0,g.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,g.jsx)(hF,{type:e.type,customIcon:e.icon,customColor:e.color}),(0,g.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,g.jsxs)(`p`,{className:`text-sm truncate`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.user.name}),` `,(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.title})]})}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0`,children:o(e.timestamp)})]}):i===`feed`?(0,g.jsx)(Y,{className:`mb-4`,children:(0,g.jsx)(Q,{className:`pt-4`,children:(0,g.jsxs)(`div`,{className:`flex gap-3`,children:[t&&(0,g.jsx)(mF,{user:e.user,size:`md`}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.user.name}),(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:s.label||e.type}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(e.timestamp)})]}),(0,g.jsx)(`p`,{className:`text-sm`,children:e.title}),e.description&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.metadata?.comment&&(0,g.jsx)(`div`,{className:`mt-2 p-3 bg-muted rounded-lg text-sm`,children:e.metadata.comment})]})]})})}):(0,g.jsxs)(`div`,{className:`flex gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,g.jsx)(hF,{type:e.type,customIcon:e.icon,customColor:e.color}),!a&&(0,g.jsx)(`div`,{className:`w-0.5 flex-1 bg-border mt-2`})]}),(0,g.jsx)(`div`,{className:`flex-1 pb-8`,children:(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t&&(0,g.jsx)(mF,{user:e.user}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.user.name}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.title})]}),e.description&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.metadata?.comment&&(0,g.jsx)(`div`,{className:`mt-2 p-3 bg-muted rounded-lg text-sm`,children:e.metadata.comment}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground mt-2 block`,children:o(e.timestamp)})]})]})})]})}function _F({activities:e,title:n=`Activité`,showSearch:r=!0,showFilters:o=!0,filters:c=[],activeFilter:l,onFilterChange:u,showRefresh:f=!0,onRefresh:m,loading:h=!1,groupByDay:_=!0,showLoadMore:v=!1,onLoadMore:y,loadingMore:b=!1,showAvatars:x=!0,relativeTime:S=!0,layout:C=`timeline`,className:w}){let[T,E]=d.useState(``),[D,O]=d.useState(null),k=l??D,A=e=>{u?u(e):O(e)},j=d.useMemo(()=>{let t=e;if(T){let e=T.toLowerCase();t=t.filter(t=>t.title.toLowerCase().includes(e)||t.user.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))}if(k){let e=c.find(e=>e.id===k);e&&(t=t.filter(t=>e.types.includes(t.type)))}return t},[e,T,k,c]),M=d.useMemo(()=>{if(!_)return null;let e={};return j.forEach(t=>{let n=(typeof t.timestamp==`string`?new Date(t.timestamp):t.timestamp).toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});e[n]||(e[n]=[]),e[n].push(t)}),e},[j,_]),N=e=>(0,g.jsx)(`div`,{children:e.map((t,n)=>(0,g.jsx)(gF,{activity:t,showAvatar:x,relativeTime:S,layout:C,isLast:n===e.length-1},t.id))});return(0,g.jsxs)(`div`,{className:t.t(`space-y-4`,w),children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,g.jsx)(`h2`,{className:`text-xl font-semibold`,children:n}),(0,g.jsx)(`div`,{className:`flex items-center gap-2`,children:f&&m&&(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:m,disabled:h,children:(0,g.jsx)(p.RefreshCw,{className:t.t(`h-4 w-4`,h&&`animate-spin`)})})})]}),(r||o)&&(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center`,children:[r&&(0,g.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher...`,value:T,onChange:e=>E(e.target.value),className:`pl-9`})]}),o&&c.length>0&&(0,g.jsxs)(a.d,{value:k||`all`,onValueChange:e=>A(e===`all`?null:e),children:[(0,g.jsxs)(a.y,{className:`w-[180px]`,children:[(0,g.jsx)(p.Filter,{className:`h-4 w-4 mr-2`}),(0,g.jsx)(a.b,{placeholder:`Filtrer`})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`Toutes les activités`}),c.map(e=>(0,g.jsx)(a.m,{value:e.id,children:e.label},e.id))]})]})]}),h?(0,g.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,g.jsx)(p.RefreshCw,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):j.length===0?(0,g.jsxs)(`div`,{className:`text-center py-12`,children:[(0,g.jsx)(p.Clock,{className:`h-12 w-12 text-muted-foreground mx-auto mb-4`}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Aucune activité`})]}):_&&M?(0,g.jsx)(`div`,{className:`space-y-6`,children:Object.entries(M).map(([e,t])=>(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-4 capitalize`,children:e}),N(t)]},e))}):N(j),v&&y&&(0,g.jsx)(`div`,{className:`flex justify-center pt-4`,children:(0,g.jsxs)(i.n,{variant:`outline`,onClick:y,disabled:b,children:[b?(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4 animate-spin mr-2`}):(0,g.jsx)(p.ChevronDown,{className:`h-4 w-4 mr-2`}),`Charger plus`]})})]})}var vF=[{id:`edits`,label:`Modifications`,types:[`created`,`updated`,`deleted`]},{id:`comments`,label:`Commentaires`,types:[`commented`,`mentioned`]},{id:`files`,label:`Fichiers`,types:[`uploaded`,`downloaded`,`shared`]},{id:`approvals`,label:`Approbations`,types:[`approved`,`rejected`,`completed`]}],yF=[{id:`1`,type:`created`,title:`a créé le document 'Rapport Q4'`,user:{id:`1`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5)},{id:`2`,type:`commented`,title:`a commenté sur 'Projet Alpha'`,user:{id:`2`,name:`Pierre Martin`},timestamp:new Date(Date.now()-1e3*60*30),metadata:{comment:`Super travail sur cette partie !`}},{id:`3`,type:`uploaded`,title:`a uploadé 3 fichiers`,user:{id:`3`,name:`Sophie Bernard`},timestamp:new Date(Date.now()-1e3*60*60*2)},{id:`4`,type:`approved`,title:`a approuvé la demande de congés`,user:{id:`1`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*60*24)}],bF={blue:{bg:`bg-blue-100`,text:`text-blue-700`,border:`border-blue-500`},green:{bg:`bg-green-100`,text:`text-green-700`,border:`border-green-500`},red:{bg:`bg-red-100`,text:`text-red-700`,border:`border-red-500`},yellow:{bg:`bg-yellow-100`,text:`text-yellow-700`,border:`border-yellow-500`},purple:{bg:`bg-purple-100`,text:`text-purple-700`,border:`border-purple-500`},pink:{bg:`bg-pink-100`,text:`text-pink-700`,border:`border-pink-500`},orange:{bg:`bg-orange-100`,text:`text-orange-700`,border:`border-orange-500`},cyan:{bg:`bg-cyan-100`,text:`text-cyan-700`,border:`border-cyan-500`}};function xF(e,t){let n=[];new Date(e,t,1);let r=new Date(e,t+1,0);for(let i=1;i<=r.getDate();i++)n.push(new Date(e,t,i));return n}function SF(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function CF(e,t){return e.filter(e=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof e.end==`string`?new Date(e.end):e.end;return e.allDay?SF(n,t)||t>=n&&t<=r:SF(n,t)})}function wF({currentDate:e,viewMode:t,onPrevious:n,onNext:r,onToday:o,onViewModeChange:s,onAddClick:c,showViewSelector:l,showAddButton:u,locale:d}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:n,children:(0,g.jsx)(p.ChevronLeft,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:r,children:(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:o,children:`Aujourd'hui`}),(0,g.jsx)(`h2`,{className:`text-xl font-semibold ml-4 capitalize`,children:(()=>{switch(t){case`month`:return e.toLocaleDateString(d,{month:`long`,year:`numeric`});case`week`:return`Semaine du ${e.toLocaleDateString(d,{day:`numeric`,month:`long`})}`;case`day`:return e.toLocaleDateString(d,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});case`agenda`:return`Agenda`;default:return``}})()})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&s&&(0,g.jsxs)(a.d,{value:t,onValueChange:e=>s(e),children:[(0,g.jsx)(a.y,{className:`w-[120px]`,children:(0,g.jsx)(a.b,{})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`month`,children:`Mois`}),(0,g.jsx)(a.m,{value:`week`,children:`Semaine`}),(0,g.jsx)(a.m,{value:`day`,children:`Jour`}),(0,g.jsx)(a.m,{value:`agenda`,children:`Agenda`})]})]}),u&&c&&(0,g.jsxs)(i.n,{onClick:c,children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-2`}),`Événement`]})]})]})}function TF({event:e,onClick:n,compact:r=!1}){let i=bF[e.color||`blue`],a=typeof e.start==`string`?new Date(e.start):e.start;return(0,g.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),n?.()},className:t.t(`w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2`,i.bg,i.text,i.border),children:[!e.allDay&&!r&&(0,g.jsx)(`span`,{className:`font-medium mr-1`,children:a.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})}),e.title]})}function EF({event:e,onEdit:n,onDelete:r}){let a=typeof e.start==`string`?new Date(e.start):e.start,o=typeof e.end==`string`?new Date(e.end):e.end,s=bF[e.color||`blue`];return(0,g.jsxs)(`div`,{className:`w-72`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsx)(`div`,{className:t.t(`w-3 h-3 rounded-full mt-1`,s.bg.replace(`100`,`500`))}),(0,g.jsxs)(`div`,{className:`flex gap-1`,children:[n&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:n,children:(0,g.jsx)(p.Edit,{className:`h-3 w-3`})}),r&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:r,children:(0,g.jsx)(p.Trash2,{className:`h-3 w-3`})})]})]}),(0,g.jsx)(`h4`,{className:`font-semibold mt-2`,children:e.title}),(0,g.jsxs)(`div`,{className:`space-y-2 mt-3 text-sm text-muted-foreground`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Clock,{className:`h-4 w-4`}),e.allDay?(0,g.jsx)(`span`,{children:`Toute la journée`}):(0,g.jsxs)(`span`,{children:[a.toLocaleString(`fr-FR`,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}),` - `,o.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})]})]}),e.location&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.MapPin,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{children:e.location})]}),e.attendees&&e.attendees.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Users,{className:`h-4 w-4`}),(0,g.jsxs)(`span`,{children:[e.attendees.length,` participant(s)`]})]})]}),e.description&&(0,g.jsx)(`p`,{className:`mt-3 text-sm`,children:e.description})]})}function DF({currentDate:e,events:n,weekStartsOn:r,locale:i,onDayClick:a,onEventClick:o,onEventEdit:s,onEventDelete:l}){let u=e.getFullYear(),d=e.getMonth(),f=xF(u,d),p=new Date,m=Array.from({length:7},(e,t)=>new Date(2024,0,r+t).toLocaleDateString(i,{weekday:`short`})),h=(new Date(u,d,1).getDay()-r+7)%7,_=[];for(let e=0;e<h;e++)_.push(null);for(_.push(...f);_.length%7!=0;)_.push(null);return(0,g.jsxs)(`div`,{className:`border rounded-lg overflow-hidden`,children:[(0,g.jsx)(`div`,{className:`grid grid-cols-7 bg-muted`,children:m.map(e=>(0,g.jsx)(`div`,{className:`p-2 text-center text-sm font-medium capitalize`,children:e},e))}),(0,g.jsx)(`div`,{className:`grid grid-cols-7`,children:_.map((e,r)=>{let i=e?CF(n,e):[],u=e&&SF(e,p);return(0,g.jsx)(`div`,{className:t.t(`min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50`,!(e&&e.getMonth()===d)&&`bg-muted/30 text-muted-foreground`),onClick:()=>e&&a?.(e),children:e&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:t.t(`text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full`,u&&`bg-primary text-primary-foreground`),children:e.getDate()}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[i.slice(0,3).map(e=>(0,g.jsxs)(c.n,{children:[(0,g.jsx)(c.i,{asChild:!0,children:(0,g.jsx)(`div`,{children:(0,g.jsx)(TF,{event:e,onClick:()=>o?.(e),compact:!0})})}),(0,g.jsx)(c.r,{children:(0,g.jsx)(EF,{event:e,onEdit:()=>s?.(e.id,{}),onDelete:()=>l?.(e.id)})})]},e.id)),i.length>3&&(0,g.jsxs)(`button`,{className:`text-xs text-muted-foreground hover:text-foreground`,children:[`+`,i.length-3,` autres`]})]})]})},r)})})]})}function OF({currentDate:e,events:n,locale:r,onEventClick:i}){let a=n.filter(t=>{let n=typeof t.start==`string`?new Date(t.start):t.start,r=new Date(e);return r.setDate(r.getDate()+30),n>=e&&n<=r}).sort((e,t)=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof t.start==`string`?new Date(t.start):t.start;return n.getTime()-r.getTime()}),o={};return a.forEach(e=>{let t=(typeof e.start==`string`?new Date(e.start):e.start).toDateString();o[t]||(o[t]=[]),o[t].push(e)}),(0,g.jsxs)(`div`,{className:`space-y-4`,children:[Object.entries(o).map(([e,n])=>(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-2 capitalize`,children:new Date(e).toLocaleDateString(r,{weekday:`long`,day:`numeric`,month:`long`})}),(0,g.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let n=bF[e.color||`blue`],a=typeof e.start==`string`?new Date(e.start):e.start,o=typeof e.end==`string`?new Date(e.end):e.end;return(0,g.jsx)(Y,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>i?.(e),children:(0,g.jsxs)(Q,{className:`p-3 flex gap-3`,children:[(0,g.jsx)(`div`,{className:t.t(`w-1 rounded-full`,n.bg.replace(`100`,`500`))}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsx)(`h4`,{className:`font-medium`,children:e.title}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.allDay?`Toute la journée`:`${a.toLocaleTimeString(r,{hour:`2-digit`,minute:`2-digit`})} - ${o.toLocaleTimeString(r,{hour:`2-digit`,minute:`2-digit`})}`}),e.location&&(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1 mt-1`,children:[(0,g.jsx)(p.MapPin,{className:`h-3 w-3`}),e.location]})]})]})},e.id)})})]},e)),Object.keys(o).length===0&&(0,g.jsx)(`div`,{className:`text-center py-12 text-muted-foreground`,children:`Aucun événement à venir`})]})}function kF({events:e,currentDate:n,onDateChange:r,viewMode:i,onViewModeChange:a,onEventClick:o,onEventCreate:s,onEventEdit:c,onEventDelete:l,onDayClick:u,showHeader:f=!0,showViewSelector:p=!0,showAddButton:m=!0,weekStartsOn:h=1,locale:_=`fr-FR`,className:v}){let[y,b]=d.useState(new Date),[x,S]=d.useState(`month`),[C,w]=d.useState(!1),T=n??y,E=i??x,D=e=>{r?r(e):b(e)};return(0,g.jsxs)(`div`,{className:t.t(`space-y-4`,v),children:[f&&(0,g.jsx)(wF,{currentDate:T,viewMode:E,onPrevious:()=>{let e=new Date(T);switch(E){case`month`:e.setMonth(e.getMonth()-1);break;case`week`:e.setDate(e.getDate()-7);break;case`day`:e.setDate(e.getDate()-1);break}D(e)},onNext:()=>{let e=new Date(T);switch(E){case`month`:e.setMonth(e.getMonth()+1);break;case`week`:e.setDate(e.getDate()+7);break;case`day`:e.setDate(e.getDate()+1);break}D(e)},onToday:()=>{D(new Date)},onViewModeChange:e=>{a?a(e):S(e)},onAddClick:()=>w(!0),showViewSelector:p,showAddButton:m,locale:_}),E===`month`&&(0,g.jsx)(DF,{currentDate:T,events:e,weekStartsOn:h,locale:_,onDayClick:u,onEventClick:o,onEventEdit:c,onEventDelete:l}),E===`agenda`&&(0,g.jsx)(OF,{currentDate:T,events:e,locale:_,onEventClick:o}),(E===`week`||E===`day`)&&(0,g.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,children:[`Vue `,E===`week`?`semaine`:`jour`,` - À implémenter`]})]})}var AF=[{id:`1`,title:`Réunion d'équipe`,start:new Date,end:new Date(Date.now()+1e3*60*60),color:`blue`,location:`Salle de réunion A`},{id:`2`,title:`Déjeuner avec le client`,start:new Date(Date.now()+1e3*60*60*24),end:new Date(Date.now()+1e3*60*60*25),color:`green`,location:`Restaurant Le Gourmet`},{id:`3`,title:`Formation React`,start:new Date(Date.now()+1e3*60*60*24*2),end:new Date(Date.now()+1e3*60*60*24*2+1e3*60*60*4),color:`purple`,allDay:!0},{id:`4`,title:`Deadline projet`,start:new Date(Date.now()+1e3*60*60*24*5),end:new Date(Date.now()+1e3*60*60*24*5),color:`red`,allDay:!0}],jF=`waka-chat-widget-position`,MF=e=>{if(typeof window>`u`)return null;try{let t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch{}return null},NF=(e,t)=>{if(!(typeof window>`u`))try{localStorage.setItem(e,JSON.stringify(t))}catch{}};function PF({defaultPosition:e,position:n,onPositionChange:i,persistPosition:a=!0,positionStorageKey:o=jF,defaultOpen:s=!1,open:c,onOpenChange:l,bubbleSize:u=`md`,bubbleColor:f=`primary`,bubbleIcon:m,bubbleText:h,showUnreadBadge:_=!0,bubbleAnimation:v=`none`,widgetPosition:y=`top-left`,widgetSize:b=`md`,bubbleClassName:x,widgetClassName:S,draggable:C=!0,constrainToViewport:w=!0,edgeOffset:T=16,onWidgetClose:E,onWidgetMinimize:D,zIndex:O=9999,conversations:k=[],...A}){let[j,M]=d.useState(s),[N,P]=d.useState(()=>{if(e)return e;if(a){let e=MF(o);if(e)return e}return{x:typeof window<`u`?window.innerWidth-80:0,y:typeof window<`u`?window.innerHeight-80:0}}),[F,I]=d.useState(!1),[L,R]=d.useState({x:0,y:0}),z=d.useRef(null),B=c===void 0?j:c,V=n===void 0?N:n;d.useEffect(()=>{!(typeof window>`u`)&&!n&&!e&&P((a?MF(o):null)||{x:window.innerWidth-80,y:window.innerHeight-80})},[n,e,a,o]);let H=e=>{c===void 0&&M(e),l?.(e)},U=e=>{n===void 0&&P(e),i?.(e),a&&NF(o,e)},W=e=>{if(!w||typeof window>`u`)return e;let t=z.current?.offsetWidth||60,n=z.current?.offsetHeight||60;return{x:Math.max(T,Math.min(e.x,window.innerWidth-t-T)),y:Math.max(T,Math.min(e.y,window.innerHeight-n-T))}},G=e=>{!C||B||(I(!0),R({x:e.clientX-V.x,y:e.clientY-V.y}))},K=e=>{if(!C||B)return;let t=e.touches[0];I(!0),R({x:t.clientX-V.x,y:t.clientY-V.y})};d.useEffect(()=>{if(!F)return;let e=e=>{U(W({x:e.clientX-L.x,y:e.clientY-L.y}))},t=e=>{let t=e.touches[0];U(W({x:t.clientX-L.x,y:t.clientY-L.y}))},n=()=>{I(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,n),document.addEventListener(`touchmove`,t),document.addEventListener(`touchend`,n),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,n),document.removeEventListener(`touchmove`,t),document.removeEventListener(`touchend`,n)}},[F,L]);let q=()=>{F||H(!B)},ee=k.reduce((e,t)=>e+(t.unreadCount||0),0),J={sm:`h-12 w-12`,md:`h-14 w-14`,lg:`h-16 w-16`},te={sm:`h-5 w-5`,md:`h-6 w-6`,lg:`h-7 w-7`},ne={primary:`bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/90`,success:`bg-green-500 text-white hover:bg-green-600`,warning:`bg-yellow-500 text-white hover:bg-yellow-600`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`},re={none:``,pulse:`animate-pulse`,bounce:`animate-bounce`},ie={sm:`h-[400px] w-[300px]`,md:`h-[500px] w-[380px]`,lg:`h-[600px] w-[420px]`},ae=()=>{let e=z.current?.offsetWidth||60,t=z.current?.offsetHeight||60,n=ie[b].match(/h-\[(\d+)px\] w-\[(\d+)px\]/),r=n?parseInt(n[1]):500,i=n?parseInt(n[2]):380,a=V.x,o=V.y;switch(y){case`top-left`:a=V.x-i+e,o=V.y-r-12;break;case`top-right`:o=V.y-r-12;break;case`bottom-left`:a=V.x-i+e,o=V.y+t+12;break;case`bottom-right`:o=V.y+t+12;break}return typeof window<`u`&&(a=Math.max(T,Math.min(a,window.innerWidth-i-T)),o=Math.max(T,Math.min(o,window.innerHeight-r-T))),{position:`fixed`,left:a,top:o,zIndex:O+1}};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`button`,{ref:z,onClick:q,onMouseDown:G,onTouchStart:K,className:t.t(`fixed rounded-full shadow-lg transition-all duration-200`,`flex items-center justify-center gap-2`,J[u],ne[f],re[v],F&&`cursor-grabbing scale-110`,C&&!F&&!B&&`cursor-grab`,B&&`opacity-0 pointer-events-none scale-75`,h&&`px-4 w-auto`,x),style:{left:V.x,top:V.y,zIndex:O,touchAction:`none`},"aria-label":`Ouvrir le chat`,children:[m||(0,g.jsx)(p.MessageCircle,{className:te[u]}),h&&(0,g.jsx)(`span`,{className:`font-medium text-sm`,children:h}),_&&ee>0&&(0,g.jsx)(r.t,{className:t.t(`absolute -top-1 -right-1 h-5 min-w-[20px] px-1.5`,`bg-destructive text-destructive-foreground`,`flex items-center justify-center text-xs font-bold`),children:ee>99?`99+`:ee})]}),B&&(0,g.jsx)(`div`,{className:t.t(`fixed rounded-xl shadow-2xl border bg-background overflow-hidden`,`animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-2`,`duration-200`,ie[b],S),style:ae(),children:(0,g.jsx)(WF,{...A,conversations:k,layout:`widget`,onClose:()=>{H(!1),E?.()},onMinimize:()=>{H(!1),D?.()},showCloseButton:!0,className:`h-full`})}),B&&(0,g.jsx)(`div`,{className:`fixed inset-0 bg-black/20 sm:hidden`,style:{zIndex:O-1},onClick:()=>H(!1)})]})}function FF(e={}){let{defaultOpen:t=!1,defaultPosition:n,persistPosition:r=!0,positionStorageKey:i=jF}=e,[a,o]=d.useState(t),[s,c]=d.useState(()=>{if(n)return n;if(typeof window>`u`)return{x:0,y:0};if(r){let e=MF(i);if(e)return e}return{x:window.innerWidth-80,y:window.innerHeight-80}}),l=()=>o(!0),u=()=>o(!1),f=()=>o(e=>!e),p=e=>{c(e),r&&NF(i,e)};return{isOpen:a,position:s,open:l,close:u,toggle:f,setIsOpen:o,updatePosition:p,resetPosition:()=>{typeof window>`u`||p(n||{x:window.innerWidth-80,y:window.innerHeight-80})},widgetProps:{open:a,onOpenChange:o,position:s,onPositionChange:p}}}var IF=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r.getTime()-1440*60*1e3),a=new Date(t.getFullYear(),t.getMonth(),t.getDate());return a.getTime()===r.getTime()?`Aujourd'hui`:a.getTime()===i.getTime()?`Hier`:t.toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`})},LF=(e,t)=>{let n=typeof e==`string`?new Date(e):e,r=typeof t==`string`?new Date(t):t;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()},RF=e=>{if(e.initials)return e.initials;let t=e.name.split(` `);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.name.substring(0,2).toUpperCase()};function zF({date:e}){return(0,g.jsx)(`div`,{className:`flex items-center justify-center my-4`,children:(0,g.jsx)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground bg-muted rounded-full`,children:IF(e)})})}function BF({conversations:e,activeId:i,currentUser:a,onSelect:o,onSearch:c}){let[l,u]=d.useState(``),f=e=>e.name?e.name:e.participants.filter(e=>e.id!==a.id).map(e=>e.name).join(`, `),m=e=>{if(e.avatar)return{url:e.avatar,fallback:e.name?.charAt(0)||`G`};if(e.isGroup)return{fallback:`G`};let t=e.participants.find(e=>e.id!==a.id);return{url:t?.avatar,fallback:RF(t||{id:``,name:`?`})}},h=e=>{if(!e)return``;let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/(1e3*60*60*24));return r===0?t.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}):r===1?`Hier`:r<7?t.toLocaleDateString(`fr-FR`,{weekday:`short`}):t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`})},_=e.filter(e=>l?f(e).toLowerCase().includes(l.toLowerCase()):!0);return(0,g.jsxs)(`div`,{className:`flex flex-col h-full border-r`,children:[(0,g.jsx)(`div`,{className:`p-3 border-b`,children:(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher...`,value:l,onChange:e=>{u(e.target.value),c?.(e.target.value)},className:`pl-9`})]})}),(0,g.jsx)(n.f,{className:`flex-1`,children:_.map(e=>{let s=m(e),c=f(e),l=e.participants.find(e=>e.id!==a.id);return(0,g.jsxs)(`button`,{onClick:()=>o(e),className:t.t(`w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left`,i===e.id&&`bg-muted`),children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsxs)(n.m,{children:[(0,g.jsx)(n.g,{src:s.url}),(0,g.jsx)(n.h,{children:s.fallback})]}),l?.status===`online`&&(0,g.jsx)(`div`,{className:`absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background`})]}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`span`,{className:`font-medium text-sm truncate`,children:c}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:h(e.lastMessage?.timestamp)})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.lastMessage?.content||`Aucun message`}),e.unreadCount&&e.unreadCount>0&&(0,g.jsx)(r.t,{className:`h-5 min-w-[20px] justify-center`,children:e.unreadCount})]})]})]},e.id)})})]})}function VF({conversation:e,currentUser:r,title:a,statusText:o,showStatus:s=!0,showCloseButton:c,onAudioCall:l,onVideoCall:u,onClose:d,onCloseConversation:f,onMinimize:m,layout:h}){let _=e?.participants.find(e=>e.id!==r.id),v=a||e?.name||_?.name||`Messages`,y=()=>o||(e?e.isGroup?`${e.participants.length} participants`:_?.status===`online`?`En ligne`:_?.lastSeen?`Vu ${(typeof _.lastSeen==`string`?new Date(_.lastSeen):_.lastSeen).toLocaleString(`fr-FR`)}`:`Hors ligne`:``),b=h===`floating`||h===`widget`;return(0,g.jsxs)(`div`,{className:t.t(`flex items-center justify-between p-3 border-b`,b&&`bg-primary text-primary-foreground rounded-t-lg`),children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e&&(0,g.jsxs)(n.m,{className:t.t(b&&`border-2 border-primary-foreground/20`),children:[(0,g.jsx)(n.g,{src:e.avatar||_?.avatar}),(0,g.jsx)(n.h,{className:t.t(b&&`bg-primary-foreground/20 text-primary-foreground`),children:RF(_||{id:``,name:v})})]}),!e&&(0,g.jsx)(p.MessageCircle,{className:`h-5 w-5`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`font-semibold text-sm`,children:v}),s&&(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[_?.status===`online`&&(0,g.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,b?`bg-green-400`:`bg-green-500`)}),_?.status===`offline`&&(0,g.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,b?`bg-gray-400`:`bg-gray-500`)}),(0,g.jsx)(`p`,{className:t.t(`text-xs`,b?`text-primary-foreground/80`:`text-muted-foreground`),children:y()})]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l&&!b&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:l,children:(0,g.jsx)(p.Phone,{className:`h-4 w-4`})}),u&&!b&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:u,children:(0,g.jsx)(p.Video,{className:`h-4 w-4`})}),c&&f&&(0,g.jsxs)(i.n,{variant:b?`ghost`:`outline`,size:`sm`,onClick:f,className:t.t(b&&`text-primary-foreground hover:bg-primary-foreground/20`),children:[(0,g.jsx)(p.Calendar,{className:`h-4 w-4 mr-1.5`}),`Clôturer`]}),m&&b&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:m,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,g.jsx)(p.Minimize2,{className:`h-4 w-4`})}),d&&b&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:d,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,g.jsx)(p.X,{className:`h-4 w-4`})}),!b&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,children:(0,g.jsx)(p.MoreVertical,{className:`h-4 w-4`})})}),(0,g.jsx)(nn,{align:`end`,children:(0,g.jsxs)($,{children:[(0,g.jsx)(p.Settings,{className:`mr-2 h-4 w-4`}),`Paramètres`]})})]})]})]})}function HF({message:e,isOwn:r,showStatus:a,showTimestamp:o,onDelete:s,onReply:c}){return(0,g.jsxs)(`div`,{className:t.t(`flex gap-2 group`,r?`flex-row-reverse`:`flex-row`),children:[!r&&(0,g.jsxs)(n.m,{className:`h-8 w-8`,children:[(0,g.jsx)(n.g,{src:e.sender.avatar}),(0,g.jsx)(n.h,{className:`text-xs`,children:RF(e.sender)})]}),(0,g.jsxs)(`div`,{className:t.t(`max-w-[70%]`,r&&`items-end`),children:[e.replyTo&&(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.replyTo.sender.name}),(0,g.jsx)(`p`,{className:`truncate`,children:e.replyTo.content})]}),(0,g.jsxs)(`div`,{className:t.t(`relative rounded-2xl px-4 py-2`,r?`bg-primary text-primary-foreground rounded-tr-sm`:`bg-muted rounded-tl-sm`),children:[e.attachments&&e.attachments.length>0&&(0,g.jsx)(`div`,{className:`space-y-2 mb-2`,children:e.attachments.map((e,t)=>(0,g.jsx)(`div`,{children:e.type===`image`?(0,g.jsx)(`img`,{src:e.url,alt:e.name,className:`rounded-lg max-w-full`}):(0,g.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-background/10 rounded`,children:[(0,g.jsx)(p.File,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{className:`text-sm truncate`,children:e.name})]})},t))}),(0,g.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words`,children:e.content}),(0,g.jsxs)(`div`,{className:t.t(`absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1`,r?`-left-20`:`-right-20`),children:[(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>c?.(e),children:(0,g.jsx)(p.Reply,{className:`h-3 w-3`})}),r&&s&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>s(e.id),children:(0,g.jsx)(p.Trash2,{className:`h-3 w-3`})})]})]}),(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-1 mt-1 text-xs text-muted-foreground`,r&&`justify-end`),children:[o&&(0,g.jsx)(`span`,{children:(e=>(typeof e==`string`?new Date(e):e).toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}))(e.timestamp)}),e.isEdited&&(0,g.jsx)(`span`,{children:`(modifié)`}),r&&a&&(()=>{switch(e.status){case`sending`:return(0,g.jsx)(`div`,{className:`h-3 w-3 rounded-full border-2 border-current animate-pulse`});case`sent`:return(0,g.jsx)(p.Check,{className:`h-3 w-3`});case`delivered`:return(0,g.jsx)(p.CheckCheck,{className:`h-3 w-3`});case`read`:return(0,g.jsx)(p.CheckCheck,{className:`h-3 w-3 text-blue-500`});case`error`:return(0,g.jsx)(p.X,{className:`h-3 w-3 text-red-500`});default:return null}})()]})]})]})}function UF({onSend:e,replyTo:t,onCancelReply:n,showAttachments:r,showEmoji:a,placeholder:s,sending:c,showHint:l=!0,hintText:u=`Appuyez sur Entrée pour envoyer, Maj+Entrée pour un saut de ligne`}){let[f,m]=d.useState(``),h=d.useRef(null),_=()=>{f.trim()&&!c&&(e(f.trim()),m(``))};return d.useEffect(()=>{h.current&&(h.current.style.height=`auto`,h.current.style.height=Math.min(h.current.scrollHeight,120)+`px`)},[f]),(0,g.jsxs)(`div`,{className:`border-t p-3`,children:[t&&(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Reply,{className:`h-4 w-4 text-primary`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-medium`,children:t.sender.name}),(0,g.jsx)(`p`,{className:`text-muted-foreground truncate`,children:t.content})]})]}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:n,children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]}),(0,g.jsxs)(`div`,{className:`flex items-end gap-2`,children:[r&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,g.jsx)(p.Paperclip,{className:`h-4 w-4`})}),(0,g.jsx)(o.t,{ref:h,value:f,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),_())},placeholder:s,className:`flex-1 min-h-[40px] max-h-[120px] resize-none`,disabled:c,rows:1}),a&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,g.jsx)(p.Smile,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{onClick:_,disabled:!f.trim()||c,size:`icon`,className:`flex-shrink-0 rounded-full`,children:(0,g.jsx)(p.Send,{className:`h-4 w-4`})})]}),l&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:u})]})}function WF({conversations:e=[],activeConversation:i,messages:a,currentUser:o,onSendMessage:s,onConversationSelect:c,onMessageDelete:l,onMessageReply:u,onSearch:f,onAudioCall:m,onVideoCall:h,onClose:_,onCloseConversation:v,onMinimize:y,showConversationList:b=!0,showHeader:x=!0,showMessageStatus:S=!0,showTimestamps:C=!0,showAttachments:w=!0,showEmoji:T=!0,showDateSeparators:E=!0,showInputHint:D=!0,showCloseButton:O=!1,inputPlaceholder:k,inputHintText:A,sending:j=!1,loading:M=!1,layout:N=`full`,headerTitle:P,showHeaderStatus:F=!0,statusText:I,minimized:L=!1,className:R}){let[z,B]=d.useState(null),V=d.useRef(null);d.useEffect(()=>{V.current?.scrollIntoView({behavior:`smooth`})},[a]);let H=(e,t)=>{s?.(e,t),B(null)},U=e=>{B(e),u?.(e)};return(N===`floating`||N===`widget`)&&L?(0,g.jsxs)(`button`,{onClick:y,className:t.t(`flex items-center gap-3 p-3 bg-primary text-primary-foreground rounded-full shadow-lg hover:shadow-xl transition-shadow`,R),children:[(0,g.jsx)(p.MessageCircle,{className:`h-5 w-5`}),(0,g.jsx)(`span`,{className:`font-medium`,children:`Messages`}),e.reduce((e,t)=>e+(t.unreadCount||0),0)>0&&(0,g.jsx)(r.t,{variant:`secondary`,className:`bg-white text-primary`,children:e.reduce((e,t)=>e+(t.unreadCount||0),0)})]}):(0,g.jsxs)(`div`,{className:t.t(`flex bg-background overflow-hidden`,{full:`h-screen`,embedded:`h-[600px]`,floating:`h-[500px] w-[400px] rounded-lg shadow-xl border`,widget:`h-[500px] w-[350px] rounded-lg shadow-2xl border`}[N],R),children:[b&&N!==`widget`&&N!==`floating`&&(0,g.jsx)(`div`,{className:`w-80 flex-shrink-0`,children:(0,g.jsx)(BF,{conversations:e,activeId:i?.id,currentUser:o,onSelect:e=>c?.(e),onSearch:f})}),(0,g.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:i||N===`widget`||N===`floating`?(0,g.jsxs)(g.Fragment,{children:[x&&(0,g.jsx)(VF,{conversation:i,currentUser:o,title:P,statusText:I,showStatus:F,showCloseButton:O,onAudioCall:m,onVideoCall:h,onClose:_,onCloseConversation:v,onMinimize:y,layout:N}),(0,g.jsx)(n.f,{className:`flex-1 p-4`,children:(0,g.jsxs)(`div`,{className:`space-y-4`,children:[M?(0,g.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,g.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-primary`})}):(()=>{let e=[],t=null;return a.forEach((n,r)=>{let i=typeof n.timestamp==`string`?new Date(n.timestamp):n.timestamp;E&&(!t||!LF(t,i))&&(e.push((0,g.jsx)(zF,{date:i},`separator-${r}`)),t=i),e.push((0,g.jsx)(HF,{message:n,isOwn:n.sender.id===o.id,showStatus:S,showTimestamp:C,onDelete:l,onReply:U},n.id))}),e})(),(0,g.jsx)(`div`,{ref:V})]})}),(0,g.jsx)(UF,{onSend:H,replyTo:z,onCancelReply:()=>B(null),showAttachments:w,showEmoji:T,placeholder:(()=>{if(k)return k;if(i){let e=i.participants.find(e=>e.id!==o.id);if(e)return`Écrire à ${e.name}...`}return`Écrivez votre message...`})(),sending:j,showHint:D,hintText:A})]}):(0,g.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground`,children:(0,g.jsxs)(`div`,{className:`text-center`,children:[(0,g.jsx)(p.MessageCircle,{className:`h-12 w-12 mx-auto mb-4 opacity-50`}),(0,g.jsx)(`p`,{children:`Sélectionnez une conversation`})]})})})]})}var GF={id:`current`,name:`Moi`,status:`online`},KF=[{id:`1`,participants:[GF,{id:`2`,name:`Marie Dupont`,status:`online`}],lastMessage:{id:`m1`,content:`D'accord, je m'en occupe !`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5),status:`read`},unreadCount:0},{id:`2`,participants:[GF,{id:`3`,name:`Pierre Martin`,status:`offline`}],lastMessage:{id:`m2`,content:`On se voit demain ?`,sender:GF,timestamp:new Date(Date.now()-1e3*60*60),status:`delivered`},unreadCount:2}],qF=[{id:`1`,content:`Salut ! Comment ça va ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*30),status:`read`},{id:`2`,content:`Ça va bien merci ! Et toi ?`,sender:GF,timestamp:new Date(Date.now()-1e3*60*25),status:`read`},{id:`3`,content:`Super ! Tu as vu le nouveau projet ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*20),status:`read`}],JF={"no-data":{title:`Aucune donnée`,description:`Il n'y a pas encore de données à afficher.`,icon:p.Inbox,actionLabel:`Ajouter`,actionIcon:p.Plus},"no-results":{title:`Aucun résultat`,description:`Aucun élément ne correspond à votre recherche.`,icon:p.Search,actionLabel:`Effacer les filtres`,actionIcon:p.Filter},"no-messages":{title:`Aucun message`,description:`Votre boîte de réception est vide.`,icon:p.MessageSquare,actionLabel:`Nouveau message`,actionIcon:p.Plus},"no-files":{title:`Aucun fichier`,description:`Vous n'avez pas encore de fichiers.`,icon:p.FolderOpen,actionLabel:`Importer un fichier`,actionIcon:p.Upload},"no-users":{title:`Aucun utilisateur`,description:`Il n'y a pas encore d'utilisateurs.`,icon:p.Users,actionLabel:`Inviter des utilisateurs`,actionIcon:p.Plus},"no-cart":{title:`Panier vide`,description:`Votre panier est vide.`,icon:p.ShoppingCart,actionLabel:`Parcourir les produits`,actionIcon:p.ArrowRight},"no-notifications":{title:`Aucune notification`,description:`Vous êtes à jour !`,icon:p.Bell},"no-events":{title:`Aucun événement`,description:`Aucun événement prévu.`,icon:p.Calendar,actionLabel:`Créer un événement`,actionIcon:p.Plus},"no-images":{title:`Aucune image`,description:`Vous n'avez pas encore d'images.`,icon:p.Image,actionLabel:`Importer des images`,actionIcon:p.Upload},"no-bookmarks":{title:`Aucun favori`,description:`Vous n'avez pas encore de favoris.`,icon:p.Bookmark,actionLabel:`Parcourir`,actionIcon:p.ArrowRight},"no-favorites":{title:`Aucun favori`,description:`Vous n'avez pas encore aimé de contenu.`,icon:p.Heart},error:{title:`Une erreur est survenue`,description:`Impossible de charger les données.`,icon:p.FileQuestion,actionLabel:`Réessayer`,actionIcon:p.RefreshCw},custom:{title:`Aucun élément`,description:`Il n'y a rien à afficher.`,icon:p.Inbox}};function YF({type:e,size:n,className:r}){let i=JF[e].icon,a={sm:{container:`h-24 w-24`,icon:`h-8 w-8`,circles:{outer:`h-20 w-20`,inner:`h-14 w-14`}},md:{container:`h-32 w-32`,icon:`h-10 w-10`,circles:{outer:`h-28 w-28`,inner:`h-20 w-20`}},lg:{container:`h-40 w-40`,icon:`h-12 w-12`,circles:{outer:`h-36 w-36`,inner:`h-28 w-28`}}}[n];return(0,g.jsxs)(`div`,{className:t.t(`relative flex items-center justify-center`,a.container,r),children:[(0,g.jsx)(`div`,{className:t.t(`absolute rounded-full bg-muted/50`,a.circles.outer)}),(0,g.jsx)(`div`,{className:t.t(`absolute rounded-full bg-muted`,a.circles.inner)}),(0,g.jsx)(`div`,{className:`relative z-10 flex items-center justify-center rounded-full bg-background p-4 shadow-sm`,children:(0,g.jsx)(i,{className:t.t(a.icon,`text-muted-foreground`)})}),(0,g.jsx)(`div`,{className:`absolute -right-1 top-2 h-2 w-2 rounded-full bg-primary/20`}),(0,g.jsx)(`div`,{className:`absolute -left-1 bottom-4 h-1.5 w-1.5 rounded-full bg-primary/30`}),(0,g.jsx)(`div`,{className:`absolute right-4 bottom-0 h-2.5 w-2.5 rounded-full bg-primary/10`})]})}function XF({type:e=`no-data`,title:n,description:r,icon:a,actions:o,illustration:s,showIllustration:c=!0,size:l=`md`,layout:u=`vertical`,centered:f=!0,children:p,className:m,LinkComponent:h}){let _=JF[e],v=n??_.title,y=r??_.description;_.icon;let b={sm:{container:`py-8 px-4`,title:`text-base`,description:`text-sm`,icon:`h-8 w-8`},md:{container:`py-12 px-6`,title:`text-lg`,description:`text-sm`,icon:`h-10 w-10`},lg:{container:`py-16 px-8`,title:`text-xl`,description:`text-base`,icon:`h-12 w-12`}},x=[];if(_.actionLabel&&!o){let e=_.actionIcon;x.push({label:_.actionLabel,variant:`default`,icon:e?(0,g.jsx)(e,{className:`h-4 w-4`}):void 0})}let S=o||(x.length>0?x:void 0);return u===`horizontal`?(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-6`,b[l].container,f&&`justify-center`,m),children:[c&&(0,g.jsx)(`div`,{className:`flex-shrink-0`,children:s||(a?(0,g.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-muted p-4`,children:a}):(0,g.jsx)(YF,{type:e,size:l}))}),(0,g.jsxs)(`div`,{className:`flex flex-col`,children:[(0,g.jsx)(`h3`,{className:t.t(`font-semibold`,b[l].title),children:v}),(0,g.jsx)(`p`,{className:t.t(`text-muted-foreground mt-1`,b[l].description),children:y}),p&&(0,g.jsx)(`div`,{className:`mt-4`,children:p}),S&&S.length>0&&(0,g.jsx)(`div`,{className:`flex gap-3 mt-4`,children:S.map((e,t)=>(0,g.jsx)(i.n,{variant:e.variant||`default`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?h?(0,g.jsxs)(h,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(g.Fragment,{children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})]}):(0,g.jsxs)(`div`,{className:t.t(`flex flex-col items-center`,f&&`text-center`,b[l].container,m),children:[c&&(0,g.jsx)(`div`,{className:`mb-6`,children:s||(a?(0,g.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-muted p-6`,children:d.cloneElement(a,{className:t.t(b[l].icon,`text-muted-foreground`)})}):(0,g.jsx)(YF,{type:e,size:l}))}),(0,g.jsx)(`h3`,{className:t.t(`font-semibold`,b[l].title),children:v}),(0,g.jsx)(`p`,{className:t.t(`text-muted-foreground mt-2 max-w-sm`,b[l].description),children:y}),p&&(0,g.jsx)(`div`,{className:`mt-4`,children:p}),S&&S.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-3 mt-6 justify-center`,children:S.map((e,t)=>(0,g.jsx)(i.n,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?h?(0,g.jsxs)(h,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(g.Fragment,{children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})}function ZF(e){return(0,g.jsx)(XF,{type:`no-data`,...e})}function QF(e){return(0,g.jsx)(XF,{type:`no-results`,...e})}function $F(e){return(0,g.jsx)(XF,{type:`no-messages`,...e})}function eI(e){return(0,g.jsx)(XF,{type:`no-files`,...e})}function tI(e){return(0,g.jsx)(XF,{type:`no-cart`,...e})}function nI(e){return(0,g.jsx)(XF,{type:`no-notifications`,...e})}function rI(e){return(0,g.jsx)(XF,{type:`error`,...e})}var iI={404:{code:`404`,title:`Page non trouvée`,description:`Désolé, la page que vous recherchez n'existe pas ou a été déplacée.`,icon:p.FileQuestion},500:{code:`500`,title:`Erreur serveur`,description:`Une erreur inattendue s'est produite. Notre équipe a été notifiée.`,icon:p.ServerCrash},403:{code:`403`,title:`Accès refusé`,description:`Vous n'avez pas les permissions nécessaires pour accéder à cette page.`,icon:p.ShieldX},503:{code:`503`,title:`Service indisponible`,description:`Le service est temporairement indisponible. Veuillez réessayer plus tard.`,icon:p.ServerCrash},offline:{code:`Hors ligne`,title:`Vous êtes hors ligne`,description:`Vérifiez votre connexion internet et réessayez.`,icon:p.Wifi},maintenance:{code:`Maintenance`,title:`Maintenance en cours`,description:`Nous effectuons une maintenance. Nous serons bientôt de retour.`,icon:p.Construction},custom:{code:``,title:`Erreur`,description:`Une erreur s'est produite.`,icon:p.FileQuestion}};function aI({type:e,className:n}){let r=iI[e].icon;return(0,g.jsxs)(`div`,{className:t.t(`relative flex items-center justify-center`,n),children:[(0,g.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,g.jsx)(`div`,{className:`h-48 w-48 rounded-full bg-muted/50`})}),(0,g.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,g.jsx)(`div`,{className:`h-32 w-32 rounded-full bg-muted`})}),(0,g.jsx)(`div`,{className:`relative z-10 flex h-20 w-20 items-center justify-center rounded-full bg-background shadow-lg`,children:(0,g.jsx)(r,{className:`h-10 w-10 text-muted-foreground`})}),(0,g.jsx)(`div`,{className:`absolute -right-4 top-4 h-3 w-3 rounded-full bg-primary/20`}),(0,g.jsx)(`div`,{className:`absolute -left-2 bottom-8 h-2 w-2 rounded-full bg-primary/30`}),(0,g.jsx)(`div`,{className:`absolute right-8 bottom-2 h-4 w-4 rounded-full bg-primary/10`})]})}function oI({type:e=`404`,code:n,title:r,description:a,actions:o,illustration:s,showCode:c=!0,showIllustration:l=!0,showBackButton:u=!0,onBack:d,showHomeButton:f=!0,homeUrl:m=`/`,showRefreshButton:h=!1,children:_,layout:v=`centered`,size:y=`md`,className:b,LinkComponent:x}){let S=iI[e],C=n??S.code,w=r??S.title,T=a??S.description,E={sm:{container:`py-12 px-4`,code:`text-6xl`,title:`text-xl`,description:`text-sm`,illustration:`h-32 w-32`},md:{container:`py-16 px-6`,code:`text-8xl`,title:`text-2xl`,description:`text-base`,illustration:`h-48 w-48`},lg:{container:`py-24 px-8`,code:`text-9xl`,title:`text-3xl`,description:`text-lg`,illustration:`h-64 w-64`}},D=[];u&&D.push({label:`Retour`,onClick:d||(()=>window.history.back()),variant:`outline`,icon:(0,g.jsx)(p.ArrowLeft,{className:`h-4 w-4`})}),f&&D.push({label:`Accueil`,href:m,variant:`default`,icon:(0,g.jsx)(p.Home,{className:`h-4 w-4`})}),h&&D.push({label:`Réessayer`,onClick:()=>window.location.reload(),variant:`secondary`,icon:(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4`})});let O=o||D;return v===`split`?(0,g.jsxs)(`div`,{className:t.t(`min-h-screen flex flex-col lg:flex-row`,b),children:[(0,g.jsx)(`div`,{className:`flex-1 bg-muted/30 flex items-center justify-center p-8 lg:p-16`,children:(0,g.jsx)(`div`,{className:E[y].illustration,children:s||(0,g.jsx)(aI,{type:e})})}),(0,g.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8 lg:p-16`,children:(0,g.jsxs)(`div`,{className:`max-w-md`,children:[c&&C&&(0,g.jsx)(`div`,{className:t.t(`font-bold text-primary mb-4`,y===`sm`?`text-4xl`:y===`md`?`text-5xl`:`text-6xl`),children:C}),(0,g.jsx)(`h1`,{className:t.t(`font-bold tracking-tight mb-4`,E[y].title),children:w}),(0,g.jsx)(`p`,{className:t.t(`text-muted-foreground mb-8`,E[y].description),children:T}),_&&(0,g.jsx)(`div`,{className:`mb-8`,children:_}),O.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:O.map((e,t)=>(0,g.jsx)(i.n,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?x?(0,g.jsxs)(x,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(g.Fragment,{children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})})]}):(0,g.jsx)(`div`,{className:t.t(`min-h-screen flex items-center justify-center`,E[y].container,b),children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[l&&(0,g.jsx)(`div`,{className:t.t(`mb-8`,E[y].illustration),children:s||(0,g.jsx)(aI,{type:e})}),c&&C&&(0,g.jsx)(`div`,{className:t.t(`font-bold text-muted-foreground/20 mb-4`,E[y].code),children:C}),(0,g.jsx)(`h1`,{className:t.t(`font-bold tracking-tight mb-4`,E[y].title),children:w}),(0,g.jsx)(`p`,{className:t.t(`text-muted-foreground max-w-md mb-8`,E[y].description),children:T}),_&&(0,g.jsx)(`div`,{className:`mb-8`,children:_}),O.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-3 justify-center`,children:O.map((e,t)=>(0,g.jsx)(i.n,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?x?(0,g.jsxs)(x,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(g.Fragment,{children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})})}function sI(e){return(0,g.jsx)(oI,{type:`404`,...e})}function cI(e){return(0,g.jsx)(oI,{type:`500`,showRefreshButton:!0,...e})}function lI(e){return(0,g.jsx)(oI,{type:`403`,...e})}function uI(e){return(0,g.jsx)(oI,{type:`maintenance`,showBackButton:!1,showHomeButton:!1,...e})}function dI(e){return(0,g.jsx)(oI,{type:`offline`,showRefreshButton:!0,...e})}function fI({value:e,onChange:t,placeholder:n}){return(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{type:`text`,placeholder:n,value:e,onChange:e=>t(e.target.value),className:`pl-10`})]})}function pI({categories:e,activeCategory:n,onCategoryChange:i,itemCounts:a}){return(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>i(null),className:t.t(`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors`,n===null?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`),children:[`Tous`,(0,g.jsx)(r.t,{variant:`secondary`,className:`ml-1`,children:Object.values(a).reduce((e,t)=>e+t,0)})]}),e.map(e=>(0,g.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:t.t(`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors`,n===e.id?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`),children:[e.icon,e.name,(0,g.jsx)(r.t,{variant:`secondary`,className:`ml-1`,children:a[e.id]||0})]},e.id))]})}function mI({itemId:e,helpful:n=0,notHelpful:r=0,onFeedback:i}){let[a,o]=d.useState(null),s=t=>{a===null&&(o(t),i(e,t))};return(0,g.jsxs)(`div`,{className:`flex items-center gap-4 mt-4 pt-4 border-t`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Cette réponse vous a-t-elle aidé ?`}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),disabled:a!==null,className:t.t(`inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors`,a===!0?`bg-green-100 text-green-700`:a===null?`hover:bg-muted`:`opacity-50`),children:[`👍 `,n+(a===!0?1:0)]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>s(!1),disabled:a!==null,className:t.t(`inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors`,a===!1?`bg-red-100 text-red-700`:a===null?`hover:bg-muted`:`opacity-50`),children:[`👎 `,r+(a===!1?1:0)]})]})]})}function hI({items:e,categories:n=[],title:i=`Questions fréquentes`,description:a,showSearch:o=!0,searchPlaceholder:s=`Rechercher une question...`,showCategoryFilter:c=!0,activeCategory:l,onCategoryChange:u,allowMultiple:f=!1,defaultOpen:m=[],showFeedback:h=!1,onFeedback:_,layout:v=`default`,size:y=`md`,className:b}){let[x,S]=d.useState(``),[C,w]=d.useState(null),T=l??C,E=e=>{u?u(e):w(e)},D=d.useMemo(()=>e.filter(e=>{if(x){let t=x.toLowerCase();if(!(e.question.toLowerCase().includes(t)||typeof e.answer==`string`&&e.answer.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))))return!1}return!(T&&e.category!==T)}),[e,x,T]),O=d.useMemo(()=>{let t={};return e.forEach(e=>{e.category&&(t[e.category]=(t[e.category]||0)+1)}),t},[e]),k=d.useMemo(()=>{if(v!==`grouped`)return null;let e={};return D.forEach(t=>{let n=t.category||`other`;e[n]||(e[n]=[]),e[n].push(t)}),e},[D,v]),A={sm:{title:`text-xl`,question:`text-sm`,answer:`text-sm`},md:{title:`text-2xl`,question:`text-base`,answer:`text-sm`},lg:{title:`text-3xl`,question:`text-lg`,answer:`text-base`}},j=e=>(0,g.jsx)(g.Fragment,{children:e.map(e=>(0,g.jsxs)(J,{value:e.id,className:t.t(v===`cards`&&`border rounded-lg px-4 bg-card`),children:[(0,g.jsx)(te,{className:t.t(`hover:no-underline`,A[y].question),children:(0,g.jsx)(`span`,{className:`text-left`,children:e.question})}),(0,g.jsxs)(ne,{children:[(0,g.jsx)(`div`,{className:t.t(`text-muted-foreground`,A[y].answer),children:typeof e.answer==`string`?(0,g.jsx)(`p`,{children:e.answer}):e.answer}),e.tags&&e.tags.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:e.tags.map(e=>(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs`,children:e},e))}),h&&_&&(0,g.jsx)(mI,{itemId:e.id,helpful:e.helpful,notHelpful:e.notHelpful,onFeedback:_})]})]},e.id))}),M=e=>f?(0,g.jsx)(ee,{type:`multiple`,defaultValue:m,className:`space-y-2`,children:j(e)}):(0,g.jsx)(ee,{type:`single`,defaultValue:m[0],collapsible:!0,className:`space-y-2`,children:j(e)});return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,b),children:[(0,g.jsxs)(`div`,{className:`text-center`,children:[(0,g.jsx)(`h2`,{className:t.t(`font-bold tracking-tight`,A[y].title),children:i}),a&&(0,g.jsx)(`p`,{className:`text-muted-foreground mt-2 max-w-2xl mx-auto`,children:a})]}),o&&(0,g.jsx)(`div`,{className:`max-w-md mx-auto`,children:(0,g.jsx)(fI,{value:x,onChange:S,placeholder:s})}),c&&n.length>0&&(0,g.jsx)(`div`,{className:`flex justify-center`,children:(0,g.jsx)(pI,{categories:n,activeCategory:T,onCategoryChange:E,itemCounts:O})}),D.length===0?(0,g.jsxs)(`div`,{className:`text-center py-12`,children:[(0,g.jsx)(p.HelpCircle,{className:`h-12 w-12 text-muted-foreground mx-auto mb-4`}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Aucune question ne correspond à votre recherche.`})]}):v===`grouped`&&k?(0,g.jsx)(`div`,{className:`space-y-8`,children:Object.entries(k).map(([e,t])=>{let r=n.find(t=>t.id===e);return(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`text-lg font-semibold mb-4 flex items-center gap-2`,children:[r?.icon,r?.name||e]}),M(t)]},e)})}):(0,g.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:M(D)})]})}var gI=[{id:`general`,name:`Général`,icon:(0,g.jsx)(p.HelpCircle,{className:`h-4 w-4`})},{id:`billing`,name:`Facturation`,icon:(0,g.jsx)(p.MessageCircle,{className:`h-4 w-4`})},{id:`technical`,name:`Technique`,icon:(0,g.jsx)(p.MessageCircle,{className:`h-4 w-4`})}],_I=[{id:`1`,question:`Comment créer un compte ?`,answer:`Pour créer un compte, cliquez sur le bouton 'S'inscrire' en haut à droite de la page, puis remplissez le formulaire avec vos informations personnelles.`,category:`general`,tags:[`compte`,`inscription`]},{id:`2`,question:`Comment réinitialiser mon mot de passe ?`,answer:`Cliquez sur 'Mot de passe oublié' sur la page de connexion, entrez votre email et suivez les instructions envoyées par email.`,category:`general`,tags:[`mot de passe`,`sécurité`]},{id:`3`,question:`Quels moyens de paiement acceptez-vous ?`,answer:`Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.`,category:`billing`,tags:[`paiement`,`carte`]},{id:`4`,question:`Comment annuler mon abonnement ?`,answer:`Vous pouvez annuler votre abonnement à tout moment depuis les paramètres de votre compte, section 'Abonnement'.`,category:`billing`,tags:[`abonnement`,`annulation`]},{id:`5`,question:`L'API est-elle disponible ?`,answer:`Oui, notre API REST est disponible pour tous les plans payants. Consultez notre documentation développeur pour plus d'informations.`,category:`technical`,tags:[`API`,`développeur`]}],vI={folder:{icon:p.Folder,color:`text-yellow-500`},document:{icon:p.FileText,color:`text-blue-500`},image:{icon:p.FileImage,color:`text-green-500`},video:{icon:p.FileVideo,color:`text-purple-500`},audio:{icon:p.FileAudio,color:`text-pink-500`},archive:{icon:p.FileArchive,color:`text-orange-500`},code:{icon:p.FileCode,color:`text-cyan-500`},other:{icon:p.File,color:`text-gray-500`}};function yI(e){if(!e)return`-`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=0,r=e;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${r.toFixed(1)} ${t[n]}`}function bI({breadcrumbs:e,viewMode:n,onViewModeChange:r,onNavigate:a,onCreateFolder:o,onUpload:c,onRefresh:l,showSearch:u,onSearch:f,selectedCount:m,onDeleteSelected:h,onDownloadSelected:_}){let[v,y]=d.useState(``);return(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:l,children:(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4`})}),c&&(0,g.jsxs)(i.n,{variant:`outline`,onClick:c,children:[(0,g.jsx)(p.Upload,{className:`h-4 w-4 mr-2`}),`Importer`]}),o&&(0,g.jsxs)(i.n,{variant:`outline`,onClick:o,children:[(0,g.jsx)(p.FolderPlus,{className:`h-4 w-4 mr-2`}),`Nouveau dossier`]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&f&&(0,g.jsxs)(`div`,{className:`relative w-64`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher...`,value:v,onChange:e=>{y(e.target.value),f(e.target.value)},className:`pl-9`})]}),(0,g.jsx)(i.n,{variant:n===`grid`?`secondary`:`ghost`,size:`icon`,onClick:()=>r(`grid`),children:(0,g.jsx)(p.Grid,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{variant:n===`list`?`secondary`:`ghost`,size:`icon`,onClick:()=>r(`list`),children:(0,g.jsx)(p.List,{className:`h-4 w-4`})})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1 text-sm`,children:[(0,g.jsx)(`button`,{onClick:()=>a(`/`),className:`flex items-center gap-1 hover:text-primary`,children:(0,g.jsx)(p.Home,{className:`h-4 w-4`})}),e.map((n,r)=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`button`,{onClick:()=>a(n.path),className:t.t(`hover:text-primary`,r===e.length-1&&`font-medium`),children:n.name})]},n.id))]}),m>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-4 p-3 bg-muted rounded-lg`,children:[(0,g.jsxs)(`span`,{className:`text-sm font-medium`,children:[m,` élément(s) sélectionné(s)`]}),_&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:_,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Télécharger`]}),h&&(0,g.jsxs)(i.n,{variant:`destructive`,size:`sm`,onClick:h,children:[(0,g.jsx)(p.Trash2,{className:`h-4 w-4 mr-2`}),`Supprimer`]})]})]})}function xI({file:e,viewMode:n,isSelected:a,onSelect:o,onOpen:s,onRename:c,onDelete:l,onDownload:u,onShare:d,onToggleStar:f}){let m=vI[e.type],h=m.icon,_=typeof e.modifiedAt==`string`?new Date(e.modifiedAt):e.modifiedAt,v=()=>{e.type===`folder`&&s()};return n===`grid`?(0,g.jsxs)(`div`,{className:t.t(`relative group p-4 rounded-lg border cursor-pointer transition-colors`,a?`bg-primary/10 border-primary`:`hover:bg-muted`),onClick:()=>o(!a),onDoubleClick:v,children:[(0,g.jsx)(`div`,{className:`absolute top-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,g.jsx)(Se,{checked:a,onCheckedChange:e=>o(e),onClick:e=>e.stopPropagation()})}),e.starred&&(0,g.jsx)(p.Star,{className:`absolute top-2 right-2 h-4 w-4 text-yellow-500 fill-yellow-500`}),(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[e.thumbnail&&e.type===`image`?(0,g.jsx)(`img`,{src:e.thumbnail,alt:e.name,className:`w-16 h-16 object-cover rounded`}):(0,g.jsx)(h,{className:t.t(`h-12 w-12`,m.color)}),(0,g.jsx)(`span`,{className:`text-sm font-medium text-center line-clamp-2`,children:e.name}),e.type!==`folder`&&(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:yI(e.size)})]}),(0,g.jsx)(`div`,{className:`absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:s,children:[(0,g.jsx)(p.Eye,{className:`mr-2 h-4 w-4`}),`Ouvrir`]}),c&&(0,g.jsxs)($,{onClick:c,children:[(0,g.jsx)(p.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),u&&e.type!==`folder`&&(0,g.jsxs)($,{onClick:u,children:[(0,g.jsx)(p.Download,{className:`mr-2 h-4 w-4`}),`Télécharger`]}),d&&(0,g.jsxs)($,{onClick:d,children:[(0,g.jsx)(p.Share2,{className:`mr-2 h-4 w-4`}),`Partager`]}),f&&(0,g.jsx)($,{onClick:f,children:e.starred?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.StarOff,{className:`mr-2 h-4 w-4`}),`Retirer des favoris`]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Star,{className:`mr-2 h-4 w-4`}),`Ajouter aux favoris`]})}),l&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:l,className:`text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})})]}):(0,g.jsxs)(hr,{className:t.t(`cursor-pointer`,a&&`bg-primary/10`),onClick:()=>o(!a),onDoubleClick:v,children:[(0,g.jsx)(_r,{className:`w-12`,children:(0,g.jsx)(Se,{checked:a,onCheckedChange:e=>o(e),onClick:e=>e.stopPropagation()})}),(0,g.jsx)(_r,{children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(h,{className:t.t(`h-5 w-5`,m.color)}),(0,g.jsx)(`span`,{className:`font-medium`,children:e.name}),e.starred&&(0,g.jsx)(p.Star,{className:`h-4 w-4 text-yellow-500 fill-yellow-500`}),e.shared&&(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:`Partagé`})]})}),(0,g.jsx)(_r,{className:`text-muted-foreground`,children:yI(e.size)}),(0,g.jsx)(_r,{className:`text-muted-foreground`,children:_.toLocaleDateString(`fr-FR`)}),(0,g.jsx)(_r,{children:(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:s,children:[(0,g.jsx)(p.Eye,{className:`mr-2 h-4 w-4`}),`Ouvrir`]}),c&&(0,g.jsxs)($,{onClick:c,children:[(0,g.jsx)(p.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),u&&e.type!==`folder`&&(0,g.jsxs)($,{onClick:u,children:[(0,g.jsx)(p.Download,{className:`mr-2 h-4 w-4`}),`Télécharger`]}),l&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:l,className:`text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})})]})}function SI({files:e,currentPath:n=`/`,breadcrumbs:r=[],selectedFiles:a=[],onSelectionChange:o,onNavigate:c,onFileOpen:l,onDownload:u,onDelete:f,onRename:m,onCopy:h,onMove:_,onCreateFolder:v,onUpload:y,onShare:b,onToggleStar:x,onRefresh:S,viewMode:C,onViewModeChange:w,showSearch:T=!0,onSearch:E,showHeader:D=!0,showActions:O=!0,loading:k=!1,className:A}){let[j,M]=d.useState(`grid`),[N,P]=d.useState(!1),[F,I]=d.useState(null),[L,R]=d.useState(``),[z,B]=d.useState(!1),[V,H]=d.useState([]),[U,W]=d.useState(!1),[G,K]=d.useState(``),q=C??j,ee=e=>{w?w(e):M(e)},J=(e,t)=>{t?o?.([...a,e]):o?.(a.filter(t=>t!==e))},te=e=>{e.type===`folder`?c?.(e.path,e.id):l?.(e)},ne=e=>{I(e),R(e.name),P(!0)},ie=()=>{F&&L.trim()&&L!==F.name&&m?.(F.id,L.trim()),P(!1),I(null)},ae=()=>{H(a),B(!0)},oe=()=>{f?.(V),B(!1),H([]),o?.([])},me=()=>{G.trim()&&(v?.(G.trim(),n),W(!1),K(``))},he=[...e].sort((e,t)=>e.type===`folder`&&t.type!==`folder`?-1:e.type!==`folder`&&t.type===`folder`?1:e.name.localeCompare(t.name));return(0,g.jsxs)(`div`,{className:t.t(`space-y-4`,A),children:[D&&(0,g.jsx)(bI,{breadcrumbs:r,viewMode:q,onViewModeChange:ee,onNavigate:e=>c?.(e),onCreateFolder:v?()=>W(!0):void 0,onUpload:y?()=>{}:void 0,onRefresh:S,showSearch:T,onSearch:E,selectedCount:a.length,onDeleteSelected:f?ae:void 0,onDownloadSelected:u?()=>u(a):void 0}),k?(0,g.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,g.jsx)(p.RefreshCw,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):he.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-muted-foreground`,children:[(0,g.jsx)(p.Folder,{className:`h-12 w-12 mb-4`}),(0,g.jsx)(`p`,{children:`Ce dossier est vide`})]}):q===`grid`?(0,g.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4`,children:he.map(e=>(0,g.jsx)(xI,{file:e,viewMode:`grid`,isSelected:a.includes(e.id),onSelect:t=>J(e.id,t),onOpen:()=>te(e),onRename:m?()=>ne(e):void 0,onDelete:f?()=>{H([e.id]),B(!0)}:void 0,onDownload:u?()=>u([e.id]):void 0,onShare:b?()=>b(e.id):void 0,onToggleStar:x?()=>x(e.id):void 0},e.id))}):(0,g.jsxs)(dr,{children:[(0,g.jsx)(fr,{children:(0,g.jsxs)(hr,{children:[(0,g.jsx)(gr,{className:`w-12`,children:(0,g.jsx)(Se,{checked:a.length===e.length&&e.length>0,onCheckedChange:t=>{t?o?.(e.map(e=>e.id)):o?.([])}})}),(0,g.jsx)(gr,{children:`Nom`}),(0,g.jsx)(gr,{children:`Taille`}),(0,g.jsx)(gr,{children:`Modifié`}),(0,g.jsx)(gr,{className:`w-12`})]})}),(0,g.jsx)(pr,{children:he.map(e=>(0,g.jsx)(xI,{file:e,viewMode:`list`,isSelected:a.includes(e.id),onSelect:t=>J(e.id,t),onOpen:()=>te(e),onRename:m?()=>ne(e):void 0,onDelete:f?()=>{H([e.id]),B(!0)}:void 0,onDownload:u?()=>u([e.id]):void 0,onShare:b?()=>b(e.id):void 0,onToggleStar:x?()=>x(e.id):void 0},e.id))})]}),(0,g.jsx)(mt,{open:N,onOpenChange:P,children:(0,g.jsxs)(yt,{children:[(0,g.jsx)(bt,{children:(0,g.jsx)(St,{children:`Renommer`})}),(0,g.jsx)(s.t,{value:L,onChange:e=>R(e.target.value),placeholder:`Nouveau nom`,onKeyDown:e=>e.key===`Enter`&&ie()}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>P(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:ie,children:`Renommer`})]})]})}),(0,g.jsx)(re,{open:z,onOpenChange:B,children:(0,g.jsxs)(se,{children:[(0,g.jsxs)(ce,{children:[(0,g.jsx)(ue,{children:`Supprimer ?`}),(0,g.jsxs)(de,{children:[`Êtes-vous sûr de vouloir supprimer `,V.length,` élément(s) ? Cette action est irréversible.`]})]}),(0,g.jsxs)(le,{children:[(0,g.jsx)(pe,{children:`Annuler`}),(0,g.jsx)(fe,{onClick:oe,children:`Supprimer`})]})]})}),(0,g.jsx)(mt,{open:U,onOpenChange:W,children:(0,g.jsxs)(yt,{children:[(0,g.jsx)(bt,{children:(0,g.jsx)(St,{children:`Nouveau dossier`})}),(0,g.jsx)(s.t,{value:G,onChange:e=>K(e.target.value),placeholder:`Nom du dossier`,onKeyDown:e=>e.key===`Enter`&&me()}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>W(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:me,children:`Créer`})]})]})})]})}var CI=[{id:`1`,name:`Documents`,type:`folder`,path:`/Documents`,createdAt:new Date(`2024-01-01`),modifiedAt:new Date(`2024-01-15`)},{id:`2`,name:`Images`,type:`folder`,path:`/Images`,createdAt:new Date(`2024-01-01`),modifiedAt:new Date(`2024-01-10`),starred:!0},{id:`3`,name:`Rapport Q4.pdf`,type:`document`,path:`/Rapport Q4.pdf`,size:2456e3,createdAt:new Date(`2024-01-05`),modifiedAt:new Date(`2024-01-05`)},{id:`4`,name:`Photo vacances.jpg`,type:`image`,path:`/Photo vacances.jpg`,size:567e4,createdAt:new Date(`2024-01-08`),modifiedAt:new Date(`2024-01-08`)},{id:`5`,name:`Présentation.pptx`,type:`document`,path:`/Présentation.pptx`,size:89e5,createdAt:new Date(`2024-01-12`),modifiedAt:new Date(`2024-01-14`),shared:!0}],wI=[{id:`root`,name:`Mes fichiers`,path:`/`}],TI={low:{label:`Basse`,color:`bg-gray-500`,icon:p.Clock},medium:{label:`Moyenne`,color:`bg-blue-500`,icon:p.Clock},high:{label:`Haute`,color:`bg-orange-500`,icon:p.AlertCircle},urgent:{label:`Urgente`,color:`bg-red-500`,icon:p.AlertCircle}};function EI({card:e,columnId:a,showAssignees:o,showLabels:s,showPriority:c,showDueDate:l,draggable:u,onCardClick:f,onCardEdit:m,onCardDelete:h,onDragStart:_}){let v=d.useMemo(()=>e.dueDate?(typeof e.dueDate==`string`?new Date(e.dueDate):e.dueDate)<new Date:!1,[e.dueDate]);return(0,g.jsx)(Y,{className:t.t(`cursor-pointer hover:shadow-md transition-shadow`,u&&`cursor-grab active:cursor-grabbing`),draggable:u,onDragStart:t=>_?.(t,e.id,a),onClick:()=>f?.(e,a),children:(0,g.jsxs)(Q,{className:`p-3 space-y-2`,children:[s&&e.labels&&e.labels.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.labels.map(e=>(0,g.jsx)(`div`,{className:`h-1.5 w-8 rounded-full`,style:{backgroundColor:e.color},title:e.name},e.id))}),(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,g.jsx)(`h4`,{className:`text-sm font-medium leading-tight`,children:e.title}),(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-6 w-6 flex-shrink-0`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-3 w-3`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:t=>{t.stopPropagation(),f?.(e,a)},children:[(0,g.jsx)(p.Edit,{className:`mr-2 h-4 w-4`}),`Modifier`]}),(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:t=>{t.stopPropagation(),h?.(e.id,a)},className:`text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]}),e.description&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between pt-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c&&e.priority&&(0,g.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,TI[e.priority].color),title:TI[e.priority].label}),l&&e.dueDate&&(0,g.jsxs)(r.t,{variant:v?`destructive`:`outline`,className:`text-xs px-1.5 py-0`,children:[(0,g.jsx)(p.Calendar,{className:`h-3 w-3 mr-1`}),(e=>(typeof e==`string`?new Date(e):e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`}))(e.dueDate)]})]}),o&&e.assignees&&e.assignees.length>0&&(0,g.jsxs)(`div`,{className:`flex -space-x-1`,children:[e.assignees.slice(0,3).map(e=>(0,g.jsxs)(n.m,{className:`h-5 w-5 border-2 border-background`,children:[(0,g.jsx)(n.g,{src:e.avatar}),(0,g.jsx)(n.h,{className:`text-[8px]`,children:e.name.charAt(0)})]},e.id)),e.assignees.length>3&&(0,g.jsxs)(`div`,{className:`h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[8px] border-2 border-background`,children:[`+`,e.assignees.length-3]})]})]})]})})}function DI({column:e,showCardCount:t,showAddCard:n,showAssignees:a,showLabels:c,showPriority:l,showDueDate:u,draggable:f,onCardClick:m,onCardAdd:h,onCardEdit:_,onCardDelete:v,onColumnEdit:y,onColumnDelete:b,onDragStart:x,onDragOver:S,onDrop:C}){let[w,T]=d.useState(!1),[E,D]=d.useState(``),[O,k]=d.useState(!1),[A,j]=d.useState(e.title),M=()=>{E.trim()&&(h?.(e.id,{title:E.trim()}),D(``),T(!1))},N=()=>{A.trim()&&A!==e.title&&y?.(e.id,{title:A.trim()}),k(!1)},P=e.limit&&e.cards.length>=e.limit;return(0,g.jsxs)(`div`,{className:`flex flex-col w-72 flex-shrink-0 bg-muted/50 rounded-lg`,onDragOver:S,onDrop:t=>C?.(t,e.id),children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between p-3 border-b`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.color&&(0,g.jsx)(`div`,{className:`h-3 w-3 rounded-full`,style:{backgroundColor:e.color}}),O?(0,g.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,g.jsx)(s.t,{value:A,onChange:e=>j(e.target.value),className:`h-7 text-sm font-semibold`,autoFocus:!0,onBlur:N,onKeyDown:e=>{e.key===`Enter`&&N(),e.key===`Escape`&&k(!1)}})}):(0,g.jsx)(`h3`,{className:`font-semibold text-sm cursor-pointer`,onClick:()=>k(!0),children:e.title}),t&&(0,g.jsxs)(r.t,{variant:`secondary`,className:`text-xs`,children:[e.cards.length,e.limit&&`/${e.limit}`]})]}),(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:()=>k(!0),children:[(0,g.jsx)(p.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:()=>b?.(e.id),className:`text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]}),(0,g.jsxs)(`div`,{className:`flex-1 p-2 space-y-2 min-h-[200px] overflow-y-auto`,children:[e.cards.map(t=>(0,g.jsx)(EI,{card:t,columnId:e.id,showAssignees:a,showLabels:c,showPriority:l,showDueDate:u,draggable:f,onCardClick:m,onCardEdit:_,onCardDelete:v,onDragStart:x},t.id)),w&&(0,g.jsxs)(Y,{className:`p-2`,children:[(0,g.jsx)(o.t,{placeholder:`Titre de la carte...`,value:E,onChange:e=>D(e.target.value),className:`min-h-[60px] text-sm`,autoFocus:!0}),(0,g.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,g.jsx)(i.n,{size:`sm`,onClick:M,children:`Ajouter`}),(0,g.jsx)(i.n,{size:`sm`,variant:`ghost`,onClick:()=>{T(!1),D(``)},children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]})]})]}),n&&!w&&!P&&(0,g.jsx)(`div`,{className:`p-2 border-t`,children:(0,g.jsxs)(i.n,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>T(!0),children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-2`}),`Ajouter une carte`]})}),P&&(0,g.jsx)(`div`,{className:`p-2 border-t text-center text-xs text-muted-foreground`,children:`Limite atteinte`})]})}function OI({columns:e,onColumnsChange:n,onCardClick:r,onCardAdd:a,onCardEdit:o,onCardDelete:c,onCardMove:l,onColumnAdd:u,onColumnEdit:f,onColumnDelete:m,showAddCard:h=!0,showAddColumn:_=!0,showCardCount:v=!0,showAssignees:y=!0,showLabels:b=!0,showPriority:x=!0,showDueDate:S=!0,draggable:C=!0,availableLabels:w=[],availableAssignees:T=[],className:E}){let[D,O]=d.useState(e),[k,A]=d.useState(null),[j,M]=d.useState(!1),[N,P]=d.useState(``);d.useEffect(()=>{O(e)},[e]);let F=(e,t,n)=>{A({cardId:t,columnId:n}),e.dataTransfer.effectAllowed=`move`},I=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},L=(e,t)=>{if(e.preventDefault(),!k)return;let{cardId:r,columnId:i}=k;if(i===t){A(null);return}if(l)l(r,i,t,0);else{let e=D.map(e=>{if(e.id===i)return{...e,cards:e.cards.filter(e=>e.id!==r)};if(e.id===t){let t=D.find(e=>e.id===i)?.cards.find(e=>e.id===r);if(t)return{...e,cards:[...e.cards,t]}}return e});O(e),n?.(e)}A(null)},R=(e,t)=>{if(a)a(e,t);else{let r={id:`card-${Date.now()}`,title:t.title||`Nouvelle carte`,...t},i=D.map(t=>t.id===e?{...t,cards:[...t.cards,r]}:t);O(i),n?.(i)}},z=(e,t)=>{if(c)c(e,t);else{let r=D.map(n=>n.id===t?{...n,cards:n.cards.filter(t=>t.id!==e)}:n);O(r),n?.(r)}},B=e=>{if(m)m(e);else{let t=D.filter(t=>t.id!==e);O(t),n?.(t)}},V=()=>{if(N.trim()){let e={id:`column-${Date.now()}`,title:N.trim(),cards:[]};if(u)u(e);else{let t=[...D,e];O(t),n?.(t)}P(``),M(!1)}};return(0,g.jsx)(`div`,{className:t.t(`overflow-x-auto`,E),children:(0,g.jsxs)(`div`,{className:`flex gap-4 p-4 min-h-[500px]`,children:[D.map(e=>(0,g.jsx)(DI,{column:e,showCardCount:v,showAddCard:h,showAssignees:y,showLabels:b,showPriority:x,showDueDate:S,draggable:C,onCardClick:r,onCardAdd:R,onCardEdit:o,onCardDelete:z,onColumnEdit:f,onColumnDelete:B,onDragStart:F,onDragOver:I,onDrop:L},e.id)),_&&(0,g.jsx)(`div`,{className:`w-72 flex-shrink-0`,children:j?(0,g.jsxs)(Y,{className:`p-3`,children:[(0,g.jsx)(s.t,{placeholder:`Titre de la colonne...`,value:N,onChange:e=>P(e.target.value),autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&V(),e.key===`Escape`&&M(!1)}}),(0,g.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,g.jsx)(i.n,{size:`sm`,onClick:V,children:`Ajouter`}),(0,g.jsx)(i.n,{size:`sm`,variant:`ghost`,onClick:()=>{M(!1),P(``)},children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]})]}):(0,g.jsxs)(i.n,{variant:`outline`,className:`w-full justify-start h-12`,onClick:()=>M(!0),children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-2`}),`Ajouter une colonne`]})})]})})}var kI=[{id:`todo`,title:`À faire`,color:`#6b7280`,cards:[{id:`1`,title:`Implémenter l'authentification`,description:`Ajouter le login/logout avec JWT`,priority:`high`,labels:[{id:`dev`,name:`Dev`,color:`#3b82f6`}],assignees:[{id:`1`,name:`Marie D.`}]},{id:`2`,title:`Créer les maquettes`,priority:`medium`,labels:[{id:`design`,name:`Design`,color:`#8b5cf6`}]}]},{id:`in-progress`,title:`En cours`,color:`#3b82f6`,limit:3,cards:[{id:`3`,title:`Refactoring du dashboard`,priority:`medium`,assignees:[{id:`2`,name:`Pierre M.`}],dueDate:new Date(Date.now()+1e3*60*60*24*2)}]},{id:`review`,title:`En revue`,color:`#f59e0b`,cards:[]},{id:`done`,title:`Terminé`,color:`#10b981`,cards:[{id:`4`,title:`Setup du projet`,priority:`low`}]}],AI=[{id:`dev`,name:`Dev`,color:`#3b82f6`},{id:`design`,name:`Design`,color:`#8b5cf6`},{id:`bug`,name:`Bug`,color:`#ef4444`},{id:`feature`,name:`Feature`,color:`#10b981`}],jI=d.createContext({});function MI(){return d.useContext(jI)}function NI({logo:e,brandName:n=`Brand`,navItems:r=[],showLoginButton:a=!0,loginButtonText:o=`Se connecter`,onLogin:s,loginHref:c}){let[l,u]=d.useState(!1),{LinkComponent:f}=MI(),m=(e,t,n,r)=>f?(0,g.jsx)(f,{href:e,className:t,onClick:r,children:n}):(0,g.jsx)(`a`,{href:e,className:t,onClick:r,children:n});return(0,g.jsxs)(`nav`,{className:`sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:[(0,g.jsxs)(`div`,{className:`container flex h-16 items-center justify-between`,children:[m(`/`,`flex items-center gap-2 font-bold text-xl`,(0,g.jsxs)(g.Fragment,{children:[e,(0,g.jsx)(`span`,{children:n})]})),(0,g.jsx)(`div`,{className:`hidden md:flex items-center gap-6`,children:r.map(e=>m(e.href,t.t(`text-sm font-medium transition-colors hover:text-primary`,e.isActive?`text-primary`:`text-muted-foreground`),e.label))}),(0,g.jsx)(`div`,{className:`hidden md:flex items-center gap-4`,children:a&&(0,g.jsx)(i.n,{variant:`default`,onClick:s,asChild:!!c,children:c?f?(0,g.jsx)(f,{href:c,children:o}):(0,g.jsx)(`a`,{href:c,children:o}):o})}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`md:hidden`,onClick:()=>u(!l),children:l?(0,g.jsx)(p.X,{className:`h-5 w-5`}):(0,g.jsx)(p.Menu,{className:`h-5 w-5`})})]}),l&&(0,g.jsx)(`div`,{className:`md:hidden border-t bg-background p-4`,children:(0,g.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[r.map(e=>m(e.href,`text-sm font-medium`,e.label,()=>u(!1))),a&&(0,g.jsx)(i.n,{onClick:s,asChild:!!c,children:c?f?(0,g.jsx)(f,{href:c,children:o}):(0,g.jsx)(`a`,{href:c,children:o}):o})]})})]})}function PI({badge:e,title:t,highlightedTitle:n,description:a,primaryButtonText:o=`Commencer`,primaryButtonAction:s,primaryButtonHref:c,secondaryButtonText:l,secondaryButtonAction:u,secondaryButtonHref:d,image:f,stats:m}){let{LinkComponent:h}=MI();return(0,g.jsx)(`section`,{className:`container py-24 md:py-32`,children:(0,g.jsxs)(`div`,{className:`flex flex-col lg:flex-row items-center gap-12`,children:[(0,g.jsxs)(`div`,{className:`flex-1 text-center lg:text-left`,children:[e&&(0,g.jsx)(r.t,{variant:`secondary`,className:`mb-4`,children:e}),(0,g.jsxs)(`h1`,{className:`text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight mb-6`,children:[t,` `,n&&(0,g.jsx)(`span`,{className:`text-primary`,children:n})]}),(0,g.jsx)(`p`,{className:`text-lg md:text-xl text-muted-foreground mb-8 max-w-2xl lg:max-w-none`,children:a}),(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-8`,children:[(0,g.jsx)(i.n,{size:`lg`,onClick:s,asChild:!!c,children:c?h?(0,g.jsxs)(h,{href:c,children:[o,(0,g.jsx)(p.ArrowRight,{className:`ml-2 h-4 w-4`})]}):(0,g.jsxs)(`a`,{href:c,children:[o,(0,g.jsx)(p.ArrowRight,{className:`ml-2 h-4 w-4`})]}):(0,g.jsxs)(g.Fragment,{children:[o,(0,g.jsx)(p.ArrowRight,{className:`ml-2 h-4 w-4`})]})}),l&&(0,g.jsx)(i.n,{size:`lg`,variant:`outline`,onClick:u,asChild:!!d,children:d?h?(0,g.jsxs)(h,{href:d,children:[(0,g.jsx)(p.Play,{className:`mr-2 h-4 w-4`}),l]}):(0,g.jsxs)(`a`,{href:d,children:[(0,g.jsx)(p.Play,{className:`mr-2 h-4 w-4`}),l]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Play,{className:`mr-2 h-4 w-4`}),l]})})]}),m&&m.length>0&&(0,g.jsx)(`div`,{className:`flex gap-8 justify-center lg:justify-start`,children:m.map((e,t)=>(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-2xl md:text-3xl font-bold`,children:e.value}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.label})]},t))})]}),f&&(0,g.jsx)(`div`,{className:`flex-1 w-full lg:w-auto`,children:f})]})})}function FI({title:e=`Fonctionnalités`,description:t,features:n}){return(0,g.jsxs)(`section`,{className:`container py-24 bg-muted/30`,children:[(0,g.jsxs)(`div`,{className:`text-center mb-12`,children:[(0,g.jsx)(`h2`,{className:`text-3xl md:text-4xl font-bold tracking-tight mb-4`,children:e}),t&&(0,g.jsx)(`p`,{className:`text-lg text-muted-foreground max-w-2xl mx-auto`,children:t})]}),(0,g.jsx)(`div`,{className:`grid md:grid-cols-2 lg:grid-cols-3 gap-6`,children:n.map(e=>(0,g.jsxs)(Y,{className:`bg-background`,children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(`div`,{className:`h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4`,children:(0,g.jsx)(`span`,{className:`text-primary`,children:e.icon})}),(0,g.jsx)(Z,{className:`text-xl`,children:e.title})]}),(0,g.jsx)(Q,{children:(0,g.jsx)(be,{className:`text-base`,children:e.description})})]},e.id))})]})}function II({title:e=`Ce que disent nos clients`,testimonials:n}){return(0,g.jsxs)(`section`,{className:`container py-24`,children:[(0,g.jsx)(`h2`,{className:`text-3xl md:text-4xl font-bold tracking-tight text-center mb-12`,children:e}),(0,g.jsx)(`div`,{className:`grid md:grid-cols-2 lg:grid-cols-3 gap-6`,children:n.map(e=>(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`pt-6`,children:[e.rating&&(0,g.jsx)(`div`,{className:`flex gap-1 mb-4`,children:Array.from({length:5}).map((n,r)=>(0,g.jsx)(p.Star,{className:t.t(`h-4 w-4`,r<e.rating?`text-yellow-400 fill-yellow-400`:`text-muted-foreground`)},r))}),(0,g.jsxs)(`p`,{className:`text-muted-foreground mb-6`,children:[`"`,e.content,`"`]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.avatar?(0,g.jsx)(`img`,{src:e.avatar,alt:e.author,className:`h-10 w-10 rounded-full object-cover`}):(0,g.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center`,children:(0,g.jsx)(`span`,{className:`text-sm font-medium text-primary`,children:e.author.charAt(0)})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`font-medium`,children:e.author}),(0,g.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[e.role,e.company&&` @ ${e.company}`]})]})]})]})},e.id))})]})}function LI({title:e,description:n,buttonText:r,buttonAction:a,buttonHref:o,secondaryButtonText:s,secondaryButtonAction:c,variant:l=`default`}){let{LinkComponent:u}=MI();return(0,g.jsx)(`section`,{className:t.t(`py-24`,{default:`bg-muted/50`,gradient:`bg-gradient-to-r from-primary/10 via-primary/5 to-background`,dark:`bg-foreground text-background`}[l]),children:(0,g.jsx)(`div`,{className:`container`,children:(0,g.jsxs)(`div`,{className:`text-center max-w-2xl mx-auto`,children:[(0,g.jsx)(`h2`,{className:t.t(`text-3xl md:text-4xl font-bold tracking-tight mb-4`,l===`dark`&&`text-background`),children:e}),n&&(0,g.jsx)(`p`,{className:t.t(`text-lg mb-8`,l===`dark`?`text-background/80`:`text-muted-foreground`),children:n}),(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center`,children:[(0,g.jsx)(i.n,{size:`lg`,variant:l===`dark`?`secondary`:`default`,onClick:a,asChild:!!o,children:o?u?(0,g.jsxs)(u,{href:o,children:[r,(0,g.jsx)(p.ChevronRight,{className:`ml-2 h-4 w-4`})]}):(0,g.jsxs)(`a`,{href:o,children:[r,(0,g.jsx)(p.ChevronRight,{className:`ml-2 h-4 w-4`})]}):(0,g.jsxs)(g.Fragment,{children:[r,(0,g.jsx)(p.ChevronRight,{className:`ml-2 h-4 w-4`})]})}),s&&(0,g.jsx)(i.n,{size:`lg`,variant:`outline`,onClick:c,className:l===`dark`?`border-background/20 text-background hover:bg-background/10`:``,children:s})]})]})})})}function RI({logo:e,brandName:n=`Brand`,navItems:r,showLoginButton:i=!0,loginButtonText:a=`Se connecter`,onLogin:o,loginHref:s,hero:c,features:l,featuresTitle:u,featuresDescription:f,testimonials:p,testimonialsTitle:m,cta:h,footer:_,className:v,LinkComponent:y}){let b=d.useMemo(()=>({LinkComponent:y}),[y]);return(0,g.jsx)(jI.Provider,{value:b,children:(0,g.jsxs)(`div`,{className:t.t(`min-h-screen`,v),children:[(0,g.jsx)(NI,{logo:e,brandName:n,navItems:r,showLoginButton:i,loginButtonText:a,onLogin:o,loginHref:s}),c&&(0,g.jsx)(PI,{...c}),l&&l.length>0&&(0,g.jsx)(FI,{title:u,description:f,features:l}),p&&p.length>0&&(0,g.jsx)(II,{title:m,testimonials:p}),h&&(0,g.jsx)(LI,{...h}),_]})})}var zI=[{label:`Fonctionnalités`,href:`#features`},{label:`Tarifs`,href:`#pricing`},{label:`Témoignages`,href:`#testimonials`},{label:`Contact`,href:`#contact`}],BI=[{id:`1`,icon:(0,g.jsx)(p.Zap,{className:`h-6 w-6`}),title:`Rapide et performant`,description:`Optimisé pour la vitesse avec des temps de chargement minimaux.`},{id:`2`,icon:(0,g.jsx)(p.Shield,{className:`h-6 w-6`}),title:`Sécurisé`,description:`Vos données sont protégées avec un chiffrement de bout en bout.`},{id:`3`,icon:(0,g.jsx)(p.Users,{className:`h-6 w-6`}),title:`Collaboration`,description:`Travaillez en équipe avec des outils de collaboration intégrés.`},{id:`4`,icon:(0,g.jsx)(p.Globe,{className:`h-6 w-6`}),title:`Accessible partout`,description:`Accédez à votre espace depuis n'importe quel appareil.`}],VI=[{id:`1`,content:`Cette solution a transformé notre façon de travailler. Nous avons gagné un temps précieux.`,author:`Marie Dupont`,role:`CEO`,company:`TechCorp`,rating:5},{id:`2`,content:`Interface intuitive et support réactif. Je recommande vivement.`,author:`Pierre Martin`,role:`CTO`,company:`StartupXYZ`,rating:5},{id:`3`,content:`Le meilleur outil que nous ayons utilisé pour gérer nos projets.`,author:`Sophie Bernard`,role:`Product Manager`,company:`InnoLab`,rating:5}],HI={badge:`Nouveau`,title:`La solution pour`,highlightedTitle:`votre entreprise`,description:`Simplifiez votre quotidien avec notre plateforme tout-en-un. Gagnez du temps et concentrez-vous sur l'essentiel.`,primaryButtonText:`Essayer gratuitement`,secondaryButtonText:`Voir la démo`,stats:[{value:`10K+`,label:`Utilisateurs`},{value:`99.9%`,label:`Uptime`},{value:`24/7`,label:`Support`}]},UI={title:`Prêt à commencer ?`,description:`Rejoignez des milliers d'entreprises qui nous font confiance.`,buttonText:`Créer un compte gratuit`,secondaryButtonText:`Contacter les ventes`,variant:`gradient`},WI=d.createContext({});function GI(){return d.useContext(WI)}function KI({period:e,onChange:n,yearlyDiscount:i}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-center gap-4 mb-8`,children:[(0,g.jsx)(o.n,{htmlFor:`billing-toggle`,className:t.t(`cursor-pointer transition-colors`,e===`monthly`?`text-foreground`:`text-muted-foreground`),children:`Mensuel`}),(0,g.jsx)(ur,{id:`billing-toggle`,checked:e===`yearly`,onCheckedChange:e=>n(e?`yearly`:`monthly`)}),(0,g.jsxs)(o.n,{htmlFor:`billing-toggle`,className:t.t(`cursor-pointer transition-colors flex items-center gap-2`,e===`yearly`?`text-foreground`:`text-muted-foreground`),children:[`Annuel`,i&&(0,g.jsxs)(r.t,{variant:`secondary`,className:`text-xs`,children:[`-`,i]})]})]})}function qI({plan:e,billingPeriod:a}){let{LinkComponent:o}=GI(),s=a===`yearly`&&e.priceYearly!==void 0?e.priceYearly:e.price,c=a===`yearly`&&e.periodYearly?e.periodYearly:e.period||`/mois`,l=typeof s==`string`;return(0,g.jsxs)(Y,{className:t.t(`relative flex flex-col`,e.popular&&`border-primary shadow-lg scale-105`),children:[e.popular&&(0,g.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2`,children:(0,g.jsxs)(r.t,{className:`px-3`,children:[(0,g.jsx)(p.Zap,{className:`h-3 w-3 mr-1`}),e.badge||`Populaire`]})}),(0,g.jsxs)(X,{className:`text-center pb-2`,children:[(0,g.jsx)(Z,{className:`text-xl`,children:e.name}),e.description&&(0,g.jsx)(be,{children:e.description})]}),(0,g.jsxs)(Q,{className:`flex-1`,children:[(0,g.jsx)(`div`,{className:`text-center mb-6`,children:l?(0,g.jsx)(`div`,{className:`text-3xl font-bold`,children:s}):(0,g.jsxs)(`div`,{className:`flex items-baseline justify-center`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground mr-1`,children:e.currency||`€`}),(0,g.jsx)(`span`,{className:`text-4xl font-bold`,children:s}),(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground ml-1`,children:c})]})}),(0,g.jsx)(`ul`,{className:`space-y-3`,children:e.features.map((e,r)=>(0,g.jsxs)(`li`,{className:`flex items-start gap-2`,children:[e.included===!0?(0,g.jsx)(p.Check,{className:`h-5 w-5 text-green-500 flex-shrink-0`}):e.included===`partial`||e.included===`limited`?(0,g.jsx)(p.Check,{className:`h-5 w-5 text-yellow-500 flex-shrink-0`}):(0,g.jsx)(p.X,{className:`h-5 w-5 text-muted-foreground flex-shrink-0`}),(0,g.jsxs)(`span`,{className:t.t(`text-sm`,!e.included&&`text-muted-foreground`),children:[e.name,e.value&&(0,g.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,e.value,`)`]})]}),e.tooltip&&(0,g.jsx)(n.u,{children:(0,g.jsxs)(n.c,{children:[(0,g.jsx)(n.d,{asChild:!0,children:(0,g.jsx)(p.HelpCircle,{className:`h-4 w-4 text-muted-foreground cursor-help`})}),(0,g.jsx)(n.l,{children:(0,g.jsx)(`p`,{className:`max-w-xs`,children:e.tooltip})})]})})]},r))})]}),(0,g.jsx)(xe,{children:(0,g.jsx)(i.n,{className:`w-full`,variant:e.buttonVariant||(e.popular?`default`:`outline`),onClick:e.onSelect,disabled:e.disabled,asChild:!!e.href,children:e.href?o?(0,g.jsx)(o,{href:e.href,children:e.buttonText||`Choisir`}):(0,g.jsx)(`a`,{href:e.href,children:e.buttonText||`Choisir`}):e.buttonText||`Choisir`})})]})}function JI({plans:e,billingPeriod:n}){let{LinkComponent:a}=GI(),o=Array.from(new Set(e.flatMap(e=>e.features.map(e=>e.name))));return(0,g.jsx)(`div`,{className:`overflow-x-auto`,children:(0,g.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,g.jsxs)(`thead`,{children:[(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{className:`text-left p-4 border-b bg-muted/50`,children:`Fonctionnalité`}),e.map(e=>(0,g.jsxs)(`th`,{className:t.t(`text-center p-4 border-b min-w-[150px]`,e.popular&&`bg-primary/5`),children:[(0,g.jsx)(`div`,{className:`font-bold`,children:e.name}),e.popular&&(0,g.jsx)(r.t,{className:`mt-1`,variant:`default`,children:`Populaire`})]},e.id))]}),(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`td`,{className:`p-4 border-b bg-muted/50 font-medium`,children:`Prix`}),e.map(e=>{let r=n===`yearly`&&e.priceYearly!==void 0?e.priceYearly:e.price,i=n===`yearly`&&e.periodYearly?e.periodYearly:e.period||`/mois`,a=typeof r==`string`;return(0,g.jsx)(`td`,{className:t.t(`text-center p-4 border-b`,e.popular&&`bg-primary/5`),children:a?(0,g.jsx)(`span`,{className:`font-bold`,children:r}):(0,g.jsxs)(`span`,{className:`font-bold`,children:[e.currency||`€`,r,(0,g.jsx)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:i})]})},e.id)})]})]}),(0,g.jsxs)(`tbody`,{children:[o.map((n,r)=>(0,g.jsxs)(`tr`,{className:r%2==0?`bg-muted/20`:``,children:[(0,g.jsx)(`td`,{className:`p-4 border-b`,children:n}),e.map(e=>{let r=e.features.find(e=>e.name===n);return(0,g.jsx)(`td`,{className:t.t(`text-center p-4 border-b`,e.popular&&`bg-primary/5`),children:r?r.included===!0?r.value?(0,g.jsx)(`span`,{children:r.value}):(0,g.jsx)(p.Check,{className:`h-5 w-5 text-green-500 mx-auto`}):r.included===`partial`||r.included===`limited`?(0,g.jsx)(`span`,{className:`text-yellow-600`,children:r.value||`Limité`}):(0,g.jsx)(p.X,{className:`h-5 w-5 text-muted-foreground mx-auto`}):(0,g.jsx)(p.X,{className:`h-5 w-5 text-muted-foreground mx-auto`})},e.id)})]},r)),(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`td`,{className:`p-4`}),e.map(e=>(0,g.jsx)(`td`,{className:t.t(`text-center p-4`,e.popular&&`bg-primary/5`),children:(0,g.jsx)(i.n,{variant:e.buttonVariant||(e.popular?`default`:`outline`),onClick:e.onSelect,disabled:e.disabled,asChild:!!e.href,children:e.href?a?(0,g.jsx)(a,{href:e.href,children:e.buttonText||`Choisir`}):(0,g.jsx)(`a`,{href:e.href,children:e.buttonText||`Choisir`}):e.buttonText||`Choisir`})},e.id))]})]})]})})}function YI({title:e=`Questions fréquentes`,items:t}){return(0,g.jsxs)(`div`,{className:`mt-16`,children:[(0,g.jsx)(`h2`,{className:`text-2xl font-bold text-center mb-8`,children:e}),(0,g.jsx)(`div`,{className:`grid md:grid-cols-2 gap-6 max-w-4xl mx-auto`,children:t.map((e,t)=>(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`h3`,{className:`font-semibold`,children:e.question}),(0,g.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:e.answer})]},t))})]})}function XI({title:e=`Tarification`,description:n,plans:r,showBillingToggle:i=!0,billingPeriod:a,onBillingPeriodChange:o,yearlyDiscount:s,faq:c,faqTitle:l,layout:u=`cards`,columns:f=3,showComparison:p=!1,className:m,LinkComponent:h}){let[_,v]=d.useState(`monthly`),y=a??_,b=e=>{o?o(e):v(e)},x={2:`md:grid-cols-2`,3:`md:grid-cols-2 lg:grid-cols-3`,4:`md:grid-cols-2 lg:grid-cols-4`},S=d.useMemo(()=>({LinkComponent:h}),[h]);return(0,g.jsx)(WI.Provider,{value:S,children:(0,g.jsxs)(`div`,{className:t.t(`container py-16`,m),children:[(0,g.jsxs)(`div`,{className:`text-center mb-12`,children:[(0,g.jsx)(`h1`,{className:`text-3xl md:text-4xl font-bold tracking-tight mb-4`,children:e}),n&&(0,g.jsx)(`p`,{className:`text-lg text-muted-foreground max-w-2xl mx-auto`,children:n})]}),i&&(0,g.jsx)(KI,{period:y,onChange:b,yearlyDiscount:s}),u===`cards`&&!p?(0,g.jsx)(`div`,{className:t.t(`grid gap-6 items-stretch`,x[f]),children:r.map(e=>(0,g.jsx)(qI,{plan:e,billingPeriod:y},e.id))}):(0,g.jsx)(JI,{plans:r,billingPeriod:y}),c&&c.length>0&&(0,g.jsx)(YI,{title:l,items:c})]})})}var ZI=[{id:`free`,name:`Gratuit`,description:`Pour démarrer`,price:0,priceYearly:0,features:[{name:`1 utilisateur`,included:!0},{name:`5 projets`,included:!0},{name:`1 Go de stockage`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!1},{name:`Analytics avancés`,included:!1},{name:`Support prioritaire`,included:!1}],buttonText:`Commencer gratuitement`,buttonVariant:`outline`},{id:`pro`,name:`Pro`,description:`Pour les équipes`,price:29,priceYearly:24,periodYearly:`/mois (facturé annuellement)`,popular:!0,features:[{name:`5 utilisateurs`,included:!0},{name:`Projets illimités`,included:!0},{name:`50 Go de stockage`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!0},{name:`Analytics avancés`,included:!0},{name:`Support prioritaire`,included:!1}],buttonText:`Essai gratuit 14 jours`},{id:`enterprise`,name:`Enterprise`,description:`Pour les grandes équipes`,price:`Sur mesure`,features:[{name:`Utilisateurs illimités`,included:!0},{name:`Projets illimités`,included:!0},{name:`Stockage illimité`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!0},{name:`Analytics avancés`,included:!0},{name:`Support prioritaire`,included:!0}],buttonText:`Contacter les ventes`,buttonVariant:`outline`}],QI=[{question:`Puis-je changer de plan à tout moment ?`,answer:`Oui, vous pouvez upgrader ou downgrader votre plan à tout moment. Les changements prennent effet immédiatement.`},{question:`Y a-t-il une période d'essai ?`,answer:`Oui, tous nos plans payants incluent une période d'essai gratuite de 14 jours, sans carte bancaire requise.`},{question:`Quels moyens de paiement acceptez-vous ?`,answer:`Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.`},{question:`Puis-je annuler à tout moment ?`,answer:`Absolument. Vous pouvez annuler votre abonnement à tout moment sans frais supplémentaires.`}],$I=d.createContext(null);function eL(){let e=d.useContext($I);if(!e)throw Error(`useWizard must be used within a WakaWizard`);return e}function tL({steps:e,currentStep:n,stepStatuses:r,showStepNumbers:i,orientation:a,onStepClick:o,allowBackNavigation:s}){let c=(e,t)=>t===`completed`?(0,g.jsx)(p.Check,{className:`h-4 w-4`}):t===`error`?(0,g.jsx)(p.AlertCircle,{className:`h-4 w-4`}):t===`skipped`?(0,g.jsx)(p.X,{className:`h-4 w-4 text-muted-foreground`}):i?(0,g.jsx)(`span`,{className:`text-xs font-medium`,children:e+1}):(0,g.jsx)(p.Circle,{className:`h-3 w-3`}),l=e=>{switch(e){case`completed`:return`bg-primary text-primary-foreground border-primary`;case`current`:return`bg-primary text-primary-foreground border-primary`;case`error`:return`bg-destructive text-destructive-foreground border-destructive`;case`skipped`:return`bg-muted text-muted-foreground border-muted`;default:return`bg-background text-muted-foreground border-border`}};return a===`vertical`?(0,g.jsx)(`div`,{className:`flex flex-col gap-0`,children:e.map((i,a)=>{let u=r[a],d=s&&a<n;return(0,g.jsxs)(`div`,{className:`flex gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,g.jsx)(`button`,{type:`button`,disabled:!d,onClick:()=>d&&o?.(a),className:t.t(`flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors`,l(u),d&&`cursor-pointer hover:opacity-80`),children:i.icon||c(a,u)}),a<e.length-1&&(0,g.jsx)(`div`,{className:t.t(`w-0.5 flex-1 min-h-[24px]`,r[a]===`completed`?`bg-primary`:`bg-border`)})]}),(0,g.jsxs)(`div`,{className:`pb-8`,children:[(0,g.jsxs)(`div`,{className:t.t(`font-medium`,u===`current`?`text-foreground`:`text-muted-foreground`),children:[i.title,i.optional&&(0,g.jsx)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:`(optionnel)`})]}),i.description&&(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground mt-0.5`,children:i.description})]})]},i.id)})}):(0,g.jsx)(`div`,{className:`flex items-center gap-0`,children:e.map((i,a)=>{let u=r[a],f=s&&a<n;return(0,g.jsxs)(d.Fragment,{children:[(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,g.jsx)(`button`,{type:`button`,disabled:!f,onClick:()=>f&&o?.(a),className:t.t(`flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors`,l(u),f&&`cursor-pointer hover:opacity-80`),children:i.icon||c(a,u)}),(0,g.jsx)(`div`,{className:`text-center`,children:(0,g.jsx)(`div`,{className:t.t(`text-sm font-medium`,u===`current`?`text-foreground`:`text-muted-foreground`),children:i.title})})]}),a<e.length-1&&(0,g.jsx)(`div`,{className:t.t(`flex-1 h-0.5 mx-2 mb-6`,r[a]===`completed`?`bg-primary`:`bg-border`)})]},i.id)})})}function nL({onPrev:e,onNext:t,onSkip:n,onCancel:r,isFirstStep:a,isLastStep:o,isOptional:s,prevButtonText:c,nextButtonText:l,finishButtonText:u,skipButtonText:d,cancelButtonText:f,showCancelButton:m,submitting:h}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`div`,{className:`flex gap-2`,children:m&&r&&(0,g.jsx)(i.n,{type:`button`,variant:`ghost`,onClick:r,disabled:h,children:f})}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[!a&&(0,g.jsxs)(i.n,{type:`button`,variant:`outline`,onClick:e,disabled:h,children:[(0,g.jsx)(p.ArrowLeft,{className:`mr-2 h-4 w-4`}),c]}),s&&n&&!o&&(0,g.jsx)(i.n,{type:`button`,variant:`ghost`,onClick:n,disabled:h,children:d}),(0,g.jsxs)(i.n,{type:`button`,onClick:t,disabled:h,children:[h&&(0,g.jsx)(p.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),o?u:l,!o&&!h&&(0,g.jsx)(p.ArrowRight,{className:`ml-2 h-4 w-4`})]})]})]})}function rL({steps:e,currentStep:n,onStepChange:r,onSubmit:i,onCancel:a,title:o,description:s,prevButtonText:c=`Précédent`,nextButtonText:l=`Suivant`,finishButtonText:u=`Terminer`,cancelButtonText:f=`Annuler`,skipButtonText:p=`Passer`,showCancelButton:m=!0,showProgress:h=!0,showStepNumbers:_=!0,showStepper:v=!0,stepperPosition:y=`top`,allowBackNavigation:b=!0,confirmCancel:x=!0,cancelConfirmMessage:S=`Êtes-vous sûr de vouloir annuler ? Toutes les modifications seront perdues.`,submitting:C=!1,layout:w=`card`,className:T}){let[E,D]=d.useState(0),[O,k]=d.useState(e.map((e,t)=>t===0?`current`:`pending`)),[A,j]=d.useState(!1),M=n??E,N=M===0,P=M===e.length-1,F=e[M],I=(M+1)/e.length*100,L=(t,n)=>{k(r=>{let i=[...r];if(n===`next`&&M<e.length)i[M]=`completed`;else if(n===`skip`)i[M]=`skipped`;else if(n===`goto`&&t<M)for(let n=t+1;n<e.length;n++)i[n]=`pending`;return i[t]=`current`,i})},R=async t=>{if(t<0||t>=e.length||t>M&&!b)return;F.onLeave&&await F.onLeave(),L(t,`goto`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},z=async()=>{if(F.validate&&!await F.validate()){k(e=>{let t=[...e];return t[M]=`error`,t});return}if(F.onLeave&&await F.onLeave(),P){let t={steps:e.map((e,t)=>({id:e.id,status:t===M?`completed`:O[t]})),completedSteps:e.filter((e,t)=>O[t]===`completed`||t===M).map(e=>e.id),skippedSteps:e.filter((e,t)=>O[t]===`skipped`).map(e=>e.id)};await i?.(t)}else{let t=M+1;L(t,`next`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()}},B=async()=>{if(N)return;F.onLeave&&await F.onLeave();let t=M-1;L(t,`prev`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},V=async()=>{if(!F.optional||P)return;F.onLeave&&await F.onLeave();let t=M+1;L(t,`skip`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},H=()=>{x?j(!0):a?.()},U={currentStep:M,totalSteps:e.length,stepStatuses:O,goToStep:R,nextStep:z,prevStep:B,skipStep:V,isFirstStep:N,isLastStep:P},W=v&&(0,g.jsx)(tL,{steps:e,currentStep:M,stepStatuses:O,showStepNumbers:_,orientation:y===`left`?`vertical`:`horizontal`,onStepClick:R,allowBackNavigation:b}),G=(0,g.jsx)(nL,{onPrev:B,onNext:z,onSkip:F.optional?V:void 0,onCancel:a?H:void 0,isFirstStep:N,isLastStep:P,isOptional:F.optional||!1,prevButtonText:c,nextButtonText:l,finishButtonText:u,skipButtonText:p,cancelButtonText:f,showCancelButton:m,submitting:C}),K=(0,g.jsxs)($I.Provider,{value:U,children:[y===`left`?(0,g.jsxs)(`div`,{className:`flex gap-8`,children:[(0,g.jsx)(`div`,{className:`w-64 flex-shrink-0`,children:W}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[h&&(0,g.jsxs)(`div`,{className:`mb-6`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between text-sm text-muted-foreground mb-2`,children:[(0,g.jsxs)(`span`,{children:[`Étape `,M+1,` sur `,e.length]}),(0,g.jsxs)(`span`,{children:[Math.round(I),`%`]})]}),(0,g.jsx)(Yn,{value:I})]}),(0,g.jsx)(`div`,{className:`min-h-[300px]`,children:F.content}),(0,g.jsx)(`div`,{className:`mt-8`,children:G})]})]}):(0,g.jsxs)(g.Fragment,{children:[W&&(0,g.jsx)(`div`,{className:`mb-8`,children:W}),h&&(0,g.jsxs)(`div`,{className:`mb-6`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between text-sm text-muted-foreground mb-2`,children:[(0,g.jsxs)(`span`,{children:[`Étape `,M+1,` sur `,e.length]}),(0,g.jsxs)(`span`,{children:[Math.round(I),`%`]})]}),(0,g.jsx)(Yn,{value:I})]}),(0,g.jsx)(`div`,{className:`min-h-[300px]`,children:F.content}),(0,g.jsx)(`div`,{className:`mt-8`,children:G})]}),(0,g.jsx)(re,{open:A,onOpenChange:j,children:(0,g.jsxs)(se,{children:[(0,g.jsxs)(ce,{children:[(0,g.jsx)(ue,{children:`Annuler ?`}),(0,g.jsx)(de,{children:S})]}),(0,g.jsxs)(le,{children:[(0,g.jsx)(pe,{children:`Non, continuer`}),(0,g.jsx)(fe,{onClick:()=>{j(!1),a?.()},children:`Oui, annuler`})]})]})})]});return w===`minimal`?(0,g.jsx)(`div`,{className:t.t(`space-y-6`,T),children:K}):w===`page`?(0,g.jsxs)(`div`,{className:t.t(`container py-8 max-w-4xl`,T),children:[(o||s)&&(0,g.jsxs)(`div`,{className:`mb-8`,children:[o&&(0,g.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:o}),s&&(0,g.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:s})]}),K]}):(0,g.jsxs)(Y,{className:T,children:[(o||s)&&(0,g.jsxs)(X,{children:[o&&(0,g.jsx)(Z,{children:o}),s&&(0,g.jsx)(be,{children:s})]}),(0,g.jsx)(Q,{children:K})]})}var iL=[{id:`step-1`,title:`Informations de base`,description:`Renseignez vos informations personnelles`,content:(0,g.jsx)(`div`,{className:`space-y-4`,children:(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 1 - Informations de base`})})},{id:`step-2`,title:`Configuration`,description:`Configurez vos préférences`,optional:!0,content:(0,g.jsx)(`div`,{className:`space-y-4`,children:(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 2 - Configuration (optionnel)`})})},{id:`step-3`,title:`Confirmation`,description:`Vérifiez et confirmez`,content:(0,g.jsx)(`div`,{className:`space-y-4`,children:(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 3 - Confirmation`})})}];t.n();function aL(e,t,n){let r=e.translations[n]?.value||``,i=e.translations[t]?.value;return!i||i.trim()===``?`missing`:i===r?`identical`:`valid`}function oL(e,t,n){let r=t.filter(e=>e!==n).map(t=>aL(e,t,n));return r.includes(`missing`)?`missing`:r.includes(`identical`)?`identical`:`valid`}function sL(e,t){let n=new Map;for(let r of e){let e=r.key.split(t),i=e.length>1?e[0]:`__root__`;n.has(i)||n.set(i,[]),n.get(i).push(r)}return n}function cL({status:e}){let{label:n,icon:i,className:a}={valid:{label:`OK`,variant:`default`,icon:p.CheckCircle,className:`bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300`},missing:{label:`Manquant`,variant:`destructive`,icon:p.XCircle,className:`bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300`},identical:{label:`Identique`,variant:`secondary`,icon:p.AlertTriangle,className:`bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300`},warning:{label:`Attention`,variant:`secondary`,icon:p.AlertTriangle,className:`bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300`}}[e];return(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(`gap-1 text-xs`,a),children:[(0,g.jsx)(i,{className:`h-3 w-3`}),n]})}function lL({value:e,onChange:n,onBlur:r,placeholder:i,status:a,disabled:s}){let[c,l]=d.useState(e);return d.useEffect(()=>{l(e)},[e]),(0,g.jsx)(o.t,{value:c,onChange:e=>{l(e.target.value),n(e.target.value)},onBlur:r,placeholder:i,disabled:s,className:t.t(`min-h-[60px] resize-none text-sm`,a===`missing`&&`border-red-300 dark:border-red-700`,a===`identical`&&`border-yellow-300 dark:border-yellow-700`)})}function uL({config:e,translations:c,onChange:l,onSave:u,onAddKey:f,onDeleteKey:m,onAddLanguage:h,onExport:_,onImport:v,isLoading:y=!1,isSaving:b=!1,className:x,title:S=`Translation Editor`,description:C=`Gérez vos traductions i18n`}){let[w,T]=d.useState(c),[E,D]=d.useState(``),[O,k]=d.useState(`all`),[A,j]=d.useState(new Set),[M,N]=d.useState(null),[P,F]=d.useState(!1),[I,L]=d.useState(!1),[R,z]=d.useState(!1),[B,V]=d.useState(!1),[H,U]=d.useState(``),[W,G]=d.useState({code:``,label:``,flag:``}),[K,q]=d.useState(null),[ee,J]=d.useState(``),[te,ne]=d.useState(`merge`),[re,ie]=d.useState(new Map),ae=d.useRef(null),{languages:oe,sourceLanguage:se,keyPathSeparator:ce=`.`,autoSave:le=!0,saveDebounceMs:ue=300,placeholderPatterns:de=[`{{.*?}}`,`{.*?}`,`%s`,`%d`]}=e,fe=oe.filter(e=>e.code!==se);d.useEffect(()=>{T(c)},[c]),d.useEffect(()=>(le&&re.size>0&&u&&(ae.current&&clearTimeout(ae.current),ae.current=setTimeout(async()=>{await u(w),ie(new Map)},ue)),()=>{ae.current&&clearTimeout(ae.current)}),[re,le,ue,u,w]);let pe=d.useMemo(()=>{let e=w;if(E){let t=E.toLowerCase();e=e.filter(e=>{if(e.key.toLowerCase().includes(t))return!0;for(let n of Object.keys(e.translations))if(e.translations[n]?.value?.toLowerCase().includes(t))return!0;return!1})}return O!==`all`&&(e=e.filter(e=>{let t=oL(e,oe.map(e=>e.code),se);switch(O){case`missing`:return t===`missing`;case`incomplete`:return t===`missing`||t===`identical`;case`identical`:return t===`identical`;default:return!0}})),e},[w,E,O,oe,se]),me=d.useMemo(()=>sL(pe,ce),[pe,ce]),he=(e,t,n)=>{T(r=>r.map(r=>r.key===e?{...r,translations:{...r.translations,[t]:{...r.translations[t],value:n,updatedAt:new Date}}}:r)),ie(r=>{let i=new Map(r);return i.has(e)||i.set(e,new Map),i.get(e).set(t,n),i}),l?.(e,t,n)},ge=async()=>{H.trim()&&(await f?.(H),U(``),L(!1))},_e=async e=>{await m?.(e),T(t=>t.filter(t=>t.key!==e))},ve=async()=>{!W.code||!W.label||(await h?.(W),G({code:``,label:``,flag:``}),z(!1))},ye=async()=>{!K||!ee||(await v?.(K,ee,te),q(null),J(``),V(!1))},Y=e=>{navigator.clipboard.writeText(e)},X=e=>{j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Z=d.useMemo(()=>{let e=w.length,t=0,n=0,r=0;for(let e of w){let i=oL(e,oe.map(e=>e.code),se);i===`missing`?t++:i===`identical`?n++:r++}return{total:e,missing:t,identical:n,valid:r}},[w,oe,se]);return y?(0,g.jsx)(`div`,{className:t.t(`flex items-center justify-center py-12`,x),children:(0,g.jsx)(p.Loader2,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,g.jsx)(n.u,{children:(0,g.jsxs)(`div`,{className:t.t(`flex flex-col h-full`,x),children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h2`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,g.jsx)(p.Languages,{className:`h-6 w-6`}),S]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:C})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>L(!0),children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-1`}),`Ajouter une clé`]}),(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>z(!0),children:[(0,g.jsx)(p.Flag,{className:`h-4 w-4 mr-1`}),`Ajouter une langue`]}),(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:()=>_?.(),children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Exporter tout`]}),oe.map(e=>(0,g.jsxs)($,{onClick:()=>_?.(e.code),children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Exporter `,e.label]},e.code)),(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:()=>V(!0),children:[(0,g.jsx)(p.Upload,{className:`h-4 w-4 mr-2`}),`Importer`]})]})]}),b&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.Loader2,{className:`h-4 w-4 animate-spin`}),`Sauvegarde...`]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[Z.total,` clés`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1 text-green-600 dark:text-green-400`,children:[(0,g.jsx)(p.CheckCircle,{className:`h-4 w-4`}),Z.valid,` traduites`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1 text-red-600 dark:text-red-400`,children:[(0,g.jsx)(p.XCircle,{className:`h-4 w-4`}),Z.missing,` manquantes`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-600 dark:text-yellow-400`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-4 w-4`}),Z.identical,` identiques`]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,g.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher une clé ou une traduction...`,value:E,onChange:e=>D(e.target.value),className:`pl-10`}),E&&(0,g.jsx)(`button`,{onClick:()=>D(``),className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Filter,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsxs)(a.d,{value:O,onValueChange:e=>k(e),children:[(0,g.jsx)(a.y,{className:`w-[180px]`,children:(0,g.jsx)(a.b,{})}),(0,g.jsxs)(a.f,{children:[(0,g.jsxs)(a.m,{value:`all`,children:[`Toutes (`,Z.total,`)`]}),(0,g.jsxs)(a.m,{value:`missing`,children:[`Manquantes (`,Z.missing,`)`]}),(0,g.jsxs)(a.m,{value:`incomplete`,children:[`Incomplètes (`,Z.missing+Z.identical,`)`]}),(0,g.jsxs)(a.m,{value:`identical`,children:[`Identiques (`,Z.identical,`)`]})]})]})]})]})]}),(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,g.jsx)(`thead`,{className:`sticky top-0 bg-muted/50 backdrop-blur z-10`,children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{className:`text-left p-3 font-medium text-sm border-b w-[280px]`,children:`Clé`}),(0,g.jsxs)(`th`,{className:`text-left p-3 font-medium text-sm border-b`,children:[oe.find(e=>e.code===se)?.label||se,` (source)`]}),fe.map(e=>(0,g.jsx)(`th`,{className:`text-left p-3 font-medium text-sm border-b`,children:(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.flag&&(0,g.jsx)(`span`,{children:e.flag}),e.label]})},e.code)),(0,g.jsx)(`th`,{className:`text-center p-3 font-medium text-sm border-b w-[100px]`,children:`État`}),(0,g.jsx)(`th`,{className:`text-center p-3 font-medium text-sm border-b w-[60px]`,children:`Actions`})]})}),(0,g.jsxs)(`tbody`,{children:[Array.from(me.entries()).map(([e,t])=>(0,g.jsxs)(d.Fragment,{children:[e!==`__root__`&&(0,g.jsx)(`tr`,{className:`bg-muted/30`,children:(0,g.jsx)(`td`,{colSpan:fe.length+4,className:`p-2`,children:(0,g.jsxs)(`button`,{onClick:()=>X(e),className:`flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors`,children:[A.has(e)?(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4`}):(0,g.jsx)(p.ChevronDown,{className:`h-4 w-4`}),e,(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:t.length})]})})}),!A.has(e)&&t.map(e=>{let t=oL(e,oe.map(e=>e.code),se);return(0,g.jsxs)(`tr`,{className:`border-b hover:bg-muted/30 transition-colors`,children:[(0,g.jsx)(`td`,{className:`p-3 font-mono text-sm`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`truncate max-w-[200px]`,title:e.key,children:e.key}),(0,g.jsxs)(n.c,{children:[(0,g.jsx)(n.d,{asChild:!0,children:(0,g.jsx)(`button`,{onClick:()=>Y(e.key),className:`text-muted-foreground hover:text-foreground`,children:(0,g.jsx)(p.Copy,{className:`h-3 w-3`})})}),(0,g.jsx)(n.l,{children:`Copier la clé`})]})]})}),(0,g.jsx)(`td`,{className:`p-2`,children:(0,g.jsx)(lL,{value:e.translations[se]?.value||``,onChange:t=>he(e.key,se,t),placeholder:`Texte source...`,status:e.translations[se]?.value?`valid`:`missing`})}),fe.map(t=>{let n=aL(e,t.code,se);return(0,g.jsx)(`td`,{className:`p-2`,children:(0,g.jsx)(lL,{value:e.translations[t.code]?.value||``,onChange:n=>he(e.key,t.code,n),placeholder:`Traduction ${t.label}...`,status:n})},t.code)}),(0,g.jsx)(`td`,{className:`p-3 text-center`,children:(0,g.jsx)(cL,{status:t})}),(0,g.jsx)(`td`,{className:`p-3 text-center`,children:(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:()=>{N(e),F(!0)},children:[(0,g.jsx)(p.Edit3,{className:`h-4 w-4 mr-2`}),`Éditer`]}),(0,g.jsxs)($,{onClick:()=>Y(e.key),children:[(0,g.jsx)(p.Copy,{className:`h-4 w-4 mr-2`}),`Copier la clé`]}),(0,g.jsx)(sn,{}),(0,g.jsxs)($,{className:`text-destructive`,onClick:()=>_e(e.key),children:[(0,g.jsx)(p.Trash2,{className:`h-4 w-4 mr-2`}),`Supprimer`]})]})]})})]},e.key)})]},e)),pe.length===0&&(0,g.jsx)(`tr`,{children:(0,g.jsxs)(`td`,{colSpan:fe.length+4,className:`p-12 text-center`,children:[(0,g.jsx)(p.Languages,{className:`h-12 w-12 mx-auto text-muted-foreground/50 mb-4`}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:E||O!==`all`?`Aucune traduction ne correspond à vos critères`:`Aucune traduction disponible`})]})})]})]})}),(0,g.jsx)(Qn,{open:P,onOpenChange:F,children:(0,g.jsxs)(ir,{className:`w-[500px] sm:max-w-[500px]`,children:[(0,g.jsxs)(ar,{children:[(0,g.jsx)(sr,{children:`Éditer la traduction`}),(0,g.jsx)(cr,{children:M?.key})]}),M&&(0,g.jsxs)(`div`,{className:`py-6 space-y-6`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`label`,{className:`text-sm font-medium`,children:[oe.find(e=>e.code===se)?.label,` (source)`]}),(0,g.jsx)(o.t,{value:M.translations[se]?.value||``,onChange:e=>{he(M.key,se,e.target.value),N({...M,translations:{...M.translations,[se]:{...M.translations[se],value:e.target.value}}})},placeholder:`Texte source...`,className:`min-h-[100px]`})]}),oe.filter(e=>e.code!==se).map(e=>(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`label`,{className:`text-sm font-medium flex items-center gap-2`,children:[e.flag&&(0,g.jsx)(`span`,{children:e.flag}),e.label]}),(0,g.jsx)(o.t,{value:M.translations[e.code]?.value||``,onChange:t=>{he(M.key,e.code,t.target.value),N({...M,translations:{...M.translations,[e.code]:{...M.translations[e.code],value:t.target.value}}})},placeholder:`Traduction ${e.label}...`,className:`min-h-[100px]`})]},e.code)),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Commentaire (optionnel)`}),(0,g.jsx)(o.t,{placeholder:`Contexte ou indication pour la traduction...`,className:`min-h-[80px]`})]})]}),(0,g.jsx)(or,{children:(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>F(!1),children:`Fermer`})})]})}),(0,g.jsx)(mt,{open:I,onOpenChange:L,children:(0,g.jsxs)(yt,{children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:`Ajouter une clé de traduction`}),(0,g.jsx)(Ct,{children:`Entrez la clé de traduction (ex: common.buttons.submit)`})]}),(0,g.jsx)(`div`,{className:`py-4`,children:(0,g.jsx)(s.t,{value:H,onChange:e=>U(e.target.value),placeholder:`namespace.key.name`})}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>L(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:ge,children:`Ajouter`})]})]})}),(0,g.jsx)(mt,{open:R,onOpenChange:z,children:(0,g.jsxs)(yt,{children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:`Ajouter une langue`}),(0,g.jsx)(Ct,{children:`Configurez la nouvelle langue à ajouter`})]}),(0,g.jsxs)(`div`,{className:`py-4 space-y-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Code (ex: de, it, pt)`}),(0,g.jsx)(s.t,{value:W.code,onChange:e=>G({...W,code:e.target.value}),placeholder:`de`})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Label`}),(0,g.jsx)(s.t,{value:W.label,onChange:e=>G({...W,label:e.target.value}),placeholder:`Allemand`})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Emoji drapeau (optionnel)`}),(0,g.jsx)(s.t,{value:W.flag,onChange:e=>G({...W,flag:e.target.value}),placeholder:`🇩🇪`})]})]}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>z(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:ve,children:`Ajouter`})]})]})}),(0,g.jsx)(mt,{open:B,onOpenChange:V,children:(0,g.jsxs)(yt,{children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:`Importer des traductions`}),(0,g.jsx)(Ct,{children:`Sélectionnez un fichier JSON à importer`})]}),(0,g.jsxs)(`div`,{className:`py-4 space-y-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Fichier JSON`}),(0,g.jsx)(s.t,{type:`file`,accept:`.json`,onChange:e=>q(e.target.files?.[0]||null)})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Langue cible`}),(0,g.jsxs)(a.d,{value:ee,onValueChange:J,children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{placeholder:`Sélectionner une langue`})}),(0,g.jsx)(a.f,{children:oe.map(e=>(0,g.jsxs)(a.m,{value:e.code,children:[e.flag&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.flag}),e.label]},e.code))})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Stratégie`}),(0,g.jsxs)(a.d,{value:te,onValueChange:e=>ne(e),children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`merge`,children:`Fusionner (conserver les existantes)`}),(0,g.jsx)(a.m,{value:`overwrite`,children:`Écraser tout`})]})]})]})]}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>V(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:ye,disabled:!K||!ee,children:`Importer`})]})]})})]})})}var dL={default:`text-foreground`,blue:`text-blue-500`,green:`text-green-500`,yellow:`text-yellow-500`,red:`text-red-500`,purple:`text-purple-500`},fL={default:`bg-muted`,blue:`bg-blue-500/10`,green:`bg-green-500/10`,yellow:`bg-yellow-500/10`,red:`bg-red-500/10`,purple:`bg-purple-500/10`};function pL({data:e,color:n=`blue`}){let r=Math.max(...e),i=Math.min(...e),a=r-i||1;return(0,g.jsx)(`svg`,{className:`w-16 h-8`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,g.jsx)(`polyline`,{points:e.map((t,n)=>`${n/(e.length-1)*100},${100-(t-i)/a*100}`).join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`3`,className:t.t(`opacity-60`,dL[n]||dL.blue)})})}function mL({metric:e}){let n=e.icon,r=e.trend===`up`?`text-green-500`:e.trend===`down`?`text-red-500`:`text-muted-foreground`,i=e.trend===`up`?p.TrendingUp:e.trend===`down`?p.TrendingDown:null;return(0,g.jsxs)(Y,{className:`relative overflow-hidden`,children:[(0,g.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,g.jsx)(Z,{className:`text-sm font-medium text-muted-foreground`,children:e.label}),n&&(0,g.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,fL[e.color||`default`]),children:(0,g.jsx)(`span`,{className:t.t(`h-4 w-4`,dL[e.color||`default`]),children:n})})]}),(0,g.jsxs)(Q,{children:[(0,g.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:e.value}),e.change!==void 0&&(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-1 text-sm`,r),children:[i&&(0,g.jsx)(i,{className:`h-3 w-3`}),(0,g.jsxs)(`span`,{children:[e.change>0?`+`:``,e.change,`%`]}),e.changeLabel&&(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.changeLabel})]})]}),e.sparkline&&(0,g.jsx)(pL,{data:e.sparkline,color:e.color})]}),e.target!==void 0&&e.current!==void 0&&(0,g.jsxs)(`div`,{className:`mt-4`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground mb-1`,children:[(0,g.jsx)(`span`,{children:`Progress`}),(0,g.jsxs)(`span`,{children:[Math.round(e.current/e.target*100),`%`]})]}),(0,g.jsx)(Yn,{value:e.current/e.target*100,className:`h-1.5`})]})]})]})}function hL({goal:e}){let n=e.current/e.target*100,i=n>=100;return(0,g.jsxs)(`div`,{className:`flex items-center gap-4 p-4 rounded-lg border bg-card`,children:[(0,g.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-full flex items-center justify-center`,i?`bg-green-500/10 text-green-500`:`bg-muted text-muted-foreground`),children:(0,g.jsx)(p.Target,{className:`h-5 w-5`})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,g.jsx)(`span`,{className:`font-medium truncate`,children:e.label}),(0,g.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[e.current,e.unit,` / `,e.target,e.unit]})]}),(0,g.jsx)(Yn,{value:Math.min(n,100),className:`h-2`})]}),i&&(0,g.jsx)(r.t,{variant:`default`,className:`bg-green-500`,children:`Complete`})]})}function gL({title:e=`Dashboard`,description:n,metrics:o,periods:s=[{value:`7d`,label:`7 days`},{value:`30d`,label:`30 days`},{value:`90d`,label:`90 days`},{value:`12m`,label:`12 months`}],selectedPeriod:c=`30d`,onPeriodChange:l,onRefresh:u,onExport:d,chart:f,secondaryMetrics:m,goals:h,isLoading:_=!1,lastUpdated:v,className:y}){return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,y),children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),n&&(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:n})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.length>0&&(0,g.jsxs)(a.d,{value:c,onValueChange:l,children:[(0,g.jsxs)(a.y,{className:`w-[140px]`,children:[(0,g.jsx)(p.Calendar,{className:`h-4 w-4 mr-2`}),(0,g.jsx)(a.b,{})]}),(0,g.jsx)(a.f,{children:s.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]}),u&&(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:u,disabled:_,children:(0,g.jsx)(p.RefreshCw,{className:t.t(`h-4 w-4`,_&&`animate-spin`)})}),d&&(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:d,children:(0,g.jsx)(p.Download,{className:`h-4 w-4`})})]})]}),v&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.Clock,{className:`h-4 w-4`}),(0,g.jsxs)(`span`,{children:[`Last updated: `,typeof v==`string`?v:v.toLocaleString()]})]}),(0,g.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:o.slice(0,4).map(e=>(0,g.jsx)(mL,{metric:e},e.id))}),f&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Overview`}),(0,g.jsx)(be,{children:`Performance metrics over time`})]}),(0,g.jsx)(Q,{children:f})]}),m&&m.length>0&&(0,g.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:m.map(e=>(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`pt-6`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.label}),(0,g.jsx)(`p`,{className:`text-xl font-bold`,children:e.value})]}),e.change!==void 0&&(0,g.jsxs)(r.t,{variant:e.trend===`up`?`default`:e.trend===`down`?`destructive`:`secondary`,className:`gap-1`,children:[e.trend===`up`?(0,g.jsx)(p.ArrowUpRight,{className:`h-3 w-3`}):e.trend===`down`?(0,g.jsx)(p.ArrowDownRight,{className:`h-3 w-3`}):null,e.change>0?`+`:``,e.change,`%`]})]})})},e.id))}),h&&h.length>0&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Target,{className:`h-5 w-5`}),`Goals & Targets`]}),(0,g.jsx)(be,{children:`Track your progress towards key objectives`})]}),(0,g.jsx)(Q,{className:`space-y-4`,children:h.map(e=>(0,g.jsx)(hL,{goal:e},e.id))})]})]})}var _L=[{id:`revenue`,label:`Total Revenue`,value:`$45,231.89`,change:20.1,changeLabel:`from last month`,trend:`up`,icon:(0,g.jsx)(p.DollarSign,{className:`h-4 w-4`}),color:`green`,sparkline:[30,40,35,50,49,60,70,91,125]},{id:`subscriptions`,label:`Subscriptions`,value:`+2,350`,change:180.1,changeLabel:`from last month`,trend:`up`,icon:(0,g.jsx)(p.Users,{className:`h-4 w-4`}),color:`blue`,sparkline:[10,20,30,40,50,60,70,80,90]},{id:`sales`,label:`Sales`,value:`+12,234`,change:19,changeLabel:`from last month`,trend:`up`,icon:(0,g.jsx)(p.ShoppingCart,{className:`h-4 w-4`}),color:`purple`,sparkline:[65,59,80,81,56,55,70,80,95]},{id:`active`,label:`Active Now`,value:`+573`,change:-2.5,changeLabel:`from last hour`,trend:`down`,icon:(0,g.jsx)(p.Activity,{className:`h-4 w-4`}),color:`yellow`,sparkline:[100,90,85,88,70,65,60,58,55]}],vL=[{id:`revenue-goal`,label:`Monthly Revenue Target`,current:45231,target:5e4,unit:`$`},{id:`users-goal`,label:`New User Signups`,current:2350,target:2e3,unit:``},{id:`conversion-goal`,label:`Conversion Rate`,current:3.2,target:5,unit:`%`}];function yL({steps:e,currentStep:n}){let r=e.findIndex(e=>e.id===n);return(0,g.jsx)(`div`,{className:`flex items-center justify-center mb-8`,children:e.map((n,i)=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsxs)(`div`,{className:`flex items-center`,children:[(0,g.jsx)(`div`,{className:t.t(`h-8 w-8 rounded-full flex items-center justify-center text-sm font-medium`,i<r?`bg-primary text-primary-foreground`:i===r?`bg-primary text-primary-foreground ring-4 ring-primary/20`:`bg-muted text-muted-foreground`),children:i<r?(0,g.jsx)(p.Check,{className:`h-4 w-4`}):i+1}),(0,g.jsx)(`span`,{className:t.t(`ml-2 text-sm font-medium hidden sm:inline`,i<=r?`text-foreground`:`text-muted-foreground`),children:n.label})]}),i<e.length-1&&(0,g.jsx)(`div`,{className:t.t(`w-8 sm:w-16 h-0.5 mx-2`,i<r?`bg-primary`:`bg-muted`)})]},n.id))})}function bL({items:e,currency:t=`$`,discount:n,couponCode:r,setCouponCode:a,onApplyCoupon:o,onRemoveDiscount:c,isApplyingCoupon:l,shippingPrice:u=0,taxRate:d=0}){let f=e.reduce((e,t)=>e+t.price*t.quantity,0),m=n?n.type===`percent`?f*n.amount/100:n.amount:0,h=f-m,_=h*d/100,v=h+_+u;return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.ShoppingBag,{className:`h-5 w-5`}),`Order Summary`]})}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[(0,g.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex gap-3`,children:[e.image&&(0,g.jsx)(`div`,{className:`h-16 w-16 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,g.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`p`,{className:`font-medium truncate`,children:e.name}),e.variant&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.variant}),(0,g.jsxs)(`p`,{className:`text-sm`,children:[`Qty: `,e.quantity]})]}),(0,g.jsxs)(`p`,{className:`font-medium`,children:[t,(e.price*e.quantity).toFixed(2)]})]},e.id))}),(0,g.jsx)(i.t,{}),n?(0,g.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded-lg bg-green-500/10 text-green-600`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Percent,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{className:`font-medium`,children:n.code}),(0,g.jsxs)(`span`,{className:`text-sm`,children:[`(-`,n.type===`percent`?`${n.amount}%`:`${t}${n.amount}`,`)`]})]}),(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:c,children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]}):(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(s.t,{placeholder:`Coupon code`,value:r,onChange:e=>a(e.target.value),className:`flex-1`}),(0,g.jsx)(i.n,{variant:`outline`,onClick:o,disabled:!r||l,children:l?(0,g.jsx)(p.Loader2,{className:`h-4 w-4 animate-spin`}):`Apply`})]}),(0,g.jsx)(i.t,{}),(0,g.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Subtotal`}),(0,g.jsxs)(`span`,{children:[t,f.toFixed(2)]})]}),m>0&&(0,g.jsxs)(`div`,{className:`flex justify-between text-green-600`,children:[(0,g.jsx)(`span`,{children:`Discount`}),(0,g.jsxs)(`span`,{children:[`-`,t,m.toFixed(2)]})]}),u>0&&(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Shipping`}),(0,g.jsxs)(`span`,{children:[t,u.toFixed(2)]})]}),_>0&&(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Tax (`,d,`%)`]}),(0,g.jsxs)(`span`,{children:[t,_.toFixed(2)]})]}),(0,g.jsx)(i.t,{}),(0,g.jsxs)(`div`,{className:`flex justify-between text-lg font-bold`,children:[(0,g.jsx)(`span`,{children:`Total`}),(0,g.jsxs)(`span`,{children:[t,v.toFixed(2)]})]})]})]})]})}function xL({items:e,shippingMethods:n=SL,paymentMethods:a=CL,onApplyCoupon:c,discount:l,onRemoveDiscount:u,onSubmitOrder:f,currency:m=`$`,taxRate:h=8.5,className:_}){let[v,y]=d.useState(`cart`),[b,x]=d.useState(``),[S,C]=d.useState(!1),[w,T]=d.useState(!1),[E,D]=d.useState({firstName:``,lastName:``,email:``,phone:``,address:``,apartment:``,city:``,state:``,postalCode:``,country:`US`}),[O,k]=d.useState(n[0]?.id||``),[A,j]=d.useState(a[0]?.id||``),[M,N]=d.useState(!1),P=[{id:`cart`,label:`Cart`},{id:`shipping`,label:`Shipping`},{id:`payment`,label:`Payment`},{id:`review`,label:`Review`}],F=n.find(e=>e.id===O),I=async()=>{!c||!b||(C(!0),await c(b),C(!1))},L=async()=>{if(f){T(!0);try{await f({address:E,shippingMethod:O,paymentMethod:A,saveInfo:M})}finally{T(!1)}}},R=()=>{let e=P.findIndex(e=>e.id===v);e<P.length-1&&y(P[e+1].id)},z=()=>{let e=P.findIndex(e=>e.id===v);e>0&&y(P[e-1].id)};return(0,g.jsxs)(`div`,{className:t.t(`max-w-6xl mx-auto`,_),children:[(0,g.jsx)(yL,{steps:P,currentStep:v}),(0,g.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-3`,children:[(0,g.jsxs)(`div`,{className:`lg:col-span-2 space-y-6`,children:[v===`cart`&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Shopping Cart`}),(0,g.jsxs)(be,{children:[e.length,` items in your cart`]})]}),(0,g.jsx)(Q,{className:`space-y-4`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex gap-4 p-4 rounded-lg border`,children:[e.image&&(0,g.jsx)(`div`,{className:`h-24 w-24 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,g.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsx)(`h3`,{className:`font-medium`,children:e.name}),e.description&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),e.variant&&(0,g.jsx)(r.t,{variant:`secondary`,className:`mt-1`,children:e.variant}),(0,g.jsxs)(`div`,{className:`mt-2 flex items-center justify-between`,children:[(0,g.jsxs)(`span`,{className:`text-sm`,children:[`Qty: `,e.quantity]}),(0,g.jsxs)(`span`,{className:`font-bold`,children:[m,(e.price*e.quantity).toFixed(2)]})]})]})]},e.id))}),(0,g.jsx)(xe,{children:(0,g.jsxs)(i.n,{className:`w-full`,onClick:R,children:[`Continue to Shipping`,(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4 ml-2`})]})})]}),v===`shipping`&&(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.MapPin,{className:`h-5 w-5`}),`Shipping Address`]})}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`First Name`}),(0,g.jsx)(s.t,{value:E.firstName,onChange:e=>D({...E,firstName:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Last Name`}),(0,g.jsx)(s.t,{value:E.lastName,onChange:e=>D({...E,lastName:e.target.value})})]})]}),(0,g.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Email`}),(0,g.jsx)(s.t,{type:`email`,value:E.email,onChange:e=>D({...E,email:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Phone`}),(0,g.jsx)(s.t,{type:`tel`,value:E.phone,onChange:e=>D({...E,phone:e.target.value})})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Address`}),(0,g.jsx)(s.t,{value:E.address,onChange:e=>D({...E,address:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Apartment, suite, etc. (optional)`}),(0,g.jsx)(s.t,{value:E.apartment,onChange:e=>D({...E,apartment:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`City`}),(0,g.jsx)(s.t,{value:E.city,onChange:e=>D({...E,city:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`State`}),(0,g.jsx)(s.t,{value:E.state,onChange:e=>D({...E,state:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Postal Code`}),(0,g.jsx)(s.t,{value:E.postalCode,onChange:e=>D({...E,postalCode:e.target.value})})]})]}),(0,g.jsx)(i.t,{className:`my-6`}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`font-medium mb-4 flex items-center gap-2`,children:[(0,g.jsx)(p.Truck,{className:`h-5 w-5`}),`Shipping Method`]}),(0,g.jsx)(Xn,{value:O,onValueChange:k,children:(0,g.jsx)(`div`,{className:`space-y-3`,children:n.map(e=>(0,g.jsxs)(o.n,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,O===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,g.jsx)(Zn,{value:e.id}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsx)(`p`,{className:`font-medium`,children:e.name}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]}),(0,g.jsxs)(`div`,{className:`text-right`,children:[(0,g.jsx)(`p`,{className:`font-medium`,children:e.price===0?`Free`:`${m}${e.price.toFixed(2)}`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.estimatedDays})]})]},e.id))})})]})]}),(0,g.jsxs)(xe,{className:`flex gap-4`,children:[(0,g.jsxs)(i.n,{variant:`outline`,onClick:z,children:[(0,g.jsx)(p.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,g.jsxs)(i.n,{className:`flex-1`,onClick:R,children:[`Continue to Payment`,(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),v===`payment`&&(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.CreditCard,{className:`h-5 w-5`}),`Payment Method`]})}),(0,g.jsxs)(Q,{children:[(0,g.jsx)(Xn,{value:A,onValueChange:j,children:(0,g.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,g.jsxs)(o.n,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,A===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,g.jsx)(Zn,{value:e.id}),e.icon,(0,g.jsx)(`span`,{className:`font-medium`,children:e.label}),e.last4&&(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[`•••• `,e.last4]})]},e.id))})}),(0,g.jsxs)(`div`,{className:`mt-6 flex items-center gap-2`,children:[(0,g.jsx)(Se,{id:`save-info`,checked:M,onCheckedChange:e=>N(e)}),(0,g.jsx)(o.n,{htmlFor:`save-info`,className:`text-sm`,children:`Save my information for faster checkout`})]}),(0,g.jsxs)(`div`,{className:`mt-6 p-4 rounded-lg bg-muted/50 flex items-center gap-3`,children:[(0,g.jsx)(p.Shield,{className:`h-5 w-5 text-green-500`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your payment information is encrypted and secure`})]})]}),(0,g.jsxs)(xe,{className:`flex gap-4`,children:[(0,g.jsxs)(i.n,{variant:`outline`,onClick:z,children:[(0,g.jsx)(p.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,g.jsxs)(i.n,{className:`flex-1`,onClick:R,children:[`Review Order`,(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),v===`review`&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Review Your Order`}),(0,g.jsx)(be,{children:`Please verify all information before placing your order`})]}),(0,g.jsxs)(Q,{className:`space-y-6`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,g.jsx)(p.MapPin,{className:`h-4 w-4`}),`Shipping Address`]}),(0,g.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,g.jsxs)(`p`,{className:`font-medium`,children:[E.firstName,` `,E.lastName]}),(0,g.jsxs)(`p`,{children:[E.address,E.apartment&&`, ${E.apartment}`]}),(0,g.jsxs)(`p`,{children:[E.city,`, `,E.state,` `,E.postalCode]}),(0,g.jsx)(`p`,{children:E.email}),(0,g.jsx)(`p`,{children:E.phone})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,g.jsx)(p.Truck,{className:`h-4 w-4`}),`Shipping Method`]}),(0,g.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,g.jsx)(`p`,{className:`font-medium`,children:F?.name}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:F?.estimatedDays})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,g.jsx)(p.CreditCard,{className:`h-4 w-4`}),`Payment Method`]}),(0,g.jsx)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:(0,g.jsx)(`p`,{className:`font-medium`,children:a.find(e=>e.id===A)?.label})})]})]}),(0,g.jsxs)(xe,{className:`flex gap-4`,children:[(0,g.jsxs)(i.n,{variant:`outline`,onClick:z,children:[(0,g.jsx)(p.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,g.jsx)(i.n,{className:`flex-1`,onClick:L,disabled:w,children:w?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Loader2,{className:`h-4 w-4 mr-2 animate-spin`}),`Processing...`]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Lock,{className:`h-4 w-4 mr-2`}),`Place Order`]})})]})]})]}),(0,g.jsx)(`div`,{className:`lg:sticky lg:top-4 h-fit`,children:(0,g.jsx)(bL,{items:e,currency:m,discount:l,couponCode:b,setCouponCode:x,onApplyCoupon:I,onRemoveDiscount:u,isApplyingCoupon:S,shippingPrice:F?.price||0,taxRate:h})})]})]})}var SL=[{id:`standard`,name:`Standard Shipping`,description:`Delivered by postal service`,price:4.99,estimatedDays:`5-7 business days`,icon:(0,g.jsx)(p.Package,{className:`h-5 w-5`})},{id:`express`,name:`Express Shipping`,description:`Fast delivery guaranteed`,price:14.99,estimatedDays:`2-3 business days`,icon:(0,g.jsx)(p.Truck,{className:`h-5 w-5`})},{id:`overnight`,name:`Overnight Shipping`,description:`Next day delivery`,price:29.99,estimatedDays:`Next business day`,icon:(0,g.jsx)(p.Truck,{className:`h-5 w-5`})}],CL=[{id:`card`,type:`card`,label:`Credit Card`,icon:(0,g.jsx)(p.CreditCard,{className:`h-5 w-5`})},{id:`paypal`,type:`paypal`,label:`PayPal`,icon:(0,g.jsx)(`div`,{className:`h-5 w-5 rounded bg-blue-500 flex items-center justify-center text-white text-xs font-bold`,children:`P`})}],wL=[{id:`1`,name:`Premium Wireless Headphones`,description:`High-quality audio with noise cancellation`,price:249.99,quantity:1,variant:`Matte Black`},{id:`2`,name:`USB-C Charging Cable`,description:`Fast charging compatible`,price:19.99,quantity:2,variant:`2m`}],TL={common:`bg-slate-500/20 text-slate-400 border-slate-500/30`,rare:`bg-blue-500/20 text-blue-400 border-blue-500/30`,epic:`bg-purple-500/20 text-purple-400 border-purple-500/30`,legendary:`bg-amber-500/20 text-amber-400 border-amber-500/30`},EL={common:``,rare:`shadow-blue-500/20`,epic:`shadow-purple-500/20`,legendary:`shadow-amber-500/30 shadow-lg`};function DL({current:e,max:t,level:n}){let r=e/t*100;return(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-bold`,children:n}),(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Level `,n]})]}),(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` XP`]})]}),(0,g.jsxs)(`div`,{className:`relative h-3 rounded-full bg-muted overflow-hidden`,children:[(0,g.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-gradient-to-r from-primary to-primary/80 rounded-full transition-all duration-500`,style:{width:`${r}%`}}),(0,g.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-gradient-to-r from-white/20 to-transparent rounded-full`,style:{width:`${r}%`}})]})]})}function OL({stat:e}){return(0,g.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-muted/50`,children:[e.icon&&(0,g.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-lg bg-background flex items-center justify-center`,{default:`text-foreground`,blue:`text-blue-500`,green:`text-green-500`,yellow:`text-yellow-500`,red:`text-red-500`,purple:`text-purple-500`}[e.color||`default`]),children:e.icon}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-2xl font-bold`,children:e.value}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.label})]})]})}function kL({achievement:e}){let n=e.unlockedAt||e.progress!==void 0&&e.maxProgress!==void 0&&e.progress>=e.maxProgress;return(0,g.jsx)(`div`,{className:t.t(`p-4 rounded-lg border transition-all`,n?t.t(TL[e.rarity||`common`],EL[e.rarity||`common`]):`bg-muted/30 border-dashed opacity-60`),children:(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(`div`,{className:t.t(`h-12 w-12 rounded-lg flex items-center justify-center`,n?`bg-background/50`:`bg-muted`),children:e.icon||(0,g.jsx)(p.Trophy,{className:`h-6 w-6`})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`h4`,{className:`font-medium truncate`,children:e.name}),e.rarity&&(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs capitalize`,children:e.rarity})]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.progress!==void 0&&e.maxProgress!==void 0&&!n&&(0,g.jsxs)(`div`,{className:`mt-2`,children:[(0,g.jsx)(Yn,{value:e.progress/e.maxProgress*100,className:`h-1.5`}),(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[e.progress,` / `,e.maxProgress]})]}),e.unlockedAt&&(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:[`Unlocked `,typeof e.unlockedAt==`string`?e.unlockedAt:e.unlockedAt.toLocaleDateString()]})]})]})})}function AL({match:e}){let n={win:`text-green-500 bg-green-500/10`,loss:`text-red-500 bg-red-500/10`,draw:`text-yellow-500 bg-yellow-500/10`},i={win:(0,g.jsx)(p.Trophy,{className:`h-4 w-4`}),loss:(0,g.jsx)(p.Swords,{className:`h-4 w-4`}),draw:(0,g.jsx)(p.Shield,{className:`h-4 w-4`})};return(0,g.jsxs)(`div`,{className:`flex items-center gap-4 p-3 rounded-lg bg-muted/50`,children:[(0,g.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-lg flex items-center justify-center`,n[e.result]),children:i[e.result]}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`font-medium capitalize`,children:e.result}),e.score&&(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.score})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[e.opponent&&(0,g.jsxs)(`span`,{children:[`vs `,e.opponent]}),e.mode&&(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs`,children:e.mode})]})]}),(0,g.jsxs)(`div`,{className:`text-right`,children:[e.xpGained&&(0,g.jsxs)(`p`,{className:`text-sm font-medium text-green-500`,children:[`+`,e.xpGained,` XP`]}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:typeof e.date==`string`?e.date:e.date.toLocaleDateString()})]})]})}function jL({name:e,avatar:r,title:i,level:a,currentXP:o,maxXP:s,totalXP:c,rank:l,rankIcon:u,stats:d,achievements:f,badges:m,matchHistory:h,streak:_,joinDate:v,playtime:y,friendsCount:b,isOnline:x=!1,className:S}){return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,S),children:[(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`pt-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-6 items-start`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsxs)(n.m,{className:`h-24 w-24 border-4 border-primary/20`,children:[(0,g.jsx)(n.g,{src:r,alt:e}),(0,g.jsx)(n.h,{className:`text-2xl`,children:e.slice(0,2).toUpperCase()})]}),x&&(0,g.jsx)(`div`,{className:`absolute bottom-1 right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background`}),(0,g.jsx)(`div`,{className:`absolute -top-2 -right-2 h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-bold text-sm`,children:a})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h2`,{className:`text-2xl font-bold`,children:e}),i&&(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:i}),l&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[u||(0,g.jsx)(p.Medal,{className:`h-5 w-5 text-yellow-500`}),(0,g.jsx)(`span`,{className:`font-medium`,children:l})]})]})]}),(0,g.jsxs)(`div`,{className:`flex-1 grid grid-cols-2 md:grid-cols-4 gap-4`,children:[_!==void 0&&(0,g.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-orange-500/10`,children:[(0,g.jsx)(p.Flame,{className:`h-6 w-6 text-orange-500 mx-auto`}),(0,g.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:_}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Day Streak`})]}),c!==void 0&&(0,g.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-purple-500/10`,children:[(0,g.jsx)(p.Zap,{className:`h-6 w-6 text-purple-500 mx-auto`}),(0,g.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:c.toLocaleString()}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Total XP`})]}),y&&(0,g.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-blue-500/10`,children:[(0,g.jsx)(p.Clock,{className:`h-6 w-6 text-blue-500 mx-auto`}),(0,g.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:y}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Playtime`})]}),b!==void 0&&(0,g.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-green-500/10`,children:[(0,g.jsx)(p.Users,{className:`h-6 w-6 text-green-500 mx-auto`}),(0,g.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:b}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Friends`})]})]})]}),(0,g.jsx)(`div`,{className:`mt-6`,children:(0,g.jsx)(DL,{current:o,max:s,level:a})}),m&&m.length>0&&(0,g.jsxs)(`div`,{className:`mt-6`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-3`,children:`Badges`}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 rounded-full bg-muted text-sm`,style:e.color?{backgroundColor:`${e.color}20`,color:e.color}:void 0,children:[e.icon,(0,g.jsx)(`span`,{children:e.name})]},e.id))})]})]})}),(0,g.jsxs)(yr,{defaultValue:`stats`,className:`w-full`,children:[(0,g.jsxs)(br,{className:`w-full justify-start`,children:[(0,g.jsx)(xr,{value:`stats`,children:`Stats`}),(0,g.jsx)(xr,{value:`achievements`,children:`Achievements`}),(0,g.jsx)(xr,{value:`history`,children:`Match History`})]}),(0,g.jsx)(Sr,{value:`stats`,className:`mt-4`,children:(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Player Statistics`}),(0,g.jsx)(be,{children:`Your performance metrics`})]}),(0,g.jsx)(Q,{children:d&&d.length>0?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:d.map((e,t)=>(0,g.jsx)(OL,{stat:e},t))}):(0,g.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No statistics available`})})]})}),(0,g.jsx)(Sr,{value:`achievements`,className:`mt-4`,children:(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Achievements`}),(0,g.jsxs)(be,{children:[f?.filter(e=>e.unlockedAt).length||0,` / `,f?.length||0,` unlocked`]})]}),(0,g.jsx)(Q,{children:f&&f.length>0?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:f.map(e=>(0,g.jsx)(kL,{achievement:e},e.id))}):(0,g.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No achievements yet`})})]})}),(0,g.jsx)(Sr,{value:`history`,className:`mt-4`,children:(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Match History`}),(0,g.jsx)(be,{children:`Your recent games`})]}),(0,g.jsx)(Q,{children:h&&h.length>0?(0,g.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>(0,g.jsx)(AL,{match:e},e.id))}):(0,g.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No matches played yet`})})]})})]}),v&&(0,g.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.Calendar,{className:`h-4 w-4`}),(0,g.jsxs)(`span`,{children:[`Member since `,typeof v==`string`?v:v.toLocaleDateString()]})]})]})}var ML=[{label:`Matches Played`,value:342,icon:(0,g.jsx)(p.Gamepad2,{className:`h-5 w-5`}),color:`blue`},{label:`Wins`,value:189,icon:(0,g.jsx)(p.Trophy,{className:`h-5 w-5`}),color:`green`},{label:`Win Rate`,value:`55.3%`,icon:(0,g.jsx)(p.TrendingUp,{className:`h-5 w-5`}),color:`yellow`},{label:`Best Score`,value:`12,450`,icon:(0,g.jsx)(p.Star,{className:`h-5 w-5`}),color:`purple`},{label:`Kills`,value:`1,234`,icon:(0,g.jsx)(p.Target,{className:`h-5 w-5`}),color:`red`},{label:`Assists`,value:876,icon:(0,g.jsx)(p.Heart,{className:`h-5 w-5`}),color:`default`}],NL=[{id:`first-win`,name:`First Victory`,description:`Win your first match`,rarity:`common`,unlockedAt:new Date(`2024-01-15`),icon:(0,g.jsx)(p.Trophy,{className:`h-6 w-6 text-yellow-500`})},{id:`streak-master`,name:`Streak Master`,description:`Achieve a 10-day login streak`,rarity:`rare`,unlockedAt:new Date(`2024-02-20`),icon:(0,g.jsx)(p.Flame,{className:`h-6 w-6 text-orange-500`})},{id:`legendary-player`,name:`Legendary Player`,description:`Reach level 50`,rarity:`legendary`,progress:42,maxProgress:50,icon:(0,g.jsx)(p.Crown,{className:`h-6 w-6 text-amber-500`})},{id:`social-butterfly`,name:`Social Butterfly`,description:`Add 25 friends`,rarity:`epic`,progress:18,maxProgress:25,icon:(0,g.jsx)(p.Users,{className:`h-6 w-6 text-purple-500`})}],PL=[{id:`beta`,name:`Beta Tester`,icon:(0,g.jsx)(p.Shield,{className:`h-4 w-4`}),color:`#3b82f6`},{id:`premium`,name:`Premium`,icon:(0,g.jsx)(p.Crown,{className:`h-4 w-4`}),color:`#f59e0b`},{id:`verified`,name:`Verified`,icon:(0,g.jsx)(p.Award,{className:`h-4 w-4`}),color:`#10b981`}],FL=[{id:`1`,result:`win`,score:`3-1`,opponent:`xShadowx`,mode:`Ranked`,date:new Date(`2024-03-10`),xpGained:150},{id:`2`,result:`win`,score:`2-0`,opponent:`ProGamer99`,mode:`Ranked`,date:new Date(`2024-03-10`),xpGained:175},{id:`3`,result:`loss`,score:`1-3`,opponent:`NightHawk`,mode:`Ranked`,date:new Date(`2024-03-09`),xpGained:50},{id:`4`,result:`draw`,score:`2-2`,opponent:`StormRider`,mode:`Casual`,date:new Date(`2024-03-09`),xpGained:75},{id:`5`,result:`win`,score:`5-2`,opponent:`BlazeMaster`,mode:`Ranked`,date:new Date(`2024-03-08`),xpGained:200}],IL={authenticator:{icon:(0,g.jsx)(p.Smartphone,{className:`h-5 w-5`}),title:`Authenticator App`,description:`Use an app like Google Authenticator or Authy`,recommended:!0},sms:{icon:(0,g.jsx)(p.MessageSquare,{className:`h-5 w-5`}),title:`SMS`,description:`Receive codes via text message`,recommended:!1},email:{icon:(0,g.jsx)(p.Mail,{className:`h-5 w-5`}),title:`Email`,description:`Receive codes via email`,recommended:!1},hardware:{icon:(0,g.jsx)(p.Key,{className:`h-5 w-5`}),title:`Hardware Key`,description:`Use a physical security key (YubiKey, etc.)`,recommended:!0}};function LL({methods:e,selected:n,onSelect:i}){return(0,g.jsx)(Xn,{value:n,onValueChange:e=>i(e),children:(0,g.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let i=IL[e];return(0,g.jsxs)(o.n,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,n===e?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,g.jsx)(Zn,{value:e}),(0,g.jsx)(`div`,{className:`h-10 w-10 rounded-lg bg-muted flex items-center justify-center`,children:i.icon}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:i.title}),i.recommended&&(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:`Recommended`})]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i.description})]})]},e)})})})}function RL({length:e=6,value:t,onChange:n}){let r=d.useRef([]),i=t.padEnd(e,``).split(``).slice(0,e),a=(t,a)=>{if(!/^\d*$/.test(a))return;let o=[...i];o[t]=a.slice(-1),n(o.join(``)),a&&t<e-1&&r.current[t+1]?.focus()},o=(e,t)=>{t.key===`Backspace`&&!i[e]&&e>0&&r.current[e-1]?.focus()},c=t=>{t.preventDefault(),n(t.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,e))};return(0,g.jsx)(`div`,{className:`flex gap-2 justify-center`,children:i.map((e,t)=>(0,g.jsx)(s.t,{ref:e=>{r.current[t]=e},type:`text`,inputMode:`numeric`,maxLength:1,value:e,onChange:e=>a(t,e.target.value),onKeyDown:e=>o(t,e),onPaste:c,className:`w-12 h-14 text-center text-2xl font-mono`},t))})}function zL({codes:e,onRegenerate:n,onDownload:r}){let[a,o]=d.useState(!1),[s,c]=d.useState(!1),l=()=>{let t=e.map(e=>e.code).join(`
|
|
2654
|
+
`})]})}t.n();var QM=[{value:`day`,label:`Day`},{value:`week`,label:`Week`},{value:`month`,label:`Month`},{value:`year`,label:`Year`}],$M=`#3b82f6`,eN=`#94a3b8`;function tN(e,t){return!t||t.length===0?e.map(e=>({date:e.date,value:e.value})):e.map((e,n)=>({date:e.date,value:e.value,compareValue:t[n]?.value}))}function nN(e){return e.toLocaleString(`en-US`)}function rN({active:e,payload:t,label:n,formatValue:r}){return!e||!t||t.length===0?null:(0,g.jsxs)(`div`,{className:`rounded-lg border bg-popover px-3 py-2 shadow-md`,children:[(0,g.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,g.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full`,style:{backgroundColor:e.color}}),(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.name,`:`]}),(0,g.jsx)(`span`,{className:`font-semibold tabular-nums`,children:r(e.value)})]},e.dataKey))]})}function iN({period:e,onPeriodChange:n}){return(0,g.jsx)(`div`,{className:`mb-4 flex gap-1 rounded-lg bg-muted p-1`,children:QM.map(r=>(0,g.jsx)(`button`,{type:`button`,onClick:()=>n(r.value),className:t.t(`rounded-md px-3 py-1.5 text-xs font-medium transition-colors`,e===r.value?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value))})}function aN({data:e,compareWith:n,period:r=`month`,stacked:i=!1,height:a=300,showLegend:o=!1,showGrid:s=!0,animated:c=!0,color:l=$M,compareColor:u=eN,formatValue:f=nN,onPeriodChange:p,className:m}){let h=d.useMemo(()=>tN(e,n),[e,n]),_=d.useId(),v=d.useId(),y=`usage-gradient-${_.replace(/:/g,``)}`,b=`compare-gradient-${v.replace(/:/g,``)}`,x=n&&n.length>0;return(0,g.jsxs)(`div`,{className:t.t(`w-full`,m),children:[p&&(0,g.jsx)(iN,{period:r,onPeriodChange:p}),(0,g.jsx)(q.ResponsiveContainer,{width:`100%`,height:a,children:(0,g.jsxs)(q.AreaChart,{data:h,margin:{top:4,right:4,left:0,bottom:0},children:[(0,g.jsxs)(`defs`,{children:[(0,g.jsxs)(`linearGradient`,{id:y,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,g.jsx)(`stop`,{offset:`5%`,stopColor:l,stopOpacity:.4}),(0,g.jsx)(`stop`,{offset:`95%`,stopColor:l,stopOpacity:.05})]}),x&&(0,g.jsxs)(`linearGradient`,{id:b,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,g.jsx)(`stop`,{offset:`5%`,stopColor:u,stopOpacity:.15}),(0,g.jsx)(`stop`,{offset:`95%`,stopColor:u,stopOpacity:.02})]})]}),s&&(0,g.jsx)(q.CartesianGrid,{strokeDasharray:`3 3`,vertical:!1,className:`stroke-border/50`}),(0,g.jsx)(q.XAxis,{dataKey:`date`,axisLine:!1,tickLine:!1,tick:{fontSize:12},className:`fill-muted-foreground`,dy:8}),(0,g.jsx)(q.YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12},className:`fill-muted-foreground`,tickFormatter:e=>f(e),width:60}),(0,g.jsx)(q.Tooltip,{content:(0,g.jsx)(rN,{formatValue:f}),cursor:{stroke:`hsl(var(--border))`,strokeWidth:1}}),o&&(0,g.jsx)(q.Legend,{verticalAlign:`bottom`,align:`center`,wrapperStyle:{paddingTop:16},iconType:`circle`}),x&&(0,g.jsx)(q.Area,{dataKey:`compareValue`,name:`Previous Period`,type:`monotone`,stroke:u,strokeWidth:1.5,strokeDasharray:`6 3`,fill:`url(#${b})`,fillOpacity:1,stackId:i?`stack`:void 0,isAnimationActive:c,animationDuration:800,dot:!1,activeDot:{r:3,fill:u,stroke:`white`,strokeWidth:1.5}}),(0,g.jsx)(q.Area,{dataKey:`value`,name:`Current Period`,type:`monotone`,stroke:l,strokeWidth:2,fill:`url(#${y})`,fillOpacity:1,stackId:i?`stack`:void 0,isAnimationActive:c,animationDuration:800,dot:!1,activeDot:{r:4,fill:l,stroke:`white`,strokeWidth:2}})]})})]})}t.n();function oN(e){if(e.length===0)return 0;let t=e.slice(-7);return t.reduce((e,t)=>e+t.value,0)/t.length}function sN(e,t){return t<=0?1/0:Math.floor(e/t)}function cN(e){if(!isFinite(e)||e<=0)return null;let t=new Date;return t.setDate(t.getDate()+e),t}function lN(e){return e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function uN(e){return e<7?{stroke:`#ef4444`,text:`text-red-600`,bg:`bg-red-100 dark:bg-red-950`,label:`Critical`}:e<=30?{stroke:`#f59e0b`,text:`text-amber-600`,bg:`bg-amber-100 dark:bg-amber-950`,label:`Warning`}:{stroke:`#22c55e`,text:`text-green-600`,bg:`bg-green-100 dark:bg-green-950`,label:`Healthy`}}function dN({dailyUsage:e,avgBurnRate:n,width:r,height:i,showProjection:a,projectionDays:o,statusColor:s,animated:c}){let[l,u]=d.useState(0),[f,p]=d.useState(!c),m=d.useRef(null),h=r-4,_=i-4,v=e.length+(a?o:0),y=e.map(e=>e.value),b=a?Array.from({length:o},()=>n):[],x=[...y,...b],S=Math.min(...x,0),C=Math.max(...x,1)-S||1,w=e.map((e,t)=>`${2+t/(v-1)*h},${2+_-(e.value-S)/C*_}`),T=[];if(a&&e.length>0){let t=e.length-1,r=2+t/(v-1)*h,i=2+_-(e[t].value-S)/C*_;T.push(`${r},${i}`);for(let t=1;t<=o;t++){let r=2+(e.length-1+t)/(v-1)*h,i=2+_-(n-S)/C*_;T.push(`${r},${i}`)}}return d.useEffect(()=>{m.current&&u(m.current.getTotalLength())},[e]),d.useEffect(()=>{if(c&&l>0){let e=setTimeout(()=>p(!0),50);return()=>clearTimeout(e)}},[c,l]),e.length<2?(0,g.jsx)(`svg`,{width:r,height:i,children:(0,g.jsx)(`text`,{x:r/2,y:i/2,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-xs fill-muted-foreground`,children:`Not enough data`})}):(0,g.jsxs)(`svg`,{width:r,height:i,className:`overflow-visible`,children:[(0,g.jsx)(`polyline`,{ref:m,points:w.join(` `),fill:`none`,stroke:s,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:c&&l>0?{strokeDasharray:l,strokeDashoffset:f?0:l,transition:`stroke-dashoffset 1s ease-out`}:void 0}),a&&T.length>1&&(0,g.jsx)(`polyline`,{points:T.join(` `),fill:`none`,stroke:s,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeDasharray:`4,3`,opacity:`0.5`,className:t.t(c&&`transition-opacity duration-500`,c&&(f?`opacity-50`:`opacity-0`))}),e.length>0&&(0,g.jsx)(`circle`,{cx:parseFloat(w[w.length-1].split(`,`)[0]),cy:parseFloat(w[w.length-1].split(`,`)[1]),r:`2.5`,fill:s,stroke:`white`,strokeWidth:`1`,className:t.t(c&&`transition-opacity duration-500`,c&&(f?`opacity-100`:`opacity-0`))})]})}function fN({dailyUsage:e,avgBurnRate:n,daysRemaining:r,width:i,height:a,showProjection:o,projectionDays:s,animated:c,className:l}){let u=uN(r);return(0,g.jsxs)(`div`,{className:t.t(`inline-flex items-center gap-2`,l),children:[(0,g.jsx)(dN,{dailyUsage:e,avgBurnRate:n,width:i,height:a,showProjection:o,projectionDays:s,statusColor:u.stroke,animated:c}),(0,g.jsx)(`span`,{className:t.t(`text-xs font-medium tabular-nums`,u.text),children:isFinite(r)?`${r}d`:`--`})]})}function pN({dailyUsage:e,balance:n,avgBurnRate:r,daysRemaining:i,depletionDate:a,width:o,height:s,showProjection:c,projectionDays:l,animated:u,className:d}){let f=uN(i);return(0,g.jsxs)(`div`,{className:t.t(`rounded-lg border bg-card p-4 space-y-4`,d),children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,g.jsx)(p.TrendingDown,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{children:`Credit Burn Rate`})]}),(0,g.jsx)(`div`,{className:t.t(`px-2 py-0.5 rounded-full text-xs font-medium`,f.bg,f.text),children:f.label})]}),(0,g.jsx)(`div`,{className:`flex justify-center`,children:(0,g.jsx)(dN,{dailyUsage:e,avgBurnRate:r,width:o,height:s,showProjection:c,projectionDays:l,statusColor:f.stroke,animated:u})}),(0,g.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Burn Rate`}),(0,g.jsx)(`div`,{className:`text-lg font-bold tabular-nums`,children:r.toFixed(1)}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`credits/day`})]}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,g.jsx)(p.Clock,{className:`h-3 w-3`}),(0,g.jsx)(`span`,{children:`Days Left`})]}),(0,g.jsx)(`div`,{className:t.t(`text-lg font-bold tabular-nums`,f.text),children:isFinite(i)?i:`--`}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[n.toLocaleString(),` credits`]})]}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Depleted By`}),(0,g.jsx)(`div`,{className:t.t(`text-sm font-semibold`,f.text),children:a?lN(a):`--`}),i<7&&isFinite(i)&&(0,g.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-red-600`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-3 w-3`}),(0,g.jsx)(`span`,{children:`Critical`})]})]})]})]})}function mN({dailyUsage:e,balance:n,showProjection:r=!1,projectionDays:i=7,width:a=120,height:o=32,animated:s=!0,variant:c=`sparkline`,className:l}){let u=d.useMemo(()=>oN(e),[e]),f=d.useMemo(()=>sN(n,u),[n,u]),p=d.useMemo(()=>cN(f),[f]);return!e||e.length===0?(0,g.jsx)(`div`,{className:t.t(`inline-flex items-center gap-2 text-muted-foreground text-sm`,l),children:`No data`}):c===`card`?(0,g.jsx)(pN,{dailyUsage:e,balance:n,avgBurnRate:u,daysRemaining:f,depletionDate:p,width:Math.max(a,200),height:Math.max(o,48),showProjection:r,projectionDays:i,animated:s,className:l}):(0,g.jsx)(fN,{dailyUsage:e,avgBurnRate:u,daysRemaining:f,width:a,height:o,showProjection:r,projectionDays:i,animated:s,className:l})}t.n();var hN=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`,`hsl(var(--primary))`,`hsl(var(--info))`,`hsl(var(--warning))`,`hsl(var(--success))`,`hsl(var(--destructive))`];function gN(e){return e.map((e,t)=>({...e,color:e.color||hN[t%hN.length]}))}function _N(e){return e.reduce((e,t)=>e+t.value,0)}function vN(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function yN({active:e,payload:n,total:r,formatter:i}){if(!e||!n||!n.length)return null;let a=n[0],o=r>0?(a.value/r*100).toFixed(1):`0`;return(0,g.jsxs)(`div`,{className:t.t(`px-3 py-2 text-sm rounded-lg shadow-lg`,`bg-foreground text-background`,`pointer-events-none min-w-[140px]`),children:[(0,g.jsxs)(`div`,{className:`font-semibold mb-1 flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full flex-shrink-0`,style:{backgroundColor:a.payload.color}}),a.name]}),(0,g.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,g.jsx)(`span`,{className:`opacity-70`,children:`Value:`}),(0,g.jsx)(`span`,{className:`font-medium`,children:i(a.value)})]}),(0,g.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,g.jsx)(`span`,{className:`opacity-70`,children:`Share:`}),(0,g.jsxs)(`span`,{children:[o,`%`]})]})]})}function bN({cx:e,cy:t,midAngle:n,innerRadius:r,outerRadius:i,percent:a}){let o=Math.PI/180,s=r+(i-r)*.5+20,c=e+s*Math.cos(-n*o),l=t+s*Math.sin(-n*o);return a<.05?null:(0,g.jsx)(`text`,{x:c,y:l,fill:`currentColor`,textAnchor:c>e?`start`:`end`,dominantBaseline:`central`,className:`text-xs fill-foreground`,children:`${(a*100).toFixed(0)}%`})}function xN({viewBox:e,total:t,formatter:n}){if(!e)return null;let{cx:r,cy:i}=e;return(0,g.jsxs)(`g`,{children:[(0,g.jsx)(`text`,{x:r,y:i-10,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-xs fill-muted-foreground`,children:`Total`}),(0,g.jsx)(`text`,{x:r,y:i+12,textAnchor:`middle`,dominantBaseline:`middle`,className:`text-base font-bold fill-foreground`,children:n(t)})]})}function SN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){return(0,g.jsx)(q.ResponsiveContainer,{width:`100%`,height:n,children:(0,g.jsxs)(q.PieChart,{children:[(0,g.jsx)(q.Pie,{data:e,dataKey:`value`,nameKey:`name`,cx:`50%`,cy:`50%`,outerRadius:n/2-40,isAnimationActive:r,animationDuration:800,label:i?bN:!1,labelLine:!1,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:e.map(e=>(0,g.jsx)(q.Cell,{fill:e.color},e.id))}),(0,g.jsx)(q.Tooltip,{content:(0,g.jsx)(yN,{total:t,formatter:o})}),a&&(0,g.jsx)(q.Legend,{verticalAlign:`bottom`,formatter:e=>(0,g.jsx)(`span`,{className:`text-sm text-foreground`,children:e})})]})})}function CN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){let c=n/2-40;return(0,g.jsx)(q.ResponsiveContainer,{width:`100%`,height:n,children:(0,g.jsxs)(q.PieChart,{children:[(0,g.jsxs)(q.Pie,{data:e,dataKey:`value`,nameKey:`name`,cx:`50%`,cy:`50%`,innerRadius:c*.55,outerRadius:c,isAnimationActive:r,animationDuration:800,paddingAngle:2,label:i?bN:!1,labelLine:!1,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:[e.map(e=>(0,g.jsx)(q.Cell,{fill:e.color},e.id)),(0,g.jsx)(xN,{total:t,formatter:o})]}),(0,g.jsx)(q.Tooltip,{content:(0,g.jsx)(yN,{total:t,formatter:o})}),a&&(0,g.jsx)(q.Legend,{verticalAlign:`bottom`,formatter:e=>(0,g.jsx)(`span`,{className:`text-sm text-foreground`,children:e})})]})})}function wN({data:e,total:t,height:n,animated:r,showPercentages:i,showLegend:a,formatter:o,onSegmentClick:s}){return(0,g.jsx)(q.ResponsiveContainer,{width:`100%`,height:n,children:(0,g.jsxs)(q.BarChart,{data:e.map(e=>({...e,percentage:t>0?(e.value/t*100).toFixed(1):`0`})),layout:`vertical`,barCategoryGap:`20%`,children:[(0,g.jsx)(q.XAxis,{type:`number`,tickFormatter:e=>i?`${t>0?(e/t*100).toFixed(0):0}%`:o(e),axisLine:!1,tickLine:!1,tick:{className:`text-xs fill-muted-foreground`}}),(0,g.jsx)(q.YAxis,{dataKey:`name`,type:`category`,width:100,axisLine:!1,tickLine:!1,tick:{className:`text-sm fill-foreground`}}),(0,g.jsx)(q.Tooltip,{content:(0,g.jsx)(yN,{total:t,formatter:o})}),a&&(0,g.jsx)(q.Legend,{verticalAlign:`bottom`,formatter:e=>(0,g.jsx)(`span`,{className:`text-sm text-foreground`,children:e})}),(0,g.jsx)(q.Bar,{dataKey:`value`,name:`Credits`,radius:[0,4,4,0],isAnimationActive:r,animationDuration:800,barSize:24,onClick:s?(t,n)=>s(e[n]):void 0,style:s?{cursor:`pointer`}:void 0,children:e.map(e=>(0,g.jsx)(q.Cell,{fill:e.color},e.id))})]})})}function TN({data:e,variant:n=`pie`,showPercentages:r=!1,showLegend:i=!0,height:a=300,animated:o=!0,onSegmentClick:s,formatValue:c,className:l}){let u=d.useMemo(()=>gN(e),[e]),f={data:u,total:d.useMemo(()=>_N(u),[u]),height:a,animated:o,showPercentages:r,showLegend:i,formatter:c||vN,onSegmentClick:s};return(0,g.jsxs)(`div`,{className:t.t(`w-full`,l),children:[n===`pie`&&(0,g.jsx)(SN,{...f}),n===`donut`&&(0,g.jsx)(CN,{...f}),n===`bar`&&(0,g.jsx)(wN,{...f})]})}t.n();function EN(e){return new Date(e)}function DN(e){return EN(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function ON(e,t){let n=EN(e);return n.setDate(n.getDate()+t),n.toISOString().split(`T`)[0]}function kN(e){if(e.length<2)return 0;let t=[...e].sort((e,t)=>EN(e.date).getTime()-EN(t.date).getTime()),n=t[0],r=t[t.length-1],i=(EN(r.date).getTime()-EN(n.date).getTime())/(1e3*60*60*24);return i===0?0:(n.value-r.value)/i}function AN(e,t,n,r){let i=[...e].sort((e,t)=>EN(e.date).getTime()-EN(t.date).getTime()),a=kN(i),o=i.map(e=>({date:e.date,historical:e.value})),s=i.length>0?i[i.length-1].date:new Date().toISOString().split(`T`)[0],c=null;i.length>0&&(o[o.length-1].projected=t,r&&(o[o.length-1].upperBound=t,o[o.length-1].lowerBound=t));for(let e=1;e<=n;e++){let i=ON(s,e),l=Math.max(0,t-a*e),u=e/n*.2,d=Math.max(0,t-a*e*(1-u)),f=Math.max(0,t-a*e*(1+u)),p={date:i,projected:l};r&&(p.upperBound=d,p.lowerBound=f),o.push(p),c===null&&l<=0&&(c=i)}return{chartData:o,depletionDate:c}}function jN({active:e,payload:t,label:n}){if(!e||!t||t.length===0||!n)return null;let r=t.find(e=>e.dataKey===`historical`),i=t.find(e=>e.dataKey===`projected`),a=t.find(e=>e.dataKey===`upperBound`),o=t.find(e=>e.dataKey===`lowerBound`);return(0,g.jsxs)(`div`,{className:`rounded-lg border bg-background px-3 py-2 shadow-md`,children:[(0,g.jsx)(`p`,{className:`text-xs font-medium text-foreground mb-1`,children:DN(n)}),r&&r.value!=null&&(0,g.jsxs)(`p`,{className:`text-xs text-blue-600`,children:[`Balance: `,r.value.toLocaleString()]}),i&&i.value!=null&&(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Projected: `,i.value.toLocaleString()]}),a&&o&&a.value!=null&&o.value!=null&&(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground/70`,children:[`Range: `,o.value.toLocaleString(),` - `,a.value.toLocaleString()]})]})}function MN({depletionDate:e}){return e?(0,g.jsxs)(`div`,{className:`mt-2 text-sm text-red-600 font-medium text-center`,children:[`Estimated depletion: `,DN(e)]}):null}function NN({historicalData:e,balance:n,projectionDays:r=30,confidenceInterval:i=!1,height:a=300,animated:o=!0,className:s}){let{chartData:c,depletionDate:l}=d.useMemo(()=>AN(e,n,r,i),[e,n,r,i]);return e.length===0?(0,g.jsx)(`div`,{className:t.t(`flex items-center justify-center text-muted-foreground text-sm border border-dashed border-border rounded-lg`,s),style:{height:a},children:`No historical data available`}):(0,g.jsxs)(`div`,{className:t.t(`w-full`,s),children:[(0,g.jsx)(q.ResponsiveContainer,{width:`100%`,height:a,children:(0,g.jsxs)(q.AreaChart,{data:c,margin:{top:10,right:30,left:10,bottom:0},children:[(0,g.jsxs)(`defs`,{children:[(0,g.jsxs)(`linearGradient`,{id:`historicalGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,g.jsx)(`stop`,{offset:`5%`,stopColor:`#3b82f6`,stopOpacity:.3}),(0,g.jsx)(`stop`,{offset:`95%`,stopColor:`#3b82f6`,stopOpacity:.05})]}),(0,g.jsxs)(`linearGradient`,{id:`confidenceGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,g.jsx)(`stop`,{offset:`5%`,stopColor:`#9ca3af`,stopOpacity:.2}),(0,g.jsx)(`stop`,{offset:`95%`,stopColor:`#9ca3af`,stopOpacity:.05})]})]}),(0,g.jsx)(q.CartesianGrid,{strokeDasharray:`3 3`,stroke:`#e5e7eb`,vertical:!1}),(0,g.jsx)(q.XAxis,{dataKey:`date`,tickFormatter:DN,tick:{fontSize:12,fill:`#6b7280`},axisLine:{stroke:`#d1d5db`},tickLine:{stroke:`#d1d5db`}}),(0,g.jsx)(q.YAxis,{tick:{fontSize:12,fill:`#6b7280`},axisLine:{stroke:`#d1d5db`},tickLine:{stroke:`#d1d5db`},tickFormatter:e=>e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}),(0,g.jsx)(q.Tooltip,{content:(0,g.jsx)(jN,{})}),(0,g.jsx)(q.ReferenceLine,{y:0,stroke:`#ef4444`,strokeWidth:2}),i&&(0,g.jsx)(q.Area,{type:`monotone`,dataKey:`upperBound`,stroke:`none`,fill:`url(#confidenceGradient)`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3}),i&&(0,g.jsx)(q.Area,{type:`monotone`,dataKey:`lowerBound`,stroke:`none`,fill:`#ffffff`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3}),(0,g.jsx)(q.Area,{type:`monotone`,dataKey:`historical`,stroke:`#3b82f6`,strokeWidth:2,fill:`url(#historicalGradient)`,fillOpacity:1,isAnimationActive:o,animationDuration:1e3,connectNulls:!1}),(0,g.jsx)(q.Line,{type:`monotone`,dataKey:`projected`,stroke:`#6b7280`,strokeWidth:2,strokeDasharray:`6 3`,dot:!1,isAnimationActive:o,animationDuration:1e3,connectNulls:!1})]})}),(0,g.jsx)(MN,{depletionDate:l})]})}t.n();function PN(e){return e.toLocaleString(`en-US`)}function FN(e,t){return Number.isInteger(e)?`${e}${t}`:`${e.toFixed(2)}${t}`}function IN(e,t){return`${e.toFixed(4).replace(/0+$/,``).replace(/\.$/,``)}${t}/credit`}function LN({pack:e,selected:n,onSelect:a,currency:o}){let s=e.currency||o;return(0,g.jsxs)(Y,{className:t.t(`relative flex flex-col transition-all duration-200 cursor-pointer`,n&&[`border-primary shadow-lg shadow-primary/10`,`ring-2 ring-primary/30`],e.highlighted&&!n&&`bg-muted/30`,!n&&!e.highlighted&&`hover:border-muted-foreground/30`),onClick:()=>a(e),children:[e.highlighted&&e.highlightLabel&&(0,g.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2 z-10`,children:(0,g.jsxs)(r.t,{className:`inline-flex items-center gap-1 rounded-full px-3 py-1 shadow-sm`,children:[(0,g.jsx)(p.Sparkles,{className:`h-3 w-3`}),e.highlightLabel]})}),(0,g.jsx)(X,{className:t.t(`pb-2`,e.highlighted&&`pt-8`),children:(0,g.jsx)(`h3`,{className:`text-lg font-bold text-foreground`,children:e.name})}),(0,g.jsxs)(Q,{className:`flex flex-1 flex-col gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Coins,{className:`h-5 w-5 text-primary`}),(0,g.jsx)(`span`,{className:`text-3xl font-bold text-foreground`,children:PN(e.credits)}),(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`credits`})]}),(0,g.jsx)(`div`,{className:`text-2xl font-semibold text-foreground`,children:FN(e.price,s)}),e.unitPrice!=null&&e.unitPrice>0&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:IN(e.unitPrice,s)}),e.bonusPercent!=null&&e.bonusPercent>0&&(0,g.jsxs)(r.t,{variant:`secondary`,className:`w-fit rounded-full`,children:[`+`,e.bonusPercent,`% bonus`]}),(0,g.jsx)(`div`,{className:`flex-1`}),(0,g.jsx)(i.n,{type:`button`,variant:n?`default`:`outline`,className:`mt-2 w-full`,onClick:t=>{t.stopPropagation(),a(e)},children:n?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Check,{className:`h-4 w-4`}),`Selected`]}):`Select`})]})]})}function RN({packs:e,selectedId:n,onSelect:r,currency:i=`€`,columns:a=3,className:o}){return(0,g.jsx)(`div`,{className:t.t(`grid gap-6`,{2:`grid-cols-1 md:grid-cols-2`,3:`grid-cols-1 md:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 md:grid-cols-2 lg:grid-cols-4`}[a],o),children:e.map(e=>(0,g.jsx)(LN,{pack:e,selected:e.id===n,onSelect:r,currency:i},e.id))})}t.n();var zN=.01,BN=100,VN=5e4;function HN(e,t){if(t.length===0)return e*zN;let n=[...t].sort((e,t)=>e.credits-t.credits);if(e<=n[0].credits){let t=n[0].price/n[0].credits;return Math.round(e*t*100)/100}if(e>=n[n.length-1].credits){let t=n[n.length-1].price/n[n.length-1].credits;return Math.round(e*t*100)/100}for(let t=0;t<n.length-1;t++)if(e>=n[t].credits&&e<=n[t+1].credits){let r=n[t],i=n[t+1],a=(e-r.credits)/(i.credits-r.credits),o=r.price+a*(i.price-r.price);return Math.round(o*100)/100}return e*zN}function UN(e,t){return`${e.toFixed(2)} ${t}`}function WN(e){return e.toLocaleString(`en-US`)}function GN({pack:e,selected:n,currency:r,onSelect:i}){return(0,g.jsxs)(`button`,{type:`button`,onClick:i,className:t.t(`relative flex flex-col items-center gap-2 rounded-lg border p-4 text-left transition-all`,`hover:border-primary/50 hover:shadow-sm`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,n?`border-primary bg-primary/5 shadow-sm ring-1 ring-primary`:`border-border bg-card`,e.highlighted&&!n&&`border-primary/30`),children:[e.highlighted&&e.highlightLabel&&(0,g.jsx)(`span`,{className:`absolute -top-2.5 left-1/2 -translate-x-1/2 rounded-full bg-primary px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground whitespace-nowrap`,children:e.highlightLabel}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(p.Coins,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`text-lg font-bold tabular-nums`,children:WN(e.credits)})]}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground font-medium`,children:e.name}),(0,g.jsx)(`span`,{className:`text-sm font-semibold`,children:UN(e.price,e.currency??r)}),e.bonusPercent!=null&&e.bonusPercent>0&&(0,g.jsxs)(`span`,{className:`rounded-full bg-green-100 dark:bg-green-900/30 px-2 py-0.5 text-[10px] font-semibold text-green-700 dark:text-green-400`,children:[`+`,e.bonusPercent,`% bonus`]}),e.unitPrice!=null&&(0,g.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[e.unitPrice.toFixed(4),` `,e.currency??r,`/credit`]})]})}function KN({packs:e,currentBalance:n,customAmount:r=!1,minAmount:a=BN,maxAmount:o=VN,currency:c=`EUR`,onPurchase:l,onCancel:u,className:f}){let[m,h]=d.useState(null),[_,v]=d.useState(!1),[y,b]=d.useState(a),x=e.find(e=>e.id===m)??null,S=HN(y,e),C=x!==null||_&&y>=a,w=_?y:x?.credits??0,T=_?S:x?.price??0;function E(e){h(e),v(!1)}function D(){v(!0),h(null)}function O(e){b(Math.max(a,Math.min(o,Math.round(e))))}function k(e){let t=e.target.value;if(t===``){b(a);return}let n=parseInt(t,10);isNaN(n)||O(n)}function A(e){e[0]!=null&&O(e[0])}function j(){C&&(_?l({credits:y,price:S}):x&&l(x))}return(0,g.jsx)(Y,{className:t.t(`w-full`,f),children:(0,g.jsxs)(Q,{className:`p-6 space-y-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10`,children:(0,g.jsx)(p.ShoppingCart,{className:`h-5 w-5 text-primary`})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Top Up Credits`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a pack or enter a custom amount`})]})]}),(0,g.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:e.map(e=>(0,g.jsx)(GN,{pack:e,selected:m===e.id&&!_,currency:c,onSelect:()=>E(e.id)},e.id))}),r&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(i.t,{}),(0,g.jsx)(`span`,{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-card px-3 text-xs text-muted-foreground font-medium`,children:`Or enter custom amount`})]}),(0,g.jsx)(`div`,{className:`space-y-4`,children:_?(0,g.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`label`,{htmlFor:`custom-credits`,className:`text-sm font-medium`,children:`Credits`}),(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:UN(S,c)})]}),(0,g.jsx)(s.t,{id:`custom-credits`,type:`number`,min:a,max:o,step:100,value:y,onChange:k,className:`tabular-nums`}),(0,g.jsx)(lr,{value:[y],onValueChange:A,min:a,max:o,step:100}),(0,g.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground tabular-nums`,children:[(0,g.jsx)(`span`,{children:WN(a)}),(0,g.jsx)(`span`,{children:WN(o)})]})]}):(0,g.jsxs)(i.n,{variant:`outline`,className:`w-full`,onClick:D,children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4`}),`Enter custom amount`]})})]}),C&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(i.t,{}),(0,g.jsxs)(`div`,{className:`space-y-2 rounded-lg bg-muted/50 p-4`,children:[(0,g.jsx)(`h4`,{className:`text-sm font-semibold`,children:`Summary`}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Credits`}),(0,g.jsx)(`span`,{className:`font-medium tabular-nums`,children:WN(w)})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Price`}),(0,g.jsx)(`span`,{className:`font-medium tabular-nums`,children:UN(T,c)})]}),n!=null&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(i.t,{className:`my-1`}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Current balance`}),(0,g.jsx)(`span`,{className:`tabular-nums`,children:WN(n)})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm font-semibold`,children:[(0,g.jsx)(`span`,{children:`New balance`}),(0,g.jsx)(`span`,{className:`tabular-nums text-green-600 dark:text-green-400`,children:WN(n+w)})]})]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[u&&(0,g.jsx)(i.n,{variant:`outline`,onClick:u,children:`Cancel`}),(0,g.jsxs)(i.n,{onClick:j,disabled:!C,children:[(0,g.jsx)(p.ShoppingCart,{className:`h-4 w-4`}),`Purchase`]})]})]})})}t.n();function qN(e){return(typeof e==`string`?new Date(e):e).toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function JN(e){return`${e>=0?`+`:``}${e.toLocaleString(`en-US`)}`}function YN(e){return e.toLocaleString(`en-US`,{style:`currency`,currency:`EUR`})}function XN(e){switch(e){case`credit`:return`default`;case`debit`:return`secondary`;case`refund`:return`destructive`;case`bonus`:return`default`;case`expiry`:return`outline`;default:return`secondary`}}function ZN(e){switch(e){case`completed`:return`default`;case`pending`:return`outline`;case`failed`:return`destructive`;case`cancelled`:return`secondary`;default:return`outline`}}function QN(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $N({label:e,children:t}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-between py-1.5 print:py-1`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground print:text-gray-500`,children:e}),(0,g.jsx)(`div`,{className:`text-sm font-medium text-right`,children:t})]})}function eP({transaction:e,organization:n,downloadable:a=!1,onDownload:o,className:s}){return(0,g.jsxs)(Y,{className:t.t(`w-full max-w-md print:shadow-none print:border-gray-300`,s),children:[(0,g.jsxs)(X,{className:`pb-4 print:pb-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Receipt,{className:`h-5 w-5 text-muted-foreground print:text-gray-500`}),(0,g.jsx)(Z,{className:`text-lg print:text-base`,children:`Receipt`})]}),(0,g.jsx)(p.CheckCircle,{className:`h-5 w-5 text-green-500 print:text-gray-700`})]}),(0,g.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground mt-1 print:text-gray-400`,children:e.id})]}),(0,g.jsx)(i.t,{className:`print:bg-gray-300`}),(0,g.jsxs)(Q,{className:`pt-4 print:pt-2`,children:[(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)($N,{label:`Date`,children:qN(e.timestamp)}),(0,g.jsx)($N,{label:`Type`,children:(0,g.jsx)(r.t,{variant:XN(e.type),className:`print:border-gray-400 print:bg-transparent print:text-gray-700`,children:QN(e.type)})}),e.credits!==void 0&&(0,g.jsx)($N,{label:`Credits`,children:(0,g.jsxs)(`span`,{className:t.t(`tabular-nums font-semibold`,e.credits>=0?`text-green-600 dark:text-green-400 print:text-gray-900`:`text-red-600 dark:text-red-400 print:text-gray-900`),children:[JN(e.credits),` credits`]})}),e.price!==void 0&&(0,g.jsx)($N,{label:`Amount`,children:(0,g.jsx)(`span`,{className:`tabular-nums`,children:YN(e.price)})}),e.paymentMethod&&(0,g.jsx)($N,{label:`Payment`,children:(0,g.jsx)(`span`,{className:`font-mono text-xs`,children:e.paymentMethod})}),(0,g.jsx)($N,{label:`Status`,children:(0,g.jsx)(r.t,{variant:ZN(e.status),className:`print:border-gray-400 print:bg-transparent print:text-gray-700`,children:QN(e.status)})}),n&&(0,g.jsx)($N,{label:`Organization`,children:n.name}),e.description&&(0,g.jsx)($N,{label:`Description`,children:(0,g.jsx)(`span`,{className:`max-w-[200px] truncate inline-block`,children:e.description})})]}),a&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(i.t,{className:`my-4 print:hidden`}),(0,g.jsx)(`div`,{className:`print:hidden`,children:(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,className:`w-full`,onClick:o,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Download PDF`]})})]})]})]})}t.n();function tP(e,t,n,r,i){let a={};e?i&&e===i&&(a.destination=`Destination must be different from source organization`):a.destination=`Please select a destination organization`;let o=parseFloat(t);return t?isNaN(o)||o<=0?a.amount=`Amount must be greater than 0`:o>r&&(a.amount=`Amount cannot exceed ${r.toLocaleString()} credits`):a.amount=`Amount is required`,n.trim()||(a.reason=`Please provide a reason for the transfer`),a}function nP({message:e}){return e?(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1.5`,children:[(0,g.jsx)(p.AlertCircle,{className:`h-3.5 w-3.5 text-destructive flex-shrink-0`}),(0,g.jsx)(`span`,{className:`text-xs text-destructive`,children:e})]}):null}function rP({maxAmount:e,organizations:n,sourceOrganization:r,onTransfer:c,onCancel:l,loading:u=!1,className:f}){let[m,h]=d.useState(``),[_,v]=d.useState(``),[y,b]=d.useState(``),[x,S]=d.useState({}),[C,w]=d.useState({}),T=d.useMemo(()=>r?n.filter(e=>e.id!==r.id):n,[n,r]),E=d.useMemo(()=>n.find(e=>e.id===m),[n,m]);d.useEffect(()=>{if(Object.keys(C).length===0)return;let t=tP(m,_,y,e,r?.id),n={};C.destination&&t.destination&&(n.destination=t.destination),C.amount&&t.amount&&(n.amount=t.amount),C.reason&&t.reason&&(n.reason=t.reason),S(n)},[m,_,y,e,r?.id,C]);let D=e=>{w(t=>({...t,[e]:!0}))},O=t=>{t.preventDefault(),w({destination:!0,amount:!0,reason:!0});let n=tP(m,_,y,e,r?.id);if(Object.keys(n).length>0){S(n);return}c({toOrgId:m,amount:parseFloat(_),reason:y.trim()})},k=parseFloat(_),A=E&&!isNaN(k)&&k>0&&k<=e&&r;return(0,g.jsxs)(Y,{className:t.t(`w-full`,f),children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`flex items-center gap-2 text-lg`,children:[(0,g.jsx)(p.Send,{className:`h-5 w-5`}),`Transfer Credits`]})}),(0,g.jsxs)(`form`,{onSubmit:O,children:[(0,g.jsxs)(Q,{className:`space-y-4`,children:[r&&(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Source Organization`}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-input bg-muted/50 px-3 py-2 text-sm`,children:[(0,g.jsx)(p.Building2,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,g.jsx)(`span`,{className:`font-medium`,children:r.name}),r.balance!==void 0&&(0,g.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[r.balance.toLocaleString(),` credits`]})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`destination-org`,children:`Destination Organization`}),(0,g.jsxs)(a.d,{value:m,onValueChange:e=>{h(e),w(e=>({...e,destination:!0}))},disabled:u,children:[(0,g.jsx)(a.y,{id:`destination-org`,className:t.t(x.destination&&`border-destructive focus:ring-destructive`),onBlur:()=>D(`destination`),children:(0,g.jsx)(a.b,{placeholder:`Select an organization`})}),(0,g.jsx)(a.f,{children:T.map(e=>(0,g.jsx)(a.m,{value:e.id,children:(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Building2,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,g.jsx)(`span`,{children:e.name}),e.balance!==void 0&&(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.balance.toLocaleString(),` credits)`]})]})},e.id))})]}),(0,g.jsx)(nP,{message:x.destination})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`transfer-amount`,children:`Amount`}),(0,g.jsx)(`div`,{className:`relative`,children:(0,g.jsx)(s.t,{id:`transfer-amount`,type:`number`,min:1,max:e,step:1,placeholder:`Max: ${e.toLocaleString()} credits`,value:_,onChange:e=>v(e.target.value),onBlur:()=>D(`amount`),disabled:u,className:t.t(x.amount&&`border-destructive focus-visible:ring-destructive`)})}),(0,g.jsx)(nP,{message:x.amount})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`transfer-reason`,children:`Reason`}),(0,g.jsx)(o.t,{id:`transfer-reason`,placeholder:`Describe the reason for this transfer...`,value:y,onChange:e=>b(e.target.value),onBlur:()=>D(`reason`),disabled:u,rows:3,className:t.t(x.reason&&`border-destructive focus-visible:ring-destructive`)}),(0,g.jsx)(nP,{message:x.reason})]}),A&&(0,g.jsx)(`div`,{className:`rounded-md border bg-muted/30 p-3`,children:(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-2 flex-wrap`,children:[`Transfer`,` `,(0,g.jsxs)(`span`,{className:`font-semibold text-foreground`,children:[k.toLocaleString(),` credits`]}),` `,`from`,` `,(0,g.jsx)(`span`,{className:`font-semibold text-foreground`,children:r.name}),(0,g.jsx)(p.ArrowRight,{className:`h-3.5 w-3.5 flex-shrink-0`}),(0,g.jsx)(`span`,{className:`font-semibold text-foreground`,children:E.name})]})})]}),(0,g.jsxs)(xe,{className:`gap-2 justify-end`,children:[l&&(0,g.jsx)(i.n,{type:`button`,variant:`outline`,onClick:l,disabled:u,children:`Cancel`}),(0,g.jsx)(i.n,{type:`submit`,disabled:u,children:u?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}),`Transferring...`]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Send,{className:`h-4 w-4`}),`Transfer`]})})]})]})]})}var iP=d.createContext(void 0);function aP({children:e,languages:t,defaultLanguage:n=`fr`,s3Config:r,onLanguageChange:i}){let{i18n:a}=(0,U.useTranslation)(),[o,s]=d.useState(n),[c,l]=d.useState(!0),[u,f]=d.useState(new Set),[p,m]=d.useState(!1),h=d.useCallback(async e=>{if(!r)throw Error(`S3 configuration not provided`);let{baseUrl:t,prefix:n=``,extension:i=`json`,headers:a={}}=r,o=`${t.replace(/\/$/,``)}/${n}${e}.${i}`;console.log(`[LanguageProvider] Loading translations from S3: ${o}`);try{let t=await fetch(o,{headers:{Accept:`application/json`,...a}});if(!t.ok)throw Error(`Failed to load translations: ${t.status} ${t.statusText}`);let n=await t.json();return console.log(`[LanguageProvider] ✓ Translations loaded for ${e}`),n}catch(t){throw console.error(`[LanguageProvider] ✗ Error loading translations for ${e}:`,t),t}},[r]);d.useEffect(()=>{p||!a||!r||(async()=>{try{let e=typeof window<`u`?localStorage.getItem(`language`):null,r=e&&t.some(t=>t.code===e)?e:n;console.log(`[LanguageProvider] Initializing with language: ${r}`);let i=await h(r);a.addResourceBundle&&a.addResourceBundle(r,`translation`,i,!0,!0),await a.changeLanguage(r),s(r),f(new Set([r])),m(!0),console.log(`[LanguageProvider] ✓ Initialized with ${r}`)}catch(e){console.error(`[LanguageProvider] Error initializing:`,e),m(!0)}finally{l(!1)}})()},[p,a,r,n,t,h]);let _={currentLanguage:o,languages:t,changeLanguage:d.useCallback(async e=>{if(e!==o){if(!a?.changeLanguage){console.error(`[LanguageProvider] i18next is not initialized`);return}if(!r){console.error(`[LanguageProvider] S3 config not provided`);return}l(!0);try{if(!u.has(e)){console.log(`[LanguageProvider] Loading ${e} from S3...`);let t=await h(e);a.addResourceBundle&&a.addResourceBundle(e,`translation`,t,!0,!0),f(t=>new Set([...t,e]))}await a.changeLanguage(e),s(e),typeof window<`u`&&localStorage.setItem(`language`,e),i?.(e),console.log(`[LanguageProvider] ✓ Language changed to: ${e}`)}catch(e){throw console.error(`[LanguageProvider] ✗ Error changing language:`,e),e}finally{l(!1)}}},[o,u,r,h,a,i]),isLoading:c,loadedLanguages:u};return(0,g.jsx)(iP.Provider,{value:_,children:e})}function oP(){let e=d.useContext(iP);if(!e)throw Error(`useLanguage must be used within a LanguageProvider`);return e}var sP=d.createContext(void 0);function cP({children:e,config:t}){let{defaultTheme:n=`light`,storageKey:r=`waka-ui-theme`,themes:i,enableSystem:a=!0,s3Config:o}=t||{},[s,c]=d.useState(n),[l,u]=d.useState(),[f,p]=d.useState([]),[m,h]=d.useState(!0),[_,v]=d.useState(`fallback`);d.useEffect(()=>{(async()=>{if(h(!0),i&&i.length>0){let e=lP(i);p(e),v(`config`),h(!1),console.log(`[ThemeProvider] Using themes from config:`,e.length);return}if(o?.baseUrl)try{let e=await uP(o.baseUrl);if(e.length>0){p(e),v(`s3`),h(!1),console.log(`[ThemeProvider] Loaded themes from S3:`,e.length);return}}catch(e){console.error(`[ThemeProvider] Failed to load themes from S3:`,e)}p([{id:`light`,label:`Clair`,previewColor:`#3b82f6`},{id:`dark`,label:`Sombre`,previewColor:`#1e293b`}]),v(`fallback`),h(!1),console.log(`[ThemeProvider] Using fallback themes`)})()},[i,o]),d.useEffect(()=>{if(!a)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=e=>{u(e.matches?`dark`:`light`)};return u(e.matches?`dark`:`light`),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[a]),d.useEffect(()=>{if(f.length===0)return;let e=localStorage.getItem(r),t=f.map(e=>e.id);e&&t.includes(e)&&c(e)},[r,f]),d.useEffect(()=>{if(f.length===0)return;let e=document.documentElement,t=s===`system`&&l?l:s;f.forEach(t=>e.classList.remove(t.id)),e.classList.add(t),e.setAttribute(`data-theme`,t),process.env.NODE_ENV===`development`&&console.log(`[WakaUI] Theme applied: ${t}`)},[s,l,f]);let y=d.useCallback(e=>{let t=f.map(e=>e.id);if(!t.includes(e)&&e!==`system`){console.warn(`[WakaUI] Theme "${e}" is not in the list of available themes:`,t);return}c(e),localStorage.setItem(r,e)},[f,r]),b=d.useMemo(()=>({theme:s,setTheme:y,themes:f,systemTheme:l,isLoadingThemes:m,themesSource:_}),[s,y,f,l,m,_]);return(0,g.jsx)(sP.Provider,{value:b,children:e})}function lP(e){return e.length===0?[]:typeof e[0]==`string`?e.map(e=>({id:e,label:dP(e),previewColor:fP(e)})):e}async function uP(e){try{let e=await fetch(`/api/themes/list`,{cache:`no-store`});if(!e.ok)throw Error(`HTTP ${e.status}`);return(await e.json()).themes||[]}catch(e){return console.error(`[ThemeProvider] Failed to fetch themes from S3:`,e),[]}}function dP(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function fP(e){return{light:`#3b82f6`,dark:`#1e293b`,forest:`#10b981`,sunset:`#f59e0b`,twilight:`#8b5cf6`,monochrome:`#6b7280`,perpetuity:`#ec4899`}[e]||`#3b82f6`}function pP(){let e=d.useContext(sP);if(!e)throw Error(`useTheme must be used within a ThemeProvider`);return e}function mP({children:e,config:t}){let[n]=d.useState(()=>K.default.createInstance()),[r,i]=d.useState(!1);return d.useEffect(()=>{(async()=>{try{await n.use(U.initReactI18next).init({lng:t.language.defaultLanguage,fallbackLng:t.language.defaultLanguage,supportedLngs:t.language.supportedLanguages,resources:t.language.resources||{},interpolation:{escapeValue:!1},react:{useSuspense:!1},debug:t.debug}),t.language.s3Config&&await hP(n,t.language.s3Config,t.language.supportedLanguages),i(!0),t.debug&&console.log(`[WakaUI] i18n initialized successfully`)}catch(e){console.error(`[WakaUI] Failed to initialize i18n:`,e),i(!0)}})()},[n,t]),d.useEffect(()=>{if(!r)return;let e=t.language.storageKey||`waka-ui-language`,i=localStorage.getItem(e);i&&t.language.supportedLanguages.includes(i)&&n.changeLanguage(i);let a=n=>{localStorage.setItem(e,n),t.debug&&console.log(`[WakaUI] Language changed to: ${n}`)};return n.on(`languageChanged`,a),()=>{n.off(`languageChanged`,a)}},[r,n,t]),r?(0,g.jsx)(U.I18nextProvider,{i18n:n,children:(0,g.jsx)(aP,{languages:t.language.languages||[],defaultLanguage:t.language.defaultLanguage,s3Config:t.language.s3Config?{baseUrl:t.language.s3Config.bucketUrl,prefix:t.language.s3Config.translationsPath?`${t.language.s3Config.translationsPath}/`:``,extension:`json`}:void 0,children:(0,g.jsx)(wr,{themes:t.theme?.themes||[{id:`default`,label:`Default`}],defaultTheme:t.theme?.defaultTheme||`default`,s3Config:t.theme?.s3Config,enableDarkMode:t.theme?.enableSystem,children:e})})}):(0,g.jsx)(`div`,{style:{padding:`20px`,textAlign:`center`},children:`Loading WakaUI...`})}async function hP(e,t,n){if(!t)return;let{bucketUrl:r,translationsPath:i=`translations`}=t;try{await Promise.all(n.map(async t=>{try{let n=`${r}/${i}/${t}.json`,a=await fetch(n);if(!a.ok){console.warn(`[WakaUI] Failed to load translations for ${t} from S3`);return}let o=await a.json();e.addResourceBundle(t,`translation`,o,!0,!0),process.env.NODE_ENV===`development`&&console.log(`[WakaUI] Loaded translations for ${t} from S3`)}catch(e){console.warn(`[WakaUI] Error loading translations for ${t}:`,e)}}))}catch(e){console.error(`[WakaUI] Error loading translations from S3:`,e)}}function gP(){let{i18n:e,t}=(0,U.useTranslation)(),n=oP(),r=Er();return{currentLanguage:e.language||n.currentLanguage,changeLanguage:async t=>{await n.changeLanguage(t),await e.changeLanguage(t)},languages:n.languages,isLanguageLoading:n.isLoading,currentTheme:r.currentTheme,changeTheme:r.changeTheme,themes:r.themes,isThemeLoading:r.isLoading,preloadTheme:r.preloadTheme,isThemeLoaded:r.isThemeLoaded,t}}var _P=d.createContext(void 0);function vP({children:e,initialSelection:t,onSelectionChange:n,persistKey:r=`admincrumb-selection`}){let[i,a]=d.useState(()=>{if(typeof window<`u`&&r){let e=localStorage.getItem(r);if(e)try{return JSON.parse(e)}catch(e){console.error(`Failed to parse stored admincrumb selection`,e)}}return t||{}});d.useEffect(()=>{typeof window<`u`&&r&&localStorage.setItem(r,JSON.stringify(i))},[i,r]),d.useEffect(()=>{n?.(i)},[i,n]);let o=d.useCallback(e=>{a({partner:e,network:void 0,customer:void 0})},[]),s=d.useCallback(e=>{a(t=>({...t,network:e,customer:void 0}))},[]),c=d.useCallback(e=>{a(t=>({...t,customer:e}))},[]),l=d.useCallback(()=>{a({})},[]),u=d.useMemo(()=>!!(i.partner||i.network||i.customer),[i]),f=d.useCallback(()=>({...i.partner?.id&&{partnerId:i.partner.id},...i.network?.id&&{networkId:i.network.id},...i.customer?.id&&{customerId:i.customer.id}}),[i]),p=d.useMemo(()=>({selection:i,setPartner:o,setNetwork:s,setCustomer:c,reset:l,isFiltered:u,getFilterQuery:f}),[i,o,s,c,l,u,f]);return(0,g.jsx)(_P.Provider,{value:p,children:e})}function yP(){let e=d.useContext(_P);if(!e)throw Error(`useAdmincrumbContext must be used within AdmincrumbProvider`);return e}function bP(){return d.useContext(_P)}var xP={github:p.Globe,twitter:p.Share2,linkedin:p.ExternalLink,email:p.Mail};function SP({columns:e=[],socialLinks:n=[],copyright:r=`© 2024 Tous droits réservés.`,className:a}){return(0,g.jsx)(`footer`,{className:t.t(`bg-muted/40`,a),children:(0,g.jsxs)(`div`,{className:`container mx-auto px-4 py-12`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4`,children:[e.map((e,t)=>(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.title}),(0,g.jsx)(`ul`,{className:`space-y-2`,children:e.links.map((e,t)=>(0,g.jsx)(`li`,{children:(0,g.jsx)(`a`,{href:e.href,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:e.label})},t))})]},t)),n.length>0&&(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Suivez-nous`}),(0,g.jsx)(`div`,{className:`flex space-x-4`,children:n.map((e,t)=>{let n=xP[e.platform];return(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-8 w-8`,children:(0,g.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e.platform,children:(0,g.jsx)(n,{className:`h-4 w-4`})})},t)})})]})]}),(0,g.jsx)(i.t,{className:`my-8`}),(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-between space-y-4 md:flex-row md:space-y-0`,children:[(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}),(0,g.jsxs)(`div`,{className:`flex space-x-6`,children:[(0,g.jsx)(`a`,{href:`/privacy`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:`Politique de confidentialité`}),(0,g.jsx)(`a`,{href:`/terms`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:`Conditions d'utilisation`})]})]})]})})}function CP({items:e,defaultActiveId:n,variant:r=`default`,size:i=`md`,className:a,onTabChange:o}){let[s,c]=d.useState(n||e[0]?.id||``),l=e=>{c(e),o?.(e)},u={sm:`h-8 px-3 text-sm`,md:`h-10 px-4 text-sm`,lg:`h-12 px-6 text-base`};return(0,g.jsx)(`div`,{className:t.t(`w-full`,a),children:(0,g.jsxs)(yr,{value:s,onValueChange:l,children:[(0,g.jsx)(br,{className:t.t(`grid w-full`,r===`pills`&&`grid-cols-auto`,r!==`pills`&&`grid-cols-${e.length}`,{default:`bg-background`,pills:`bg-muted rounded-full`,underline:`bg-transparent border-b-2 border-transparent data-[state=active]:border-primary`}[r]),children:e.map(e=>(0,g.jsx)(xr,{value:e.id,disabled:e.disabled,className:t.t(u[i],r===`underline`&&`rounded-none border-b-2 border-transparent data-[state=active]:border-primary`,r===`pills`&&`rounded-full`),children:e.label},e.id))}),e.map(e=>(0,g.jsx)(Sr,{value:e.id,className:`mt-6`,children:e.content},e.id))]})})}function wP({items:e,separator:n=`/`,className:r}){return(0,g.jsx)(`nav`,{className:t.t(`flex items-center space-x-1 text-sm text-muted-foreground`,r),children:e.map((e,t)=>(0,g.jsxs)(d.Fragment,{children:[t>0&&(0,g.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:n}),e.href?(0,g.jsx)(`a`,{href:e.href,className:`hover:text-foreground transition-colors`,children:e.label}):(0,g.jsx)(`span`,{className:`text-foreground font-medium`,children:e.label})]},t))})}function TP({variant:e=`dropdown`,showFlags:n=!0,className:r}){let{currentLanguage:o,languages:s,changeLanguage:c,isLoading:l}=oP(),u=s.find(e=>e.code===o);return e===`select`?(0,g.jsxs)(a.d,{value:o,onValueChange:c,disabled:l,children:[(0,g.jsx)(a.y,{className:t.t(`w-[180px]`,r),children:(0,g.jsxs)(a.b,{children:[n&&u?.flagEmoji&&(0,g.jsx)(`span`,{className:`mr-2`,children:u.flagEmoji}),u?.label]})}),(0,g.jsx)(a.f,{children:s.map(e=>(0,g.jsxs)(a.m,{value:e.code,children:[n&&e.flagEmoji&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.flagEmoji}),e.label]},e.code))})]}):(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,className:t.t(`gap-2`,r),disabled:l,children:[(0,g.jsx)(p.Globe,{className:`h-4 w-4`}),n&&u?.flagEmoji&&(0,g.jsx)(`span`,{children:u.flagEmoji}),u?.label]})}),(0,g.jsx)(nn,{align:`end`,children:s.map(e=>(0,g.jsxs)($,{onClick:()=>c(e.code),className:`cursor-pointer`,children:[n&&e.flagEmoji&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.flagEmoji}),e.label]},e.code))})]})}function EP({children:e,header:n,sidebar:r,footer:a,collapsible:o=!1,className:s}){let[c,l]=d.useState(!1);return(0,g.jsxs)(`div`,{className:t.t(`min-h-screen bg-background`,s),children:[n&&(0,g.jsx)(`header`,{className:`sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,g.jsxs)(`div`,{className:`container flex h-14 max-w-screen-2xl items-center`,children:[o&&r&&(0,g.jsxs)(Qn,{open:c,onOpenChange:l,children:[(0,g.jsx)($n,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`ghost`,size:`icon`,className:`md:hidden`,children:[(0,g.jsx)(p.Menu,{className:`h-5 w-5`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Ouvrir le menu`})]})}),(0,g.jsx)(ir,{side:`left`,className:`w-72 p-0`,children:(0,g.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between p-4`,children:[(0,g.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Navigation`}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:()=>l(!1),children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]}),(0,g.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:r})]})})]}),n]})}),(0,g.jsxs)(`div`,{className:`flex`,children:[r&&!o&&(0,g.jsx)(`aside`,{className:`hidden w-64 border-r bg-muted/40 md:block`,children:(0,g.jsx)(`div`,{className:`h-full overflow-y-auto p-4`,children:r})}),(0,g.jsx)(`main`,{className:`flex-1`,children:(0,g.jsx)(`div`,{className:`container mx-auto p-4`,children:e})})]}),a&&(0,g.jsx)(`footer`,{className:`border-t bg-muted/40`,children:(0,g.jsx)(`div`,{className:`container mx-auto p-4`,children:a})})]})}function DP({config:e,onSubmit:n,onForgotPassword:r,onSignUp:a,onSSOGoogle:c,onSSOMicrosoft:l,onSSOApple:u,onSSOLinkedIn:f,onSSOGlobe:m,onSSOUsers:h,onSSOCamera:_,onSSOFranceConnect:v,showSocialLogin:y=!1,className:b}){let x=!1;try{x=Er().isDarkMode}catch{}let S=e?.theme_json?.dark_mode??x,[C,w]=d.useState({email:``,password:``,rememberMe:!1}),[T,E]=d.useState(!1),D=d.useMemo(()=>e?.assets?S?e.assets.theme_logo_dark:e.assets.theme_logo_light:null,[e?.assets,S]),O=d.useMemo(()=>e?.color_json?{"--login-primary":e.color_json.primary,"--login-secondary":e.color_json.secondary,"--login-accent":e.color_json.accent}:{},[e?.color_json]),k=d.useMemo(()=>{let t=[];if(!e?.signup_options)return y&&(m&&t.push({id:`github`,label:`GitHub`,icon:(0,g.jsx)(p.Globe,{className:`h-4 w-4`}),onClick:m}),c&&t.push({id:`google`,label:`Google`,icon:(0,g.jsx)(p.Mail,{className:`h-4 w-4`}),onClick:c})),t;let n=e.signup_options;return n.allow_sso_google&&t.push({id:`google`,label:`Google`,icon:(0,g.jsx)(p.Mail,{className:`h-4 w-4`}),onClick:c}),n.allow_sso_microsoft&&t.push({id:`microsoft`,label:`Microsoft`,icon:(0,g.jsx)(p.Mail,{className:`h-4 w-4`}),onClick:l}),n.allow_sso_apple&&t.push({id:`apple`,label:`Apple`,icon:(0,g.jsx)(p.Apple,{className:`h-4 w-4`}),onClick:u}),n.allow_sso_linkedIn&&t.push({id:`linkedin`,label:`LinkedIn`,icon:(0,g.jsx)(p.ExternalLink,{className:`h-4 w-4`}),onClick:f}),n.allow_sso_github&&t.push({id:`github`,label:`GitHub`,icon:(0,g.jsx)(p.Globe,{className:`h-4 w-4`}),onClick:m}),n.allow_sso_facebook&&t.push({id:`facebook`,label:`Users`,icon:(0,g.jsx)(p.Users,{className:`h-4 w-4`}),onClick:h}),n.allow_sso_instagram&&t.push({id:`instagram`,label:`Camera`,icon:(0,g.jsx)(p.Camera,{className:`h-4 w-4`}),onClick:_}),n.allow_sso_france_connect&&t.push({id:`france-connect`,label:`France Connect`,icon:(0,g.jsx)(p.Mail,{className:`h-4 w-4`}),onClick:v}),t},[e?.signup_options,y,c,l,u,f,m,h,_,v]),A=e?.signup_options?.allow_login!==!1,j=async e=>{e.preventDefault(),E(!0);try{await n?.(C)}finally{E(!1)}},M=e=>t=>{w(n=>({...n,[e]:e===`rememberMe`?t.target.checked:t.target.value}))};return(0,g.jsx)(`div`,{className:t.t(`flex items-center justify-center p-4`,b),style:O,children:(0,g.jsxs)(Y,{className:`w-full max-w-md`,children:[(0,g.jsxs)(X,{className:`space-y-1`,children:[D&&(0,g.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,g.jsx)(`img`,{src:D,alt:e?.theme_json?.name||`Logo`,className:`max-h-16 max-w-full object-contain`})}),(0,g.jsx)(Z,{className:`text-2xl text-center`,children:`Connexion`}),(0,g.jsx)(be,{className:`text-center`,children:`Entrez vos identifiants pour accéder à votre compte`})]}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[k.length>0&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:t.t(`grid gap-4`,k.length===1?`grid-cols-1`:`grid-cols-2`),children:k.map(e=>(0,g.jsxs)(i.n,{variant:`outline`,className:`w-full`,onClick:e.onClick,type:`button`,children:[e.icon,e.label]},e.id))}),A&&(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,g.jsx)(i.t,{className:`w-full`})}),(0,g.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,g.jsx)(`span`,{className:`bg-background px-2 text-muted-foreground`,children:`Ou continuez avec`})})]})]}),A&&(0,g.jsxs)(`form`,{onSubmit:j,className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`email`,children:`Email`}),(0,g.jsx)(s.t,{id:`email`,type:`email`,placeholder:`votre@email.com`,value:C.email,onChange:M(`email`),required:!0})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`password`,children:`Mot de passe`}),(0,g.jsx)(s.t,{id:`password`,type:`password`,placeholder:`••••••••`,value:C.password,onChange:M(`password`),required:!0})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,g.jsx)(`input`,{id:`remember`,type:`checkbox`,checked:C.rememberMe,onChange:M(`rememberMe`),className:`h-4 w-4 rounded border-gray-300`}),(0,g.jsx)(o.n,{htmlFor:`remember`,className:`text-sm`,children:`Se souvenir de moi`})]}),r&&(0,g.jsx)(i.n,{type:`button`,variant:`link`,className:`px-0 text-sm`,onClick:r,children:`Mot de passe oublié ?`})]}),(0,g.jsx)(i.n,{type:`submit`,className:`w-full`,disabled:T,style:e?.color_json?.primary?{backgroundColor:e.color_json.primary,color:e.color_json.secondary}:void 0,children:T?`Connexion...`:`Se connecter`})]}),a&&(0,g.jsxs)(`div`,{className:`text-center text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Pas encore de compte ? `}),(0,g.jsx)(i.n,{type:`button`,variant:`link`,className:`px-0 text-sm`,onClick:a,children:`S'inscrire`})]}),e?.waka_powered&&(0,g.jsx)(`div`,{className:`text-center text-xs text-muted-foreground mt-4 pt-4 border-t`,children:`Powered by Waka`})]})]})})}var OP=d.createContext(null);function kP(){let e=d.useContext(OP);if(!e)throw Error(`Sidebar components must be used within WakaSidebar`);return e}function AP({config:e}){let{LinkComponent:t}=kP(),n=e.component?e.component:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.src&&(0,g.jsx)(`img`,{src:e.src,alt:e.alt||`Logo`,className:`h-8 w-auto object-contain`}),e.title&&(0,g.jsx)(`span`,{className:`text-lg font-bold tracking-wide`,children:e.title})]});return e.href?t?(0,g.jsx)(t,{href:e.href,className:`block`,onClick:e.onClick,children:n}):(0,g.jsx)(`a`,{href:e.href,className:`block`,onClick:e.onClick,children:n}):e.onClick?(0,g.jsx)(`button`,{type:`button`,onClick:e.onClick,className:`block text-left`,children:n}):(0,g.jsx)(`div`,{children:n})}function jP({item:e,isChild:n=!1,renderItem:r}){let{activeId:i,setActiveId:a,expandedIds:o,toggleExpanded:s,isMobile:c,closeOnNavigate:l,onClose:u,LinkComponent:d}=kP(),f=e.children&&e.children.length>0,m=o.includes(e.id),h=i===e.id||e.active,_=()=>{e.disabled||(f?s(e.id):(a(e.id),e.onClick?.(),c&&l&&u()))};if(r)return(0,g.jsx)(g.Fragment,{children:r(e,n)});let v=(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200`,`hover:bg-white/10`,h&&!f&&`bg-sidebar-active text-sidebar-active-foreground`,n&&`ml-6 text-[13px]`,e.disabled&&`opacity-50 cursor-not-allowed`),children:[e.icon&&(0,g.jsx)(`span`,{className:t.t(`flex-shrink-0`,n?`h-4 w-4`:`h-5 w-5`),children:e.icon}),(0,g.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.badge!==void 0&&(0,g.jsx)(`span`,{className:`ml-auto flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold text-primary-foreground`,children:e.badge}),f&&(0,g.jsx)(p.ChevronDown,{className:t.t(`h-4 w-4 transition-transform duration-200`,m&&`rotate-180`)})]});if(f)return(0,g.jsxs)(dt,{open:m,onOpenChange:()=>s(e.id),children:[(0,g.jsx)(ft,{asChild:!0,children:(0,g.jsx)(`button`,{type:`button`,className:`w-full text-left`,disabled:e.disabled,children:v})}),(0,g.jsx)(pt,{className:`space-y-1 pt-1`,children:e.children?.map(e=>(0,g.jsx)(jP,{item:e,isChild:!0,renderItem:r},e.id))})]});if(e.href){let t={href:e.href,className:`block`,onClick:t=>{if(e.disabled){t.preventDefault();return}_()}};return d?(0,g.jsx)(d,{...t,children:v}):(0,g.jsx)(`a`,{...t,children:v})}return(0,g.jsx)(`button`,{type:`button`,className:`w-full text-left`,disabled:e.disabled,onClick:_,children:v})}function MP({config:e}){let{LinkComponent:r}=kP(),i=e.initials||e.name.split(` `).map(e=>e[0]).join(``).slice(0,2).toUpperCase(),a=[{id:`profile`,label:`Profil`,icon:(0,g.jsx)(p.User,{className:`h-4 w-4`})},{id:`settings`,label:`Paramètres`,icon:(0,g.jsx)(p.Settings,{className:`h-4 w-4`})},{id:`logout`,label:`Déconnexion`,icon:(0,g.jsx)(p.LogOut,{className:`h-4 w-4`}),variant:`destructive`}],o=e.actions??a;return(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-lg p-2 text-left transition-colors hover:bg-white/10`,children:[(0,g.jsxs)(n.m,{className:`h-10 w-10 border-2 border-sidebar-active`,children:[(0,g.jsx)(n.g,{src:e.avatarUrl,alt:e.name}),(0,g.jsx)(n.h,{className:`bg-sidebar-active text-sidebar-active-foreground text-sm font-medium`,children:i})]}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.name}),e.email&&(0,g.jsx)(`p`,{className:`text-xs text-sidebar-foreground/70 truncate`,children:e.email})]}),(0,g.jsx)(p.ChevronDown,{className:`h-4 w-4 flex-shrink-0 opacity-70`})]})}),(0,g.jsx)(nn,{align:`end`,className:`w-56`,children:o.map((e,n)=>(0,g.jsxs)(d.Fragment,{children:[e.variant===`destructive`&&n>0&&(0,g.jsx)(sn,{}),(0,g.jsx)($,{onClick:e.onClick,className:t.t(e.variant===`destructive`&&`text-destructive focus:text-destructive`),asChild:!!e.href,children:e.href?r?(0,g.jsxs)(r,{href:e.href,className:`flex items-center gap-2`,children:[e.icon,e.label]}):(0,g.jsxs)(`a`,{href:e.href,className:`flex items-center gap-2`,children:[e.icon,e.label]}):(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,e.label]})})]},e.id))})]})}function NP({logo:e,menu:t,user:r,userPosition:i=`bottom`,header:a,footer:o,renderItem:s}){return(0,g.jsxs)(`div`,{className:`flex h-full flex-col`,children:[e&&(0,g.jsx)(`div`,{className:`flex-shrink-0 p-4 pb-2`,children:(0,g.jsx)(AP,{config:e})}),a&&(0,g.jsx)(`div`,{className:`flex-shrink-0 px-4 py-2`,children:a}),r&&i===`top`&&(0,g.jsx)(`div`,{className:`flex-shrink-0 px-3 py-2 border-b border-white/10`,children:(0,g.jsx)(MP,{config:r})}),(0,g.jsx)(n.f,{className:`flex-1 px-3 py-4`,children:(0,g.jsx)(`nav`,{className:`space-y-1`,children:t.map(e=>(0,g.jsx)(jP,{item:e,renderItem:s},e.id))})}),o&&(0,g.jsx)(`div`,{className:`flex-shrink-0 px-4 py-2 border-t border-white/10`,children:o}),r&&i===`bottom`&&(0,g.jsx)(`div`,{className:`flex-shrink-0 p-3 border-t border-white/10`,children:(0,g.jsx)(MP,{config:r})})]})}function PP({logo:e,menu:n,user:r,width:a=260,mobileBreakpoint:o=768,open:s,onOpenChange:c,className:l,contentClassName:u,backgroundColor:f,textColor:m,activeColor:h,hoverColor:_,userPosition:v=`bottom`,showHamburger:y=!0,hamburgerPosition:b=`left`,renderItem:x,footer:S,header:C,position:w=`fixed`,LinkComponent:T}){let[E,D]=d.useState(!1),O=s!==void 0,k=O?s:E,A=O?c:D,[j,M]=d.useState(!1);d.useEffect(()=>{let e=()=>{M(window.innerWidth<o)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]);let[N,P]=d.useState(()=>{let e=t=>{for(let n of t){if(n.active)return n.id;if(n.children){let t=e(n.children);if(t)return t}}return null};return e(n)}),[F,I]=d.useState(()=>{let e=(t,n=[])=>{for(let r of t){if(r.active)return n;if(r.children){let t=e(r.children,[...n,r.id]);if(t.length>n.length)return t}}return[]};return e(n)}),L={activeId:N,setActiveId:P,expandedIds:F,toggleExpanded:d.useCallback(e=>{I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),isMobile:j,closeOnNavigate:!0,onClose:()=>A(!1),LinkComponent:T},R={"--sidebar-bg":f||`hsl(var(--sidebar-background, var(--card)))`,"--sidebar-text":m||`hsl(var(--sidebar-foreground, var(--muted-foreground)))`,"--sidebar-active":h||`hsl(var(--sidebar-primary, var(--primary)))`,"--sidebar-active-foreground":`hsl(var(--sidebar-primary-foreground, var(--primary-foreground)))`,"--sidebar-hover":_||`hsl(var(--sidebar-accent, var(--accent)))`},z=t.t(`bg-[var(--sidebar-bg)] text-[var(--sidebar-text)]`,`[&_.bg-sidebar-active]:bg-[var(--sidebar-active)]`,`[&_.text-sidebar-active-foreground]:text-[var(--sidebar-active-foreground)]`,`[&_.border-sidebar-active]:border-[var(--sidebar-active)]`,u),B=(0,g.jsx)(OP.Provider,{value:L,children:(0,g.jsx)(`div`,{className:t.t(`h-full`,z),style:R,children:(0,g.jsx)(NP,{logo:e,menu:n,user:r,userPosition:v,header:C,footer:S,renderItem:x})})});return(0,g.jsxs)(g.Fragment,{children:[y&&j&&(0,g.jsxs)(i.n,{variant:`ghost`,size:`icon`,className:t.t(`fixed top-3 z-50`,b===`left`?`left-3`:`right-3`),onClick:()=>A(!0),children:[(0,g.jsx)(p.Menu,{className:`h-6 w-6`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Ouvrir le menu`})]}),!j&&(0,g.jsx)(`aside`,{className:t.t(w===`fixed`?`fixed left-0 top-0 h-screen z-40`:`relative h-full`,l),style:{width:a},children:B}),j&&(0,g.jsx)(Qn,{open:k,onOpenChange:A,children:(0,g.jsxs)(ir,{side:`left`,className:t.t(`w-[280px] p-0 border-0`,l),style:R,"aria-describedby":`sidebar-description`,children:[(0,g.jsx)(sr,{className:`sr-only`,children:`Menu de navigation`}),(0,g.jsx)(cr,{id:`sidebar-description`,className:`sr-only`,children:`Menu principal de l'application`}),B]})})]})}function FP(){let[e,t]=d.useState(!1);return{isOpen:e,setIsOpen:t,open:d.useCallback(()=>t(!0),[]),close:d.useCallback(()=>t(!1),[]),toggle:d.useCallback(()=>t(e=>!e),[])}}function IP({sidebar:e,children:n,sidebarWidth:r=260,className:i,contentClassName:a}){let[o,s]=d.useState(!1),c=e.mobileBreakpoint||768;return d.useEffect(()=>{let e=()=>s(window.innerWidth<c);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[c]),(0,g.jsxs)(`div`,{className:t.t(`min-h-screen bg-background`,i),children:[(0,g.jsx)(PP,{...e,width:r}),(0,g.jsx)(`main`,{className:t.t(`min-h-screen transition-all duration-300`,a),style:{marginLeft:o?0:r},children:n})]})}t.n();function LP({title:e,subtitle:o,showSearch:c=!0,searchPlaceholder:l=`Rechercher...`,searchValue:u,onSearchChange:f,onSearchSubmit:m,primaryAction:h,secondaryActions:_,filters:v,notifications:y,unreadCount:b=0,onNotificationsClick:x,userMenu:S,leftContent:C,rightContent:w,filterContent:T,className:E,mainBarClassName:D,filterBarClassName:O,sticky:k=!0}){let[A,j]=d.useState(u||``),M=e=>{let t=e.target.value;j(t),f?.(t)},N=e=>{e.key===`Enter`&&m?.(A)},P=v&&v.length>0||T;return(0,g.jsxs)(`header`,{className:t.t(`w-full bg-background border-b`,k&&`sticky top-0 z-50`,E),children:[(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-4 px-4 py-2 min-h-[56px]`,D),children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[h&&(0,g.jsxs)(i.n,{variant:h.variant||`default`,size:`sm`,onClick:h.onClick,className:`gap-2`,children:[h.icon||(0,g.jsx)(p.Plus,{className:`h-4 w-4`}),h.label]}),c&&(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{type:`search`,placeholder:l,value:A,onChange:M,onKeyDown:N,className:`pl-9 w-[200px] h-9 bg-muted/50`})]}),C]}),(e||o)&&(0,g.jsxs)(`div`,{className:`flex-1 text-center`,children:[e&&(0,g.jsx)(`h1`,{className:`text-lg font-semibold leading-none`,children:e}),o&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:o})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0 ml-auto`,children:[_?.map(e=>(0,g.jsxs)(i.n,{variant:e.variant||`ghost`,size:`sm`,onClick:e.onClick,className:`gap-2`,children:[e.icon,e.label]},e.id)),w,(y||x)&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`ghost`,size:`icon`,className:`relative`,onClick:y?void 0:x,children:[(0,g.jsx)(p.Bell,{className:`h-5 w-5`}),b>0&&(0,g.jsx)(r.t,{variant:`destructive`,className:`absolute -top-1 -right-1 h-5 w-5 p-0 flex items-center justify-center text-xs`,children:b>9?`9+`:b})]})}),y&&y.length>0&&(0,g.jsxs)(nn,{align:`end`,className:`w-80`,children:[(0,g.jsx)(`div`,{className:`p-2 font-semibold border-b`,children:`Notifications`}),y.slice(0,5).map(e=>(0,g.jsxs)($,{onClick:e.onClick,className:t.t(`flex flex-col items-start gap-1 p-3`,!e.read&&`bg-muted/50`),children:[(0,g.jsx)(`div`,{className:`font-medium`,children:e.title}),e.description&&(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.description}),e.time&&(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.time})]},e.id))]})]}),S&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`ghost`,size:`sm`,className:`gap-2`,children:[(0,g.jsxs)(n.m,{className:`h-7 w-7`,children:[S.avatar&&(0,g.jsx)(n.g,{src:S.avatar,alt:S.name}),(0,g.jsx)(n.h,{className:`text-xs`,children:S.initials||S.name.slice(0,2).toUpperCase()})]}),(0,g.jsx)(p.ChevronDown,{className:`h-4 w-4`})]})}),(0,g.jsxs)(nn,{align:`end`,className:`w-56`,children:[(0,g.jsxs)(`div`,{className:`p-2`,children:[(0,g.jsx)(`p`,{className:`font-medium`,children:S.name}),S.email&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.email})]}),(0,g.jsx)(sn,{}),S.items.map((e,t)=>e.separator?(0,g.jsx)(sn,{},t):(0,g.jsxs)($,{onClick:e.onClick,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]},t))]})]})]})]}),P&&(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-2 px-4 py-2 border-t bg-muted/30`,O),children:[v?.map(e=>(0,g.jsxs)(a.d,{value:e.value,onValueChange:e.onChange,children:[(0,g.jsxs)(a.y,{className:`w-auto h-8 gap-2 bg-muted/50 border-0`,children:[e.icon,(0,g.jsx)(a.b,{placeholder:e.placeholder||e.label})]}),(0,g.jsx)(a.f,{children:e.options.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]},e.id)),T]})]})}var RP=d.createContext({});function zP(){return d.useContext(RP)}function BP({title:e=`Tableau de bord`,description:n,period:r,onPeriodChange:a,periods:o=[{value:`today`,label:`Aujourd'hui`},{value:`week`,label:`Cette semaine`},{value:`month`,label:`Ce mois`},{value:`year`,label:`Cette année`}],onRefresh:s,loading:c,quickActions:l}){return(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),n&&(0,g.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:n})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[a&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,children:[(0,g.jsx)(p.Calendar,{className:`mr-2 h-4 w-4`}),o.find(e=>e.value===r)?.label||`Période`]})}),(0,g.jsx)(nn,{align:`end`,children:o.map(e=>(0,g.jsx)($,{onClick:()=>a(e.value),className:t.t(r===e.value&&`bg-muted`),children:e.label},e.value))})]}),s&&(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:s,disabled:c,children:(0,g.jsx)(p.RefreshCw,{className:t.t(`h-4 w-4`,c&&`animate-spin`)})}),l?.map(e=>{let{LinkComponent:t}=zP();return(0,g.jsx)(i.n,{variant:e.variant||`default`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?t?(0,g.jsxs)(t,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(g.Fragment,{children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},e.id)})]})]})}function VP({stats:e,layout:t=`grid`,columns:n=4,loading:r}){return(0,g.jsx)(Io,{layout:t,columns:n,gap:`md`,children:e.map(e=>(0,g.jsx)(Fo,{label:e.label,value:e.value,trend:e.trend,trendValue:e.trendValue,trendText:e.trendText,icon:e.icon,color:e.color,variant:`card`,loading:r},e.id))})}function HP({config:e}){return(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,g.jsx)(be,{children:e.description})]}),e.actions&&e.actions.length>0&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsx)(nn,{align:`end`,children:e.actions.map((e,t)=>(0,g.jsx)($,{onClick:e.onClick,children:e.label},t))})]})]}),(0,g.jsx)(Q,{children:e.chart})]})}function UP({config:e}){let{LinkComponent:t}=zP();return(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,g.jsx)(be,{children:e.description})]}),e.actions&&e.actions.length>0&&(0,g.jsx)(`div`,{className:`flex gap-2`,children:e.actions.map((e,n)=>(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?t?(0,g.jsxs)(t,{href:e.href,children:[e.label,(0,g.jsx)(p.ArrowUpRight,{className:`ml-1 h-3 w-3`})]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.label,(0,g.jsx)(p.ArrowUpRight,{className:`ml-1 h-3 w-3`})]}):e.label},n))})]}),(0,g.jsx)(Q,{children:e.table})]})}function WP({activities:e}){let n=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24);return r<1?`À l'instant`:r<60?`Il y a ${r} min`:i<24?`Il y a ${i}h`:a<7?`Il y a ${a}j`:t.toLocaleDateString(`fr-FR`)},r={info:`bg-blue-500`,success:`bg-green-500`,warning:`bg-yellow-500`,error:`bg-red-500`};return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsx)(Z,{className:`text-base`,children:`Activité récente`})}),(0,g.jsx)(Q,{children:(0,g.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full mt-2 flex-shrink-0`,r[e.type||`info`])}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),e.description&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0`,children:n(e.timestamp)})]},e.id))})})]})}function GP({title:e=`Tableau de bord`,description:n,stats:r,charts:i,tables:a,activities:o,quickActions:s,showHeader:c=!0,onRefresh:l,loading:u=!1,period:f=`month`,onPeriodChange:p,periods:m,statsLayout:h=`grid`,statsColumns:_=4,className:v,LinkComponent:y}){let b=d.useMemo(()=>({LinkComponent:y}),[y]);return(0,g.jsx)(RP.Provider,{value:b,children:(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,v),children:[c&&(0,g.jsx)(BP,{title:e,description:n,period:f,onPeriodChange:p,periods:m,onRefresh:l,loading:u,quickActions:s}),r&&r.length>0&&(0,g.jsx)(VP,{stats:r,layout:h,columns:_,loading:u}),i&&i.length>0&&(0,g.jsx)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:i.map(e=>(0,g.jsx)(HP,{config:e},e.id))}),(0,g.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3`,children:[a&&a.length>0&&(0,g.jsx)(`div`,{className:t.t(`space-y-6`,o?`lg:col-span-2`:`lg:col-span-3`),children:a.map(e=>(0,g.jsx)(UP,{config:e},e.id))}),o&&o.length>0&&(0,g.jsx)(`div`,{className:t.t(!a||a.length===0?`lg:col-span-3`:``),children:(0,g.jsx)(WP,{activities:o})})]})]})})}var KP=[{id:`revenue`,label:`Revenus`,value:`€45,231.89`,trend:`up`,trendValue:`+20.1%`,trendText:`vs mois dernier`,icon:(0,g.jsx)(p.DollarSign,{className:`h-5 w-5`}),color:`success`},{id:`users`,label:`Utilisateurs`,value:`2,350`,trend:`up`,trendValue:`+180`,trendText:`cette semaine`,icon:(0,g.jsx)(p.Users,{className:`h-5 w-5`}),color:`blue`},{id:`orders`,label:`Commandes`,value:`12,234`,trend:`down`,trendValue:`-4.3%`,trendText:`vs mois dernier`,icon:(0,g.jsx)(p.ShoppingCart,{className:`h-5 w-5`}),color:`purple`},{id:`performance`,label:`Performance`,value:`94.2%`,trend:`up`,trendValue:`+2.4%`,icon:(0,g.jsx)(p.Activity,{className:`h-5 w-5`}),color:`primary`}];function qP({field:e,value:t,onChange:n}){let r=e=>{n?.(e)};return e.type===`custom`&&e.customComponent?(0,g.jsx)(`div`,{className:`space-y-2`,children:e.customComponent}):(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(o.n,{htmlFor:e.id,className:`text-sm font-medium`,children:[e.label,e.required&&(0,g.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),e.type===`switch`&&(0,g.jsx)(ur,{id:e.id,checked:t,onCheckedChange:r,disabled:e.disabled})]}),e.description&&e.type!==`switch`&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),e.type===`switch`&&e.description&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),e.type===`text`&&(0,g.jsx)(s.t,{id:e.id,type:`text`,value:t||``,onChange:e=>r(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`email`&&(0,g.jsx)(s.t,{id:e.id,type:`email`,value:t||``,onChange:e=>r(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`password`&&(0,g.jsx)(s.t,{id:e.id,type:`password`,value:t||``,onChange:e=>r(e.target.value),placeholder:e.placeholder,disabled:e.disabled}),e.type===`textarea`&&(0,g.jsx)(o.t,{id:e.id,value:t||``,onChange:e=>r(e.target.value),placeholder:e.placeholder,disabled:e.disabled,rows:3}),e.type===`select`&&e.options&&(0,g.jsxs)(a.d,{value:t,onValueChange:r,disabled:e.disabled,children:[(0,g.jsx)(a.y,{id:e.id,children:(0,g.jsx)(a.b,{placeholder:e.placeholder||`Sélectionner...`})}),(0,g.jsx)(a.f,{children:e.options.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]})]})}function JP({section:e,values:t,onChange:n}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,g.jsx)(be,{children:e.description})]})]})}),(0,g.jsx)(Q,{className:`space-y-6`,children:e.fields.map((r,a)=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsx)(qP,{field:r,value:t?.[r.id],onChange:e=>n?.(r.id,e)}),a<e.fields.length-1&&(0,g.jsx)(i.t,{className:`my-4`})]},r.id))})]})}function YP({title:e=`Paramètres`,description:n=`Gérez les paramètres de votre compte et de l'application.`,tabs:r,sections:a,useTabs:o=!0,defaultTab:s,values:c={},onChange:l,onSave:u,saving:f=!1,showSaveButton:m=!0,showDeleteAccount:h=!1,onDeleteAccount:_,className:v}){let[y,b]=d.useState(c),[x,S]=d.useState(!1);d.useEffect(()=>{b(c)},[c]);let C=(e,t)=>{b(n=>({...n,[e]:t})),S(!0),l?.(e,t)},w=async()=>{await u?.(y),S(!1)},T=e=>(0,g.jsx)(`div`,{className:`space-y-6`,children:e.map(e=>(0,g.jsx)(JP,{section:e,values:y,onChange:C},e.id))});return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,v),children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),n&&(0,g.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:n})]}),m&&u&&(0,g.jsxs)(i.n,{onClick:w,disabled:f||!x,children:[f?(0,g.jsx)(p.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}):(0,g.jsx)(p.Save,{className:`mr-2 h-4 w-4`}),`Enregistrer`]})]}),o&&r&&r.length>0?(0,g.jsxs)(yr,{defaultValue:s||r[0].id,className:`space-y-6`,children:[(0,g.jsx)(br,{className:`grid w-full grid-cols-2 md:w-auto md:inline-flex`,children:r.map(e=>(0,g.jsxs)(xr,{value:e.id,className:`gap-2`,children:[e.icon,e.label]},e.id))}),r.map(e=>(0,g.jsx)(Sr,{value:e.id,className:`space-y-6`,children:T(e.sections)},e.id))]}):a&&T(a),h&&_&&(0,g.jsxs)(Y,{className:`border-destructive`,children:[(0,g.jsxs)(X,{children:[(0,g.jsxs)(Z,{className:`text-base text-destructive flex items-center gap-2`,children:[(0,g.jsx)(p.Trash2,{className:`h-4 w-4`}),`Zone dangereuse`]}),(0,g.jsx)(be,{children:`Actions irréversibles concernant votre compte.`})]}),(0,g.jsx)(Q,{children:(0,g.jsxs)(re,{children:[(0,g.jsx)(ie,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer mon compte`]})}),(0,g.jsxs)(se,{children:[(0,g.jsxs)(ce,{children:[(0,g.jsx)(ue,{children:`Êtes-vous sûr ?`}),(0,g.jsx)(de,{children:`Cette action est irréversible. Toutes vos données seront définitivement supprimées et ne pourront pas être récupérées.`})]}),(0,g.jsxs)(le,{children:[(0,g.jsx)(pe,{children:`Annuler`}),(0,g.jsx)(fe,{onClick:_,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer définitivement`})]})]})]})})]})]})}var XP=[{id:`profile`,label:`Profil`,icon:(0,g.jsx)(p.User,{className:`h-4 w-4`}),sections:[{id:`personal`,title:`Informations personnelles`,description:`Mettez à jour vos informations personnelles.`,icon:(0,g.jsx)(p.User,{className:`h-5 w-5`}),fields:[{id:`name`,label:`Nom complet`,type:`text`,placeholder:`Jean Dupont`,required:!0},{id:`email`,label:`Adresse email`,type:`email`,placeholder:`jean@exemple.com`,required:!0},{id:`bio`,label:`Bio`,type:`textarea`,placeholder:`Parlez-nous de vous...`}]}]},{id:`notifications`,label:`Notifications`,icon:(0,g.jsx)(p.Bell,{className:`h-4 w-4`}),sections:[{id:`email-notifs`,title:`Notifications par email`,description:`Gérez vos préférences de notification par email.`,icon:(0,g.jsx)(p.Mail,{className:`h-5 w-5`}),fields:[{id:`notif-marketing`,label:`Marketing`,description:`Recevoir des emails marketing et promotionnels.`,type:`switch`},{id:`notif-security`,label:`Sécurité`,description:`Recevoir des alertes de sécurité importantes.`,type:`switch`},{id:`notif-updates`,label:`Mises à jour`,description:`Recevoir les mises à jour de produit.`,type:`switch`}]}]},{id:`security`,label:`Sécurité`,icon:(0,g.jsx)(p.Shield,{className:`h-4 w-4`}),sections:[{id:`password`,title:`Mot de passe`,description:`Changez votre mot de passe.`,icon:(0,g.jsx)(p.Lock,{className:`h-5 w-5`}),fields:[{id:`current-password`,label:`Mot de passe actuel`,type:`password`,placeholder:`••••••••`},{id:`new-password`,label:`Nouveau mot de passe`,type:`password`,placeholder:`••••••••`},{id:`confirm-password`,label:`Confirmer le mot de passe`,type:`password`,placeholder:`••••••••`}]},{id:`two-factor`,title:`Authentification à deux facteurs`,description:`Ajoutez une couche de sécurité supplémentaire.`,icon:(0,g.jsx)(p.Smartphone,{className:`h-5 w-5`}),fields:[{id:`2fa-enabled`,label:`Activer la 2FA`,description:`Utilisez une application d'authentification.`,type:`switch`}]}]},{id:`preferences`,label:`Préférences`,icon:(0,g.jsx)(p.Palette,{className:`h-4 w-4`}),sections:[{id:`appearance`,title:`Apparence`,description:`Personnalisez l'apparence de l'application.`,icon:(0,g.jsx)(p.Palette,{className:`h-5 w-5`}),fields:[{id:`theme`,label:`Thème`,type:`select`,options:[{value:`light`,label:`Clair`},{value:`dark`,label:`Sombre`},{value:`system`,label:`Système`}]},{id:`language`,label:`Langue`,type:`select`,options:[{value:`fr`,label:`Français`},{value:`en`,label:`English`},{value:`es`,label:`Español`}]}]}]}];function ZP({url:e,name:r,size:a=`lg`,editable:o,onAvatarChange:s}){let c=d.useRef(null),l={sm:`h-12 w-12`,md:`h-16 w-16`,lg:`h-24 w-24`,xl:`h-32 w-32`},u=r.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,g.jsxs)(`div`,{className:`relative inline-block`,children:[(0,g.jsxs)(n.m,{className:t.t(l[a],`border-4 border-background shadow-lg`),children:[(0,g.jsx)(n.g,{src:e,alt:r}),(0,g.jsx)(n.h,{className:`text-lg font-medium`,children:u})]}),o&&s&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`input`,{ref:c,type:`file`,accept:`image/*`,onChange:e=>{let t=e.target.files?.[0];t&&s&&s(t)},className:`hidden`}),(0,g.jsx)(i.n,{size:`icon`,variant:`secondary`,className:`absolute bottom-0 right-0 h-8 w-8 rounded-full shadow-md`,onClick:()=>c.current?.click(),children:(0,g.jsx)(p.Camera,{className:`h-4 w-4`})})]})]})}function QP({field:e,value:n,onChange:r,isEditing:i}){if(!i)return(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,g.jsx)(`span`,{className:t.t(!n&&`text-muted-foreground italic`),children:n||`Non renseigné`})]});let c={id:e.id,value:n||``,onChange:e=>r(e.target.value),placeholder:e.placeholder,disabled:e.disabled};return e.type===`textarea`?(0,g.jsx)(o.t,{...c,rows:3}):e.type===`select`&&e.options?(0,g.jsxs)(a.d,{value:n,onValueChange:r,disabled:e.disabled,children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{placeholder:e.placeholder||`Sélectionner...`})}),(0,g.jsx)(a.f,{children:e.options.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]}):(0,g.jsx)(s.t,{type:e.type||`text`,...c})}function $P({section:e,values:t,onChange:n,isEditing:r}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{className:`text-base`,children:e.title}),e.description&&(0,g.jsx)(be,{children:e.description})]})]})}),(0,g.jsx)(Q,{className:`space-y-4`,children:e.fields.map((a,s)=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(o.n,{htmlFor:a.id,className:`text-sm font-medium`,children:[a.label,a.required&&(0,g.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,g.jsx)(QP,{field:a,value:t[a.id]||``,onChange:e=>n(a.id,e),isEditing:r})]}),s<e.fields.length-1&&r&&(0,g.jsx)(i.t,{className:`my-4`})]},a.id))})]})}function eF({links:e,isEditing:t}){let n=e=>{switch(e){case`twitter`:return(0,g.jsx)(p.Share2,{className:`h-4 w-4`});case`github`:return(0,g.jsx)(p.Globe,{className:`h-4 w-4`});case`linkedin`:return(0,g.jsx)(p.ExternalLink,{className:`h-4 w-4`});case`website`:return(0,g.jsx)(p.Globe,{className:`h-4 w-4`});default:return(0,g.jsx)(p.Link,{className:`h-4 w-4`})}};return t?(0,g.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n(e.type),(0,g.jsx)(s.t,{value:e.url,className:`flex-1`,readOnly:!0})]},e.id))}):(0,g.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:e.map(e=>(0,g.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted rounded-full text-sm hover:bg-muted/80 transition-colors`,children:[n(e.type),(0,g.jsx)(`span`,{children:e.label||e.type})]},e.id))})}function tF({profile:e,editable:n=!1,isEditing:r,onEditToggle:a,onChange:o,onSave:s,saving:c=!1,onAvatarChange:l,customSections:u,showSocialLinks:f=!0,showStats:m=!1,stats:h,layout:_=`card`,useTabs:v=!1,className:y}){let[b,x]=d.useState(!1),[S,C]=d.useState(e),w=r??b;d.useEffect(()=>{C(e)},[e]);let T=t=>{a?a(t):x(t),t||C(e)},E=(e,t)=>{C(n=>({...n,[e]:t})),o?.(e,t)},D=async()=>{await s?.(S),T(!1)},O=[{id:`personal`,title:`Informations personnelles`,icon:(0,g.jsx)(p.User,{className:`h-5 w-5`}),fields:[{id:`firstName`,label:`Prénom`,value:S.firstName||``,type:`text`,placeholder:`Jean`,icon:(0,g.jsx)(p.User,{className:`h-4 w-4`})},{id:`lastName`,label:`Nom`,value:S.lastName||``,type:`text`,placeholder:`Dupont`},{id:`email`,label:`Email`,value:S.email,type:`email`,placeholder:`jean@exemple.com`,required:!0,icon:(0,g.jsx)(p.Mail,{className:`h-4 w-4`})},{id:`phone`,label:`Téléphone`,value:S.phone||``,type:`tel`,placeholder:`+33 6 12 34 56 78`,icon:(0,g.jsx)(p.Phone,{className:`h-4 w-4`})},{id:`bio`,label:`Bio`,value:S.bio||``,type:`textarea`,placeholder:`Parlez-nous de vous...`}]},{id:`professional`,title:`Informations professionnelles`,icon:(0,g.jsx)(p.Briefcase,{className:`h-5 w-5`}),fields:[{id:`role`,label:`Poste`,value:S.role||``,type:`text`,placeholder:`Développeur Senior`,icon:(0,g.jsx)(p.Briefcase,{className:`h-4 w-4`})},{id:`department`,label:`Département`,value:S.department||``,type:`text`,placeholder:`Engineering`},{id:`company`,label:`Entreprise`,value:S.company||``,type:`text`,placeholder:`Acme Inc.`,icon:(0,g.jsx)(p.Building,{className:`h-4 w-4`})},{id:`location`,label:`Localisation`,value:S.location||``,type:`text`,placeholder:`Paris, France`,icon:(0,g.jsx)(p.MapPin,{className:`h-4 w-4`})},{id:`website`,label:`Site web`,value:S.website||``,type:`url`,placeholder:`https://exemple.com`,icon:(0,g.jsx)(p.Globe,{className:`h-4 w-4`})}]}],k=u||O,A={firstName:S.firstName||``,lastName:S.lastName||``,email:S.email,phone:S.phone||``,bio:S.bio||``,role:S.role||``,department:S.department||``,company:S.company||``,location:S.location||``,website:S.website||``,...S.customFields};if(_===`compact`)return(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-4`,y),children:[(0,g.jsx)(ZP,{url:S.avatarUrl,name:S.displayName,size:`md`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`font-semibold`,children:S.displayName}),S.role&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.role}),S.email&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.email})]})]});let j=()=>(0,g.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 md:flex-row md:text-left`,children:[(0,g.jsx)(ZP,{url:S.avatarUrl,name:S.displayName,size:`xl`,editable:n&&w,onAvatarChange:l}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-start md:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-bold`,children:S.displayName}),S.role&&(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:S.role}),S.company&&(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,g.jsx)(p.Building,{className:`h-3 w-3`}),S.company]}),S.location&&(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,g.jsx)(p.MapPin,{className:`h-3 w-3`}),S.location]})]}),n&&(0,g.jsx)(`div`,{className:`flex gap-2`,children:w?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>T(!1),disabled:c,children:[(0,g.jsx)(p.X,{className:`mr-2 h-4 w-4`}),`Annuler`]}),(0,g.jsxs)(i.n,{size:`sm`,onClick:D,disabled:c,children:[c?(0,g.jsx)(p.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}):(0,g.jsx)(p.Save,{className:`mr-2 h-4 w-4`}),`Enregistrer`]})]}):(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>T(!0),children:[(0,g.jsx)(p.Edit3,{className:`mr-2 h-4 w-4`}),`Modifier`]})})]}),m&&h&&h.length>0&&(0,g.jsx)(`div`,{className:`flex gap-6 mt-4`,children:h.map((e,t)=>(0,g.jsxs)(`div`,{className:`text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:e.value}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.label})]},t))}),f&&S.socialLinks&&S.socialLinks.length>0&&(0,g.jsx)(`div`,{className:`mt-4`,children:(0,g.jsx)(eF,{links:S.socialLinks,isEditing:w})}),S.joinedAt&&(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-4 flex items-center gap-1`,children:[(0,g.jsx)(p.Calendar,{className:`h-3 w-3`}),`Membre depuis`,` `,new Date(S.joinedAt).toLocaleDateString(`fr-FR`,{month:`long`,year:`numeric`})]})]})]}),M=()=>(0,g.jsx)(`div`,{className:`space-y-6`,children:k.map(e=>(0,g.jsx)($P,{section:e,values:A,onChange:E,isEditing:w},e.id))});return _===`card`?(0,g.jsx)(Y,{className:y,children:(0,g.jsx)(Q,{className:`pt-6`,children:(0,g.jsxs)(`div`,{className:`space-y-6`,children:[j(),(0,g.jsx)(i.t,{}),M()]})})}):(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,y),children:[j(),v?(0,g.jsxs)(yr,{defaultValue:k[0]?.id,className:`space-y-6`,children:[(0,g.jsx)(br,{children:k.map(e=>(0,g.jsxs)(xr,{value:e.id,className:`gap-2`,children:[e.icon,e.title]},e.id))}),k.map(e=>(0,g.jsx)(Sr,{value:e.id,children:(0,g.jsx)($P,{section:e,values:A,onChange:E,isEditing:w})},e.id))]}):M()]})}var nF={displayName:`Jean Dupont`,firstName:`Jean`,lastName:`Dupont`,email:`jean.dupont@exemple.com`,phone:`+33 6 12 34 56 78`,bio:`Développeur passionné avec plus de 10 ans d'expérience dans le développement web et mobile.`,avatarUrl:``,role:`Lead Developer`,department:`Engineering`,company:`Acme Inc.`,location:`Paris, France`,website:`https://jeandupont.dev`,joinedAt:new Date(`2023-01-15`),socialLinks:[{id:`1`,type:`twitter`,url:`https://twitter.com/jeandupont`,label:`@jeandupont`},{id:`2`,type:`github`,url:`https://github.com/jeandupont`,label:`jeandupont`},{id:`3`,type:`linkedin`,url:`https://linkedin.com/in/jeandupont`,label:`Jean Dupont`}]},rF=[{value:`admin`,label:`Administrateur`,color:`destructive`},{value:`moderator`,label:`Modérateur`,color:`warning`},{value:`user`,label:`Utilisateur`,color:`default`},{value:`guest`,label:`Invité`,color:`secondary`}],iF={active:{label:`Actif`,color:`bg-green-500`,icon:p.CheckCircle},inactive:{label:`Inactif`,color:`bg-gray-500`,icon:p.XCircle},pending:{label:`En attente`,color:`bg-yellow-500`,icon:p.Mail},banned:{label:`Banni`,color:`bg-red-500`,icon:p.Ban}};function aF({user:e,size:t=`sm`}){let r={sm:`h-8 w-8`,md:`h-10 w-10`},i=e.displayName.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,g.jsxs)(n.m,{className:r[t],children:[(0,g.jsx)(n.g,{src:e.avatarUrl,alt:e.displayName}),(0,g.jsx)(n.h,{className:`text-xs`,children:i})]})}function oF({role:e,roles:t=rF}){let n=t.find(t=>t.value===e),i=e===`admin`?p.ShieldAlert:e===`moderator`?p.ShieldCheck:p.Shield;return(0,g.jsxs)(r.t,{variant:n?.color,children:[(0,g.jsx)(i,{className:`h-3 w-3 mr-1`}),n?.label||e]})}function sF({status:e}){let n=iF[e];return(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,n.color)}),(0,g.jsx)(`span`,{className:`text-sm`,children:n.label})]})}function cF({open:e,onOpenChange:t,user:n,roles:r,permissions:c,onSubmit:l,loading:u}){let[f,m]=d.useState({email:``,displayName:``,firstName:``,lastName:``,role:`user`,status:`pending`,permissions:[]});d.useEffect(()=>{m(n?{email:n.email,displayName:n.displayName,firstName:n.firstName||``,lastName:n.lastName||``,role:n.role,status:n.status,permissions:n.permissions||[]}:{email:``,displayName:``,firstName:``,lastName:``,role:`user`,status:`pending`,permissions:[]})},[n,e]);let h=async e=>{e.preventDefault(),await l(f),t(!1)},_=e=>{m(t=>({...t,permissions:t.permissions?.includes(e)?t.permissions.filter(t=>t!==e):[...t.permissions||[],e]}))};return(0,g.jsx)(mt,{open:e,onOpenChange:t,children:(0,g.jsx)(yt,{className:`sm:max-w-[500px]`,children:(0,g.jsxs)(`form`,{onSubmit:h,children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:n?`Modifier l'utilisateur`:`Créer un utilisateur`}),(0,g.jsx)(Ct,{children:n?`Modifiez les informations de l'utilisateur.`:`Remplissez les informations pour créer un nouvel utilisateur.`})]}),(0,g.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`firstName`,children:`Prénom`}),(0,g.jsx)(s.t,{id:`firstName`,value:f.firstName,onChange:e=>m(t=>({...t,firstName:e.target.value})),placeholder:`Jean`})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`lastName`,children:`Nom`}),(0,g.jsx)(s.t,{id:`lastName`,value:f.lastName,onChange:e=>m(t=>({...t,lastName:e.target.value})),placeholder:`Dupont`})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`displayName`,children:`Nom d'affichage *`}),(0,g.jsx)(s.t,{id:`displayName`,value:f.displayName,onChange:e=>m(t=>({...t,displayName:e.target.value})),placeholder:`Jean Dupont`,required:!0})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`email`,children:`Email *`}),(0,g.jsx)(s.t,{id:`email`,type:`email`,value:f.email,onChange:e=>m(t=>({...t,email:e.target.value})),placeholder:`jean@exemple.com`,required:!0})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`role`,children:`Rôle`}),(0,g.jsxs)(a.d,{value:f.role,onValueChange:e=>m(t=>({...t,role:e})),children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{})}),(0,g.jsx)(a.f,{children:r.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`status`,children:`Statut`}),(0,g.jsxs)(a.d,{value:f.status,onValueChange:e=>m(t=>({...t,status:e})),children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{})}),(0,g.jsx)(a.f,{children:Object.entries(iF).map(([e,t])=>(0,g.jsx)(a.m,{value:e,children:t.label},e))})]})]})]}),c&&c.length>0&&(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Permissions`}),(0,g.jsx)(`div`,{className:`border rounded-md p-3 space-y-2 max-h-[150px] overflow-y-auto`,children:c.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,g.jsx)(Se,{id:e.id,checked:f.permissions?.includes(e.id),onCheckedChange:()=>_(e.id)}),(0,g.jsx)(`label`,{htmlFor:e.id,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:e.name})]},e.id))})]})]}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Annuler`}),(0,g.jsxs)(i.n,{type:`submit`,disabled:u,children:[u&&(0,g.jsx)(p.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),n?`Enregistrer`:`Créer`]})]})]})})})}function lF({user:e,onEdit:t,onDelete:n,onResetPassword:r,onStatusChange:a,onRoleChange:o,roles:s}){return(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[t&&(0,g.jsxs)($,{onClick:t,children:[(0,g.jsx)(p.Edit,{className:`mr-2 h-4 w-4`}),`Modifier`]}),r&&(0,g.jsxs)($,{onClick:r,children:[(0,g.jsx)(p.Key,{className:`mr-2 h-4 w-4`}),`Réinitialiser le mot de passe`]}),o&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sn,{}),(0,g.jsx)(on,{children:`Changer le rôle`}),s.map(t=>(0,g.jsx)($,{onClick:()=>o(t.value),disabled:e.role===t.value,children:t.label},t.value))]}),a&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sn,{}),(0,g.jsx)(on,{children:`Changer le statut`}),Object.entries(iF).map(([t,n])=>(0,g.jsx)($,{onClick:()=>a(t),disabled:e.status===t,children:n.label},t))]}),n&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:n,className:`text-destructive focus:text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})}function uF({users:e,roles:n=rF,permissions:r,selectedUsers:o=[],onSelectionChange:c,onCreate:l,onEdit:u,onDelete:f,onBulkDelete:m,onRoleChange:h,onStatusChange:_,onResetPassword:v,onExport:y,onRefresh:b,loading:x=!1,actionLoading:S=!1,searchQuery:C=``,onSearchChange:w,roleFilter:T=`all`,onRoleFilterChange:E,statusFilter:D=`all`,onStatusFilterChange:O,showBulkActions:k=!0,showCreateButton:A=!0,title:j=`Gestion des utilisateurs`,description:M=`Gérez les utilisateurs, leurs rôles et permissions.`,className:N}){let[P,F]=d.useState(!1),[I,L]=d.useState(null),[R,z]=d.useState(null),[B,V]=d.useState(!1),H=d.useMemo(()=>e.filter(e=>{if(C){let t=C.toLowerCase();if(!(e.displayName.toLowerCase().includes(t)||e.email.toLowerCase().includes(t)))return!1}return!(T!==`all`&&e.role!==T||D!==`all`&&e.status!==D)}),[e,C,T,D]),U=e=>{e?c?.(H.map(e=>e.id)):c?.([])},W=(e,t)=>{t?c?.([...o,e]):c?.(o.filter(t=>t!==e))},G=async e=>{await l?.(e)},K=async e=>{I&&(await u?.(I.id,e),L(null))},q=async()=>{R&&(await f?.(R.id),z(null))},ee=async()=>{await m?.(o),c?.([]),V(!1)},J=e=>(typeof e==`string`?new Date(e):e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`,year:`numeric`});return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,N),children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h1`,{className:`text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,g.jsx)(p.Users,{className:`h-6 w-6`}),j]}),M&&(0,g.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:M})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b&&(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:b,disabled:x,children:(0,g.jsx)(p.RefreshCw,{className:t.t(`h-4 w-4`,x&&`animate-spin`)})}),y&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:y,children:[(0,g.jsx)(p.Download,{className:`mr-2 h-4 w-4`}),`Exporter`]}),A&&l&&(0,g.jsxs)(i.n,{size:`sm`,onClick:()=>F(!0),children:[(0,g.jsx)(p.UserPlus,{className:`mr-2 h-4 w-4`}),`Ajouter`]})]})]}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`pt-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center`,children:[w&&(0,g.jsxs)(`div`,{className:`relative flex-1`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher un utilisateur...`,value:C,onChange:e=>w(e.target.value),className:`pl-9`})]}),E&&(0,g.jsxs)(a.d,{value:T,onValueChange:e=>E(e),children:[(0,g.jsxs)(a.y,{className:`w-[180px]`,children:[(0,g.jsx)(p.Filter,{className:`mr-2 h-4 w-4`}),(0,g.jsx)(a.b,{placeholder:`Rôle`})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`Tous les rôles`}),n.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))]})]}),O&&(0,g.jsxs)(a.d,{value:D,onValueChange:e=>O(e),children:[(0,g.jsxs)(a.y,{className:`w-[180px]`,children:[(0,g.jsx)(p.Filter,{className:`mr-2 h-4 w-4`}),(0,g.jsx)(a.b,{placeholder:`Statut`})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`Tous les statuts`}),Object.entries(iF).map(([e,t])=>(0,g.jsx)(a.m,{value:e,children:t.label},e))]})]})]}),k&&o.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-4 mt-4 p-3 bg-muted rounded-lg`,children:[(0,g.jsxs)(`span`,{className:`text-sm font-medium`,children:[o.length,` utilisateur(s) sélectionné(s)`]}),m&&(0,g.jsxs)(i.n,{variant:`destructive`,size:`sm`,onClick:()=>V(!0),children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]}),(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:()=>c?.([]),children:`Désélectionner`})]})]})}),(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`p-0`,children:(0,g.jsxs)(dr,{children:[(0,g.jsx)(fr,{children:(0,g.jsxs)(hr,{children:[c&&(0,g.jsx)(gr,{className:`w-[50px]`,children:(0,g.jsx)(Se,{checked:H.length>0&&o.length===H.length,onCheckedChange:U})}),(0,g.jsx)(gr,{children:`Utilisateur`}),(0,g.jsx)(gr,{children:`Rôle`}),(0,g.jsx)(gr,{children:`Statut`}),(0,g.jsx)(gr,{children:`Inscrit le`}),(0,g.jsx)(gr,{children:`Dernière connexion`}),(0,g.jsx)(gr,{className:`w-[50px]`})]})}),(0,g.jsx)(pr,{children:x?(0,g.jsx)(hr,{children:(0,g.jsx)(_r,{colSpan:c?7:6,className:`text-center py-8`,children:(0,g.jsx)(p.Loader2,{className:`h-6 w-6 animate-spin mx-auto`})})}):H.length===0?(0,g.jsx)(hr,{children:(0,g.jsx)(_r,{colSpan:c?7:6,className:`text-center py-8 text-muted-foreground`,children:`Aucun utilisateur trouvé`})}):H.map(e=>(0,g.jsxs)(hr,{children:[c&&(0,g.jsx)(_r,{children:(0,g.jsx)(Se,{checked:o.includes(e.id),onCheckedChange:t=>W(e.id,t)})}),(0,g.jsx)(_r,{children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(aF,{user:e}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`font-medium`,children:e.displayName}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.email})]})]})}),(0,g.jsx)(_r,{children:(0,g.jsx)(oF,{role:e.role,roles:n})}),(0,g.jsx)(_r,{children:(0,g.jsx)(sF,{status:e.status})}),(0,g.jsx)(_r,{className:`text-muted-foreground`,children:J(e.createdAt)}),(0,g.jsx)(_r,{className:`text-muted-foreground`,children:e.lastLogin?J(e.lastLogin):`-`}),(0,g.jsx)(_r,{children:(0,g.jsx)(lF,{user:e,roles:n,onEdit:u?()=>L(e):void 0,onDelete:f?()=>z(e):void 0,onResetPassword:v?()=>v(e.id):void 0,onRoleChange:h?t=>h(e.id,t):void 0,onStatusChange:_?t=>_(e.id,t):void 0})})]},e.id))})]})})}),(0,g.jsx)(cF,{open:P,onOpenChange:F,roles:n,permissions:r,onSubmit:G,loading:S}),(0,g.jsx)(cF,{open:!!I,onOpenChange:e=>!e&&L(null),user:I||void 0,roles:n,permissions:r,onSubmit:K,loading:S}),(0,g.jsx)(re,{open:!!R,onOpenChange:e=>!e&&z(null),children:(0,g.jsxs)(se,{children:[(0,g.jsxs)(ce,{children:[(0,g.jsx)(ue,{children:`Supprimer l'utilisateur ?`}),(0,g.jsxs)(de,{children:[`Êtes-vous sûr de vouloir supprimer `,R?.displayName,` ? Cette action est irréversible.`]})]}),(0,g.jsxs)(le,{children:[(0,g.jsx)(pe,{children:`Annuler`}),(0,g.jsx)(fe,{onClick:q,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer`})]})]})}),(0,g.jsx)(re,{open:B,onOpenChange:V,children:(0,g.jsxs)(se,{children:[(0,g.jsxs)(ce,{children:[(0,g.jsx)(ue,{children:`Supprimer les utilisateurs ?`}),(0,g.jsxs)(de,{children:[`Êtes-vous sûr de vouloir supprimer `,o.length,` utilisateur(s) ? Cette action est irréversible.`]})]}),(0,g.jsxs)(le,{children:[(0,g.jsx)(pe,{children:`Annuler`}),(0,g.jsx)(fe,{onClick:ee,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`Supprimer`})]})]})})]})}var dF=[{id:`1`,email:`admin@exemple.com`,displayName:`Admin User`,firstName:`Admin`,lastName:`User`,role:`admin`,status:`active`,createdAt:new Date(`2023-01-01`),lastLogin:new Date(`2024-01-15`)},{id:`2`,email:`moderator@exemple.com`,displayName:`Marie Modérateur`,firstName:`Marie`,lastName:`Modérateur`,role:`moderator`,status:`active`,createdAt:new Date(`2023-03-15`),lastLogin:new Date(`2024-01-14`)},{id:`3`,email:`user@exemple.com`,displayName:`Jean Utilisateur`,firstName:`Jean`,lastName:`Utilisateur`,role:`user`,status:`active`,createdAt:new Date(`2023-06-01`),lastLogin:new Date(`2024-01-10`)},{id:`4`,email:`pending@exemple.com`,displayName:`Paul Pending`,firstName:`Paul`,lastName:`Pending`,role:`user`,status:`pending`,createdAt:new Date(`2024-01-10`)},{id:`5`,email:`banned@exemple.com`,displayName:`Bob Banni`,firstName:`Bob`,lastName:`Banni`,role:`guest`,status:`banned`,createdAt:new Date(`2023-09-01`),lastLogin:new Date(`2023-12-01`)}],fF=[{id:`read`,name:`Lecture`,description:`Accès en lecture`,category:`Base`},{id:`write`,name:`Écriture`,description:`Accès en écriture`,category:`Base`},{id:`delete`,name:`Suppression`,description:`Accès suppression`,category:`Base`},{id:`admin`,name:`Administration`,description:`Accès admin`,category:`Admin`},{id:`users`,name:`Gestion utilisateurs`,description:`Gérer les utilisateurs`,category:`Admin`}],pF={created:{icon:p.Plus,color:`text-green-500`,label:`créé`},updated:{icon:p.Edit,color:`text-blue-500`,label:`modifié`},deleted:{icon:p.Trash2,color:`text-red-500`,label:`supprimé`},commented:{icon:p.MessageSquare,color:`text-purple-500`,label:`commenté`},uploaded:{icon:p.Upload,color:`text-cyan-500`,label:`uploadé`},downloaded:{icon:p.Download,color:`text-gray-500`,label:`téléchargé`},shared:{icon:p.User,color:`text-orange-500`,label:`partagé`},approved:{icon:p.Check,color:`text-green-500`,label:`approuvé`},rejected:{icon:p.X,color:`text-red-500`,label:`rejeté`},mentioned:{icon:p.Bell,color:`text-yellow-500`,label:`mentionné`},assigned:{icon:p.User,color:`text-indigo-500`,label:`assigné`},completed:{icon:p.Check,color:`text-green-500`,label:`terminé`},custom:{icon:p.AlertCircle,color:`text-gray-500`,label:``}};function mF({user:e,size:t=`sm`}){let r={sm:`h-8 w-8`,md:`h-10 w-10`},i=e.name.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,g.jsxs)(n.m,{className:r[t],children:[(0,g.jsx)(n.g,{src:e.avatar,alt:e.name}),(0,g.jsx)(n.h,{className:`text-xs`,children:i})]})}function hF({type:e,customIcon:n,customColor:r}){let i=pF[e],a=i.icon;return(0,g.jsx)(`div`,{className:t.t(`flex h-8 w-8 items-center justify-center rounded-full bg-background border-2 shadow-sm`,r||i.color),children:n||(0,g.jsx)(a,{className:`h-4 w-4`})})}function gF({activity:e,showAvatar:t,relativeTime:n,layout:i,isLast:a}){let o=e=>{let t=typeof e==`string`?new Date(e):e;if(n){let e=new Date().getTime()-t.getTime(),n=Math.floor(e/6e4),r=Math.floor(n/60),i=Math.floor(r/24);if(n<1)return`À l'instant`;if(n<60)return`Il y a ${n} min`;if(r<24)return`Il y a ${r}h`;if(i<7)return`Il y a ${i}j`}return t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`})},s=pF[e.type];return i===`compact`?(0,g.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,g.jsx)(hF,{type:e.type,customIcon:e.icon,customColor:e.color}),(0,g.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,g.jsxs)(`p`,{className:`text-sm truncate`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.user.name}),` `,(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.title})]})}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0`,children:o(e.timestamp)})]}):i===`feed`?(0,g.jsx)(Y,{className:`mb-4`,children:(0,g.jsx)(Q,{className:`pt-4`,children:(0,g.jsxs)(`div`,{className:`flex gap-3`,children:[t&&(0,g.jsx)(mF,{user:e.user,size:`md`}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.user.name}),(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:s.label||e.type}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(e.timestamp)})]}),(0,g.jsx)(`p`,{className:`text-sm`,children:e.title}),e.description&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.metadata?.comment&&(0,g.jsx)(`div`,{className:`mt-2 p-3 bg-muted rounded-lg text-sm`,children:e.metadata.comment})]})]})})}):(0,g.jsxs)(`div`,{className:`flex gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,g.jsx)(hF,{type:e.type,customIcon:e.icon,customColor:e.color}),!a&&(0,g.jsx)(`div`,{className:`w-0.5 flex-1 bg-border mt-2`})]}),(0,g.jsx)(`div`,{className:`flex-1 pb-8`,children:(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t&&(0,g.jsx)(mF,{user:e.user}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.user.name}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.title})]}),e.description&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.metadata?.comment&&(0,g.jsx)(`div`,{className:`mt-2 p-3 bg-muted rounded-lg text-sm`,children:e.metadata.comment}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground mt-2 block`,children:o(e.timestamp)})]})]})})]})}function _F({activities:e,title:n=`Activité`,showSearch:r=!0,showFilters:o=!0,filters:c=[],activeFilter:l,onFilterChange:u,showRefresh:f=!0,onRefresh:m,loading:h=!1,groupByDay:_=!0,showLoadMore:v=!1,onLoadMore:y,loadingMore:b=!1,showAvatars:x=!0,relativeTime:S=!0,layout:C=`timeline`,className:w}){let[T,E]=d.useState(``),[D,O]=d.useState(null),k=l??D,A=e=>{u?u(e):O(e)},j=d.useMemo(()=>{let t=e;if(T){let e=T.toLowerCase();t=t.filter(t=>t.title.toLowerCase().includes(e)||t.user.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))}if(k){let e=c.find(e=>e.id===k);e&&(t=t.filter(t=>e.types.includes(t.type)))}return t},[e,T,k,c]),M=d.useMemo(()=>{if(!_)return null;let e={};return j.forEach(t=>{let n=(typeof t.timestamp==`string`?new Date(t.timestamp):t.timestamp).toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});e[n]||(e[n]=[]),e[n].push(t)}),e},[j,_]),N=e=>(0,g.jsx)(`div`,{children:e.map((t,n)=>(0,g.jsx)(gF,{activity:t,showAvatar:x,relativeTime:S,layout:C,isLast:n===e.length-1},t.id))});return(0,g.jsxs)(`div`,{className:t.t(`space-y-4`,w),children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,g.jsx)(`h2`,{className:`text-xl font-semibold`,children:n}),(0,g.jsx)(`div`,{className:`flex items-center gap-2`,children:f&&m&&(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:m,disabled:h,children:(0,g.jsx)(p.RefreshCw,{className:t.t(`h-4 w-4`,h&&`animate-spin`)})})})]}),(r||o)&&(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center`,children:[r&&(0,g.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher...`,value:T,onChange:e=>E(e.target.value),className:`pl-9`})]}),o&&c.length>0&&(0,g.jsxs)(a.d,{value:k||`all`,onValueChange:e=>A(e===`all`?null:e),children:[(0,g.jsxs)(a.y,{className:`w-[180px]`,children:[(0,g.jsx)(p.Filter,{className:`h-4 w-4 mr-2`}),(0,g.jsx)(a.b,{placeholder:`Filtrer`})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`Toutes les activités`}),c.map(e=>(0,g.jsx)(a.m,{value:e.id,children:e.label},e.id))]})]})]}),h?(0,g.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,g.jsx)(p.RefreshCw,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):j.length===0?(0,g.jsxs)(`div`,{className:`text-center py-12`,children:[(0,g.jsx)(p.Clock,{className:`h-12 w-12 text-muted-foreground mx-auto mb-4`}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Aucune activité`})]}):_&&M?(0,g.jsx)(`div`,{className:`space-y-6`,children:Object.entries(M).map(([e,t])=>(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-4 capitalize`,children:e}),N(t)]},e))}):N(j),v&&y&&(0,g.jsx)(`div`,{className:`flex justify-center pt-4`,children:(0,g.jsxs)(i.n,{variant:`outline`,onClick:y,disabled:b,children:[b?(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4 animate-spin mr-2`}):(0,g.jsx)(p.ChevronDown,{className:`h-4 w-4 mr-2`}),`Charger plus`]})})]})}var vF=[{id:`edits`,label:`Modifications`,types:[`created`,`updated`,`deleted`]},{id:`comments`,label:`Commentaires`,types:[`commented`,`mentioned`]},{id:`files`,label:`Fichiers`,types:[`uploaded`,`downloaded`,`shared`]},{id:`approvals`,label:`Approbations`,types:[`approved`,`rejected`,`completed`]}],yF=[{id:`1`,type:`created`,title:`a créé le document 'Rapport Q4'`,user:{id:`1`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5)},{id:`2`,type:`commented`,title:`a commenté sur 'Projet Alpha'`,user:{id:`2`,name:`Pierre Martin`},timestamp:new Date(Date.now()-1e3*60*30),metadata:{comment:`Super travail sur cette partie !`}},{id:`3`,type:`uploaded`,title:`a uploadé 3 fichiers`,user:{id:`3`,name:`Sophie Bernard`},timestamp:new Date(Date.now()-1e3*60*60*2)},{id:`4`,type:`approved`,title:`a approuvé la demande de congés`,user:{id:`1`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*60*24)}],bF={blue:{bg:`bg-blue-100`,text:`text-blue-700`,border:`border-blue-500`},green:{bg:`bg-green-100`,text:`text-green-700`,border:`border-green-500`},red:{bg:`bg-red-100`,text:`text-red-700`,border:`border-red-500`},yellow:{bg:`bg-yellow-100`,text:`text-yellow-700`,border:`border-yellow-500`},purple:{bg:`bg-purple-100`,text:`text-purple-700`,border:`border-purple-500`},pink:{bg:`bg-pink-100`,text:`text-pink-700`,border:`border-pink-500`},orange:{bg:`bg-orange-100`,text:`text-orange-700`,border:`border-orange-500`},cyan:{bg:`bg-cyan-100`,text:`text-cyan-700`,border:`border-cyan-500`}};function xF(e,t){let n=[];new Date(e,t,1);let r=new Date(e,t+1,0);for(let i=1;i<=r.getDate();i++)n.push(new Date(e,t,i));return n}function SF(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function CF(e,t){return e.filter(e=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof e.end==`string`?new Date(e.end):e.end;return e.allDay?SF(n,t)||t>=n&&t<=r:SF(n,t)})}function wF({currentDate:e,viewMode:t,onPrevious:n,onNext:r,onToday:o,onViewModeChange:s,onAddClick:c,showViewSelector:l,showAddButton:u,locale:d}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:n,children:(0,g.jsx)(p.ChevronLeft,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:r,children:(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:o,children:`Aujourd'hui`}),(0,g.jsx)(`h2`,{className:`text-xl font-semibold ml-4 capitalize`,children:(()=>{switch(t){case`month`:return e.toLocaleDateString(d,{month:`long`,year:`numeric`});case`week`:return`Semaine du ${e.toLocaleDateString(d,{day:`numeric`,month:`long`})}`;case`day`:return e.toLocaleDateString(d,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`});case`agenda`:return`Agenda`;default:return``}})()})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&s&&(0,g.jsxs)(a.d,{value:t,onValueChange:e=>s(e),children:[(0,g.jsx)(a.y,{className:`w-[120px]`,children:(0,g.jsx)(a.b,{})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`month`,children:`Mois`}),(0,g.jsx)(a.m,{value:`week`,children:`Semaine`}),(0,g.jsx)(a.m,{value:`day`,children:`Jour`}),(0,g.jsx)(a.m,{value:`agenda`,children:`Agenda`})]})]}),u&&c&&(0,g.jsxs)(i.n,{onClick:c,children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-2`}),`Événement`]})]})]})}function TF({event:e,onClick:n,compact:r=!1}){let i=bF[e.color||`blue`],a=typeof e.start==`string`?new Date(e.start):e.start;return(0,g.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),n?.()},className:t.t(`w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2`,i.bg,i.text,i.border),children:[!e.allDay&&!r&&(0,g.jsx)(`span`,{className:`font-medium mr-1`,children:a.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})}),e.title]})}function EF({event:e,onEdit:n,onDelete:r}){let a=typeof e.start==`string`?new Date(e.start):e.start,o=typeof e.end==`string`?new Date(e.end):e.end,s=bF[e.color||`blue`];return(0,g.jsxs)(`div`,{className:`w-72`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsx)(`div`,{className:t.t(`w-3 h-3 rounded-full mt-1`,s.bg.replace(`100`,`500`))}),(0,g.jsxs)(`div`,{className:`flex gap-1`,children:[n&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:n,children:(0,g.jsx)(p.Edit,{className:`h-3 w-3`})}),r&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:r,children:(0,g.jsx)(p.Trash2,{className:`h-3 w-3`})})]})]}),(0,g.jsx)(`h4`,{className:`font-semibold mt-2`,children:e.title}),(0,g.jsxs)(`div`,{className:`space-y-2 mt-3 text-sm text-muted-foreground`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Clock,{className:`h-4 w-4`}),e.allDay?(0,g.jsx)(`span`,{children:`Toute la journée`}):(0,g.jsxs)(`span`,{children:[a.toLocaleString(`fr-FR`,{weekday:`short`,day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}),` - `,o.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})]})]}),e.location&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.MapPin,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{children:e.location})]}),e.attendees&&e.attendees.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Users,{className:`h-4 w-4`}),(0,g.jsxs)(`span`,{children:[e.attendees.length,` participant(s)`]})]})]}),e.description&&(0,g.jsx)(`p`,{className:`mt-3 text-sm`,children:e.description})]})}function DF({currentDate:e,events:n,weekStartsOn:r,locale:i,onDayClick:a,onEventClick:o,onEventEdit:s,onEventDelete:l}){let u=e.getFullYear(),d=e.getMonth(),f=xF(u,d),p=new Date,m=Array.from({length:7},(e,t)=>new Date(2024,0,r+t).toLocaleDateString(i,{weekday:`short`})),h=(new Date(u,d,1).getDay()-r+7)%7,_=[];for(let e=0;e<h;e++)_.push(null);for(_.push(...f);_.length%7!=0;)_.push(null);return(0,g.jsxs)(`div`,{className:`border rounded-lg overflow-hidden`,children:[(0,g.jsx)(`div`,{className:`grid grid-cols-7 bg-muted`,children:m.map(e=>(0,g.jsx)(`div`,{className:`p-2 text-center text-sm font-medium capitalize`,children:e},e))}),(0,g.jsx)(`div`,{className:`grid grid-cols-7`,children:_.map((e,r)=>{let i=e?CF(n,e):[],u=e&&SF(e,p);return(0,g.jsx)(`div`,{className:t.t(`min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50`,!(e&&e.getMonth()===d)&&`bg-muted/30 text-muted-foreground`),onClick:()=>e&&a?.(e),children:e&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:t.t(`text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full`,u&&`bg-primary text-primary-foreground`),children:e.getDate()}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[i.slice(0,3).map(e=>(0,g.jsxs)(c.n,{children:[(0,g.jsx)(c.i,{asChild:!0,children:(0,g.jsx)(`div`,{children:(0,g.jsx)(TF,{event:e,onClick:()=>o?.(e),compact:!0})})}),(0,g.jsx)(c.r,{children:(0,g.jsx)(EF,{event:e,onEdit:()=>s?.(e.id,{}),onDelete:()=>l?.(e.id)})})]},e.id)),i.length>3&&(0,g.jsxs)(`button`,{className:`text-xs text-muted-foreground hover:text-foreground`,children:[`+`,i.length-3,` autres`]})]})]})},r)})})]})}function OF({currentDate:e,events:n,locale:r,onEventClick:i}){let a=n.filter(t=>{let n=typeof t.start==`string`?new Date(t.start):t.start,r=new Date(e);return r.setDate(r.getDate()+30),n>=e&&n<=r}).sort((e,t)=>{let n=typeof e.start==`string`?new Date(e.start):e.start,r=typeof t.start==`string`?new Date(t.start):t.start;return n.getTime()-r.getTime()}),o={};return a.forEach(e=>{let t=(typeof e.start==`string`?new Date(e.start):e.start).toDateString();o[t]||(o[t]=[]),o[t].push(e)}),(0,g.jsxs)(`div`,{className:`space-y-4`,children:[Object.entries(o).map(([e,n])=>(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-2 capitalize`,children:new Date(e).toLocaleDateString(r,{weekday:`long`,day:`numeric`,month:`long`})}),(0,g.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let n=bF[e.color||`blue`],a=typeof e.start==`string`?new Date(e.start):e.start,o=typeof e.end==`string`?new Date(e.end):e.end;return(0,g.jsx)(Y,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>i?.(e),children:(0,g.jsxs)(Q,{className:`p-3 flex gap-3`,children:[(0,g.jsx)(`div`,{className:t.t(`w-1 rounded-full`,n.bg.replace(`100`,`500`))}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsx)(`h4`,{className:`font-medium`,children:e.title}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.allDay?`Toute la journée`:`${a.toLocaleTimeString(r,{hour:`2-digit`,minute:`2-digit`})} - ${o.toLocaleTimeString(r,{hour:`2-digit`,minute:`2-digit`})}`}),e.location&&(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground flex items-center gap-1 mt-1`,children:[(0,g.jsx)(p.MapPin,{className:`h-3 w-3`}),e.location]})]})]})},e.id)})})]},e)),Object.keys(o).length===0&&(0,g.jsx)(`div`,{className:`text-center py-12 text-muted-foreground`,children:`Aucun événement à venir`})]})}function kF({events:e,currentDate:n,onDateChange:r,viewMode:i,onViewModeChange:a,onEventClick:o,onEventCreate:s,onEventEdit:c,onEventDelete:l,onDayClick:u,showHeader:f=!0,showViewSelector:p=!0,showAddButton:m=!0,weekStartsOn:h=1,locale:_=`fr-FR`,className:v}){let[y,b]=d.useState(new Date),[x,S]=d.useState(`month`),[C,w]=d.useState(!1),T=n??y,E=i??x,D=e=>{r?r(e):b(e)};return(0,g.jsxs)(`div`,{className:t.t(`space-y-4`,v),children:[f&&(0,g.jsx)(wF,{currentDate:T,viewMode:E,onPrevious:()=>{let e=new Date(T);switch(E){case`month`:e.setMonth(e.getMonth()-1);break;case`week`:e.setDate(e.getDate()-7);break;case`day`:e.setDate(e.getDate()-1);break}D(e)},onNext:()=>{let e=new Date(T);switch(E){case`month`:e.setMonth(e.getMonth()+1);break;case`week`:e.setDate(e.getDate()+7);break;case`day`:e.setDate(e.getDate()+1);break}D(e)},onToday:()=>{D(new Date)},onViewModeChange:e=>{a?a(e):S(e)},onAddClick:()=>w(!0),showViewSelector:p,showAddButton:m,locale:_}),E===`month`&&(0,g.jsx)(DF,{currentDate:T,events:e,weekStartsOn:h,locale:_,onDayClick:u,onEventClick:o,onEventEdit:c,onEventDelete:l}),E===`agenda`&&(0,g.jsx)(OF,{currentDate:T,events:e,locale:_,onEventClick:o}),(E===`week`||E===`day`)&&(0,g.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,children:[`Vue `,E===`week`?`semaine`:`jour`,` - À implémenter`]})]})}var AF=[{id:`1`,title:`Réunion d'équipe`,start:new Date,end:new Date(Date.now()+1e3*60*60),color:`blue`,location:`Salle de réunion A`},{id:`2`,title:`Déjeuner avec le client`,start:new Date(Date.now()+1e3*60*60*24),end:new Date(Date.now()+1e3*60*60*25),color:`green`,location:`Restaurant Le Gourmet`},{id:`3`,title:`Formation React`,start:new Date(Date.now()+1e3*60*60*24*2),end:new Date(Date.now()+1e3*60*60*24*2+1e3*60*60*4),color:`purple`,allDay:!0},{id:`4`,title:`Deadline projet`,start:new Date(Date.now()+1e3*60*60*24*5),end:new Date(Date.now()+1e3*60*60*24*5),color:`red`,allDay:!0}],jF=`waka-chat-widget-position`,MF=e=>{if(typeof window>`u`)return null;try{let t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch{}return null},NF=(e,t)=>{if(!(typeof window>`u`))try{localStorage.setItem(e,JSON.stringify(t))}catch{}};function PF({defaultPosition:e,position:n,onPositionChange:i,persistPosition:a=!0,positionStorageKey:o=jF,defaultOpen:s=!1,open:c,onOpenChange:l,bubbleSize:u=`md`,bubbleColor:f=`primary`,bubbleIcon:m,bubbleText:h,showUnreadBadge:_=!0,bubbleAnimation:v=`none`,widgetPosition:y=`top-left`,widgetSize:b=`md`,bubbleClassName:x,widgetClassName:S,draggable:C=!0,constrainToViewport:w=!0,edgeOffset:T=16,onWidgetClose:E,onWidgetMinimize:D,zIndex:O=9999,conversations:k=[],...A}){let[j,M]=d.useState(s),[N,P]=d.useState(()=>{if(e)return e;if(a){let e=MF(o);if(e)return e}return{x:typeof window<`u`?window.innerWidth-80:0,y:typeof window<`u`?window.innerHeight-80:0}}),[F,I]=d.useState(!1),[L,R]=d.useState({x:0,y:0}),z=d.useRef(null),B=c===void 0?j:c,V=n===void 0?N:n;d.useEffect(()=>{!(typeof window>`u`)&&!n&&!e&&P((a?MF(o):null)||{x:window.innerWidth-80,y:window.innerHeight-80})},[n,e,a,o]);let H=e=>{c===void 0&&M(e),l?.(e)},U=e=>{n===void 0&&P(e),i?.(e),a&&NF(o,e)},W=e=>{if(!w||typeof window>`u`)return e;let t=z.current?.offsetWidth||60,n=z.current?.offsetHeight||60;return{x:Math.max(T,Math.min(e.x,window.innerWidth-t-T)),y:Math.max(T,Math.min(e.y,window.innerHeight-n-T))}},G=e=>{!C||B||(I(!0),R({x:e.clientX-V.x,y:e.clientY-V.y}))},K=e=>{if(!C||B)return;let t=e.touches[0];I(!0),R({x:t.clientX-V.x,y:t.clientY-V.y})};d.useEffect(()=>{if(!F)return;let e=e=>{U(W({x:e.clientX-L.x,y:e.clientY-L.y}))},t=e=>{let t=e.touches[0];U(W({x:t.clientX-L.x,y:t.clientY-L.y}))},n=()=>{I(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,n),document.addEventListener(`touchmove`,t),document.addEventListener(`touchend`,n),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,n),document.removeEventListener(`touchmove`,t),document.removeEventListener(`touchend`,n)}},[F,L]);let q=()=>{F||H(!B)},ee=k.reduce((e,t)=>e+(t.unreadCount||0),0),J={sm:`h-12 w-12`,md:`h-14 w-14`,lg:`h-16 w-16`},te={sm:`h-5 w-5`,md:`h-6 w-6`,lg:`h-7 w-7`},ne={primary:`bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/90`,success:`bg-green-500 text-white hover:bg-green-600`,warning:`bg-yellow-500 text-white hover:bg-yellow-600`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`},re={none:``,pulse:`animate-pulse`,bounce:`animate-bounce`},ie={sm:`h-[400px] w-[300px]`,md:`h-[500px] w-[380px]`,lg:`h-[600px] w-[420px]`},ae=()=>{let e=z.current?.offsetWidth||60,t=z.current?.offsetHeight||60,n=ie[b].match(/h-\[(\d+)px\] w-\[(\d+)px\]/),r=n?parseInt(n[1]):500,i=n?parseInt(n[2]):380,a=V.x,o=V.y;switch(y){case`top-left`:a=V.x-i+e,o=V.y-r-12;break;case`top-right`:o=V.y-r-12;break;case`bottom-left`:a=V.x-i+e,o=V.y+t+12;break;case`bottom-right`:o=V.y+t+12;break}return typeof window<`u`&&(a=Math.max(T,Math.min(a,window.innerWidth-i-T)),o=Math.max(T,Math.min(o,window.innerHeight-r-T))),{position:`fixed`,left:a,top:o,zIndex:O+1}};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`button`,{ref:z,onClick:q,onMouseDown:G,onTouchStart:K,className:t.t(`fixed rounded-full shadow-lg transition-all duration-200`,`flex items-center justify-center gap-2`,J[u],ne[f],re[v],F&&`cursor-grabbing scale-110`,C&&!F&&!B&&`cursor-grab`,B&&`opacity-0 pointer-events-none scale-75`,h&&`px-4 w-auto`,x),style:{left:V.x,top:V.y,zIndex:O,touchAction:`none`},"aria-label":`Ouvrir le chat`,children:[m||(0,g.jsx)(p.MessageCircle,{className:te[u]}),h&&(0,g.jsx)(`span`,{className:`font-medium text-sm`,children:h}),_&&ee>0&&(0,g.jsx)(r.t,{className:t.t(`absolute -top-1 -right-1 h-5 min-w-[20px] px-1.5`,`bg-destructive text-destructive-foreground`,`flex items-center justify-center text-xs font-bold`),children:ee>99?`99+`:ee})]}),B&&(0,g.jsx)(`div`,{className:t.t(`fixed rounded-xl shadow-2xl border bg-background overflow-hidden`,`animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-2`,`duration-200`,ie[b],S),style:ae(),children:(0,g.jsx)(WF,{...A,conversations:k,layout:`widget`,onClose:()=>{H(!1),E?.()},onMinimize:()=>{H(!1),D?.()},showCloseButton:!0,className:`h-full`})}),B&&(0,g.jsx)(`div`,{className:`fixed inset-0 bg-black/20 sm:hidden`,style:{zIndex:O-1},onClick:()=>H(!1)})]})}function FF(e={}){let{defaultOpen:t=!1,defaultPosition:n,persistPosition:r=!0,positionStorageKey:i=jF}=e,[a,o]=d.useState(t),[s,c]=d.useState(()=>{if(n)return n;if(typeof window>`u`)return{x:0,y:0};if(r){let e=MF(i);if(e)return e}return{x:window.innerWidth-80,y:window.innerHeight-80}}),l=()=>o(!0),u=()=>o(!1),f=()=>o(e=>!e),p=e=>{c(e),r&&NF(i,e)};return{isOpen:a,position:s,open:l,close:u,toggle:f,setIsOpen:o,updatePosition:p,resetPosition:()=>{typeof window>`u`||p(n||{x:window.innerWidth-80,y:window.innerHeight-80})},widgetProps:{open:a,onOpenChange:o,position:s,onPositionChange:p}}}var IF=e=>{let t=typeof e==`string`?new Date(e):e,n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r.getTime()-1440*60*1e3),a=new Date(t.getFullYear(),t.getMonth(),t.getDate());return a.getTime()===r.getTime()?`Aujourd'hui`:a.getTime()===i.getTime()?`Hier`:t.toLocaleDateString(`fr-FR`,{weekday:`long`,day:`numeric`,month:`long`})},LF=(e,t)=>{let n=typeof e==`string`?new Date(e):e,r=typeof t==`string`?new Date(t):t;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()},RF=e=>{if(e.initials)return e.initials;let t=e.name.split(` `);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.name.substring(0,2).toUpperCase()};function zF({date:e}){return(0,g.jsx)(`div`,{className:`flex items-center justify-center my-4`,children:(0,g.jsx)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground bg-muted rounded-full`,children:IF(e)})})}function BF({conversations:e,activeId:i,currentUser:a,onSelect:o,onSearch:c}){let[l,u]=d.useState(``),f=e=>e.name?e.name:e.participants.filter(e=>e.id!==a.id).map(e=>e.name).join(`, `),m=e=>{if(e.avatar)return{url:e.avatar,fallback:e.name?.charAt(0)||`G`};if(e.isGroup)return{fallback:`G`};let t=e.participants.find(e=>e.id!==a.id);return{url:t?.avatar,fallback:RF(t||{id:``,name:`?`})}},h=e=>{if(!e)return``;let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/(1e3*60*60*24));return r===0?t.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}):r===1?`Hier`:r<7?t.toLocaleDateString(`fr-FR`,{weekday:`short`}):t.toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`})},_=e.filter(e=>l?f(e).toLowerCase().includes(l.toLowerCase()):!0);return(0,g.jsxs)(`div`,{className:`flex flex-col h-full border-r`,children:[(0,g.jsx)(`div`,{className:`p-3 border-b`,children:(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher...`,value:l,onChange:e=>{u(e.target.value),c?.(e.target.value)},className:`pl-9`})]})}),(0,g.jsx)(n.f,{className:`flex-1`,children:_.map(e=>{let s=m(e),c=f(e),l=e.participants.find(e=>e.id!==a.id);return(0,g.jsxs)(`button`,{onClick:()=>o(e),className:t.t(`w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left`,i===e.id&&`bg-muted`),children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsxs)(n.m,{children:[(0,g.jsx)(n.g,{src:s.url}),(0,g.jsx)(n.h,{children:s.fallback})]}),l?.status===`online`&&(0,g.jsx)(`div`,{className:`absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background`})]}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`span`,{className:`font-medium text-sm truncate`,children:c}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:h(e.lastMessage?.timestamp)})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.lastMessage?.content||`Aucun message`}),e.unreadCount&&e.unreadCount>0&&(0,g.jsx)(r.t,{className:`h-5 min-w-[20px] justify-center`,children:e.unreadCount})]})]})]},e.id)})})]})}function VF({conversation:e,currentUser:r,title:a,statusText:o,showStatus:s=!0,showCloseButton:c,onAudioCall:l,onVideoCall:u,onClose:d,onCloseConversation:f,onMinimize:m,layout:h}){let _=e?.participants.find(e=>e.id!==r.id),v=a||e?.name||_?.name||`Messages`,y=()=>o||(e?e.isGroup?`${e.participants.length} participants`:_?.status===`online`?`En ligne`:_?.lastSeen?`Vu ${(typeof _.lastSeen==`string`?new Date(_.lastSeen):_.lastSeen).toLocaleString(`fr-FR`)}`:`Hors ligne`:``),b=h===`floating`||h===`widget`;return(0,g.jsxs)(`div`,{className:t.t(`flex items-center justify-between p-3 border-b`,b&&`bg-primary text-primary-foreground rounded-t-lg`),children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e&&(0,g.jsxs)(n.m,{className:t.t(b&&`border-2 border-primary-foreground/20`),children:[(0,g.jsx)(n.g,{src:e.avatar||_?.avatar}),(0,g.jsx)(n.h,{className:t.t(b&&`bg-primary-foreground/20 text-primary-foreground`),children:RF(_||{id:``,name:v})})]}),!e&&(0,g.jsx)(p.MessageCircle,{className:`h-5 w-5`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`font-semibold text-sm`,children:v}),s&&(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[_?.status===`online`&&(0,g.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,b?`bg-green-400`:`bg-green-500`)}),_?.status===`offline`&&(0,g.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,b?`bg-gray-400`:`bg-gray-500`)}),(0,g.jsx)(`p`,{className:t.t(`text-xs`,b?`text-primary-foreground/80`:`text-muted-foreground`),children:y()})]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l&&!b&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:l,children:(0,g.jsx)(p.Phone,{className:`h-4 w-4`})}),u&&!b&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:u,children:(0,g.jsx)(p.Video,{className:`h-4 w-4`})}),c&&f&&(0,g.jsxs)(i.n,{variant:b?`ghost`:`outline`,size:`sm`,onClick:f,className:t.t(b&&`text-primary-foreground hover:bg-primary-foreground/20`),children:[(0,g.jsx)(p.Calendar,{className:`h-4 w-4 mr-1.5`}),`Clôturer`]}),m&&b&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:m,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,g.jsx)(p.Minimize2,{className:`h-4 w-4`})}),d&&b&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:d,className:`text-primary-foreground hover:bg-primary-foreground/20`,children:(0,g.jsx)(p.X,{className:`h-4 w-4`})}),!b&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,children:(0,g.jsx)(p.MoreVertical,{className:`h-4 w-4`})})}),(0,g.jsx)(nn,{align:`end`,children:(0,g.jsxs)($,{children:[(0,g.jsx)(p.Settings,{className:`mr-2 h-4 w-4`}),`Paramètres`]})})]})]})]})}function HF({message:e,isOwn:r,showStatus:a,showTimestamp:o,onDelete:s,onReply:c}){return(0,g.jsxs)(`div`,{className:t.t(`flex gap-2 group`,r?`flex-row-reverse`:`flex-row`),children:[!r&&(0,g.jsxs)(n.m,{className:`h-8 w-8`,children:[(0,g.jsx)(n.g,{src:e.sender.avatar}),(0,g.jsx)(n.h,{className:`text-xs`,children:RF(e.sender)})]}),(0,g.jsxs)(`div`,{className:t.t(`max-w-[70%]`,r&&`items-end`),children:[e.replyTo&&(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.replyTo.sender.name}),(0,g.jsx)(`p`,{className:`truncate`,children:e.replyTo.content})]}),(0,g.jsxs)(`div`,{className:t.t(`relative rounded-2xl px-4 py-2`,r?`bg-primary text-primary-foreground rounded-tr-sm`:`bg-muted rounded-tl-sm`),children:[e.attachments&&e.attachments.length>0&&(0,g.jsx)(`div`,{className:`space-y-2 mb-2`,children:e.attachments.map((e,t)=>(0,g.jsx)(`div`,{children:e.type===`image`?(0,g.jsx)(`img`,{src:e.url,alt:e.name,className:`rounded-lg max-w-full`}):(0,g.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-background/10 rounded`,children:[(0,g.jsx)(p.File,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{className:`text-sm truncate`,children:e.name})]})},t))}),(0,g.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words`,children:e.content}),(0,g.jsxs)(`div`,{className:t.t(`absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1`,r?`-left-20`:`-right-20`),children:[(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>c?.(e),children:(0,g.jsx)(p.Reply,{className:`h-3 w-3`})}),r&&s&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>s(e.id),children:(0,g.jsx)(p.Trash2,{className:`h-3 w-3`})})]})]}),(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-1 mt-1 text-xs text-muted-foreground`,r&&`justify-end`),children:[o&&(0,g.jsx)(`span`,{children:(e=>(typeof e==`string`?new Date(e):e).toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`}))(e.timestamp)}),e.isEdited&&(0,g.jsx)(`span`,{children:`(modifié)`}),r&&a&&(()=>{switch(e.status){case`sending`:return(0,g.jsx)(`div`,{className:`h-3 w-3 rounded-full border-2 border-current animate-pulse`});case`sent`:return(0,g.jsx)(p.Check,{className:`h-3 w-3`});case`delivered`:return(0,g.jsx)(p.CheckCheck,{className:`h-3 w-3`});case`read`:return(0,g.jsx)(p.CheckCheck,{className:`h-3 w-3 text-blue-500`});case`error`:return(0,g.jsx)(p.X,{className:`h-3 w-3 text-red-500`});default:return null}})()]})]})]})}function UF({onSend:e,replyTo:t,onCancelReply:n,showAttachments:r,showEmoji:a,placeholder:s,sending:c,showHint:l=!0,hintText:u=`Appuyez sur Entrée pour envoyer, Maj+Entrée pour un saut de ligne`}){let[f,m]=d.useState(``),h=d.useRef(null),_=()=>{f.trim()&&!c&&(e(f.trim()),m(``))};return d.useEffect(()=>{h.current&&(h.current.style.height=`auto`,h.current.style.height=Math.min(h.current.scrollHeight,120)+`px`)},[f]),(0,g.jsxs)(`div`,{className:`border-t p-3`,children:[t&&(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Reply,{className:`h-4 w-4 text-primary`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-medium`,children:t.sender.name}),(0,g.jsx)(`p`,{className:`text-muted-foreground truncate`,children:t.content})]})]}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:n,children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]}),(0,g.jsxs)(`div`,{className:`flex items-end gap-2`,children:[r&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,g.jsx)(p.Paperclip,{className:`h-4 w-4`})}),(0,g.jsx)(o.t,{ref:h,value:f,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),_())},placeholder:s,className:`flex-1 min-h-[40px] max-h-[120px] resize-none`,disabled:c,rows:1}),a&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`flex-shrink-0`,children:(0,g.jsx)(p.Smile,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{onClick:_,disabled:!f.trim()||c,size:`icon`,className:`flex-shrink-0 rounded-full`,children:(0,g.jsx)(p.Send,{className:`h-4 w-4`})})]}),l&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:u})]})}function WF({conversations:e=[],activeConversation:i,messages:a,currentUser:o,onSendMessage:s,onConversationSelect:c,onMessageDelete:l,onMessageReply:u,onSearch:f,onAudioCall:m,onVideoCall:h,onClose:_,onCloseConversation:v,onMinimize:y,showConversationList:b=!0,showHeader:x=!0,showMessageStatus:S=!0,showTimestamps:C=!0,showAttachments:w=!0,showEmoji:T=!0,showDateSeparators:E=!0,showInputHint:D=!0,showCloseButton:O=!1,inputPlaceholder:k,inputHintText:A,sending:j=!1,loading:M=!1,layout:N=`full`,headerTitle:P,showHeaderStatus:F=!0,statusText:I,minimized:L=!1,className:R}){let[z,B]=d.useState(null),V=d.useRef(null);d.useEffect(()=>{V.current?.scrollIntoView({behavior:`smooth`})},[a]);let H=(e,t)=>{s?.(e,t),B(null)},U=e=>{B(e),u?.(e)};return(N===`floating`||N===`widget`)&&L?(0,g.jsxs)(`button`,{onClick:y,className:t.t(`flex items-center gap-3 p-3 bg-primary text-primary-foreground rounded-full shadow-lg hover:shadow-xl transition-shadow`,R),children:[(0,g.jsx)(p.MessageCircle,{className:`h-5 w-5`}),(0,g.jsx)(`span`,{className:`font-medium`,children:`Messages`}),e.reduce((e,t)=>e+(t.unreadCount||0),0)>0&&(0,g.jsx)(r.t,{variant:`secondary`,className:`bg-white text-primary`,children:e.reduce((e,t)=>e+(t.unreadCount||0),0)})]}):(0,g.jsxs)(`div`,{className:t.t(`flex bg-background overflow-hidden`,{full:`h-screen`,embedded:`h-[600px]`,floating:`h-[500px] w-[400px] rounded-lg shadow-xl border`,widget:`h-[500px] w-[350px] rounded-lg shadow-2xl border`}[N],R),children:[b&&N!==`widget`&&N!==`floating`&&(0,g.jsx)(`div`,{className:`w-80 flex-shrink-0`,children:(0,g.jsx)(BF,{conversations:e,activeId:i?.id,currentUser:o,onSelect:e=>c?.(e),onSearch:f})}),(0,g.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:i||N===`widget`||N===`floating`?(0,g.jsxs)(g.Fragment,{children:[x&&(0,g.jsx)(VF,{conversation:i,currentUser:o,title:P,statusText:I,showStatus:F,showCloseButton:O,onAudioCall:m,onVideoCall:h,onClose:_,onCloseConversation:v,onMinimize:y,layout:N}),(0,g.jsx)(n.f,{className:`flex-1 p-4`,children:(0,g.jsxs)(`div`,{className:`space-y-4`,children:[M?(0,g.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,g.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-primary`})}):(()=>{let e=[],t=null;return a.forEach((n,r)=>{let i=typeof n.timestamp==`string`?new Date(n.timestamp):n.timestamp;E&&(!t||!LF(t,i))&&(e.push((0,g.jsx)(zF,{date:i},`separator-${r}`)),t=i),e.push((0,g.jsx)(HF,{message:n,isOwn:n.sender.id===o.id,showStatus:S,showTimestamp:C,onDelete:l,onReply:U},n.id))}),e})(),(0,g.jsx)(`div`,{ref:V})]})}),(0,g.jsx)(UF,{onSend:H,replyTo:z,onCancelReply:()=>B(null),showAttachments:w,showEmoji:T,placeholder:(()=>{if(k)return k;if(i){let e=i.participants.find(e=>e.id!==o.id);if(e)return`Écrire à ${e.name}...`}return`Écrivez votre message...`})(),sending:j,showHint:D,hintText:A})]}):(0,g.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground`,children:(0,g.jsxs)(`div`,{className:`text-center`,children:[(0,g.jsx)(p.MessageCircle,{className:`h-12 w-12 mx-auto mb-4 opacity-50`}),(0,g.jsx)(`p`,{children:`Sélectionnez une conversation`})]})})})]})}var GF={id:`current`,name:`Moi`,status:`online`},KF=[{id:`1`,participants:[GF,{id:`2`,name:`Marie Dupont`,status:`online`}],lastMessage:{id:`m1`,content:`D'accord, je m'en occupe !`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*5),status:`read`},unreadCount:0},{id:`2`,participants:[GF,{id:`3`,name:`Pierre Martin`,status:`offline`}],lastMessage:{id:`m2`,content:`On se voit demain ?`,sender:GF,timestamp:new Date(Date.now()-1e3*60*60),status:`delivered`},unreadCount:2}],qF=[{id:`1`,content:`Salut ! Comment ça va ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*30),status:`read`},{id:`2`,content:`Ça va bien merci ! Et toi ?`,sender:GF,timestamp:new Date(Date.now()-1e3*60*25),status:`read`},{id:`3`,content:`Super ! Tu as vu le nouveau projet ?`,sender:{id:`2`,name:`Marie Dupont`},timestamp:new Date(Date.now()-1e3*60*20),status:`read`}],JF={"no-data":{title:`Aucune donnée`,description:`Il n'y a pas encore de données à afficher.`,icon:p.Inbox,actionLabel:`Ajouter`,actionIcon:p.Plus},"no-results":{title:`Aucun résultat`,description:`Aucun élément ne correspond à votre recherche.`,icon:p.Search,actionLabel:`Effacer les filtres`,actionIcon:p.Filter},"no-messages":{title:`Aucun message`,description:`Votre boîte de réception est vide.`,icon:p.MessageSquare,actionLabel:`Nouveau message`,actionIcon:p.Plus},"no-files":{title:`Aucun fichier`,description:`Vous n'avez pas encore de fichiers.`,icon:p.FolderOpen,actionLabel:`Importer un fichier`,actionIcon:p.Upload},"no-users":{title:`Aucun utilisateur`,description:`Il n'y a pas encore d'utilisateurs.`,icon:p.Users,actionLabel:`Inviter des utilisateurs`,actionIcon:p.Plus},"no-cart":{title:`Panier vide`,description:`Votre panier est vide.`,icon:p.ShoppingCart,actionLabel:`Parcourir les produits`,actionIcon:p.ArrowRight},"no-notifications":{title:`Aucune notification`,description:`Vous êtes à jour !`,icon:p.Bell},"no-events":{title:`Aucun événement`,description:`Aucun événement prévu.`,icon:p.Calendar,actionLabel:`Créer un événement`,actionIcon:p.Plus},"no-images":{title:`Aucune image`,description:`Vous n'avez pas encore d'images.`,icon:p.Image,actionLabel:`Importer des images`,actionIcon:p.Upload},"no-bookmarks":{title:`Aucun favori`,description:`Vous n'avez pas encore de favoris.`,icon:p.Bookmark,actionLabel:`Parcourir`,actionIcon:p.ArrowRight},"no-favorites":{title:`Aucun favori`,description:`Vous n'avez pas encore aimé de contenu.`,icon:p.Heart},error:{title:`Une erreur est survenue`,description:`Impossible de charger les données.`,icon:p.FileQuestion,actionLabel:`Réessayer`,actionIcon:p.RefreshCw},custom:{title:`Aucun élément`,description:`Il n'y a rien à afficher.`,icon:p.Inbox}};function YF({type:e,size:n,className:r}){let i=JF[e].icon,a={sm:{container:`h-24 w-24`,icon:`h-8 w-8`,circles:{outer:`h-20 w-20`,inner:`h-14 w-14`}},md:{container:`h-32 w-32`,icon:`h-10 w-10`,circles:{outer:`h-28 w-28`,inner:`h-20 w-20`}},lg:{container:`h-40 w-40`,icon:`h-12 w-12`,circles:{outer:`h-36 w-36`,inner:`h-28 w-28`}}}[n];return(0,g.jsxs)(`div`,{className:t.t(`relative flex items-center justify-center`,a.container,r),children:[(0,g.jsx)(`div`,{className:t.t(`absolute rounded-full bg-muted/50`,a.circles.outer)}),(0,g.jsx)(`div`,{className:t.t(`absolute rounded-full bg-muted`,a.circles.inner)}),(0,g.jsx)(`div`,{className:`relative z-10 flex items-center justify-center rounded-full bg-background p-4 shadow-sm`,children:(0,g.jsx)(i,{className:t.t(a.icon,`text-muted-foreground`)})}),(0,g.jsx)(`div`,{className:`absolute -right-1 top-2 h-2 w-2 rounded-full bg-primary/20`}),(0,g.jsx)(`div`,{className:`absolute -left-1 bottom-4 h-1.5 w-1.5 rounded-full bg-primary/30`}),(0,g.jsx)(`div`,{className:`absolute right-4 bottom-0 h-2.5 w-2.5 rounded-full bg-primary/10`})]})}function XF({type:e=`no-data`,title:n,description:r,icon:a,actions:o,illustration:s,showIllustration:c=!0,size:l=`md`,layout:u=`vertical`,centered:f=!0,children:p,className:m,LinkComponent:h}){let _=JF[e],v=n??_.title,y=r??_.description;_.icon;let b={sm:{container:`py-8 px-4`,title:`text-base`,description:`text-sm`,icon:`h-8 w-8`},md:{container:`py-12 px-6`,title:`text-lg`,description:`text-sm`,icon:`h-10 w-10`},lg:{container:`py-16 px-8`,title:`text-xl`,description:`text-base`,icon:`h-12 w-12`}},x=[];if(_.actionLabel&&!o){let e=_.actionIcon;x.push({label:_.actionLabel,variant:`default`,icon:e?(0,g.jsx)(e,{className:`h-4 w-4`}):void 0})}let S=o||(x.length>0?x:void 0);return u===`horizontal`?(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-6`,b[l].container,f&&`justify-center`,m),children:[c&&(0,g.jsx)(`div`,{className:`flex-shrink-0`,children:s||(a?(0,g.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-muted p-4`,children:a}):(0,g.jsx)(YF,{type:e,size:l}))}),(0,g.jsxs)(`div`,{className:`flex flex-col`,children:[(0,g.jsx)(`h3`,{className:t.t(`font-semibold`,b[l].title),children:v}),(0,g.jsx)(`p`,{className:t.t(`text-muted-foreground mt-1`,b[l].description),children:y}),p&&(0,g.jsx)(`div`,{className:`mt-4`,children:p}),S&&S.length>0&&(0,g.jsx)(`div`,{className:`flex gap-3 mt-4`,children:S.map((e,t)=>(0,g.jsx)(i.n,{variant:e.variant||`default`,size:`sm`,onClick:e.onClick,asChild:!!e.href,children:e.href?h?(0,g.jsxs)(h,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(g.Fragment,{children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})]}):(0,g.jsxs)(`div`,{className:t.t(`flex flex-col items-center`,f&&`text-center`,b[l].container,m),children:[c&&(0,g.jsx)(`div`,{className:`mb-6`,children:s||(a?(0,g.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-muted p-6`,children:d.cloneElement(a,{className:t.t(b[l].icon,`text-muted-foreground`)})}):(0,g.jsx)(YF,{type:e,size:l}))}),(0,g.jsx)(`h3`,{className:t.t(`font-semibold`,b[l].title),children:v}),(0,g.jsx)(`p`,{className:t.t(`text-muted-foreground mt-2 max-w-sm`,b[l].description),children:y}),p&&(0,g.jsx)(`div`,{className:`mt-4`,children:p}),S&&S.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-3 mt-6 justify-center`,children:S.map((e,t)=>(0,g.jsx)(i.n,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?h?(0,g.jsxs)(h,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(g.Fragment,{children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})}function ZF(e){return(0,g.jsx)(XF,{type:`no-data`,...e})}function QF(e){return(0,g.jsx)(XF,{type:`no-results`,...e})}function $F(e){return(0,g.jsx)(XF,{type:`no-messages`,...e})}function eI(e){return(0,g.jsx)(XF,{type:`no-files`,...e})}function tI(e){return(0,g.jsx)(XF,{type:`no-cart`,...e})}function nI(e){return(0,g.jsx)(XF,{type:`no-notifications`,...e})}function rI(e){return(0,g.jsx)(XF,{type:`error`,...e})}var iI={404:{code:`404`,title:`Page non trouvée`,description:`Désolé, la page que vous recherchez n'existe pas ou a été déplacée.`,icon:p.FileQuestion},500:{code:`500`,title:`Erreur serveur`,description:`Une erreur inattendue s'est produite. Notre équipe a été notifiée.`,icon:p.ServerCrash},403:{code:`403`,title:`Accès refusé`,description:`Vous n'avez pas les permissions nécessaires pour accéder à cette page.`,icon:p.ShieldX},503:{code:`503`,title:`Service indisponible`,description:`Le service est temporairement indisponible. Veuillez réessayer plus tard.`,icon:p.ServerCrash},offline:{code:`Hors ligne`,title:`Vous êtes hors ligne`,description:`Vérifiez votre connexion internet et réessayez.`,icon:p.Wifi},maintenance:{code:`Maintenance`,title:`Maintenance en cours`,description:`Nous effectuons une maintenance. Nous serons bientôt de retour.`,icon:p.Construction},custom:{code:``,title:`Erreur`,description:`Une erreur s'est produite.`,icon:p.FileQuestion}};function aI({type:e,className:n}){let r=iI[e].icon;return(0,g.jsxs)(`div`,{className:t.t(`relative flex items-center justify-center`,n),children:[(0,g.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,g.jsx)(`div`,{className:`h-48 w-48 rounded-full bg-muted/50`})}),(0,g.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,g.jsx)(`div`,{className:`h-32 w-32 rounded-full bg-muted`})}),(0,g.jsx)(`div`,{className:`relative z-10 flex h-20 w-20 items-center justify-center rounded-full bg-background shadow-lg`,children:(0,g.jsx)(r,{className:`h-10 w-10 text-muted-foreground`})}),(0,g.jsx)(`div`,{className:`absolute -right-4 top-4 h-3 w-3 rounded-full bg-primary/20`}),(0,g.jsx)(`div`,{className:`absolute -left-2 bottom-8 h-2 w-2 rounded-full bg-primary/30`}),(0,g.jsx)(`div`,{className:`absolute right-8 bottom-2 h-4 w-4 rounded-full bg-primary/10`})]})}function oI({type:e=`404`,code:n,title:r,description:a,actions:o,illustration:s,showCode:c=!0,showIllustration:l=!0,showBackButton:u=!0,onBack:d,showHomeButton:f=!0,homeUrl:m=`/`,showRefreshButton:h=!1,children:_,layout:v=`centered`,size:y=`md`,className:b,LinkComponent:x}){let S=iI[e],C=n??S.code,w=r??S.title,T=a??S.description,E={sm:{container:`py-12 px-4`,code:`text-6xl`,title:`text-xl`,description:`text-sm`,illustration:`h-32 w-32`},md:{container:`py-16 px-6`,code:`text-8xl`,title:`text-2xl`,description:`text-base`,illustration:`h-48 w-48`},lg:{container:`py-24 px-8`,code:`text-9xl`,title:`text-3xl`,description:`text-lg`,illustration:`h-64 w-64`}},D=[];u&&D.push({label:`Retour`,onClick:d||(()=>window.history.back()),variant:`outline`,icon:(0,g.jsx)(p.ArrowLeft,{className:`h-4 w-4`})}),f&&D.push({label:`Accueil`,href:m,variant:`default`,icon:(0,g.jsx)(p.Home,{className:`h-4 w-4`})}),h&&D.push({label:`Réessayer`,onClick:()=>window.location.reload(),variant:`secondary`,icon:(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4`})});let O=o||D;return v===`split`?(0,g.jsxs)(`div`,{className:t.t(`min-h-screen flex flex-col lg:flex-row`,b),children:[(0,g.jsx)(`div`,{className:`flex-1 bg-muted/30 flex items-center justify-center p-8 lg:p-16`,children:(0,g.jsx)(`div`,{className:E[y].illustration,children:s||(0,g.jsx)(aI,{type:e})})}),(0,g.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8 lg:p-16`,children:(0,g.jsxs)(`div`,{className:`max-w-md`,children:[c&&C&&(0,g.jsx)(`div`,{className:t.t(`font-bold text-primary mb-4`,y===`sm`?`text-4xl`:y===`md`?`text-5xl`:`text-6xl`),children:C}),(0,g.jsx)(`h1`,{className:t.t(`font-bold tracking-tight mb-4`,E[y].title),children:w}),(0,g.jsx)(`p`,{className:t.t(`text-muted-foreground mb-8`,E[y].description),children:T}),_&&(0,g.jsx)(`div`,{className:`mb-8`,children:_}),O.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:O.map((e,t)=>(0,g.jsx)(i.n,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?x?(0,g.jsxs)(x,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(g.Fragment,{children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})})]}):(0,g.jsx)(`div`,{className:t.t(`min-h-screen flex items-center justify-center`,E[y].container,b),children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[l&&(0,g.jsx)(`div`,{className:t.t(`mb-8`,E[y].illustration),children:s||(0,g.jsx)(aI,{type:e})}),c&&C&&(0,g.jsx)(`div`,{className:t.t(`font-bold text-muted-foreground/20 mb-4`,E[y].code),children:C}),(0,g.jsx)(`h1`,{className:t.t(`font-bold tracking-tight mb-4`,E[y].title),children:w}),(0,g.jsx)(`p`,{className:t.t(`text-muted-foreground max-w-md mb-8`,E[y].description),children:T}),_&&(0,g.jsx)(`div`,{className:`mb-8`,children:_}),O.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-3 justify-center`,children:O.map((e,t)=>(0,g.jsx)(i.n,{variant:e.variant||`default`,onClick:e.onClick,asChild:!!e.href,children:e.href?x?(0,g.jsxs)(x,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(`a`,{href:e.href,children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}):(0,g.jsxs)(g.Fragment,{children:[e.icon&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]})},t))})]})})}function sI(e){return(0,g.jsx)(oI,{type:`404`,...e})}function cI(e){return(0,g.jsx)(oI,{type:`500`,showRefreshButton:!0,...e})}function lI(e){return(0,g.jsx)(oI,{type:`403`,...e})}function uI(e){return(0,g.jsx)(oI,{type:`maintenance`,showBackButton:!1,showHomeButton:!1,...e})}function dI(e){return(0,g.jsx)(oI,{type:`offline`,showRefreshButton:!0,...e})}function fI({value:e,onChange:t,placeholder:n}){return(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{type:`text`,placeholder:n,value:e,onChange:e=>t(e.target.value),className:`pl-10`})]})}function pI({categories:e,activeCategory:n,onCategoryChange:i,itemCounts:a}){return(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>i(null),className:t.t(`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors`,n===null?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`),children:[`Tous`,(0,g.jsx)(r.t,{variant:`secondary`,className:`ml-1`,children:Object.values(a).reduce((e,t)=>e+t,0)})]}),e.map(e=>(0,g.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:t.t(`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors`,n===e.id?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`),children:[e.icon,e.name,(0,g.jsx)(r.t,{variant:`secondary`,className:`ml-1`,children:a[e.id]||0})]},e.id))]})}function mI({itemId:e,helpful:n=0,notHelpful:r=0,onFeedback:i}){let[a,o]=d.useState(null),s=t=>{a===null&&(o(t),i(e,t))};return(0,g.jsxs)(`div`,{className:`flex items-center gap-4 mt-4 pt-4 border-t`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Cette réponse vous a-t-elle aidé ?`}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),disabled:a!==null,className:t.t(`inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors`,a===!0?`bg-green-100 text-green-700`:a===null?`hover:bg-muted`:`opacity-50`),children:[`👍 `,n+(a===!0?1:0)]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>s(!1),disabled:a!==null,className:t.t(`inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors`,a===!1?`bg-red-100 text-red-700`:a===null?`hover:bg-muted`:`opacity-50`),children:[`👎 `,r+(a===!1?1:0)]})]})]})}function hI({items:e,categories:n=[],title:i=`Questions fréquentes`,description:a,showSearch:o=!0,searchPlaceholder:s=`Rechercher une question...`,showCategoryFilter:c=!0,activeCategory:l,onCategoryChange:u,allowMultiple:f=!1,defaultOpen:m=[],showFeedback:h=!1,onFeedback:_,layout:v=`default`,size:y=`md`,className:b}){let[x,S]=d.useState(``),[C,w]=d.useState(null),T=l??C,E=e=>{u?u(e):w(e)},D=d.useMemo(()=>e.filter(e=>{if(x){let t=x.toLowerCase();if(!(e.question.toLowerCase().includes(t)||typeof e.answer==`string`&&e.answer.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))))return!1}return!(T&&e.category!==T)}),[e,x,T]),O=d.useMemo(()=>{let t={};return e.forEach(e=>{e.category&&(t[e.category]=(t[e.category]||0)+1)}),t},[e]),k=d.useMemo(()=>{if(v!==`grouped`)return null;let e={};return D.forEach(t=>{let n=t.category||`other`;e[n]||(e[n]=[]),e[n].push(t)}),e},[D,v]),A={sm:{title:`text-xl`,question:`text-sm`,answer:`text-sm`},md:{title:`text-2xl`,question:`text-base`,answer:`text-sm`},lg:{title:`text-3xl`,question:`text-lg`,answer:`text-base`}},j=e=>(0,g.jsx)(g.Fragment,{children:e.map(e=>(0,g.jsxs)(J,{value:e.id,className:t.t(v===`cards`&&`border rounded-lg px-4 bg-card`),children:[(0,g.jsx)(te,{className:t.t(`hover:no-underline`,A[y].question),children:(0,g.jsx)(`span`,{className:`text-left`,children:e.question})}),(0,g.jsxs)(ne,{children:[(0,g.jsx)(`div`,{className:t.t(`text-muted-foreground`,A[y].answer),children:typeof e.answer==`string`?(0,g.jsx)(`p`,{children:e.answer}):e.answer}),e.tags&&e.tags.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:e.tags.map(e=>(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs`,children:e},e))}),h&&_&&(0,g.jsx)(mI,{itemId:e.id,helpful:e.helpful,notHelpful:e.notHelpful,onFeedback:_})]})]},e.id))}),M=e=>f?(0,g.jsx)(ee,{type:`multiple`,defaultValue:m,className:`space-y-2`,children:j(e)}):(0,g.jsx)(ee,{type:`single`,defaultValue:m[0],collapsible:!0,className:`space-y-2`,children:j(e)});return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,b),children:[(0,g.jsxs)(`div`,{className:`text-center`,children:[(0,g.jsx)(`h2`,{className:t.t(`font-bold tracking-tight`,A[y].title),children:i}),a&&(0,g.jsx)(`p`,{className:`text-muted-foreground mt-2 max-w-2xl mx-auto`,children:a})]}),o&&(0,g.jsx)(`div`,{className:`max-w-md mx-auto`,children:(0,g.jsx)(fI,{value:x,onChange:S,placeholder:s})}),c&&n.length>0&&(0,g.jsx)(`div`,{className:`flex justify-center`,children:(0,g.jsx)(pI,{categories:n,activeCategory:T,onCategoryChange:E,itemCounts:O})}),D.length===0?(0,g.jsxs)(`div`,{className:`text-center py-12`,children:[(0,g.jsx)(p.HelpCircle,{className:`h-12 w-12 text-muted-foreground mx-auto mb-4`}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Aucune question ne correspond à votre recherche.`})]}):v===`grouped`&&k?(0,g.jsx)(`div`,{className:`space-y-8`,children:Object.entries(k).map(([e,t])=>{let r=n.find(t=>t.id===e);return(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`text-lg font-semibold mb-4 flex items-center gap-2`,children:[r?.icon,r?.name||e]}),M(t)]},e)})}):(0,g.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:M(D)})]})}var gI=[{id:`general`,name:`Général`,icon:(0,g.jsx)(p.HelpCircle,{className:`h-4 w-4`})},{id:`billing`,name:`Facturation`,icon:(0,g.jsx)(p.MessageCircle,{className:`h-4 w-4`})},{id:`technical`,name:`Technique`,icon:(0,g.jsx)(p.MessageCircle,{className:`h-4 w-4`})}],_I=[{id:`1`,question:`Comment créer un compte ?`,answer:`Pour créer un compte, cliquez sur le bouton 'S'inscrire' en haut à droite de la page, puis remplissez le formulaire avec vos informations personnelles.`,category:`general`,tags:[`compte`,`inscription`]},{id:`2`,question:`Comment réinitialiser mon mot de passe ?`,answer:`Cliquez sur 'Mot de passe oublié' sur la page de connexion, entrez votre email et suivez les instructions envoyées par email.`,category:`general`,tags:[`mot de passe`,`sécurité`]},{id:`3`,question:`Quels moyens de paiement acceptez-vous ?`,answer:`Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.`,category:`billing`,tags:[`paiement`,`carte`]},{id:`4`,question:`Comment annuler mon abonnement ?`,answer:`Vous pouvez annuler votre abonnement à tout moment depuis les paramètres de votre compte, section 'Abonnement'.`,category:`billing`,tags:[`abonnement`,`annulation`]},{id:`5`,question:`L'API est-elle disponible ?`,answer:`Oui, notre API REST est disponible pour tous les plans payants. Consultez notre documentation développeur pour plus d'informations.`,category:`technical`,tags:[`API`,`développeur`]}],vI={folder:{icon:p.Folder,color:`text-yellow-500`},document:{icon:p.FileText,color:`text-blue-500`},image:{icon:p.FileImage,color:`text-green-500`},video:{icon:p.FileVideo,color:`text-purple-500`},audio:{icon:p.FileAudio,color:`text-pink-500`},archive:{icon:p.FileArchive,color:`text-orange-500`},code:{icon:p.FileCode,color:`text-cyan-500`},other:{icon:p.File,color:`text-gray-500`}};function yI(e){if(!e)return`-`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=0,r=e;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${r.toFixed(1)} ${t[n]}`}function bI({breadcrumbs:e,viewMode:n,onViewModeChange:r,onNavigate:a,onCreateFolder:o,onUpload:c,onRefresh:l,showSearch:u,onSearch:f,selectedCount:m,onDeleteSelected:h,onDownloadSelected:_}){let[v,y]=d.useState(``);return(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:l,children:(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4`})}),c&&(0,g.jsxs)(i.n,{variant:`outline`,onClick:c,children:[(0,g.jsx)(p.Upload,{className:`h-4 w-4 mr-2`}),`Importer`]}),o&&(0,g.jsxs)(i.n,{variant:`outline`,onClick:o,children:[(0,g.jsx)(p.FolderPlus,{className:`h-4 w-4 mr-2`}),`Nouveau dossier`]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&f&&(0,g.jsxs)(`div`,{className:`relative w-64`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher...`,value:v,onChange:e=>{y(e.target.value),f(e.target.value)},className:`pl-9`})]}),(0,g.jsx)(i.n,{variant:n===`grid`?`secondary`:`ghost`,size:`icon`,onClick:()=>r(`grid`),children:(0,g.jsx)(p.Grid,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{variant:n===`list`?`secondary`:`ghost`,size:`icon`,onClick:()=>r(`list`),children:(0,g.jsx)(p.List,{className:`h-4 w-4`})})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1 text-sm`,children:[(0,g.jsx)(`button`,{onClick:()=>a(`/`),className:`flex items-center gap-1 hover:text-primary`,children:(0,g.jsx)(p.Home,{className:`h-4 w-4`})}),e.map((n,r)=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`button`,{onClick:()=>a(n.path),className:t.t(`hover:text-primary`,r===e.length-1&&`font-medium`),children:n.name})]},n.id))]}),m>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-4 p-3 bg-muted rounded-lg`,children:[(0,g.jsxs)(`span`,{className:`text-sm font-medium`,children:[m,` élément(s) sélectionné(s)`]}),_&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:_,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Télécharger`]}),h&&(0,g.jsxs)(i.n,{variant:`destructive`,size:`sm`,onClick:h,children:[(0,g.jsx)(p.Trash2,{className:`h-4 w-4 mr-2`}),`Supprimer`]})]})]})}function xI({file:e,viewMode:n,isSelected:a,onSelect:o,onOpen:s,onRename:c,onDelete:l,onDownload:u,onShare:d,onToggleStar:f}){let m=vI[e.type],h=m.icon,_=typeof e.modifiedAt==`string`?new Date(e.modifiedAt):e.modifiedAt,v=()=>{e.type===`folder`&&s()};return n===`grid`?(0,g.jsxs)(`div`,{className:t.t(`relative group p-4 rounded-lg border cursor-pointer transition-colors`,a?`bg-primary/10 border-primary`:`hover:bg-muted`),onClick:()=>o(!a),onDoubleClick:v,children:[(0,g.jsx)(`div`,{className:`absolute top-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,g.jsx)(Se,{checked:a,onCheckedChange:e=>o(e),onClick:e=>e.stopPropagation()})}),e.starred&&(0,g.jsx)(p.Star,{className:`absolute top-2 right-2 h-4 w-4 text-yellow-500 fill-yellow-500`}),(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[e.thumbnail&&e.type===`image`?(0,g.jsx)(`img`,{src:e.thumbnail,alt:e.name,className:`w-16 h-16 object-cover rounded`}):(0,g.jsx)(h,{className:t.t(`h-12 w-12`,m.color)}),(0,g.jsx)(`span`,{className:`text-sm font-medium text-center line-clamp-2`,children:e.name}),e.type!==`folder`&&(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:yI(e.size)})]}),(0,g.jsx)(`div`,{className:`absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:s,children:[(0,g.jsx)(p.Eye,{className:`mr-2 h-4 w-4`}),`Ouvrir`]}),c&&(0,g.jsxs)($,{onClick:c,children:[(0,g.jsx)(p.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),u&&e.type!==`folder`&&(0,g.jsxs)($,{onClick:u,children:[(0,g.jsx)(p.Download,{className:`mr-2 h-4 w-4`}),`Télécharger`]}),d&&(0,g.jsxs)($,{onClick:d,children:[(0,g.jsx)(p.Share2,{className:`mr-2 h-4 w-4`}),`Partager`]}),f&&(0,g.jsx)($,{onClick:f,children:e.starred?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.StarOff,{className:`mr-2 h-4 w-4`}),`Retirer des favoris`]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Star,{className:`mr-2 h-4 w-4`}),`Ajouter aux favoris`]})}),l&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:l,className:`text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})})]}):(0,g.jsxs)(hr,{className:t.t(`cursor-pointer`,a&&`bg-primary/10`),onClick:()=>o(!a),onDoubleClick:v,children:[(0,g.jsx)(_r,{className:`w-12`,children:(0,g.jsx)(Se,{checked:a,onCheckedChange:e=>o(e),onClick:e=>e.stopPropagation()})}),(0,g.jsx)(_r,{children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(h,{className:t.t(`h-5 w-5`,m.color)}),(0,g.jsx)(`span`,{className:`font-medium`,children:e.name}),e.starred&&(0,g.jsx)(p.Star,{className:`h-4 w-4 text-yellow-500 fill-yellow-500`}),e.shared&&(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:`Partagé`})]})}),(0,g.jsx)(_r,{className:`text-muted-foreground`,children:yI(e.size)}),(0,g.jsx)(_r,{className:`text-muted-foreground`,children:_.toLocaleDateString(`fr-FR`)}),(0,g.jsx)(_r,{children:(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:s,children:[(0,g.jsx)(p.Eye,{className:`mr-2 h-4 w-4`}),`Ouvrir`]}),c&&(0,g.jsxs)($,{onClick:c,children:[(0,g.jsx)(p.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),u&&e.type!==`folder`&&(0,g.jsxs)($,{onClick:u,children:[(0,g.jsx)(p.Download,{className:`mr-2 h-4 w-4`}),`Télécharger`]}),l&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:l,className:`text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]})})]})}function SI({files:e,currentPath:n=`/`,breadcrumbs:r=[],selectedFiles:a=[],onSelectionChange:o,onNavigate:c,onFileOpen:l,onDownload:u,onDelete:f,onRename:m,onCopy:h,onMove:_,onCreateFolder:v,onUpload:y,onShare:b,onToggleStar:x,onRefresh:S,viewMode:C,onViewModeChange:w,showSearch:T=!0,onSearch:E,showHeader:D=!0,showActions:O=!0,loading:k=!1,className:A}){let[j,M]=d.useState(`grid`),[N,P]=d.useState(!1),[F,I]=d.useState(null),[L,R]=d.useState(``),[z,B]=d.useState(!1),[V,H]=d.useState([]),[U,W]=d.useState(!1),[G,K]=d.useState(``),q=C??j,ee=e=>{w?w(e):M(e)},J=(e,t)=>{t?o?.([...a,e]):o?.(a.filter(t=>t!==e))},te=e=>{e.type===`folder`?c?.(e.path,e.id):l?.(e)},ne=e=>{I(e),R(e.name),P(!0)},ie=()=>{F&&L.trim()&&L!==F.name&&m?.(F.id,L.trim()),P(!1),I(null)},ae=()=>{H(a),B(!0)},oe=()=>{f?.(V),B(!1),H([]),o?.([])},me=()=>{G.trim()&&(v?.(G.trim(),n),W(!1),K(``))},he=[...e].sort((e,t)=>e.type===`folder`&&t.type!==`folder`?-1:e.type!==`folder`&&t.type===`folder`?1:e.name.localeCompare(t.name));return(0,g.jsxs)(`div`,{className:t.t(`space-y-4`,A),children:[D&&(0,g.jsx)(bI,{breadcrumbs:r,viewMode:q,onViewModeChange:ee,onNavigate:e=>c?.(e),onCreateFolder:v?()=>W(!0):void 0,onUpload:y?()=>{}:void 0,onRefresh:S,showSearch:T,onSearch:E,selectedCount:a.length,onDeleteSelected:f?ae:void 0,onDownloadSelected:u?()=>u(a):void 0}),k?(0,g.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,g.jsx)(p.RefreshCw,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):he.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-muted-foreground`,children:[(0,g.jsx)(p.Folder,{className:`h-12 w-12 mb-4`}),(0,g.jsx)(`p`,{children:`Ce dossier est vide`})]}):q===`grid`?(0,g.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4`,children:he.map(e=>(0,g.jsx)(xI,{file:e,viewMode:`grid`,isSelected:a.includes(e.id),onSelect:t=>J(e.id,t),onOpen:()=>te(e),onRename:m?()=>ne(e):void 0,onDelete:f?()=>{H([e.id]),B(!0)}:void 0,onDownload:u?()=>u([e.id]):void 0,onShare:b?()=>b(e.id):void 0,onToggleStar:x?()=>x(e.id):void 0},e.id))}):(0,g.jsxs)(dr,{children:[(0,g.jsx)(fr,{children:(0,g.jsxs)(hr,{children:[(0,g.jsx)(gr,{className:`w-12`,children:(0,g.jsx)(Se,{checked:a.length===e.length&&e.length>0,onCheckedChange:t=>{t?o?.(e.map(e=>e.id)):o?.([])}})}),(0,g.jsx)(gr,{children:`Nom`}),(0,g.jsx)(gr,{children:`Taille`}),(0,g.jsx)(gr,{children:`Modifié`}),(0,g.jsx)(gr,{className:`w-12`})]})}),(0,g.jsx)(pr,{children:he.map(e=>(0,g.jsx)(xI,{file:e,viewMode:`list`,isSelected:a.includes(e.id),onSelect:t=>J(e.id,t),onOpen:()=>te(e),onRename:m?()=>ne(e):void 0,onDelete:f?()=>{H([e.id]),B(!0)}:void 0,onDownload:u?()=>u([e.id]):void 0,onShare:b?()=>b(e.id):void 0,onToggleStar:x?()=>x(e.id):void 0},e.id))})]}),(0,g.jsx)(mt,{open:N,onOpenChange:P,children:(0,g.jsxs)(yt,{children:[(0,g.jsx)(bt,{children:(0,g.jsx)(St,{children:`Renommer`})}),(0,g.jsx)(s.t,{value:L,onChange:e=>R(e.target.value),placeholder:`Nouveau nom`,onKeyDown:e=>e.key===`Enter`&&ie()}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>P(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:ie,children:`Renommer`})]})]})}),(0,g.jsx)(re,{open:z,onOpenChange:B,children:(0,g.jsxs)(se,{children:[(0,g.jsxs)(ce,{children:[(0,g.jsx)(ue,{children:`Supprimer ?`}),(0,g.jsxs)(de,{children:[`Êtes-vous sûr de vouloir supprimer `,V.length,` élément(s) ? Cette action est irréversible.`]})]}),(0,g.jsxs)(le,{children:[(0,g.jsx)(pe,{children:`Annuler`}),(0,g.jsx)(fe,{onClick:oe,children:`Supprimer`})]})]})}),(0,g.jsx)(mt,{open:U,onOpenChange:W,children:(0,g.jsxs)(yt,{children:[(0,g.jsx)(bt,{children:(0,g.jsx)(St,{children:`Nouveau dossier`})}),(0,g.jsx)(s.t,{value:G,onChange:e=>K(e.target.value),placeholder:`Nom du dossier`,onKeyDown:e=>e.key===`Enter`&&me()}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>W(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:me,children:`Créer`})]})]})})]})}var CI=[{id:`1`,name:`Documents`,type:`folder`,path:`/Documents`,createdAt:new Date(`2024-01-01`),modifiedAt:new Date(`2024-01-15`)},{id:`2`,name:`Images`,type:`folder`,path:`/Images`,createdAt:new Date(`2024-01-01`),modifiedAt:new Date(`2024-01-10`),starred:!0},{id:`3`,name:`Rapport Q4.pdf`,type:`document`,path:`/Rapport Q4.pdf`,size:2456e3,createdAt:new Date(`2024-01-05`),modifiedAt:new Date(`2024-01-05`)},{id:`4`,name:`Photo vacances.jpg`,type:`image`,path:`/Photo vacances.jpg`,size:567e4,createdAt:new Date(`2024-01-08`),modifiedAt:new Date(`2024-01-08`)},{id:`5`,name:`Présentation.pptx`,type:`document`,path:`/Présentation.pptx`,size:89e5,createdAt:new Date(`2024-01-12`),modifiedAt:new Date(`2024-01-14`),shared:!0}],wI=[{id:`root`,name:`Mes fichiers`,path:`/`}],TI={low:{label:`Basse`,color:`bg-gray-500`,icon:p.Clock},medium:{label:`Moyenne`,color:`bg-blue-500`,icon:p.Clock},high:{label:`Haute`,color:`bg-orange-500`,icon:p.AlertCircle},urgent:{label:`Urgente`,color:`bg-red-500`,icon:p.AlertCircle}};function EI({card:e,columnId:a,showAssignees:o,showLabels:s,showPriority:c,showDueDate:l,draggable:u,onCardClick:f,onCardEdit:m,onCardDelete:h,onDragStart:_}){let v=d.useMemo(()=>e.dueDate?(typeof e.dueDate==`string`?new Date(e.dueDate):e.dueDate)<new Date:!1,[e.dueDate]);return(0,g.jsx)(Y,{className:t.t(`cursor-pointer hover:shadow-md transition-shadow`,u&&`cursor-grab active:cursor-grabbing`),draggable:u,onDragStart:t=>_?.(t,e.id,a),onClick:()=>f?.(e,a),children:(0,g.jsxs)(Q,{className:`p-3 space-y-2`,children:[s&&e.labels&&e.labels.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.labels.map(e=>(0,g.jsx)(`div`,{className:`h-1.5 w-8 rounded-full`,style:{backgroundColor:e.color},title:e.name},e.id))}),(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,g.jsx)(`h4`,{className:`text-sm font-medium leading-tight`,children:e.title}),(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-6 w-6 flex-shrink-0`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-3 w-3`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:t=>{t.stopPropagation(),f?.(e,a)},children:[(0,g.jsx)(p.Edit,{className:`mr-2 h-4 w-4`}),`Modifier`]}),(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:t=>{t.stopPropagation(),h?.(e.id,a)},className:`text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]}),e.description&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between pt-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c&&e.priority&&(0,g.jsx)(`div`,{className:t.t(`h-2 w-2 rounded-full`,TI[e.priority].color),title:TI[e.priority].label}),l&&e.dueDate&&(0,g.jsxs)(r.t,{variant:v?`destructive`:`outline`,className:`text-xs px-1.5 py-0`,children:[(0,g.jsx)(p.Calendar,{className:`h-3 w-3 mr-1`}),(e=>(typeof e==`string`?new Date(e):e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`}))(e.dueDate)]})]}),o&&e.assignees&&e.assignees.length>0&&(0,g.jsxs)(`div`,{className:`flex -space-x-1`,children:[e.assignees.slice(0,3).map(e=>(0,g.jsxs)(n.m,{className:`h-5 w-5 border-2 border-background`,children:[(0,g.jsx)(n.g,{src:e.avatar}),(0,g.jsx)(n.h,{className:`text-[8px]`,children:e.name.charAt(0)})]},e.id)),e.assignees.length>3&&(0,g.jsxs)(`div`,{className:`h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[8px] border-2 border-background`,children:[`+`,e.assignees.length-3]})]})]})]})})}function DI({column:e,showCardCount:t,showAddCard:n,showAssignees:a,showLabels:c,showPriority:l,showDueDate:u,draggable:f,onCardClick:m,onCardAdd:h,onCardEdit:_,onCardDelete:v,onColumnEdit:y,onColumnDelete:b,onDragStart:x,onDragOver:S,onDrop:C}){let[w,T]=d.useState(!1),[E,D]=d.useState(``),[O,k]=d.useState(!1),[A,j]=d.useState(e.title),M=()=>{E.trim()&&(h?.(e.id,{title:E.trim()}),D(``),T(!1))},N=()=>{A.trim()&&A!==e.title&&y?.(e.id,{title:A.trim()}),k(!1)},P=e.limit&&e.cards.length>=e.limit;return(0,g.jsxs)(`div`,{className:`flex flex-col w-72 flex-shrink-0 bg-muted/50 rounded-lg`,onDragOver:S,onDrop:t=>C?.(t,e.id),children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between p-3 border-b`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.color&&(0,g.jsx)(`div`,{className:`h-3 w-3 rounded-full`,style:{backgroundColor:e.color}}),O?(0,g.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,g.jsx)(s.t,{value:A,onChange:e=>j(e.target.value),className:`h-7 text-sm font-semibold`,autoFocus:!0,onBlur:N,onKeyDown:e=>{e.key===`Enter`&&N(),e.key===`Escape`&&k(!1)}})}):(0,g.jsx)(`h3`,{className:`font-semibold text-sm cursor-pointer`,onClick:()=>k(!0),children:e.title}),t&&(0,g.jsxs)(r.t,{variant:`secondary`,className:`text-xs`,children:[e.cards.length,e.limit&&`/${e.limit}`]})]}),(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:()=>k(!0),children:[(0,g.jsx)(p.Edit,{className:`mr-2 h-4 w-4`}),`Renommer`]}),(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:()=>b?.(e.id),className:`text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Supprimer`]})]})]})]}),(0,g.jsxs)(`div`,{className:`flex-1 p-2 space-y-2 min-h-[200px] overflow-y-auto`,children:[e.cards.map(t=>(0,g.jsx)(EI,{card:t,columnId:e.id,showAssignees:a,showLabels:c,showPriority:l,showDueDate:u,draggable:f,onCardClick:m,onCardEdit:_,onCardDelete:v,onDragStart:x},t.id)),w&&(0,g.jsxs)(Y,{className:`p-2`,children:[(0,g.jsx)(o.t,{placeholder:`Titre de la carte...`,value:E,onChange:e=>D(e.target.value),className:`min-h-[60px] text-sm`,autoFocus:!0}),(0,g.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,g.jsx)(i.n,{size:`sm`,onClick:M,children:`Ajouter`}),(0,g.jsx)(i.n,{size:`sm`,variant:`ghost`,onClick:()=>{T(!1),D(``)},children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]})]})]}),n&&!w&&!P&&(0,g.jsx)(`div`,{className:`p-2 border-t`,children:(0,g.jsxs)(i.n,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>T(!0),children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-2`}),`Ajouter une carte`]})}),P&&(0,g.jsx)(`div`,{className:`p-2 border-t text-center text-xs text-muted-foreground`,children:`Limite atteinte`})]})}function OI({columns:e,onColumnsChange:n,onCardClick:r,onCardAdd:a,onCardEdit:o,onCardDelete:c,onCardMove:l,onColumnAdd:u,onColumnEdit:f,onColumnDelete:m,showAddCard:h=!0,showAddColumn:_=!0,showCardCount:v=!0,showAssignees:y=!0,showLabels:b=!0,showPriority:x=!0,showDueDate:S=!0,draggable:C=!0,availableLabels:w=[],availableAssignees:T=[],className:E}){let[D,O]=d.useState(e),[k,A]=d.useState(null),[j,M]=d.useState(!1),[N,P]=d.useState(``);d.useEffect(()=>{O(e)},[e]);let F=(e,t,n)=>{A({cardId:t,columnId:n}),e.dataTransfer.effectAllowed=`move`},I=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},L=(e,t)=>{if(e.preventDefault(),!k)return;let{cardId:r,columnId:i}=k;if(i===t){A(null);return}if(l)l(r,i,t,0);else{let e=D.map(e=>{if(e.id===i)return{...e,cards:e.cards.filter(e=>e.id!==r)};if(e.id===t){let t=D.find(e=>e.id===i)?.cards.find(e=>e.id===r);if(t)return{...e,cards:[...e.cards,t]}}return e});O(e),n?.(e)}A(null)},R=(e,t)=>{if(a)a(e,t);else{let r={id:`card-${Date.now()}`,title:t.title||`Nouvelle carte`,...t},i=D.map(t=>t.id===e?{...t,cards:[...t.cards,r]}:t);O(i),n?.(i)}},z=(e,t)=>{if(c)c(e,t);else{let r=D.map(n=>n.id===t?{...n,cards:n.cards.filter(t=>t.id!==e)}:n);O(r),n?.(r)}},B=e=>{if(m)m(e);else{let t=D.filter(t=>t.id!==e);O(t),n?.(t)}},V=()=>{if(N.trim()){let e={id:`column-${Date.now()}`,title:N.trim(),cards:[]};if(u)u(e);else{let t=[...D,e];O(t),n?.(t)}P(``),M(!1)}};return(0,g.jsx)(`div`,{className:t.t(`overflow-x-auto`,E),children:(0,g.jsxs)(`div`,{className:`flex gap-4 p-4 min-h-[500px]`,children:[D.map(e=>(0,g.jsx)(DI,{column:e,showCardCount:v,showAddCard:h,showAssignees:y,showLabels:b,showPriority:x,showDueDate:S,draggable:C,onCardClick:r,onCardAdd:R,onCardEdit:o,onCardDelete:z,onColumnEdit:f,onColumnDelete:B,onDragStart:F,onDragOver:I,onDrop:L},e.id)),_&&(0,g.jsx)(`div`,{className:`w-72 flex-shrink-0`,children:j?(0,g.jsxs)(Y,{className:`p-3`,children:[(0,g.jsx)(s.t,{placeholder:`Titre de la colonne...`,value:N,onChange:e=>P(e.target.value),autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&V(),e.key===`Escape`&&M(!1)}}),(0,g.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,g.jsx)(i.n,{size:`sm`,onClick:V,children:`Ajouter`}),(0,g.jsx)(i.n,{size:`sm`,variant:`ghost`,onClick:()=>{M(!1),P(``)},children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]})]}):(0,g.jsxs)(i.n,{variant:`outline`,className:`w-full justify-start h-12`,onClick:()=>M(!0),children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-2`}),`Ajouter une colonne`]})})]})})}var kI=[{id:`todo`,title:`À faire`,color:`#6b7280`,cards:[{id:`1`,title:`Implémenter l'authentification`,description:`Ajouter le login/logout avec JWT`,priority:`high`,labels:[{id:`dev`,name:`Dev`,color:`#3b82f6`}],assignees:[{id:`1`,name:`Marie D.`}]},{id:`2`,title:`Créer les maquettes`,priority:`medium`,labels:[{id:`design`,name:`Design`,color:`#8b5cf6`}]}]},{id:`in-progress`,title:`En cours`,color:`#3b82f6`,limit:3,cards:[{id:`3`,title:`Refactoring du dashboard`,priority:`medium`,assignees:[{id:`2`,name:`Pierre M.`}],dueDate:new Date(Date.now()+1e3*60*60*24*2)}]},{id:`review`,title:`En revue`,color:`#f59e0b`,cards:[]},{id:`done`,title:`Terminé`,color:`#10b981`,cards:[{id:`4`,title:`Setup du projet`,priority:`low`}]}],AI=[{id:`dev`,name:`Dev`,color:`#3b82f6`},{id:`design`,name:`Design`,color:`#8b5cf6`},{id:`bug`,name:`Bug`,color:`#ef4444`},{id:`feature`,name:`Feature`,color:`#10b981`}],jI=d.createContext({});function MI(){return d.useContext(jI)}function NI({logo:e,brandName:n=`Brand`,navItems:r=[],showLoginButton:a=!0,loginButtonText:o=`Se connecter`,onLogin:s,loginHref:c}){let[l,u]=d.useState(!1),{LinkComponent:f}=MI(),m=(e,t,n,r)=>f?(0,g.jsx)(f,{href:e,className:t,onClick:r,children:n}):(0,g.jsx)(`a`,{href:e,className:t,onClick:r,children:n});return(0,g.jsxs)(`nav`,{className:`sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:[(0,g.jsxs)(`div`,{className:`container flex h-16 items-center justify-between`,children:[m(`/`,`flex items-center gap-2 font-bold text-xl`,(0,g.jsxs)(g.Fragment,{children:[e,(0,g.jsx)(`span`,{children:n})]})),(0,g.jsx)(`div`,{className:`hidden md:flex items-center gap-6`,children:r.map(e=>m(e.href,t.t(`text-sm font-medium transition-colors hover:text-primary`,e.isActive?`text-primary`:`text-muted-foreground`),e.label))}),(0,g.jsx)(`div`,{className:`hidden md:flex items-center gap-4`,children:a&&(0,g.jsx)(i.n,{variant:`default`,onClick:s,asChild:!!c,children:c?f?(0,g.jsx)(f,{href:c,children:o}):(0,g.jsx)(`a`,{href:c,children:o}):o})}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,className:`md:hidden`,onClick:()=>u(!l),children:l?(0,g.jsx)(p.X,{className:`h-5 w-5`}):(0,g.jsx)(p.Menu,{className:`h-5 w-5`})})]}),l&&(0,g.jsx)(`div`,{className:`md:hidden border-t bg-background p-4`,children:(0,g.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[r.map(e=>m(e.href,`text-sm font-medium`,e.label,()=>u(!1))),a&&(0,g.jsx)(i.n,{onClick:s,asChild:!!c,children:c?f?(0,g.jsx)(f,{href:c,children:o}):(0,g.jsx)(`a`,{href:c,children:o}):o})]})})]})}function PI({badge:e,title:t,highlightedTitle:n,description:a,primaryButtonText:o=`Commencer`,primaryButtonAction:s,primaryButtonHref:c,secondaryButtonText:l,secondaryButtonAction:u,secondaryButtonHref:d,image:f,stats:m}){let{LinkComponent:h}=MI();return(0,g.jsx)(`section`,{className:`container py-24 md:py-32`,children:(0,g.jsxs)(`div`,{className:`flex flex-col lg:flex-row items-center gap-12`,children:[(0,g.jsxs)(`div`,{className:`flex-1 text-center lg:text-left`,children:[e&&(0,g.jsx)(r.t,{variant:`secondary`,className:`mb-4`,children:e}),(0,g.jsxs)(`h1`,{className:`text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight mb-6`,children:[t,` `,n&&(0,g.jsx)(`span`,{className:`text-primary`,children:n})]}),(0,g.jsx)(`p`,{className:`text-lg md:text-xl text-muted-foreground mb-8 max-w-2xl lg:max-w-none`,children:a}),(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-8`,children:[(0,g.jsx)(i.n,{size:`lg`,onClick:s,asChild:!!c,children:c?h?(0,g.jsxs)(h,{href:c,children:[o,(0,g.jsx)(p.ArrowRight,{className:`ml-2 h-4 w-4`})]}):(0,g.jsxs)(`a`,{href:c,children:[o,(0,g.jsx)(p.ArrowRight,{className:`ml-2 h-4 w-4`})]}):(0,g.jsxs)(g.Fragment,{children:[o,(0,g.jsx)(p.ArrowRight,{className:`ml-2 h-4 w-4`})]})}),l&&(0,g.jsx)(i.n,{size:`lg`,variant:`outline`,onClick:u,asChild:!!d,children:d?h?(0,g.jsxs)(h,{href:d,children:[(0,g.jsx)(p.Play,{className:`mr-2 h-4 w-4`}),l]}):(0,g.jsxs)(`a`,{href:d,children:[(0,g.jsx)(p.Play,{className:`mr-2 h-4 w-4`}),l]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Play,{className:`mr-2 h-4 w-4`}),l]})})]}),m&&m.length>0&&(0,g.jsx)(`div`,{className:`flex gap-8 justify-center lg:justify-start`,children:m.map((e,t)=>(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-2xl md:text-3xl font-bold`,children:e.value}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.label})]},t))})]}),f&&(0,g.jsx)(`div`,{className:`flex-1 w-full lg:w-auto`,children:f})]})})}function FI({title:e=`Fonctionnalités`,description:t,features:n}){return(0,g.jsxs)(`section`,{className:`container py-24 bg-muted/30`,children:[(0,g.jsxs)(`div`,{className:`text-center mb-12`,children:[(0,g.jsx)(`h2`,{className:`text-3xl md:text-4xl font-bold tracking-tight mb-4`,children:e}),t&&(0,g.jsx)(`p`,{className:`text-lg text-muted-foreground max-w-2xl mx-auto`,children:t})]}),(0,g.jsx)(`div`,{className:`grid md:grid-cols-2 lg:grid-cols-3 gap-6`,children:n.map(e=>(0,g.jsxs)(Y,{className:`bg-background`,children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(`div`,{className:`h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4`,children:(0,g.jsx)(`span`,{className:`text-primary`,children:e.icon})}),(0,g.jsx)(Z,{className:`text-xl`,children:e.title})]}),(0,g.jsx)(Q,{children:(0,g.jsx)(be,{className:`text-base`,children:e.description})})]},e.id))})]})}function II({title:e=`Ce que disent nos clients`,testimonials:n}){return(0,g.jsxs)(`section`,{className:`container py-24`,children:[(0,g.jsx)(`h2`,{className:`text-3xl md:text-4xl font-bold tracking-tight text-center mb-12`,children:e}),(0,g.jsx)(`div`,{className:`grid md:grid-cols-2 lg:grid-cols-3 gap-6`,children:n.map(e=>(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`pt-6`,children:[e.rating&&(0,g.jsx)(`div`,{className:`flex gap-1 mb-4`,children:Array.from({length:5}).map((n,r)=>(0,g.jsx)(p.Star,{className:t.t(`h-4 w-4`,r<e.rating?`text-yellow-400 fill-yellow-400`:`text-muted-foreground`)},r))}),(0,g.jsxs)(`p`,{className:`text-muted-foreground mb-6`,children:[`"`,e.content,`"`]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.avatar?(0,g.jsx)(`img`,{src:e.avatar,alt:e.author,className:`h-10 w-10 rounded-full object-cover`}):(0,g.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center`,children:(0,g.jsx)(`span`,{className:`text-sm font-medium text-primary`,children:e.author.charAt(0)})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`font-medium`,children:e.author}),(0,g.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[e.role,e.company&&` @ ${e.company}`]})]})]})]})},e.id))})]})}function LI({title:e,description:n,buttonText:r,buttonAction:a,buttonHref:o,secondaryButtonText:s,secondaryButtonAction:c,variant:l=`default`}){let{LinkComponent:u}=MI();return(0,g.jsx)(`section`,{className:t.t(`py-24`,{default:`bg-muted/50`,gradient:`bg-gradient-to-r from-primary/10 via-primary/5 to-background`,dark:`bg-foreground text-background`}[l]),children:(0,g.jsx)(`div`,{className:`container`,children:(0,g.jsxs)(`div`,{className:`text-center max-w-2xl mx-auto`,children:[(0,g.jsx)(`h2`,{className:t.t(`text-3xl md:text-4xl font-bold tracking-tight mb-4`,l===`dark`&&`text-background`),children:e}),n&&(0,g.jsx)(`p`,{className:t.t(`text-lg mb-8`,l===`dark`?`text-background/80`:`text-muted-foreground`),children:n}),(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center`,children:[(0,g.jsx)(i.n,{size:`lg`,variant:l===`dark`?`secondary`:`default`,onClick:a,asChild:!!o,children:o?u?(0,g.jsxs)(u,{href:o,children:[r,(0,g.jsx)(p.ChevronRight,{className:`ml-2 h-4 w-4`})]}):(0,g.jsxs)(`a`,{href:o,children:[r,(0,g.jsx)(p.ChevronRight,{className:`ml-2 h-4 w-4`})]}):(0,g.jsxs)(g.Fragment,{children:[r,(0,g.jsx)(p.ChevronRight,{className:`ml-2 h-4 w-4`})]})}),s&&(0,g.jsx)(i.n,{size:`lg`,variant:`outline`,onClick:c,className:l===`dark`?`border-background/20 text-background hover:bg-background/10`:``,children:s})]})]})})})}function RI({logo:e,brandName:n=`Brand`,navItems:r,showLoginButton:i=!0,loginButtonText:a=`Se connecter`,onLogin:o,loginHref:s,hero:c,features:l,featuresTitle:u,featuresDescription:f,testimonials:p,testimonialsTitle:m,cta:h,footer:_,className:v,LinkComponent:y}){let b=d.useMemo(()=>({LinkComponent:y}),[y]);return(0,g.jsx)(jI.Provider,{value:b,children:(0,g.jsxs)(`div`,{className:t.t(`min-h-screen`,v),children:[(0,g.jsx)(NI,{logo:e,brandName:n,navItems:r,showLoginButton:i,loginButtonText:a,onLogin:o,loginHref:s}),c&&(0,g.jsx)(PI,{...c}),l&&l.length>0&&(0,g.jsx)(FI,{title:u,description:f,features:l}),p&&p.length>0&&(0,g.jsx)(II,{title:m,testimonials:p}),h&&(0,g.jsx)(LI,{...h}),_]})})}var zI=[{label:`Fonctionnalités`,href:`#features`},{label:`Tarifs`,href:`#pricing`},{label:`Témoignages`,href:`#testimonials`},{label:`Contact`,href:`#contact`}],BI=[{id:`1`,icon:(0,g.jsx)(p.Zap,{className:`h-6 w-6`}),title:`Rapide et performant`,description:`Optimisé pour la vitesse avec des temps de chargement minimaux.`},{id:`2`,icon:(0,g.jsx)(p.Shield,{className:`h-6 w-6`}),title:`Sécurisé`,description:`Vos données sont protégées avec un chiffrement de bout en bout.`},{id:`3`,icon:(0,g.jsx)(p.Users,{className:`h-6 w-6`}),title:`Collaboration`,description:`Travaillez en équipe avec des outils de collaboration intégrés.`},{id:`4`,icon:(0,g.jsx)(p.Globe,{className:`h-6 w-6`}),title:`Accessible partout`,description:`Accédez à votre espace depuis n'importe quel appareil.`}],VI=[{id:`1`,content:`Cette solution a transformé notre façon de travailler. Nous avons gagné un temps précieux.`,author:`Marie Dupont`,role:`CEO`,company:`TechCorp`,rating:5},{id:`2`,content:`Interface intuitive et support réactif. Je recommande vivement.`,author:`Pierre Martin`,role:`CTO`,company:`StartupXYZ`,rating:5},{id:`3`,content:`Le meilleur outil que nous ayons utilisé pour gérer nos projets.`,author:`Sophie Bernard`,role:`Product Manager`,company:`InnoLab`,rating:5}],HI={badge:`Nouveau`,title:`La solution pour`,highlightedTitle:`votre entreprise`,description:`Simplifiez votre quotidien avec notre plateforme tout-en-un. Gagnez du temps et concentrez-vous sur l'essentiel.`,primaryButtonText:`Essayer gratuitement`,secondaryButtonText:`Voir la démo`,stats:[{value:`10K+`,label:`Utilisateurs`},{value:`99.9%`,label:`Uptime`},{value:`24/7`,label:`Support`}]},UI={title:`Prêt à commencer ?`,description:`Rejoignez des milliers d'entreprises qui nous font confiance.`,buttonText:`Créer un compte gratuit`,secondaryButtonText:`Contacter les ventes`,variant:`gradient`},WI=d.createContext({});function GI(){return d.useContext(WI)}function KI({period:e,onChange:n,yearlyDiscount:i}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-center gap-4 mb-8`,children:[(0,g.jsx)(o.n,{htmlFor:`billing-toggle`,className:t.t(`cursor-pointer transition-colors`,e===`monthly`?`text-foreground`:`text-muted-foreground`),children:`Mensuel`}),(0,g.jsx)(ur,{id:`billing-toggle`,checked:e===`yearly`,onCheckedChange:e=>n(e?`yearly`:`monthly`)}),(0,g.jsxs)(o.n,{htmlFor:`billing-toggle`,className:t.t(`cursor-pointer transition-colors flex items-center gap-2`,e===`yearly`?`text-foreground`:`text-muted-foreground`),children:[`Annuel`,i&&(0,g.jsxs)(r.t,{variant:`secondary`,className:`text-xs`,children:[`-`,i]})]})]})}function qI({plan:e,billingPeriod:a}){let{LinkComponent:o}=GI(),s=a===`yearly`&&e.priceYearly!==void 0?e.priceYearly:e.price,c=a===`yearly`&&e.periodYearly?e.periodYearly:e.period||`/mois`,l=typeof s==`string`;return(0,g.jsxs)(Y,{className:t.t(`relative flex flex-col`,e.popular&&`border-primary shadow-lg scale-105`),children:[e.popular&&(0,g.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2`,children:(0,g.jsxs)(r.t,{className:`px-3`,children:[(0,g.jsx)(p.Zap,{className:`h-3 w-3 mr-1`}),e.badge||`Populaire`]})}),(0,g.jsxs)(X,{className:`text-center pb-2`,children:[(0,g.jsx)(Z,{className:`text-xl`,children:e.name}),e.description&&(0,g.jsx)(be,{children:e.description})]}),(0,g.jsxs)(Q,{className:`flex-1`,children:[(0,g.jsx)(`div`,{className:`text-center mb-6`,children:l?(0,g.jsx)(`div`,{className:`text-3xl font-bold`,children:s}):(0,g.jsxs)(`div`,{className:`flex items-baseline justify-center`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground mr-1`,children:e.currency||`€`}),(0,g.jsx)(`span`,{className:`text-4xl font-bold`,children:s}),(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground ml-1`,children:c})]})}),(0,g.jsx)(`ul`,{className:`space-y-3`,children:e.features.map((e,r)=>(0,g.jsxs)(`li`,{className:`flex items-start gap-2`,children:[e.included===!0?(0,g.jsx)(p.Check,{className:`h-5 w-5 text-green-500 flex-shrink-0`}):e.included===`partial`||e.included===`limited`?(0,g.jsx)(p.Check,{className:`h-5 w-5 text-yellow-500 flex-shrink-0`}):(0,g.jsx)(p.X,{className:`h-5 w-5 text-muted-foreground flex-shrink-0`}),(0,g.jsxs)(`span`,{className:t.t(`text-sm`,!e.included&&`text-muted-foreground`),children:[e.name,e.value&&(0,g.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,e.value,`)`]})]}),e.tooltip&&(0,g.jsx)(n.u,{children:(0,g.jsxs)(n.c,{children:[(0,g.jsx)(n.d,{asChild:!0,children:(0,g.jsx)(p.HelpCircle,{className:`h-4 w-4 text-muted-foreground cursor-help`})}),(0,g.jsx)(n.l,{children:(0,g.jsx)(`p`,{className:`max-w-xs`,children:e.tooltip})})]})})]},r))})]}),(0,g.jsx)(xe,{children:(0,g.jsx)(i.n,{className:`w-full`,variant:e.buttonVariant||(e.popular?`default`:`outline`),onClick:e.onSelect,disabled:e.disabled,asChild:!!e.href,children:e.href?o?(0,g.jsx)(o,{href:e.href,children:e.buttonText||`Choisir`}):(0,g.jsx)(`a`,{href:e.href,children:e.buttonText||`Choisir`}):e.buttonText||`Choisir`})})]})}function JI({plans:e,billingPeriod:n}){let{LinkComponent:a}=GI(),o=Array.from(new Set(e.flatMap(e=>e.features.map(e=>e.name))));return(0,g.jsx)(`div`,{className:`overflow-x-auto`,children:(0,g.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,g.jsxs)(`thead`,{children:[(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{className:`text-left p-4 border-b bg-muted/50`,children:`Fonctionnalité`}),e.map(e=>(0,g.jsxs)(`th`,{className:t.t(`text-center p-4 border-b min-w-[150px]`,e.popular&&`bg-primary/5`),children:[(0,g.jsx)(`div`,{className:`font-bold`,children:e.name}),e.popular&&(0,g.jsx)(r.t,{className:`mt-1`,variant:`default`,children:`Populaire`})]},e.id))]}),(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`td`,{className:`p-4 border-b bg-muted/50 font-medium`,children:`Prix`}),e.map(e=>{let r=n===`yearly`&&e.priceYearly!==void 0?e.priceYearly:e.price,i=n===`yearly`&&e.periodYearly?e.periodYearly:e.period||`/mois`,a=typeof r==`string`;return(0,g.jsx)(`td`,{className:t.t(`text-center p-4 border-b`,e.popular&&`bg-primary/5`),children:a?(0,g.jsx)(`span`,{className:`font-bold`,children:r}):(0,g.jsxs)(`span`,{className:`font-bold`,children:[e.currency||`€`,r,(0,g.jsx)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:i})]})},e.id)})]})]}),(0,g.jsxs)(`tbody`,{children:[o.map((n,r)=>(0,g.jsxs)(`tr`,{className:r%2==0?`bg-muted/20`:``,children:[(0,g.jsx)(`td`,{className:`p-4 border-b`,children:n}),e.map(e=>{let r=e.features.find(e=>e.name===n);return(0,g.jsx)(`td`,{className:t.t(`text-center p-4 border-b`,e.popular&&`bg-primary/5`),children:r?r.included===!0?r.value?(0,g.jsx)(`span`,{children:r.value}):(0,g.jsx)(p.Check,{className:`h-5 w-5 text-green-500 mx-auto`}):r.included===`partial`||r.included===`limited`?(0,g.jsx)(`span`,{className:`text-yellow-600`,children:r.value||`Limité`}):(0,g.jsx)(p.X,{className:`h-5 w-5 text-muted-foreground mx-auto`}):(0,g.jsx)(p.X,{className:`h-5 w-5 text-muted-foreground mx-auto`})},e.id)})]},r)),(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`td`,{className:`p-4`}),e.map(e=>(0,g.jsx)(`td`,{className:t.t(`text-center p-4`,e.popular&&`bg-primary/5`),children:(0,g.jsx)(i.n,{variant:e.buttonVariant||(e.popular?`default`:`outline`),onClick:e.onSelect,disabled:e.disabled,asChild:!!e.href,children:e.href?a?(0,g.jsx)(a,{href:e.href,children:e.buttonText||`Choisir`}):(0,g.jsx)(`a`,{href:e.href,children:e.buttonText||`Choisir`}):e.buttonText||`Choisir`})},e.id))]})]})]})})}function YI({title:e=`Questions fréquentes`,items:t}){return(0,g.jsxs)(`div`,{className:`mt-16`,children:[(0,g.jsx)(`h2`,{className:`text-2xl font-bold text-center mb-8`,children:e}),(0,g.jsx)(`div`,{className:`grid md:grid-cols-2 gap-6 max-w-4xl mx-auto`,children:t.map((e,t)=>(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`h3`,{className:`font-semibold`,children:e.question}),(0,g.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:e.answer})]},t))})]})}function XI({title:e=`Tarification`,description:n,plans:r,showBillingToggle:i=!0,billingPeriod:a,onBillingPeriodChange:o,yearlyDiscount:s,faq:c,faqTitle:l,layout:u=`cards`,columns:f=3,showComparison:p=!1,className:m,LinkComponent:h}){let[_,v]=d.useState(`monthly`),y=a??_,b=e=>{o?o(e):v(e)},x={2:`md:grid-cols-2`,3:`md:grid-cols-2 lg:grid-cols-3`,4:`md:grid-cols-2 lg:grid-cols-4`},S=d.useMemo(()=>({LinkComponent:h}),[h]);return(0,g.jsx)(WI.Provider,{value:S,children:(0,g.jsxs)(`div`,{className:t.t(`container py-16`,m),children:[(0,g.jsxs)(`div`,{className:`text-center mb-12`,children:[(0,g.jsx)(`h1`,{className:`text-3xl md:text-4xl font-bold tracking-tight mb-4`,children:e}),n&&(0,g.jsx)(`p`,{className:`text-lg text-muted-foreground max-w-2xl mx-auto`,children:n})]}),i&&(0,g.jsx)(KI,{period:y,onChange:b,yearlyDiscount:s}),u===`cards`&&!p?(0,g.jsx)(`div`,{className:t.t(`grid gap-6 items-stretch`,x[f]),children:r.map(e=>(0,g.jsx)(qI,{plan:e,billingPeriod:y},e.id))}):(0,g.jsx)(JI,{plans:r,billingPeriod:y}),c&&c.length>0&&(0,g.jsx)(YI,{title:l,items:c})]})})}var ZI=[{id:`free`,name:`Gratuit`,description:`Pour démarrer`,price:0,priceYearly:0,features:[{name:`1 utilisateur`,included:!0},{name:`5 projets`,included:!0},{name:`1 Go de stockage`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!1},{name:`Analytics avancés`,included:!1},{name:`Support prioritaire`,included:!1}],buttonText:`Commencer gratuitement`,buttonVariant:`outline`},{id:`pro`,name:`Pro`,description:`Pour les équipes`,price:29,priceYearly:24,periodYearly:`/mois (facturé annuellement)`,popular:!0,features:[{name:`5 utilisateurs`,included:!0},{name:`Projets illimités`,included:!0},{name:`50 Go de stockage`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!0},{name:`Analytics avancés`,included:!0},{name:`Support prioritaire`,included:!1}],buttonText:`Essai gratuit 14 jours`},{id:`enterprise`,name:`Enterprise`,description:`Pour les grandes équipes`,price:`Sur mesure`,features:[{name:`Utilisateurs illimités`,included:!0},{name:`Projets illimités`,included:!0},{name:`Stockage illimité`,included:!0},{name:`Support email`,included:!0},{name:`API Access`,included:!0},{name:`Analytics avancés`,included:!0},{name:`Support prioritaire`,included:!0}],buttonText:`Contacter les ventes`,buttonVariant:`outline`}],QI=[{question:`Puis-je changer de plan à tout moment ?`,answer:`Oui, vous pouvez upgrader ou downgrader votre plan à tout moment. Les changements prennent effet immédiatement.`},{question:`Y a-t-il une période d'essai ?`,answer:`Oui, tous nos plans payants incluent une période d'essai gratuite de 14 jours, sans carte bancaire requise.`},{question:`Quels moyens de paiement acceptez-vous ?`,answer:`Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.`},{question:`Puis-je annuler à tout moment ?`,answer:`Absolument. Vous pouvez annuler votre abonnement à tout moment sans frais supplémentaires.`}],$I=d.createContext(null);function eL(){let e=d.useContext($I);if(!e)throw Error(`useWizard must be used within a WakaWizard`);return e}function tL({steps:e,currentStep:n,stepStatuses:r,showStepNumbers:i,orientation:a,onStepClick:o,allowBackNavigation:s}){let c=(e,t)=>t===`completed`?(0,g.jsx)(p.Check,{className:`h-4 w-4`}):t===`error`?(0,g.jsx)(p.AlertCircle,{className:`h-4 w-4`}):t===`skipped`?(0,g.jsx)(p.X,{className:`h-4 w-4 text-muted-foreground`}):i?(0,g.jsx)(`span`,{className:`text-xs font-medium`,children:e+1}):(0,g.jsx)(p.Circle,{className:`h-3 w-3`}),l=e=>{switch(e){case`completed`:return`bg-primary text-primary-foreground border-primary`;case`current`:return`bg-primary text-primary-foreground border-primary`;case`error`:return`bg-destructive text-destructive-foreground border-destructive`;case`skipped`:return`bg-muted text-muted-foreground border-muted`;default:return`bg-background text-muted-foreground border-border`}};return a===`vertical`?(0,g.jsx)(`div`,{className:`flex flex-col gap-0`,children:e.map((i,a)=>{let u=r[a],d=s&&a<n;return(0,g.jsxs)(`div`,{className:`flex gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,g.jsx)(`button`,{type:`button`,disabled:!d,onClick:()=>d&&o?.(a),className:t.t(`flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors`,l(u),d&&`cursor-pointer hover:opacity-80`),children:i.icon||c(a,u)}),a<e.length-1&&(0,g.jsx)(`div`,{className:t.t(`w-0.5 flex-1 min-h-[24px]`,r[a]===`completed`?`bg-primary`:`bg-border`)})]}),(0,g.jsxs)(`div`,{className:`pb-8`,children:[(0,g.jsxs)(`div`,{className:t.t(`font-medium`,u===`current`?`text-foreground`:`text-muted-foreground`),children:[i.title,i.optional&&(0,g.jsx)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:`(optionnel)`})]}),i.description&&(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground mt-0.5`,children:i.description})]})]},i.id)})}):(0,g.jsx)(`div`,{className:`flex items-center gap-0`,children:e.map((i,a)=>{let u=r[a],f=s&&a<n;return(0,g.jsxs)(d.Fragment,{children:[(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,g.jsx)(`button`,{type:`button`,disabled:!f,onClick:()=>f&&o?.(a),className:t.t(`flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors`,l(u),f&&`cursor-pointer hover:opacity-80`),children:i.icon||c(a,u)}),(0,g.jsx)(`div`,{className:`text-center`,children:(0,g.jsx)(`div`,{className:t.t(`text-sm font-medium`,u===`current`?`text-foreground`:`text-muted-foreground`),children:i.title})})]}),a<e.length-1&&(0,g.jsx)(`div`,{className:t.t(`flex-1 h-0.5 mx-2 mb-6`,r[a]===`completed`?`bg-primary`:`bg-border`)})]},i.id)})})}function nL({onPrev:e,onNext:t,onSkip:n,onCancel:r,isFirstStep:a,isLastStep:o,isOptional:s,prevButtonText:c,nextButtonText:l,finishButtonText:u,skipButtonText:d,cancelButtonText:f,showCancelButton:m,submitting:h}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`div`,{className:`flex gap-2`,children:m&&r&&(0,g.jsx)(i.n,{type:`button`,variant:`ghost`,onClick:r,disabled:h,children:f})}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[!a&&(0,g.jsxs)(i.n,{type:`button`,variant:`outline`,onClick:e,disabled:h,children:[(0,g.jsx)(p.ArrowLeft,{className:`mr-2 h-4 w-4`}),c]}),s&&n&&!o&&(0,g.jsx)(i.n,{type:`button`,variant:`ghost`,onClick:n,disabled:h,children:d}),(0,g.jsxs)(i.n,{type:`button`,onClick:t,disabled:h,children:[h&&(0,g.jsx)(p.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),o?u:l,!o&&!h&&(0,g.jsx)(p.ArrowRight,{className:`ml-2 h-4 w-4`})]})]})]})}function rL({steps:e,currentStep:n,onStepChange:r,onSubmit:i,onCancel:a,title:o,description:s,prevButtonText:c=`Précédent`,nextButtonText:l=`Suivant`,finishButtonText:u=`Terminer`,cancelButtonText:f=`Annuler`,skipButtonText:p=`Passer`,showCancelButton:m=!0,showProgress:h=!0,showStepNumbers:_=!0,showStepper:v=!0,stepperPosition:y=`top`,allowBackNavigation:b=!0,confirmCancel:x=!0,cancelConfirmMessage:S=`Êtes-vous sûr de vouloir annuler ? Toutes les modifications seront perdues.`,submitting:C=!1,layout:w=`card`,className:T}){let[E,D]=d.useState(0),[O,k]=d.useState(e.map((e,t)=>t===0?`current`:`pending`)),[A,j]=d.useState(!1),M=n??E,N=M===0,P=M===e.length-1,F=e[M],I=(M+1)/e.length*100,L=(t,n)=>{k(r=>{let i=[...r];if(n===`next`&&M<e.length)i[M]=`completed`;else if(n===`skip`)i[M]=`skipped`;else if(n===`goto`&&t<M)for(let n=t+1;n<e.length;n++)i[n]=`pending`;return i[t]=`current`,i})},R=async t=>{if(t<0||t>=e.length||t>M&&!b)return;F.onLeave&&await F.onLeave(),L(t,`goto`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},z=async()=>{if(F.validate&&!await F.validate()){k(e=>{let t=[...e];return t[M]=`error`,t});return}if(F.onLeave&&await F.onLeave(),P){let t={steps:e.map((e,t)=>({id:e.id,status:t===M?`completed`:O[t]})),completedSteps:e.filter((e,t)=>O[t]===`completed`||t===M).map(e=>e.id),skippedSteps:e.filter((e,t)=>O[t]===`skipped`).map(e=>e.id)};await i?.(t)}else{let t=M+1;L(t,`next`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()}},B=async()=>{if(N)return;F.onLeave&&await F.onLeave();let t=M-1;L(t,`prev`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},V=async()=>{if(!F.optional||P)return;F.onLeave&&await F.onLeave();let t=M+1;L(t,`skip`),r?r(t):D(t);let n=e[t];n.onEnter&&await n.onEnter()},H=()=>{x?j(!0):a?.()},U={currentStep:M,totalSteps:e.length,stepStatuses:O,goToStep:R,nextStep:z,prevStep:B,skipStep:V,isFirstStep:N,isLastStep:P},W=v&&(0,g.jsx)(tL,{steps:e,currentStep:M,stepStatuses:O,showStepNumbers:_,orientation:y===`left`?`vertical`:`horizontal`,onStepClick:R,allowBackNavigation:b}),G=(0,g.jsx)(nL,{onPrev:B,onNext:z,onSkip:F.optional?V:void 0,onCancel:a?H:void 0,isFirstStep:N,isLastStep:P,isOptional:F.optional||!1,prevButtonText:c,nextButtonText:l,finishButtonText:u,skipButtonText:p,cancelButtonText:f,showCancelButton:m,submitting:C}),K=(0,g.jsxs)($I.Provider,{value:U,children:[y===`left`?(0,g.jsxs)(`div`,{className:`flex gap-8`,children:[(0,g.jsx)(`div`,{className:`w-64 flex-shrink-0`,children:W}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[h&&(0,g.jsxs)(`div`,{className:`mb-6`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between text-sm text-muted-foreground mb-2`,children:[(0,g.jsxs)(`span`,{children:[`Étape `,M+1,` sur `,e.length]}),(0,g.jsxs)(`span`,{children:[Math.round(I),`%`]})]}),(0,g.jsx)(Yn,{value:I})]}),(0,g.jsx)(`div`,{className:`min-h-[300px]`,children:F.content}),(0,g.jsx)(`div`,{className:`mt-8`,children:G})]})]}):(0,g.jsxs)(g.Fragment,{children:[W&&(0,g.jsx)(`div`,{className:`mb-8`,children:W}),h&&(0,g.jsxs)(`div`,{className:`mb-6`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between text-sm text-muted-foreground mb-2`,children:[(0,g.jsxs)(`span`,{children:[`Étape `,M+1,` sur `,e.length]}),(0,g.jsxs)(`span`,{children:[Math.round(I),`%`]})]}),(0,g.jsx)(Yn,{value:I})]}),(0,g.jsx)(`div`,{className:`min-h-[300px]`,children:F.content}),(0,g.jsx)(`div`,{className:`mt-8`,children:G})]}),(0,g.jsx)(re,{open:A,onOpenChange:j,children:(0,g.jsxs)(se,{children:[(0,g.jsxs)(ce,{children:[(0,g.jsx)(ue,{children:`Annuler ?`}),(0,g.jsx)(de,{children:S})]}),(0,g.jsxs)(le,{children:[(0,g.jsx)(pe,{children:`Non, continuer`}),(0,g.jsx)(fe,{onClick:()=>{j(!1),a?.()},children:`Oui, annuler`})]})]})})]});return w===`minimal`?(0,g.jsx)(`div`,{className:t.t(`space-y-6`,T),children:K}):w===`page`?(0,g.jsxs)(`div`,{className:t.t(`container py-8 max-w-4xl`,T),children:[(o||s)&&(0,g.jsxs)(`div`,{className:`mb-8`,children:[o&&(0,g.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:o}),s&&(0,g.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:s})]}),K]}):(0,g.jsxs)(Y,{className:T,children:[(o||s)&&(0,g.jsxs)(X,{children:[o&&(0,g.jsx)(Z,{children:o}),s&&(0,g.jsx)(be,{children:s})]}),(0,g.jsx)(Q,{children:K})]})}var iL=[{id:`step-1`,title:`Informations de base`,description:`Renseignez vos informations personnelles`,content:(0,g.jsx)(`div`,{className:`space-y-4`,children:(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 1 - Informations de base`})})},{id:`step-2`,title:`Configuration`,description:`Configurez vos préférences`,optional:!0,content:(0,g.jsx)(`div`,{className:`space-y-4`,children:(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 2 - Configuration (optionnel)`})})},{id:`step-3`,title:`Confirmation`,description:`Vérifiez et confirmez`,content:(0,g.jsx)(`div`,{className:`space-y-4`,children:(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Contenu de l'étape 3 - Confirmation`})})}];t.n();function aL(e,t,n){let r=e.translations[n]?.value||``,i=e.translations[t]?.value;return!i||i.trim()===``?`missing`:i===r?`identical`:`valid`}function oL(e,t,n){let r=t.filter(e=>e!==n).map(t=>aL(e,t,n));return r.includes(`missing`)?`missing`:r.includes(`identical`)?`identical`:`valid`}function sL(e,t){let n=new Map;for(let r of e){let e=r.key.split(t),i=e.length>1?e[0]:`__root__`;n.has(i)||n.set(i,[]),n.get(i).push(r)}return n}function cL({status:e}){let{label:n,icon:i,className:a}={valid:{label:`OK`,variant:`default`,icon:p.CheckCircle,className:`bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300`},missing:{label:`Manquant`,variant:`destructive`,icon:p.XCircle,className:`bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300`},identical:{label:`Identique`,variant:`secondary`,icon:p.AlertTriangle,className:`bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300`},warning:{label:`Attention`,variant:`secondary`,icon:p.AlertTriangle,className:`bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300`}}[e];return(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(`gap-1 text-xs`,a),children:[(0,g.jsx)(i,{className:`h-3 w-3`}),n]})}function lL({value:e,onChange:n,onBlur:r,placeholder:i,status:a,disabled:s}){let[c,l]=d.useState(e);return d.useEffect(()=>{l(e)},[e]),(0,g.jsx)(o.t,{value:c,onChange:e=>{l(e.target.value),n(e.target.value)},onBlur:r,placeholder:i,disabled:s,className:t.t(`min-h-[60px] resize-none text-sm`,a===`missing`&&`border-red-300 dark:border-red-700`,a===`identical`&&`border-yellow-300 dark:border-yellow-700`)})}function uL({config:e,translations:c,onChange:l,onSave:u,onAddKey:f,onDeleteKey:m,onAddLanguage:h,onExport:_,onImport:v,isLoading:y=!1,isSaving:b=!1,className:x,title:S=`Translation Editor`,description:C=`Gérez vos traductions i18n`}){let[w,T]=d.useState(c),[E,D]=d.useState(``),[O,k]=d.useState(`all`),[A,j]=d.useState(new Set),[M,N]=d.useState(null),[P,F]=d.useState(!1),[I,L]=d.useState(!1),[R,z]=d.useState(!1),[B,V]=d.useState(!1),[H,U]=d.useState(``),[W,G]=d.useState({code:``,label:``,flag:``}),[K,q]=d.useState(null),[ee,J]=d.useState(``),[te,ne]=d.useState(`merge`),[re,ie]=d.useState(new Map),ae=d.useRef(null),{languages:oe,sourceLanguage:se,keyPathSeparator:ce=`.`,autoSave:le=!0,saveDebounceMs:ue=300,placeholderPatterns:de=[`{{.*?}}`,`{.*?}`,`%s`,`%d`]}=e,fe=oe.filter(e=>e.code!==se);d.useEffect(()=>{T(c)},[c]),d.useEffect(()=>(le&&re.size>0&&u&&(ae.current&&clearTimeout(ae.current),ae.current=setTimeout(async()=>{await u(w),ie(new Map)},ue)),()=>{ae.current&&clearTimeout(ae.current)}),[re,le,ue,u,w]);let pe=d.useMemo(()=>{let e=w;if(E){let t=E.toLowerCase();e=e.filter(e=>{if(e.key.toLowerCase().includes(t))return!0;for(let n of Object.keys(e.translations))if(e.translations[n]?.value?.toLowerCase().includes(t))return!0;return!1})}return O!==`all`&&(e=e.filter(e=>{let t=oL(e,oe.map(e=>e.code),se);switch(O){case`missing`:return t===`missing`;case`incomplete`:return t===`missing`||t===`identical`;case`identical`:return t===`identical`;default:return!0}})),e},[w,E,O,oe,se]),me=d.useMemo(()=>sL(pe,ce),[pe,ce]),he=(e,t,n)=>{T(r=>r.map(r=>r.key===e?{...r,translations:{...r.translations,[t]:{...r.translations[t],value:n,updatedAt:new Date}}}:r)),ie(r=>{let i=new Map(r);return i.has(e)||i.set(e,new Map),i.get(e).set(t,n),i}),l?.(e,t,n)},ge=async()=>{H.trim()&&(await f?.(H),U(``),L(!1))},_e=async e=>{await m?.(e),T(t=>t.filter(t=>t.key!==e))},ve=async()=>{!W.code||!W.label||(await h?.(W),G({code:``,label:``,flag:``}),z(!1))},ye=async()=>{!K||!ee||(await v?.(K,ee,te),q(null),J(``),V(!1))},Y=e=>{navigator.clipboard.writeText(e)},X=e=>{j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Z=d.useMemo(()=>{let e=w.length,t=0,n=0,r=0;for(let e of w){let i=oL(e,oe.map(e=>e.code),se);i===`missing`?t++:i===`identical`?n++:r++}return{total:e,missing:t,identical:n,valid:r}},[w,oe,se]);return y?(0,g.jsx)(`div`,{className:t.t(`flex items-center justify-center py-12`,x),children:(0,g.jsx)(p.Loader2,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,g.jsx)(n.u,{children:(0,g.jsxs)(`div`,{className:t.t(`flex flex-col h-full`,x),children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h2`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,g.jsx)(p.Languages,{className:`h-6 w-6`}),S]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:C})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>L(!0),children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-1`}),`Ajouter une clé`]}),(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>z(!0),children:[(0,g.jsx)(p.Flag,{className:`h-4 w-4 mr-1`}),`Ajouter une langue`]}),(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:()=>_?.(),children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Exporter tout`]}),oe.map(e=>(0,g.jsxs)($,{onClick:()=>_?.(e.code),children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Exporter `,e.label]},e.code)),(0,g.jsx)(sn,{}),(0,g.jsxs)($,{onClick:()=>V(!0),children:[(0,g.jsx)(p.Upload,{className:`h-4 w-4 mr-2`}),`Importer`]})]})]}),b&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.Loader2,{className:`h-4 w-4 animate-spin`}),`Sauvegarde...`]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[Z.total,` clés`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1 text-green-600 dark:text-green-400`,children:[(0,g.jsx)(p.CheckCircle,{className:`h-4 w-4`}),Z.valid,` traduites`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1 text-red-600 dark:text-red-400`,children:[(0,g.jsx)(p.XCircle,{className:`h-4 w-4`}),Z.missing,` manquantes`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-600 dark:text-yellow-400`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-4 w-4`}),Z.identical,` identiques`]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,g.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher une clé ou une traduction...`,value:E,onChange:e=>D(e.target.value),className:`pl-10`}),E&&(0,g.jsx)(`button`,{onClick:()=>D(``),className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Filter,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsxs)(a.d,{value:O,onValueChange:e=>k(e),children:[(0,g.jsx)(a.y,{className:`w-[180px]`,children:(0,g.jsx)(a.b,{})}),(0,g.jsxs)(a.f,{children:[(0,g.jsxs)(a.m,{value:`all`,children:[`Toutes (`,Z.total,`)`]}),(0,g.jsxs)(a.m,{value:`missing`,children:[`Manquantes (`,Z.missing,`)`]}),(0,g.jsxs)(a.m,{value:`incomplete`,children:[`Incomplètes (`,Z.missing+Z.identical,`)`]}),(0,g.jsxs)(a.m,{value:`identical`,children:[`Identiques (`,Z.identical,`)`]})]})]})]})]})]}),(0,g.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,g.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,g.jsx)(`thead`,{className:`sticky top-0 bg-muted/50 backdrop-blur z-10`,children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{className:`text-left p-3 font-medium text-sm border-b w-[280px]`,children:`Clé`}),(0,g.jsxs)(`th`,{className:`text-left p-3 font-medium text-sm border-b`,children:[oe.find(e=>e.code===se)?.label||se,` (source)`]}),fe.map(e=>(0,g.jsx)(`th`,{className:`text-left p-3 font-medium text-sm border-b`,children:(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.flag&&(0,g.jsx)(`span`,{children:e.flag}),e.label]})},e.code)),(0,g.jsx)(`th`,{className:`text-center p-3 font-medium text-sm border-b w-[100px]`,children:`État`}),(0,g.jsx)(`th`,{className:`text-center p-3 font-medium text-sm border-b w-[60px]`,children:`Actions`})]})}),(0,g.jsxs)(`tbody`,{children:[Array.from(me.entries()).map(([e,t])=>(0,g.jsxs)(d.Fragment,{children:[e!==`__root__`&&(0,g.jsx)(`tr`,{className:`bg-muted/30`,children:(0,g.jsx)(`td`,{colSpan:fe.length+4,className:`p-2`,children:(0,g.jsxs)(`button`,{onClick:()=>X(e),className:`flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors`,children:[A.has(e)?(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4`}):(0,g.jsx)(p.ChevronDown,{className:`h-4 w-4`}),e,(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:t.length})]})})}),!A.has(e)&&t.map(e=>{let t=oL(e,oe.map(e=>e.code),se);return(0,g.jsxs)(`tr`,{className:`border-b hover:bg-muted/30 transition-colors`,children:[(0,g.jsx)(`td`,{className:`p-3 font-mono text-sm`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`truncate max-w-[200px]`,title:e.key,children:e.key}),(0,g.jsxs)(n.c,{children:[(0,g.jsx)(n.d,{asChild:!0,children:(0,g.jsx)(`button`,{onClick:()=>Y(e.key),className:`text-muted-foreground hover:text-foreground`,children:(0,g.jsx)(p.Copy,{className:`h-3 w-3`})})}),(0,g.jsx)(n.l,{children:`Copier la clé`})]})]})}),(0,g.jsx)(`td`,{className:`p-2`,children:(0,g.jsx)(lL,{value:e.translations[se]?.value||``,onChange:t=>he(e.key,se,t),placeholder:`Texte source...`,status:e.translations[se]?.value?`valid`:`missing`})}),fe.map(t=>{let n=aL(e,t.code,se);return(0,g.jsx)(`td`,{className:`p-2`,children:(0,g.jsx)(lL,{value:e.translations[t.code]?.value||``,onChange:n=>he(e.key,t.code,n),placeholder:`Traduction ${t.label}...`,status:n})},t.code)}),(0,g.jsx)(`td`,{className:`p-3 text-center`,children:(0,g.jsx)(cL,{status:t})}),(0,g.jsx)(`td`,{className:`p-3 text-center`,children:(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,children:(0,g.jsx)(p.MoreHorizontal,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:()=>{N(e),F(!0)},children:[(0,g.jsx)(p.Edit3,{className:`h-4 w-4 mr-2`}),`Éditer`]}),(0,g.jsxs)($,{onClick:()=>Y(e.key),children:[(0,g.jsx)(p.Copy,{className:`h-4 w-4 mr-2`}),`Copier la clé`]}),(0,g.jsx)(sn,{}),(0,g.jsxs)($,{className:`text-destructive`,onClick:()=>_e(e.key),children:[(0,g.jsx)(p.Trash2,{className:`h-4 w-4 mr-2`}),`Supprimer`]})]})]})})]},e.key)})]},e)),pe.length===0&&(0,g.jsx)(`tr`,{children:(0,g.jsxs)(`td`,{colSpan:fe.length+4,className:`p-12 text-center`,children:[(0,g.jsx)(p.Languages,{className:`h-12 w-12 mx-auto text-muted-foreground/50 mb-4`}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:E||O!==`all`?`Aucune traduction ne correspond à vos critères`:`Aucune traduction disponible`})]})})]})]})}),(0,g.jsx)(Qn,{open:P,onOpenChange:F,children:(0,g.jsxs)(ir,{className:`w-[500px] sm:max-w-[500px]`,children:[(0,g.jsxs)(ar,{children:[(0,g.jsx)(sr,{children:`Éditer la traduction`}),(0,g.jsx)(cr,{children:M?.key})]}),M&&(0,g.jsxs)(`div`,{className:`py-6 space-y-6`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`label`,{className:`text-sm font-medium`,children:[oe.find(e=>e.code===se)?.label,` (source)`]}),(0,g.jsx)(o.t,{value:M.translations[se]?.value||``,onChange:e=>{he(M.key,se,e.target.value),N({...M,translations:{...M.translations,[se]:{...M.translations[se],value:e.target.value}}})},placeholder:`Texte source...`,className:`min-h-[100px]`})]}),oe.filter(e=>e.code!==se).map(e=>(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`label`,{className:`text-sm font-medium flex items-center gap-2`,children:[e.flag&&(0,g.jsx)(`span`,{children:e.flag}),e.label]}),(0,g.jsx)(o.t,{value:M.translations[e.code]?.value||``,onChange:t=>{he(M.key,e.code,t.target.value),N({...M,translations:{...M.translations,[e.code]:{...M.translations[e.code],value:t.target.value}}})},placeholder:`Traduction ${e.label}...`,className:`min-h-[100px]`})]},e.code)),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Commentaire (optionnel)`}),(0,g.jsx)(o.t,{placeholder:`Contexte ou indication pour la traduction...`,className:`min-h-[80px]`})]})]}),(0,g.jsx)(or,{children:(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>F(!1),children:`Fermer`})})]})}),(0,g.jsx)(mt,{open:I,onOpenChange:L,children:(0,g.jsxs)(yt,{children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:`Ajouter une clé de traduction`}),(0,g.jsx)(Ct,{children:`Entrez la clé de traduction (ex: common.buttons.submit)`})]}),(0,g.jsx)(`div`,{className:`py-4`,children:(0,g.jsx)(s.t,{value:H,onChange:e=>U(e.target.value),placeholder:`namespace.key.name`})}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>L(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:ge,children:`Ajouter`})]})]})}),(0,g.jsx)(mt,{open:R,onOpenChange:z,children:(0,g.jsxs)(yt,{children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:`Ajouter une langue`}),(0,g.jsx)(Ct,{children:`Configurez la nouvelle langue à ajouter`})]}),(0,g.jsxs)(`div`,{className:`py-4 space-y-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Code (ex: de, it, pt)`}),(0,g.jsx)(s.t,{value:W.code,onChange:e=>G({...W,code:e.target.value}),placeholder:`de`})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Label`}),(0,g.jsx)(s.t,{value:W.label,onChange:e=>G({...W,label:e.target.value}),placeholder:`Allemand`})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Emoji drapeau (optionnel)`}),(0,g.jsx)(s.t,{value:W.flag,onChange:e=>G({...W,flag:e.target.value}),placeholder:`🇩🇪`})]})]}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>z(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:ve,children:`Ajouter`})]})]})}),(0,g.jsx)(mt,{open:B,onOpenChange:V,children:(0,g.jsxs)(yt,{children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:`Importer des traductions`}),(0,g.jsx)(Ct,{children:`Sélectionnez un fichier JSON à importer`})]}),(0,g.jsxs)(`div`,{className:`py-4 space-y-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Fichier JSON`}),(0,g.jsx)(s.t,{type:`file`,accept:`.json`,onChange:e=>q(e.target.files?.[0]||null)})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Langue cible`}),(0,g.jsxs)(a.d,{value:ee,onValueChange:J,children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{placeholder:`Sélectionner une langue`})}),(0,g.jsx)(a.f,{children:oe.map(e=>(0,g.jsxs)(a.m,{value:e.code,children:[e.flag&&(0,g.jsx)(`span`,{className:`mr-2`,children:e.flag}),e.label]},e.code))})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(`label`,{className:`text-sm font-medium`,children:`Stratégie`}),(0,g.jsxs)(a.d,{value:te,onValueChange:e=>ne(e),children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`merge`,children:`Fusionner (conserver les existantes)`}),(0,g.jsx)(a.m,{value:`overwrite`,children:`Écraser tout`})]})]})]})]}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>V(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:ye,disabled:!K||!ee,children:`Importer`})]})]})})]})})}var dL={default:`text-foreground`,blue:`text-blue-500`,green:`text-green-500`,yellow:`text-yellow-500`,red:`text-red-500`,purple:`text-purple-500`},fL={default:`bg-muted`,blue:`bg-blue-500/10`,green:`bg-green-500/10`,yellow:`bg-yellow-500/10`,red:`bg-red-500/10`,purple:`bg-purple-500/10`};function pL({data:e,color:n=`blue`}){let r=Math.max(...e),i=Math.min(...e),a=r-i||1;return(0,g.jsx)(`svg`,{className:`w-16 h-8`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,g.jsx)(`polyline`,{points:e.map((t,n)=>`${n/(e.length-1)*100},${100-(t-i)/a*100}`).join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`3`,className:t.t(`opacity-60`,dL[n]||dL.blue)})})}function mL({metric:e}){let n=e.icon,r=e.trend===`up`?`text-green-500`:e.trend===`down`?`text-red-500`:`text-muted-foreground`,i=e.trend===`up`?p.TrendingUp:e.trend===`down`?p.TrendingDown:null;return(0,g.jsxs)(Y,{className:`relative overflow-hidden`,children:[(0,g.jsxs)(X,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,g.jsx)(Z,{className:`text-sm font-medium text-muted-foreground`,children:e.label}),n&&(0,g.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,fL[e.color||`default`]),children:(0,g.jsx)(`span`,{className:t.t(`h-4 w-4`,dL[e.color||`default`]),children:n})})]}),(0,g.jsxs)(Q,{children:[(0,g.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:e.value}),e.change!==void 0&&(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-1 text-sm`,r),children:[i&&(0,g.jsx)(i,{className:`h-3 w-3`}),(0,g.jsxs)(`span`,{children:[e.change>0?`+`:``,e.change,`%`]}),e.changeLabel&&(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.changeLabel})]})]}),e.sparkline&&(0,g.jsx)(pL,{data:e.sparkline,color:e.color})]}),e.target!==void 0&&e.current!==void 0&&(0,g.jsxs)(`div`,{className:`mt-4`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground mb-1`,children:[(0,g.jsx)(`span`,{children:`Progress`}),(0,g.jsxs)(`span`,{children:[Math.round(e.current/e.target*100),`%`]})]}),(0,g.jsx)(Yn,{value:e.current/e.target*100,className:`h-1.5`})]})]})]})}function hL({goal:e}){let n=e.current/e.target*100,i=n>=100;return(0,g.jsxs)(`div`,{className:`flex items-center gap-4 p-4 rounded-lg border bg-card`,children:[(0,g.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-full flex items-center justify-center`,i?`bg-green-500/10 text-green-500`:`bg-muted text-muted-foreground`),children:(0,g.jsx)(p.Target,{className:`h-5 w-5`})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,g.jsx)(`span`,{className:`font-medium truncate`,children:e.label}),(0,g.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[e.current,e.unit,` / `,e.target,e.unit]})]}),(0,g.jsx)(Yn,{value:Math.min(n,100),className:`h-2`})]}),i&&(0,g.jsx)(r.t,{variant:`default`,className:`bg-green-500`,children:`Complete`})]})}function gL({title:e=`Dashboard`,description:n,metrics:o,periods:s=[{value:`7d`,label:`7 days`},{value:`30d`,label:`30 days`},{value:`90d`,label:`90 days`},{value:`12m`,label:`12 months`}],selectedPeriod:c=`30d`,onPeriodChange:l,onRefresh:u,onExport:d,chart:f,secondaryMetrics:m,goals:h,isLoading:_=!1,lastUpdated:v,className:y}){return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,y),children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:e}),n&&(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:n})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.length>0&&(0,g.jsxs)(a.d,{value:c,onValueChange:l,children:[(0,g.jsxs)(a.y,{className:`w-[140px]`,children:[(0,g.jsx)(p.Calendar,{className:`h-4 w-4 mr-2`}),(0,g.jsx)(a.b,{})]}),(0,g.jsx)(a.f,{children:s.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]}),u&&(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:u,disabled:_,children:(0,g.jsx)(p.RefreshCw,{className:t.t(`h-4 w-4`,_&&`animate-spin`)})}),d&&(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:d,children:(0,g.jsx)(p.Download,{className:`h-4 w-4`})})]})]}),v&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.Clock,{className:`h-4 w-4`}),(0,g.jsxs)(`span`,{children:[`Last updated: `,typeof v==`string`?v:v.toLocaleString()]})]}),(0,g.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:o.slice(0,4).map(e=>(0,g.jsx)(mL,{metric:e},e.id))}),f&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Overview`}),(0,g.jsx)(be,{children:`Performance metrics over time`})]}),(0,g.jsx)(Q,{children:f})]}),m&&m.length>0&&(0,g.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:m.map(e=>(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`pt-6`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.label}),(0,g.jsx)(`p`,{className:`text-xl font-bold`,children:e.value})]}),e.change!==void 0&&(0,g.jsxs)(r.t,{variant:e.trend===`up`?`default`:e.trend===`down`?`destructive`:`secondary`,className:`gap-1`,children:[e.trend===`up`?(0,g.jsx)(p.ArrowUpRight,{className:`h-3 w-3`}):e.trend===`down`?(0,g.jsx)(p.ArrowDownRight,{className:`h-3 w-3`}):null,e.change>0?`+`:``,e.change,`%`]})]})})},e.id))}),h&&h.length>0&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Target,{className:`h-5 w-5`}),`Goals & Targets`]}),(0,g.jsx)(be,{children:`Track your progress towards key objectives`})]}),(0,g.jsx)(Q,{className:`space-y-4`,children:h.map(e=>(0,g.jsx)(hL,{goal:e},e.id))})]})]})}var _L=[{id:`revenue`,label:`Total Revenue`,value:`$45,231.89`,change:20.1,changeLabel:`from last month`,trend:`up`,icon:(0,g.jsx)(p.DollarSign,{className:`h-4 w-4`}),color:`green`,sparkline:[30,40,35,50,49,60,70,91,125]},{id:`subscriptions`,label:`Subscriptions`,value:`+2,350`,change:180.1,changeLabel:`from last month`,trend:`up`,icon:(0,g.jsx)(p.Users,{className:`h-4 w-4`}),color:`blue`,sparkline:[10,20,30,40,50,60,70,80,90]},{id:`sales`,label:`Sales`,value:`+12,234`,change:19,changeLabel:`from last month`,trend:`up`,icon:(0,g.jsx)(p.ShoppingCart,{className:`h-4 w-4`}),color:`purple`,sparkline:[65,59,80,81,56,55,70,80,95]},{id:`active`,label:`Active Now`,value:`+573`,change:-2.5,changeLabel:`from last hour`,trend:`down`,icon:(0,g.jsx)(p.Activity,{className:`h-4 w-4`}),color:`yellow`,sparkline:[100,90,85,88,70,65,60,58,55]}],vL=[{id:`revenue-goal`,label:`Monthly Revenue Target`,current:45231,target:5e4,unit:`$`},{id:`users-goal`,label:`New User Signups`,current:2350,target:2e3,unit:``},{id:`conversion-goal`,label:`Conversion Rate`,current:3.2,target:5,unit:`%`}];function yL({steps:e,currentStep:n}){let r=e.findIndex(e=>e.id===n);return(0,g.jsx)(`div`,{className:`flex items-center justify-center mb-8`,children:e.map((n,i)=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsxs)(`div`,{className:`flex items-center`,children:[(0,g.jsx)(`div`,{className:t.t(`h-8 w-8 rounded-full flex items-center justify-center text-sm font-medium`,i<r?`bg-primary text-primary-foreground`:i===r?`bg-primary text-primary-foreground ring-4 ring-primary/20`:`bg-muted text-muted-foreground`),children:i<r?(0,g.jsx)(p.Check,{className:`h-4 w-4`}):i+1}),(0,g.jsx)(`span`,{className:t.t(`ml-2 text-sm font-medium hidden sm:inline`,i<=r?`text-foreground`:`text-muted-foreground`),children:n.label})]}),i<e.length-1&&(0,g.jsx)(`div`,{className:t.t(`w-8 sm:w-16 h-0.5 mx-2`,i<r?`bg-primary`:`bg-muted`)})]},n.id))})}function bL({items:e,currency:t=`$`,discount:n,couponCode:r,setCouponCode:a,onApplyCoupon:o,onRemoveDiscount:c,isApplyingCoupon:l,shippingPrice:u=0,taxRate:d=0}){let f=e.reduce((e,t)=>e+t.price*t.quantity,0),m=n?n.type===`percent`?f*n.amount/100:n.amount:0,h=f-m,_=h*d/100,v=h+_+u;return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.ShoppingBag,{className:`h-5 w-5`}),`Order Summary`]})}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[(0,g.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex gap-3`,children:[e.image&&(0,g.jsx)(`div`,{className:`h-16 w-16 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,g.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`p`,{className:`font-medium truncate`,children:e.name}),e.variant&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.variant}),(0,g.jsxs)(`p`,{className:`text-sm`,children:[`Qty: `,e.quantity]})]}),(0,g.jsxs)(`p`,{className:`font-medium`,children:[t,(e.price*e.quantity).toFixed(2)]})]},e.id))}),(0,g.jsx)(i.t,{}),n?(0,g.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded-lg bg-green-500/10 text-green-600`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Percent,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{className:`font-medium`,children:n.code}),(0,g.jsxs)(`span`,{className:`text-sm`,children:[`(-`,n.type===`percent`?`${n.amount}%`:`${t}${n.amount}`,`)`]})]}),(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:c,children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]}):(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(s.t,{placeholder:`Coupon code`,value:r,onChange:e=>a(e.target.value),className:`flex-1`}),(0,g.jsx)(i.n,{variant:`outline`,onClick:o,disabled:!r||l,children:l?(0,g.jsx)(p.Loader2,{className:`h-4 w-4 animate-spin`}):`Apply`})]}),(0,g.jsx)(i.t,{}),(0,g.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Subtotal`}),(0,g.jsxs)(`span`,{children:[t,f.toFixed(2)]})]}),m>0&&(0,g.jsxs)(`div`,{className:`flex justify-between text-green-600`,children:[(0,g.jsx)(`span`,{children:`Discount`}),(0,g.jsxs)(`span`,{children:[`-`,t,m.toFixed(2)]})]}),u>0&&(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Shipping`}),(0,g.jsxs)(`span`,{children:[t,u.toFixed(2)]})]}),_>0&&(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Tax (`,d,`%)`]}),(0,g.jsxs)(`span`,{children:[t,_.toFixed(2)]})]}),(0,g.jsx)(i.t,{}),(0,g.jsxs)(`div`,{className:`flex justify-between text-lg font-bold`,children:[(0,g.jsx)(`span`,{children:`Total`}),(0,g.jsxs)(`span`,{children:[t,v.toFixed(2)]})]})]})]})]})}function xL({items:e,shippingMethods:n=SL,paymentMethods:a=CL,onApplyCoupon:c,discount:l,onRemoveDiscount:u,onSubmitOrder:f,currency:m=`$`,taxRate:h=8.5,className:_}){let[v,y]=d.useState(`cart`),[b,x]=d.useState(``),[S,C]=d.useState(!1),[w,T]=d.useState(!1),[E,D]=d.useState({firstName:``,lastName:``,email:``,phone:``,address:``,apartment:``,city:``,state:``,postalCode:``,country:`US`}),[O,k]=d.useState(n[0]?.id||``),[A,j]=d.useState(a[0]?.id||``),[M,N]=d.useState(!1),P=[{id:`cart`,label:`Cart`},{id:`shipping`,label:`Shipping`},{id:`payment`,label:`Payment`},{id:`review`,label:`Review`}],F=n.find(e=>e.id===O),I=async()=>{!c||!b||(C(!0),await c(b),C(!1))},L=async()=>{if(f){T(!0);try{await f({address:E,shippingMethod:O,paymentMethod:A,saveInfo:M})}finally{T(!1)}}},R=()=>{let e=P.findIndex(e=>e.id===v);e<P.length-1&&y(P[e+1].id)},z=()=>{let e=P.findIndex(e=>e.id===v);e>0&&y(P[e-1].id)};return(0,g.jsxs)(`div`,{className:t.t(`max-w-6xl mx-auto`,_),children:[(0,g.jsx)(yL,{steps:P,currentStep:v}),(0,g.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-3`,children:[(0,g.jsxs)(`div`,{className:`lg:col-span-2 space-y-6`,children:[v===`cart`&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Shopping Cart`}),(0,g.jsxs)(be,{children:[e.length,` items in your cart`]})]}),(0,g.jsx)(Q,{className:`space-y-4`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex gap-4 p-4 rounded-lg border`,children:[e.image&&(0,g.jsx)(`div`,{className:`h-24 w-24 rounded-lg bg-muted overflow-hidden flex-shrink-0`,children:(0,g.jsx)(`img`,{src:e.image,alt:e.name,className:`h-full w-full object-cover`})}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsx)(`h3`,{className:`font-medium`,children:e.name}),e.description&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),e.variant&&(0,g.jsx)(r.t,{variant:`secondary`,className:`mt-1`,children:e.variant}),(0,g.jsxs)(`div`,{className:`mt-2 flex items-center justify-between`,children:[(0,g.jsxs)(`span`,{className:`text-sm`,children:[`Qty: `,e.quantity]}),(0,g.jsxs)(`span`,{className:`font-bold`,children:[m,(e.price*e.quantity).toFixed(2)]})]})]})]},e.id))}),(0,g.jsx)(xe,{children:(0,g.jsxs)(i.n,{className:`w-full`,onClick:R,children:[`Continue to Shipping`,(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4 ml-2`})]})})]}),v===`shipping`&&(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.MapPin,{className:`h-5 w-5`}),`Shipping Address`]})}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`First Name`}),(0,g.jsx)(s.t,{value:E.firstName,onChange:e=>D({...E,firstName:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Last Name`}),(0,g.jsx)(s.t,{value:E.lastName,onChange:e=>D({...E,lastName:e.target.value})})]})]}),(0,g.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Email`}),(0,g.jsx)(s.t,{type:`email`,value:E.email,onChange:e=>D({...E,email:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Phone`}),(0,g.jsx)(s.t,{type:`tel`,value:E.phone,onChange:e=>D({...E,phone:e.target.value})})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Address`}),(0,g.jsx)(s.t,{value:E.address,onChange:e=>D({...E,address:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Apartment, suite, etc. (optional)`}),(0,g.jsx)(s.t,{value:E.apartment,onChange:e=>D({...E,apartment:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`City`}),(0,g.jsx)(s.t,{value:E.city,onChange:e=>D({...E,city:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`State`}),(0,g.jsx)(s.t,{value:E.state,onChange:e=>D({...E,state:e.target.value})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Postal Code`}),(0,g.jsx)(s.t,{value:E.postalCode,onChange:e=>D({...E,postalCode:e.target.value})})]})]}),(0,g.jsx)(i.t,{className:`my-6`}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`font-medium mb-4 flex items-center gap-2`,children:[(0,g.jsx)(p.Truck,{className:`h-5 w-5`}),`Shipping Method`]}),(0,g.jsx)(Xn,{value:O,onValueChange:k,children:(0,g.jsx)(`div`,{className:`space-y-3`,children:n.map(e=>(0,g.jsxs)(o.n,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,O===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,g.jsx)(Zn,{value:e.id}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsx)(`p`,{className:`font-medium`,children:e.name}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]}),(0,g.jsxs)(`div`,{className:`text-right`,children:[(0,g.jsx)(`p`,{className:`font-medium`,children:e.price===0?`Free`:`${m}${e.price.toFixed(2)}`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.estimatedDays})]})]},e.id))})})]})]}),(0,g.jsxs)(xe,{className:`flex gap-4`,children:[(0,g.jsxs)(i.n,{variant:`outline`,onClick:z,children:[(0,g.jsx)(p.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,g.jsxs)(i.n,{className:`flex-1`,onClick:R,children:[`Continue to Payment`,(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),v===`payment`&&(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.CreditCard,{className:`h-5 w-5`}),`Payment Method`]})}),(0,g.jsxs)(Q,{children:[(0,g.jsx)(Xn,{value:A,onValueChange:j,children:(0,g.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,g.jsxs)(o.n,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,A===e.id?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,g.jsx)(Zn,{value:e.id}),e.icon,(0,g.jsx)(`span`,{className:`font-medium`,children:e.label}),e.last4&&(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[`•••• `,e.last4]})]},e.id))})}),(0,g.jsxs)(`div`,{className:`mt-6 flex items-center gap-2`,children:[(0,g.jsx)(Se,{id:`save-info`,checked:M,onCheckedChange:e=>N(e)}),(0,g.jsx)(o.n,{htmlFor:`save-info`,className:`text-sm`,children:`Save my information for faster checkout`})]}),(0,g.jsxs)(`div`,{className:`mt-6 p-4 rounded-lg bg-muted/50 flex items-center gap-3`,children:[(0,g.jsx)(p.Shield,{className:`h-5 w-5 text-green-500`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your payment information is encrypted and secure`})]})]}),(0,g.jsxs)(xe,{className:`flex gap-4`,children:[(0,g.jsxs)(i.n,{variant:`outline`,onClick:z,children:[(0,g.jsx)(p.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,g.jsxs)(i.n,{className:`flex-1`,onClick:R,children:[`Review Order`,(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),v===`review`&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Review Your Order`}),(0,g.jsx)(be,{children:`Please verify all information before placing your order`})]}),(0,g.jsxs)(Q,{className:`space-y-6`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,g.jsx)(p.MapPin,{className:`h-4 w-4`}),`Shipping Address`]}),(0,g.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,g.jsxs)(`p`,{className:`font-medium`,children:[E.firstName,` `,E.lastName]}),(0,g.jsxs)(`p`,{children:[E.address,E.apartment&&`, ${E.apartment}`]}),(0,g.jsxs)(`p`,{children:[E.city,`, `,E.state,` `,E.postalCode]}),(0,g.jsx)(`p`,{children:E.email}),(0,g.jsx)(`p`,{children:E.phone})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,g.jsx)(p.Truck,{className:`h-4 w-4`}),`Shipping Method`]}),(0,g.jsxs)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:[(0,g.jsx)(`p`,{className:`font-medium`,children:F?.name}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:F?.estimatedDays})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h3`,{className:`font-medium mb-2 flex items-center gap-2`,children:[(0,g.jsx)(p.CreditCard,{className:`h-4 w-4`}),`Payment Method`]}),(0,g.jsx)(`div`,{className:`p-4 rounded-lg bg-muted/50 text-sm`,children:(0,g.jsx)(`p`,{className:`font-medium`,children:a.find(e=>e.id===A)?.label})})]})]}),(0,g.jsxs)(xe,{className:`flex gap-4`,children:[(0,g.jsxs)(i.n,{variant:`outline`,onClick:z,children:[(0,g.jsx)(p.ChevronLeft,{className:`h-4 w-4 mr-2`}),`Back`]}),(0,g.jsx)(i.n,{className:`flex-1`,onClick:L,disabled:w,children:w?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Loader2,{className:`h-4 w-4 mr-2 animate-spin`}),`Processing...`]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Lock,{className:`h-4 w-4 mr-2`}),`Place Order`]})})]})]})]}),(0,g.jsx)(`div`,{className:`lg:sticky lg:top-4 h-fit`,children:(0,g.jsx)(bL,{items:e,currency:m,discount:l,couponCode:b,setCouponCode:x,onApplyCoupon:I,onRemoveDiscount:u,isApplyingCoupon:S,shippingPrice:F?.price||0,taxRate:h})})]})]})}var SL=[{id:`standard`,name:`Standard Shipping`,description:`Delivered by postal service`,price:4.99,estimatedDays:`5-7 business days`,icon:(0,g.jsx)(p.Package,{className:`h-5 w-5`})},{id:`express`,name:`Express Shipping`,description:`Fast delivery guaranteed`,price:14.99,estimatedDays:`2-3 business days`,icon:(0,g.jsx)(p.Truck,{className:`h-5 w-5`})},{id:`overnight`,name:`Overnight Shipping`,description:`Next day delivery`,price:29.99,estimatedDays:`Next business day`,icon:(0,g.jsx)(p.Truck,{className:`h-5 w-5`})}],CL=[{id:`card`,type:`card`,label:`Credit Card`,icon:(0,g.jsx)(p.CreditCard,{className:`h-5 w-5`})},{id:`paypal`,type:`paypal`,label:`PayPal`,icon:(0,g.jsx)(`div`,{className:`h-5 w-5 rounded bg-blue-500 flex items-center justify-center text-white text-xs font-bold`,children:`P`})}],wL=[{id:`1`,name:`Premium Wireless Headphones`,description:`High-quality audio with noise cancellation`,price:249.99,quantity:1,variant:`Matte Black`},{id:`2`,name:`USB-C Charging Cable`,description:`Fast charging compatible`,price:19.99,quantity:2,variant:`2m`}],TL={common:`bg-slate-500/20 text-slate-400 border-slate-500/30`,rare:`bg-blue-500/20 text-blue-400 border-blue-500/30`,epic:`bg-purple-500/20 text-purple-400 border-purple-500/30`,legendary:`bg-amber-500/20 text-amber-400 border-amber-500/30`},EL={common:``,rare:`shadow-blue-500/20`,epic:`shadow-purple-500/20`,legendary:`shadow-amber-500/30 shadow-lg`};function DL({current:e,max:t,level:n}){let r=e/t*100;return(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-bold`,children:n}),(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Level `,n]})]}),(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` XP`]})]}),(0,g.jsxs)(`div`,{className:`relative h-3 rounded-full bg-muted overflow-hidden`,children:[(0,g.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-gradient-to-r from-primary to-primary/80 rounded-full transition-all duration-500`,style:{width:`${r}%`}}),(0,g.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-gradient-to-r from-white/20 to-transparent rounded-full`,style:{width:`${r}%`}})]})]})}function OL({stat:e}){return(0,g.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-muted/50`,children:[e.icon&&(0,g.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-lg bg-background flex items-center justify-center`,{default:`text-foreground`,blue:`text-blue-500`,green:`text-green-500`,yellow:`text-yellow-500`,red:`text-red-500`,purple:`text-purple-500`}[e.color||`default`]),children:e.icon}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-2xl font-bold`,children:e.value}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.label})]})]})}function kL({achievement:e}){let n=e.unlockedAt||e.progress!==void 0&&e.maxProgress!==void 0&&e.progress>=e.maxProgress;return(0,g.jsx)(`div`,{className:t.t(`p-4 rounded-lg border transition-all`,n?t.t(TL[e.rarity||`common`],EL[e.rarity||`common`]):`bg-muted/30 border-dashed opacity-60`),children:(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(`div`,{className:t.t(`h-12 w-12 rounded-lg flex items-center justify-center`,n?`bg-background/50`:`bg-muted`),children:e.icon||(0,g.jsx)(p.Trophy,{className:`h-6 w-6`})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`h4`,{className:`font-medium truncate`,children:e.name}),e.rarity&&(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs capitalize`,children:e.rarity})]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.progress!==void 0&&e.maxProgress!==void 0&&!n&&(0,g.jsxs)(`div`,{className:`mt-2`,children:[(0,g.jsx)(Yn,{value:e.progress/e.maxProgress*100,className:`h-1.5`}),(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[e.progress,` / `,e.maxProgress]})]}),e.unlockedAt&&(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:[`Unlocked `,typeof e.unlockedAt==`string`?e.unlockedAt:e.unlockedAt.toLocaleDateString()]})]})]})})}function AL({match:e}){let n={win:`text-green-500 bg-green-500/10`,loss:`text-red-500 bg-red-500/10`,draw:`text-yellow-500 bg-yellow-500/10`},i={win:(0,g.jsx)(p.Trophy,{className:`h-4 w-4`}),loss:(0,g.jsx)(p.Swords,{className:`h-4 w-4`}),draw:(0,g.jsx)(p.Shield,{className:`h-4 w-4`})};return(0,g.jsxs)(`div`,{className:`flex items-center gap-4 p-3 rounded-lg bg-muted/50`,children:[(0,g.jsx)(`div`,{className:t.t(`h-10 w-10 rounded-lg flex items-center justify-center`,n[e.result]),children:i[e.result]}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`font-medium capitalize`,children:e.result}),e.score&&(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.score})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[e.opponent&&(0,g.jsxs)(`span`,{children:[`vs `,e.opponent]}),e.mode&&(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs`,children:e.mode})]})]}),(0,g.jsxs)(`div`,{className:`text-right`,children:[e.xpGained&&(0,g.jsxs)(`p`,{className:`text-sm font-medium text-green-500`,children:[`+`,e.xpGained,` XP`]}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:typeof e.date==`string`?e.date:e.date.toLocaleDateString()})]})]})}function jL({name:e,avatar:r,title:i,level:a,currentXP:o,maxXP:s,totalXP:c,rank:l,rankIcon:u,stats:d,achievements:f,badges:m,matchHistory:h,streak:_,joinDate:v,playtime:y,friendsCount:b,isOnline:x=!1,className:S}){return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,S),children:[(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`pt-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-6 items-start`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsxs)(n.m,{className:`h-24 w-24 border-4 border-primary/20`,children:[(0,g.jsx)(n.g,{src:r,alt:e}),(0,g.jsx)(n.h,{className:`text-2xl`,children:e.slice(0,2).toUpperCase()})]}),x&&(0,g.jsx)(`div`,{className:`absolute bottom-1 right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background`}),(0,g.jsx)(`div`,{className:`absolute -top-2 -right-2 h-8 w-8 rounded-full bg-primary flex items-center justify-center text-primary-foreground font-bold text-sm`,children:a})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h2`,{className:`text-2xl font-bold`,children:e}),i&&(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:i}),l&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[u||(0,g.jsx)(p.Medal,{className:`h-5 w-5 text-yellow-500`}),(0,g.jsx)(`span`,{className:`font-medium`,children:l})]})]})]}),(0,g.jsxs)(`div`,{className:`flex-1 grid grid-cols-2 md:grid-cols-4 gap-4`,children:[_!==void 0&&(0,g.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-orange-500/10`,children:[(0,g.jsx)(p.Flame,{className:`h-6 w-6 text-orange-500 mx-auto`}),(0,g.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:_}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Day Streak`})]}),c!==void 0&&(0,g.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-purple-500/10`,children:[(0,g.jsx)(p.Zap,{className:`h-6 w-6 text-purple-500 mx-auto`}),(0,g.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:c.toLocaleString()}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Total XP`})]}),y&&(0,g.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-blue-500/10`,children:[(0,g.jsx)(p.Clock,{className:`h-6 w-6 text-blue-500 mx-auto`}),(0,g.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:y}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Playtime`})]}),b!==void 0&&(0,g.jsxs)(`div`,{className:`text-center p-3 rounded-lg bg-green-500/10`,children:[(0,g.jsx)(p.Users,{className:`h-6 w-6 text-green-500 mx-auto`}),(0,g.jsx)(`p`,{className:`text-2xl font-bold mt-1`,children:b}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Friends`})]})]})]}),(0,g.jsx)(`div`,{className:`mt-6`,children:(0,g.jsx)(DL,{current:o,max:s,level:a})}),m&&m.length>0&&(0,g.jsxs)(`div`,{className:`mt-6`,children:[(0,g.jsx)(`h3`,{className:`text-sm font-medium text-muted-foreground mb-3`,children:`Badges`}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 rounded-full bg-muted text-sm`,style:e.color?{backgroundColor:`${e.color}20`,color:e.color}:void 0,children:[e.icon,(0,g.jsx)(`span`,{children:e.name})]},e.id))})]})]})}),(0,g.jsxs)(yr,{defaultValue:`stats`,className:`w-full`,children:[(0,g.jsxs)(br,{className:`w-full justify-start`,children:[(0,g.jsx)(xr,{value:`stats`,children:`Stats`}),(0,g.jsx)(xr,{value:`achievements`,children:`Achievements`}),(0,g.jsx)(xr,{value:`history`,children:`Match History`})]}),(0,g.jsx)(Sr,{value:`stats`,className:`mt-4`,children:(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Player Statistics`}),(0,g.jsx)(be,{children:`Your performance metrics`})]}),(0,g.jsx)(Q,{children:d&&d.length>0?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:d.map((e,t)=>(0,g.jsx)(OL,{stat:e},t))}):(0,g.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No statistics available`})})]})}),(0,g.jsx)(Sr,{value:`achievements`,className:`mt-4`,children:(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Achievements`}),(0,g.jsxs)(be,{children:[f?.filter(e=>e.unlockedAt).length||0,` / `,f?.length||0,` unlocked`]})]}),(0,g.jsx)(Q,{children:f&&f.length>0?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:f.map(e=>(0,g.jsx)(kL,{achievement:e},e.id))}):(0,g.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No achievements yet`})})]})}),(0,g.jsx)(Sr,{value:`history`,className:`mt-4`,children:(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Match History`}),(0,g.jsx)(be,{children:`Your recent games`})]}),(0,g.jsx)(Q,{children:h&&h.length>0?(0,g.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>(0,g.jsx)(AL,{match:e},e.id))}):(0,g.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No matches played yet`})})]})})]}),v&&(0,g.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.Calendar,{className:`h-4 w-4`}),(0,g.jsxs)(`span`,{children:[`Member since `,typeof v==`string`?v:v.toLocaleDateString()]})]})]})}var ML=[{label:`Matches Played`,value:342,icon:(0,g.jsx)(p.Gamepad2,{className:`h-5 w-5`}),color:`blue`},{label:`Wins`,value:189,icon:(0,g.jsx)(p.Trophy,{className:`h-5 w-5`}),color:`green`},{label:`Win Rate`,value:`55.3%`,icon:(0,g.jsx)(p.TrendingUp,{className:`h-5 w-5`}),color:`yellow`},{label:`Best Score`,value:`12,450`,icon:(0,g.jsx)(p.Star,{className:`h-5 w-5`}),color:`purple`},{label:`Kills`,value:`1,234`,icon:(0,g.jsx)(p.Target,{className:`h-5 w-5`}),color:`red`},{label:`Assists`,value:876,icon:(0,g.jsx)(p.Heart,{className:`h-5 w-5`}),color:`default`}],NL=[{id:`first-win`,name:`First Victory`,description:`Win your first match`,rarity:`common`,unlockedAt:new Date(`2024-01-15`),icon:(0,g.jsx)(p.Trophy,{className:`h-6 w-6 text-yellow-500`})},{id:`streak-master`,name:`Streak Master`,description:`Achieve a 10-day login streak`,rarity:`rare`,unlockedAt:new Date(`2024-02-20`),icon:(0,g.jsx)(p.Flame,{className:`h-6 w-6 text-orange-500`})},{id:`legendary-player`,name:`Legendary Player`,description:`Reach level 50`,rarity:`legendary`,progress:42,maxProgress:50,icon:(0,g.jsx)(p.Crown,{className:`h-6 w-6 text-amber-500`})},{id:`social-butterfly`,name:`Social Butterfly`,description:`Add 25 friends`,rarity:`epic`,progress:18,maxProgress:25,icon:(0,g.jsx)(p.Users,{className:`h-6 w-6 text-purple-500`})}],PL=[{id:`beta`,name:`Beta Tester`,icon:(0,g.jsx)(p.Shield,{className:`h-4 w-4`}),color:`#3b82f6`},{id:`premium`,name:`Premium`,icon:(0,g.jsx)(p.Crown,{className:`h-4 w-4`}),color:`#f59e0b`},{id:`verified`,name:`Verified`,icon:(0,g.jsx)(p.Award,{className:`h-4 w-4`}),color:`#10b981`}],FL=[{id:`1`,result:`win`,score:`3-1`,opponent:`xShadowx`,mode:`Ranked`,date:new Date(`2024-03-10`),xpGained:150},{id:`2`,result:`win`,score:`2-0`,opponent:`ProGamer99`,mode:`Ranked`,date:new Date(`2024-03-10`),xpGained:175},{id:`3`,result:`loss`,score:`1-3`,opponent:`NightHawk`,mode:`Ranked`,date:new Date(`2024-03-09`),xpGained:50},{id:`4`,result:`draw`,score:`2-2`,opponent:`StormRider`,mode:`Casual`,date:new Date(`2024-03-09`),xpGained:75},{id:`5`,result:`win`,score:`5-2`,opponent:`BlazeMaster`,mode:`Ranked`,date:new Date(`2024-03-08`),xpGained:200}],IL={authenticator:{icon:(0,g.jsx)(p.Smartphone,{className:`h-5 w-5`}),title:`Authenticator App`,description:`Use an app like Google Authenticator or Authy`,recommended:!0},sms:{icon:(0,g.jsx)(p.MessageSquare,{className:`h-5 w-5`}),title:`SMS`,description:`Receive codes via text message`,recommended:!1},email:{icon:(0,g.jsx)(p.Mail,{className:`h-5 w-5`}),title:`Email`,description:`Receive codes via email`,recommended:!1},hardware:{icon:(0,g.jsx)(p.Key,{className:`h-5 w-5`}),title:`Hardware Key`,description:`Use a physical security key (YubiKey, etc.)`,recommended:!0}};function LL({methods:e,selected:n,onSelect:i}){return(0,g.jsx)(Xn,{value:n,onValueChange:e=>i(e),children:(0,g.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let i=IL[e];return(0,g.jsxs)(o.n,{className:t.t(`flex items-center gap-4 p-4 rounded-lg border cursor-pointer transition-colors`,n===e?`border-primary bg-primary/5`:`hover:bg-muted/50`),children:[(0,g.jsx)(Zn,{value:e}),(0,g.jsx)(`div`,{className:`h-10 w-10 rounded-lg bg-muted flex items-center justify-center`,children:i.icon}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:i.title}),i.recommended&&(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:`Recommended`})]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i.description})]})]},e)})})})}function RL({length:e=6,value:t,onChange:n}){let r=d.useRef([]),i=t.padEnd(e,``).split(``).slice(0,e),a=(t,a)=>{if(!/^\d*$/.test(a))return;let o=[...i];o[t]=a.slice(-1),n(o.join(``)),a&&t<e-1&&r.current[t+1]?.focus()},o=(e,t)=>{t.key===`Backspace`&&!i[e]&&e>0&&r.current[e-1]?.focus()},c=t=>{t.preventDefault(),n(t.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,e))};return(0,g.jsx)(`div`,{className:`flex gap-2 justify-center`,children:i.map((e,t)=>(0,g.jsx)(s.t,{ref:e=>{r.current[t]=e},type:`text`,inputMode:`numeric`,maxLength:1,value:e,onChange:e=>a(t,e.target.value),onKeyDown:e=>o(t,e),onPaste:c,className:`w-12 h-14 text-center text-2xl font-mono`},t))})}function zL({codes:e,onRegenerate:n,onDownload:r}){let[a,o]=d.useState(!1),[s,c]=d.useState(!1),l=()=>{let t=e.map(e=>e.code).join(`
|
|
2655
2655
|
`);navigator.clipboard.writeText(t),o(!0),setTimeout(()=>o(!1),2e3)},u=e.filter(e=>!e.used);return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Key,{className:`h-5 w-5`}),`Backup Codes`]}),(0,g.jsxs)(be,{children:[u.length,` of `,e.length,` codes remaining`]})]}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:()=>c(!s),children:s?(0,g.jsx)(p.EyeOff,{className:`h-4 w-4`}):(0,g.jsx)(p.Eye,{className:`h-4 w-4`})})]})}),(0,g.jsxs)(Q,{children:[(0,g.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:e.map((e,n)=>(0,g.jsx)(`div`,{className:t.t(`font-mono text-sm p-2 rounded border text-center`,e.used?`bg-muted text-muted-foreground line-through`:`bg-card`),children:s?e.code:`••••••••`},n))}),u.length<3&&(0,g.jsxs)(`div`,{className:`mt-4 p-3 rounded-lg bg-yellow-500/10 border border-yellow-500/20 flex items-center gap-3`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-5 w-5 text-yellow-500`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`You're running low on backup codes. Consider regenerating them.`})]})]}),(0,g.jsxs)(xe,{className:`flex gap-2`,children:[(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:l,children:[a?(0,g.jsx)(p.Check,{className:`h-4 w-4 mr-2`}):(0,g.jsx)(p.Copy,{className:`h-4 w-4 mr-2`}),a?`Copied`:`Copy All`]}),r&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:r,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Download`]}),n&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:n,children:[(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4 mr-2`}),`Regenerate`]})]})]})}function BL({status:e={enabled:!1},availableMethods:n=[`authenticator`,`sms`,`email`],qrCodeUrl:a,secretKey:c,backupCodes:l,onEnable:u,onDisable:f,onRegenerateBackupCodes:m,onSendCode:h,className:_}){let[v,y]=d.useState(`overview`),[b,x]=d.useState(n[0]),[S,C]=d.useState(``),[w,T]=d.useState(!1),[E,D]=d.useState(null),[O,k]=d.useState(!1),[A,j]=d.useState(!1);return(0,g.jsxs)(`div`,{className:t.t(`space-y-6 max-w-2xl`,_),children:[(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.enabled?(0,g.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-green-500/10 flex items-center justify-center`,children:(0,g.jsx)(p.ShieldCheck,{className:`h-6 w-6 text-green-500`})}):(0,g.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-yellow-500/10 flex items-center justify-center`,children:(0,g.jsx)(p.ShieldAlert,{className:`h-6 w-6 text-yellow-500`})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{children:`Two-Factor Authentication`}),(0,g.jsx)(be,{children:e.enabled?`Enabled via ${IL[e.method]?.title}`:`Add an extra layer of security to your account`})]})]}),(0,g.jsx)(r.t,{variant:e.enabled?`default`:`secondary`,children:e.enabled?`Enabled`:`Disabled`})]})}),v===`overview`&&(0,g.jsx)(xe,{children:e.enabled?(0,g.jsxs)(`div`,{className:`flex gap-2 w-full`,children:[(0,g.jsx)(i.n,{variant:`outline`,className:`flex-1`,onClick:()=>y(`setup`),children:`Change Method`}),(0,g.jsx)(i.n,{variant:`destructive`,className:`flex-1`,onClick:()=>y(`disable`),children:`Disable 2FA`})]}):(0,g.jsxs)(i.n,{className:`w-full`,onClick:()=>y(`setup`),children:[(0,g.jsx)(p.Shield,{className:`h-4 w-4 mr-2`}),`Enable Two-Factor Authentication`]})})]}),v===`setup`&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Choose Authentication Method`}),(0,g.jsx)(be,{children:`Select how you want to receive verification codes`})]}),(0,g.jsx)(Q,{children:(0,g.jsx)(LL,{methods:n,selected:b,onSelect:x})}),(0,g.jsxs)(xe,{className:`flex gap-2`,children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>y(`overview`),children:`Cancel`}),(0,g.jsxs)(i.n,{className:`flex-1`,onClick:()=>y(`verify`),children:[`Continue`,(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4 ml-2`})]})]})]}),v===`verify`&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:b===`authenticator`?`Set Up Authenticator`:`Verify Your Identity`}),(0,g.jsx)(be,{children:b===`authenticator`?`Scan the QR code with your authenticator app`:`Enter the code sent to your ${b}`})]}),(0,g.jsxs)(Q,{className:`space-y-6`,children:[b===`authenticator`&&(0,g.jsxs)(g.Fragment,{children:[a&&(0,g.jsx)(`div`,{className:`flex justify-center`,children:(0,g.jsx)(`div`,{className:`p-4 bg-white rounded-lg`,children:(0,g.jsx)(`img`,{src:a,alt:`QR Code`,className:`h-48 w-48`})})}),c&&(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Or enter this code manually:`}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(s.t,{value:c,readOnly:!0,className:`font-mono`}),(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:()=>{c&&(navigator.clipboard.writeText(c),k(!0),setTimeout(()=>k(!1),2e3))},children:O?(0,g.jsx)(p.Check,{className:`h-4 w-4`}):(0,g.jsx)(p.Copy,{className:`h-4 w-4`})})]})]}),(0,g.jsx)(i.t,{})]}),(b===`sms`||b===`email`)&&!A&&(0,g.jsxs)(`div`,{className:`text-center`,children:[(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:[`We'll send a verification code to your `,b===`sms`?`phone`:`email`]}),(0,g.jsxs)(i.n,{onClick:async()=>{if(h){T(!0);try{await h(b),j(!0)}finally{T(!1)}}},disabled:w,children:[w?(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):b===`sms`?(0,g.jsx)(p.MessageSquare,{className:`h-4 w-4 mr-2`}):(0,g.jsx)(p.Mail,{className:`h-4 w-4 mr-2`}),`Send Code`]})]}),(b===`authenticator`||A)&&(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(o.n,{className:`text-center block`,children:`Enter the 6-digit code`}),(0,g.jsx)(RL,{value:S,onChange:C}),E&&(0,g.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:E})]})]}),(0,g.jsxs)(xe,{className:`flex gap-2`,children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>y(`setup`),children:`Back`}),(0,g.jsxs)(i.n,{className:`flex-1`,onClick:async()=>{if(u){T(!0),D(null);try{await u(b,S)?(y(`overview`),C(``)):D(`Invalid verification code. Please try again.`)}finally{T(!1)}}},disabled:S.length!==6||w,children:[w?(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):(0,g.jsx)(p.Lock,{className:`h-4 w-4 mr-2`}),`Verify & Enable`]})]})]}),v===`disable`&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{className:`text-destructive`,children:`Disable Two-Factor Authentication`}),(0,g.jsx)(be,{children:`Enter your verification code to confirm. This will make your account less secure.`})]}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[(0,g.jsx)(`div`,{className:`p-4 rounded-lg bg-destructive/10 border border-destructive/20`,children:(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-5 w-5 text-destructive mt-0.5`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`font-medium text-destructive`,children:`Warning`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Disabling 2FA will remove an important layer of security from your account. Anyone with your password will be able to access your account.`})]})]})}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Enter your verification code`}),(0,g.jsx)(RL,{value:S,onChange:C}),E&&(0,g.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:E})]})]}),(0,g.jsxs)(xe,{className:`flex gap-2`,children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>y(`overview`),children:`Cancel`}),(0,g.jsxs)(i.n,{variant:`destructive`,className:`flex-1`,onClick:async()=>{if(f){T(!0),D(null);try{await f(S)?(y(`overview`),C(``)):D(`Invalid verification code. Please try again.`)}finally{T(!1)}}},disabled:S.length!==6||w,children:[w?(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4 mr-2 animate-spin`}):(0,g.jsx)(p.ShieldAlert,{className:`h-4 w-4 mr-2`}),`Disable 2FA`]})]})]}),e.enabled&&l&&l.length>0&&v===`overview`&&(0,g.jsx)(zL,{codes:l,onRegenerate:m,onDownload:()=>{let e=l.map(e=>e.code).join(`
|
|
2656
2656
|
`),t=new Blob([e],{type:`text/plain`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`backup-codes.txt`,r.click()}}),(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Fingerprint,{className:`h-5 w-5`}),`Security Tips`]})}),(0,g.jsxs)(Q,{className:`space-y-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(p.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Use an authenticator app for the most secure experience`})]}),(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(p.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Store your backup codes in a safe place (password manager, safe deposit box)`})]}),(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(p.Check,{className:`h-4 w-4 text-green-500 mt-1`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Never share your verification codes with anyone`})]})]})]})]})}var VL=[{code:`ABCD-1234`,used:!1},{code:`EFGH-5678`,used:!1},{code:`IJKL-9012`,used:!0},{code:`MNOP-3456`,used:!1},{code:`QRST-7890`,used:!1},{code:`UVWX-1234`,used:!0},{code:`YZAB-5678`,used:!1},{code:`CDEF-9012`,used:!1}],HL={enabled:!0,method:`authenticator`,lastVerified:new Date(`2024-03-01`)},UL={online:`bg-green-500`,offline:`bg-gray-400`,away:`bg-yellow-500`,busy:`bg-red-500`};function WL({user:e,size:r=`md`}){return(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsxs)(n.m,{className:{sm:`h-8 w-8`,md:`h-10 w-10`,lg:`h-12 w-12`}[r],children:[(0,g.jsx)(n.g,{src:e.avatar,alt:e.name}),(0,g.jsx)(n.h,{children:e.name.slice(0,2).toUpperCase()})]}),e.status&&(0,g.jsx)(`div`,{className:t.t(`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background`,UL[e.status])})]})}function GL({conversation:e,currentUserId:i,isSelected:a,onClick:o}){let s=e.participants.find(e=>e.id!==i),c=e.isGroup?e.groupName:s?.name,l=e.isGroup?e.groupAvatar:s?.avatar;return(0,g.jsxs)(`button`,{onClick:o,className:t.t(`w-full flex items-center gap-3 p-3 rounded-lg transition-colors text-left`,a?`bg-primary/10`:`hover:bg-muted/50`),children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsxs)(n.m,{children:[(0,g.jsx)(n.g,{src:l}),(0,g.jsx)(n.h,{children:c?.slice(0,2).toUpperCase()})]}),!e.isGroup&&s?.status&&(0,g.jsx)(`div`,{className:t.t(`absolute bottom-0 right-0 h-3 w-3 rounded-full border-2 border-background`,UL[s.status])})]}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`span`,{className:`font-medium truncate`,children:c}),e.lastMessage&&(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:typeof e.lastMessage.timestamp==`string`?e.lastMessage.timestamp:JL(e.lastMessage.timestamp)})]}),e.lastMessage&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:e.lastMessage.content})]}),e.unreadCount&&e.unreadCount>0&&(0,g.jsx)(r.t,{className:`h-5 w-5 p-0 flex items-center justify-center rounded-full`,children:e.unreadCount}),e.isPinned&&(0,g.jsx)(p.Pin,{className:`h-3 w-3 text-muted-foreground`})]})}function KL({message:e,isOwn:n,sender:r,showAvatar:i}){let a={sending:(0,g.jsx)(p.Clock,{className:`h-3 w-3`}),sent:(0,g.jsx)(p.Check,{className:`h-3 w-3`}),delivered:(0,g.jsx)(p.CheckCheck,{className:`h-3 w-3`}),read:(0,g.jsx)(p.CheckCheck,{className:`h-3 w-3 text-blue-500`})};return(0,g.jsxs)(`div`,{className:t.t(`flex gap-2 max-w-[80%]`,n?`ml-auto flex-row-reverse`:``),children:[i&&r&&!n&&(0,g.jsx)(WL,{user:r,size:`sm`}),!i&&!n&&(0,g.jsx)(`div`,{className:`w-8`}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[!n&&i&&r&&(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground ml-1`,children:r.name}),(0,g.jsxs)(`div`,{className:t.t(`rounded-2xl px-4 py-2`,n?`bg-primary text-primary-foreground rounded-br-md`:`bg-muted rounded-bl-md`),children:[e.replyTo&&(0,g.jsxs)(`div`,{className:t.t(`text-xs mb-1 pb-1 border-b`,n?`border-primary-foreground/20`:`border-border`),children:[(0,g.jsx)(p.Reply,{className:`h-3 w-3 inline mr-1`}),`Reply to message`]}),(0,g.jsx)(`p`,{className:`text-sm whitespace-pre-wrap`,children:e.content}),e.attachments&&e.attachments.length>0&&(0,g.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.attachments.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.type===`image`?(0,g.jsx)(p.Image,{className:`h-4 w-4`}):(0,g.jsx)(p.File,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{className:`text-xs truncate`,children:e.name})]},e.id))})]}),(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-1 text-xs text-muted-foreground`,n?`justify-end`:``),children:[(0,g.jsx)(`span`,{children:typeof e.timestamp==`string`?e.timestamp:JL(e.timestamp)}),n&&e.status&&a[e.status]]}),e.reactions&&e.reactions.length>0&&(0,g.jsx)(`div`,{className:`flex gap-1 mt-1`,children:Array.from(new Set(e.reactions.map(e=>e.emoji))).map(t=>(0,g.jsxs)(`span`,{className:`text-xs bg-muted rounded-full px-2 py-0.5`,children:[t,` `,e.reactions.filter(e=>e.emoji===t).length]},t))})]})]})}function qL({users:e}){if(e.length===0)return null;let t=e.map(e=>e.name).join(`, `);return(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsxs)(`div`,{className:`flex gap-1`,children:[(0,g.jsx)(p.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`0ms`}}),(0,g.jsx)(p.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`150ms`}}),(0,g.jsx)(p.Circle,{className:`h-2 w-2 animate-bounce`,style:{animationDelay:`300ms`}})]}),(0,g.jsxs)(`span`,{children:[t,` `,e.length===1?`is`:`are`,` typing...`]})]})}function JL(e){return e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function YL({currentUser:e,conversations:r=[],selectedConversation:a,messages:o=[],onSendMessage:c,onSelectConversation:l,onTyping:u,typingUsers:f=[],showSidebar:m=!0,className:h}){let[_,v]=d.useState(``),[y,b]=d.useState(``),x=d.useRef(null),S=()=>{x.current?.scrollIntoView({behavior:`smooth`})};d.useEffect(()=>{S()},[o]);let C=()=>{!_.trim()||!c||(c(_.trim()),v(``))},w=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),C())},T=r.filter(t=>{if(!y)return!0;let n=t.participants.find(t=>t.id!==e.id);return(t.isGroup?t.groupName:n?.name)?.toLowerCase().includes(y.toLowerCase())}),E=a?.participants.find(t=>t.id!==e.id),D=a?.isGroup?a.groupName:E?.name,O=o.reduce((e,t,n)=>{let r=o[n-1],i=!r||r.senderId!==t.senderId;return e.push({message:t,showAvatar:i}),e},[]);return(0,g.jsxs)(`div`,{className:t.t(`flex h-[600px] rounded-lg border overflow-hidden`,h),children:[m&&(0,g.jsxs)(`div`,{className:`w-80 border-r flex flex-col bg-card`,children:[(0,g.jsxs)(`div`,{className:`p-4 border-b`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,g.jsx)(`h2`,{className:`font-semibold text-lg`,children:`Messages`}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,children:(0,g.jsx)(p.MoreVertical,{className:`h-4 w-4`})})]}),(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Search conversations...`,value:y,onChange:e=>b(e.target.value),className:`pl-9`})]})]}),(0,g.jsx)(n.f,{className:`flex-1`,children:(0,g.jsx)(`div`,{className:`p-2 space-y-1`,children:T.map(t=>(0,g.jsx)(GL,{conversation:t,currentUserId:e.id,isSelected:a?.id===t.id,onClick:()=>l?.(t)},t.id))})})]}),(0,g.jsx)(`div`,{className:`flex-1 flex flex-col`,children:a?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`h-16 border-b flex items-center justify-between px-4 bg-card`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[E&&(0,g.jsx)(WL,{user:E}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`font-medium`,children:D}),E?.status&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground capitalize`,children:E.status===`online`?`Online`:`Last seen ${E.lastSeen||`recently`}`})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,children:(0,g.jsx)(p.Phone,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,children:(0,g.jsx)(p.Video,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,children:(0,g.jsx)(p.MoreVertical,{className:`h-4 w-4`})})]})]}),(0,g.jsxs)(n.f,{className:`flex-1 p-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-4`,children:[O.map(({message:t,showAvatar:n})=>(0,g.jsx)(KL,{message:t,isOwn:t.senderId===e.id,sender:a.participants.find(e=>e.id===t.senderId),showAvatar:n},t.id)),(0,g.jsx)(`div`,{ref:x})]}),f.length>0&&(0,g.jsx)(`div`,{className:`mt-4`,children:(0,g.jsx)(qL,{users:f})})]}),(0,g.jsx)(`div`,{className:`p-4 border-t bg-card`,children:(0,g.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,children:(0,g.jsx)(p.Paperclip,{className:`h-4 w-4`})}),(0,g.jsx)(`div`,{className:`flex-1`,children:(0,g.jsx)(s.t,{placeholder:`Type a message...`,value:_,onChange:e=>{v(e.target.value),u?.()},onKeyDown:w,className:`rounded-full`})}),(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,children:(0,g.jsx)(p.Smile,{className:`h-4 w-4`})}),(0,g.jsx)(i.n,{size:`icon`,onClick:C,disabled:!_.trim(),children:(0,g.jsx)(p.Send,{className:`h-4 w-4`})})]})})]}):(0,g.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,g.jsxs)(`div`,{className:`text-center`,children:[(0,g.jsx)(`div`,{className:`h-16 w-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4`,children:(0,g.jsx)(p.Send,{className:`h-8 w-8 text-muted-foreground`})}),(0,g.jsx)(`h3`,{className:`font-medium text-lg`,children:`Your Messages`}),(0,g.jsx)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:`Select a conversation to start chatting`})]})})})]})}var XL=[{id:`1`,name:`John Doe`,avatar:``,status:`online`},{id:`2`,name:`Jane Smith`,avatar:``,status:`away`,lastSeen:`2 hours ago`},{id:`3`,name:`Bob Wilson`,avatar:``,status:`offline`,lastSeen:`yesterday`},{id:`4`,name:`Alice Brown`,avatar:``,status:`busy`}],ZL=[{id:`conv1`,participants:[XL[0],XL[1]],lastMessage:{id:`m1`,content:`Hey, how's the project going?`,senderId:`2`,timestamp:new Date,status:`read`},unreadCount:2,isPinned:!0},{id:`conv2`,participants:[XL[0],XL[2]],lastMessage:{id:`m2`,content:`See you tomorrow!`,senderId:`1`,timestamp:new Date(Date.now()-36e5),status:`delivered`}},{id:`conv3`,isGroup:!0,groupName:`Project Team`,participants:[XL[0],XL[1],XL[2],XL[3]],lastMessage:{id:`m3`,content:`Meeting at 3pm`,senderId:`4`,timestamp:new Date(Date.now()-72e5),status:`read`},unreadCount:5}],QL=[{id:`msg1`,content:`Hey! How are you doing?`,senderId:`2`,timestamp:new Date(Date.now()-36e5),status:`read`},{id:`msg2`,content:`I'm doing great, thanks for asking! Just finished the new feature.`,senderId:`1`,timestamp:new Date(Date.now()-35e5),status:`read`},{id:`msg3`,content:`That's awesome! Can you show me a demo?`,senderId:`2`,timestamp:new Date(Date.now()-34e5),status:`read`},{id:`msg4`,content:`Sure! Let me schedule a call for tomorrow. Does 2pm work for you?`,senderId:`1`,timestamp:new Date(Date.now()-33e5),status:`delivered`},{id:`msg5`,content:`Perfect, 2pm works great!`,senderId:`2`,timestamp:new Date(Date.now()-32e5),status:`read`}],$L={pending:{color:`text-yellow-500 bg-yellow-500/10`,icon:(0,g.jsx)(p.Clock,{className:`h-4 w-4`}),label:`Pending`},building:{color:`text-blue-500 bg-blue-500/10`,icon:(0,g.jsx)(p.Loader2,{className:`h-4 w-4 animate-spin`}),label:`Building`},deploying:{color:`text-purple-500 bg-purple-500/10`,icon:(0,g.jsx)(p.Rocket,{className:`h-4 w-4 animate-pulse`}),label:`Deploying`},success:{color:`text-green-500 bg-green-500/10`,icon:(0,g.jsx)(p.CheckCircle,{className:`h-4 w-4`}),label:`Success`},failed:{color:`text-red-500 bg-red-500/10`,icon:(0,g.jsx)(p.XCircle,{className:`h-4 w-4`}),label:`Failed`},cancelled:{color:`text-gray-500 bg-gray-500/10`,icon:(0,g.jsx)(p.XCircle,{className:`h-4 w-4`}),label:`Cancelled`},rollback:{color:`text-orange-500 bg-orange-500/10`,icon:(0,g.jsx)(p.RotateCcw,{className:`h-4 w-4`}),label:`Rollback`}},eR={development:{color:`text-blue-500 border-blue-500/30 bg-blue-500/10`,icon:(0,g.jsx)(p.Terminal,{className:`h-4 w-4`})},staging:{color:`text-yellow-500 border-yellow-500/30 bg-yellow-500/10`,icon:(0,g.jsx)(p.Server,{className:`h-4 w-4`})},production:{color:`text-green-500 border-green-500/30 bg-green-500/10`,icon:(0,g.jsx)(p.Globe,{className:`h-4 w-4`})}};function tR({status:e}){let n=$L[e];return(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(`gap-1`,n.color),children:[n.icon,n.label]})}function nR({environment:e}){let n=eR[e];return(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(`gap-1 capitalize`,n.color),children:[n.icon,e]})}function rR({deployment:e,onRollback:t,onCancel:r,onRetry:a}){let o=e.status===`building`||e.status===`deploying`,s=e.status===`success`&&e.environment===`production`,c=e.status===`failed`,l=o;return(0,g.jsx)(`div`,{className:`p-4 rounded-lg border bg-card hover:bg-muted/50 transition-colors`,children:(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsxs)(n.m,{className:`h-10 w-10`,children:[(0,g.jsx)(n.g,{src:e.author.avatar}),(0,g.jsx)(n.h,{children:e.author.name.slice(0,2).toUpperCase()})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsx)(tR,{status:e.status}),(0,g.jsx)(nR,{environment:e.environment})]}),(0,g.jsx)(`p`,{className:`text-sm mt-1 line-clamp-1`,children:e.commitMessage}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.GitBranch,{className:`h-3 w-3`}),e.branch]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.GitCommit,{className:`h-3 w-3`}),e.commit.slice(0,7)]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Clock,{className:`h-3 w-3`}),typeof e.startedAt==`string`?e.startedAt:oR(e.startedAt)]}),e.duration&&(0,g.jsx)(`span`,{children:e.duration})]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.url&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,asChild:!0,children:(0,g.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:(0,g.jsx)(p.ExternalLink,{className:`h-4 w-4`})})}),l&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:r,children:(0,g.jsx)(p.Pause,{className:`h-4 w-4`})}),c&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:a,children:(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4`})}),s&&(0,g.jsx)(i.n,{variant:`ghost`,size:`icon`,onClick:t,children:(0,g.jsx)(p.RotateCcw,{className:`h-4 w-4`})})]})]})})}function iR({pipeline:e}){let n=e.stages.filter(e=>e.status===`success`).length/e.stages.length*100;return(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{className:`pb-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(tR,{status:e.status}),(0,g.jsx)(`span`,{className:`font-medium`,children:e.name})]}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:typeof e.startedAt==`string`?e.startedAt:oR(e.startedAt)})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,g.jsx)(p.GitBranch,{className:`h-3 w-3`}),e.branch,(0,g.jsx)(`span`,{className:`mx-1`,children:`•`}),`Triggered by `,e.trigger]})]}),(0,g.jsx)(Q,{children:(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsx)(Yn,{value:n,className:`h-2`}),(0,g.jsx)(`div`,{className:`flex items-center justify-between`,children:e.stages.map((n,r)=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,g.jsx)(`div`,{className:t.t(`h-8 w-8 rounded-full flex items-center justify-center`,$L[n.status].color),children:$L[n.status].icon}),(0,g.jsx)(`span`,{className:`text-xs`,children:n.name}),n.duration&&(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.duration})]}),r<e.stages.length-1&&(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4 text-muted-foreground`})]},n.id))})]})})]})}function aR({env:e}){let n={healthy:`text-green-500`,degraded:`text-yellow-500`,down:`text-red-500`},r={healthy:(0,g.jsx)(p.CheckCircle,{className:`h-5 w-5`}),degraded:(0,g.jsx)(p.AlertCircle,{className:`h-5 w-5`}),down:(0,g.jsx)(p.XCircle,{className:`h-5 w-5`})};return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(Z,{className:`capitalize flex items-center gap-2`,children:[eR[e.name].icon,e.name]}),(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-1`,n[e.status]),children:[r[e.status],(0,g.jsx)(`span`,{className:`text-sm capitalize`,children:e.status})]})]})}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,g.jsx)(p.ExternalLink,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary hover:underline truncate`,children:e.url})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 text-sm`,children:[e.uptime&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Uptime`}),(0,g.jsx)(`p`,{className:`font-medium`,children:e.uptime})]}),e.responseTime&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Response Time`}),(0,g.jsx)(`p`,{className:`font-medium`,children:e.responseTime})]})]}),e.lastDeployment&&(0,g.jsxs)(`div`,{className:`pt-2 border-t`,children:[(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:`Last Deployment`}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,g.jsx)(tR,{status:e.lastDeployment.status}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:typeof e.lastDeployment.startedAt==`string`?e.lastDeployment.startedAt:oR(e.lastDeployment.startedAt)})]})]})]})]})}function oR(e){let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`}function sR({deployments:e=[],pipelines:n=[],environments:r=[],onDeploy:o,onRollback:s,onCancel:c,onRetry:l,branches:u=[`main`,`develop`,`staging`],className:f}){let[m,h]=d.useState(u[0]),[_,v]=d.useState(`staging`),y=e.filter(e=>e.status===`building`||e.status===`deploying`);return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,f),children:[(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Deployments`}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage and monitor your deployments`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(a.d,{value:m,onValueChange:h,children:[(0,g.jsxs)(a.y,{className:`w-[160px]`,children:[(0,g.jsx)(p.GitBranch,{className:`h-4 w-4 mr-2`}),(0,g.jsx)(a.b,{})]}),(0,g.jsx)(a.f,{children:u.map(e=>(0,g.jsx)(a.m,{value:e,children:e},e))})]}),(0,g.jsxs)(a.d,{value:_,onValueChange:e=>v(e),children:[(0,g.jsxs)(a.y,{className:`w-[160px]`,children:[(0,g.jsx)(p.Server,{className:`h-4 w-4 mr-2`}),(0,g.jsx)(a.b,{})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`development`,children:`Development`}),(0,g.jsx)(a.m,{value:`staging`,children:`Staging`}),(0,g.jsx)(a.m,{value:`production`,children:`Production`})]})]}),(0,g.jsxs)(i.n,{onClick:()=>o?.(_,m),children:[(0,g.jsx)(p.Rocket,{className:`h-4 w-4 mr-2`}),`Deploy`]})]})]}),y.length>0&&(0,g.jsx)(Y,{className:`border-blue-500/50 bg-blue-500/5`,children:(0,g.jsx)(Q,{className:`py-4`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`div`,{className:`h-10 w-10 rounded-full bg-blue-500/10 flex items-center justify-center`,children:(0,g.jsx)(p.Rocket,{className:`h-5 w-5 text-blue-500 animate-pulse`})}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`p`,{className:`font-medium`,children:[y.length,` deployment`,y.length>1?`s`:``,` in progress`]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y.map(e=>e.environment).join(`, `)})]})]})})}),(0,g.jsx)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:r.map(e=>(0,g.jsx)(aR,{env:e},e.name))}),(0,g.jsxs)(yr,{defaultValue:`deployments`,className:`w-full`,children:[(0,g.jsxs)(br,{children:[(0,g.jsx)(xr,{value:`deployments`,children:`Recent Deployments`}),(0,g.jsx)(xr,{value:`pipelines`,children:`Pipelines`})]}),(0,g.jsx)(Sr,{value:`deployments`,className:`mt-4 space-y-3`,children:e.length>0?e.map(e=>(0,g.jsx)(rR,{deployment:e,onRollback:()=>s?.(e.id),onCancel:()=>c?.(e.id),onRetry:()=>l?.(e.id)},e.id)):(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`py-12 text-center`,children:[(0,g.jsx)(p.Rocket,{className:`h-12 w-12 mx-auto text-muted-foreground mb-4`}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`No deployments yet`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Deploy your first version to get started`})]})})}),(0,g.jsx)(Sr,{value:`pipelines`,className:`mt-4 space-y-4`,children:n.length>0?n.map(e=>(0,g.jsx)(iR,{pipeline:e},e.id)):(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`py-12 text-center`,children:[(0,g.jsx)(p.Activity,{className:`h-12 w-12 mx-auto text-muted-foreground mb-4`}),(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`No active pipelines`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pipelines will appear here when triggered`})]})})})]})]})}var cR=[{id:`d1`,status:`success`,environment:`production`,branch:`main`,commit:`a1b2c3d4e5f6`,commitMessage:`feat: Add new dashboard component`,author:{name:`John Doe`},startedAt:new Date(Date.now()-36e5),finishedAt:new Date(Date.now()-33e5),duration:`5m 12s`,url:`https://app.example.com`},{id:`d2`,status:`building`,environment:`staging`,branch:`develop`,commit:`f6e5d4c3b2a1`,commitMessage:`fix: Resolve login issue`,author:{name:`Jane Smith`},startedAt:new Date(Date.now()-18e4)},{id:`d3`,status:`failed`,environment:`development`,branch:`feature/new-api`,commit:`1a2b3c4d5e6f`,commitMessage:`wip: New API endpoints`,author:{name:`Bob Wilson`},startedAt:new Date(Date.now()-72e5),finishedAt:new Date(Date.now()-7e6),duration:`3m 20s`}],lR=[{id:`p1`,name:`CI/CD Pipeline`,status:`building`,trigger:`push to main`,branch:`main`,startedAt:new Date(Date.now()-3e5),stages:[{id:`s1`,name:`Build`,status:`success`,duration:`1m 30s`},{id:`s2`,name:`Test`,status:`success`,duration:`2m 45s`},{id:`s3`,name:`Deploy`,status:`building`},{id:`s4`,name:`Verify`,status:`pending`}]}],uR=[{name:`production`,status:`healthy`,url:`https://app.example.com`,uptime:`99.9%`,responseTime:`120ms`,lastDeployment:cR[0]},{name:`staging`,status:`degraded`,url:`https://staging.example.com`,uptime:`98.5%`,responseTime:`250ms`},{name:`development`,status:`healthy`,url:`https://dev.example.com`,uptime:`95.0%`,responseTime:`180ms`}];t.n();var dR={critical:{label:`Critical`,color:`text-red-500`,bgColor:`bg-red-500`},high:{label:`High`,color:`text-orange-500`,bgColor:`bg-orange-500`},medium:{label:`Medium`,color:`text-yellow-500`,bgColor:`bg-yellow-500`},low:{label:`Low`,color:`text-blue-500`,bgColor:`bg-blue-500`}},fR={triggered:{label:`Triggered`,color:`text-red-500`,icon:p.AlertCircle},acknowledged:{label:`Acknowledged`,color:`text-orange-500`,icon:p.Bell},investigating:{label:`Investigating`,color:`text-yellow-500`,icon:p.Search},identified:{label:`Identified`,color:`text-blue-500`,icon:p.Activity},resolved:{label:`Resolved`,color:`text-green-500`,icon:p.CheckCircle2},closed:{label:`Closed`,color:`text-gray-500`,icon:p.XCircle}};function pR(e,t){let n=(t||new Date).getTime()-e.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24);return a>0?`${a}d ${i%24}h`:i>0?`${i}h ${r%60}m`:`${r}m`}function mR(e){return e.toLocaleTimeString(`fr-FR`,{hour:`2-digit`,minute:`2-digit`})}function hR({incident:e,onAcknowledge:a,onResolve:o,onSelect:s}){let c=dR[e.severity],l=fR[e.status],u=l.icon,d=![`resolved`,`closed`].includes(e.status);return(0,g.jsx)(Y,{className:t.t(`cursor-pointer transition-all hover:shadow-md`,e.severity===`critical`&&d&&`border-red-500/50 bg-red-500/5`,e.severity===`high`&&d&&`border-orange-500/30`),onClick:s,children:(0,g.jsx)(Q,{className:`p-4`,children:(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(`div`,{className:t.t(`p-2 rounded-lg shrink-0`,`${c.bgColor}/10`),children:(0,g.jsx)(p.AlertTriangle,{className:t.t(`h-5 w-5`,c.color)})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsx)(r.t,{className:t.t(`text-white text-xs`,c.bgColor),children:c.label}),(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(`text-xs`,l.color),children:[(0,g.jsx)(u,{className:`h-3 w-3 mr-1`}),l.label]}),e.service&&(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:e.service})]}),(0,g.jsx)(`h4`,{className:`font-semibold mt-2 truncate`,children:e.title}),e.description&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:e.description}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 text-xs text-muted-foreground`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Clock,{className:`h-3 w-3`}),pR(e.createdAt,e.resolvedAt)]}),e.affectedUsers!==void 0&&(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Users,{className:`h-3 w-3`}),e.affectedUsers,` affected`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.MessageSquare,{className:`h-3 w-3`}),e.events.length]})]}),e.responders.length>0&&(0,g.jsx)(`div`,{className:`flex items-center gap-2 mt-3`,children:(0,g.jsxs)(`div`,{className:`flex -space-x-2`,children:[e.responders.slice(0,3).map(e=>(0,g.jsxs)(n.m,{className:`h-6 w-6 border-2 border-background`,children:[(0,g.jsx)(n.g,{src:e.avatar}),(0,g.jsx)(n.h,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]},e.id)),e.responders.length>3&&(0,g.jsxs)(`div`,{className:`h-6 w-6 rounded-full bg-muted flex items-center justify-center text-xs border-2 border-background`,children:[`+`,e.responders.length-3]})]})})]}),d&&(0,g.jsxs)(`div`,{className:`flex flex-col gap-1 shrink-0`,children:[e.status===`triggered`&&a&&(0,g.jsx)(i.n,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:e=>{e.stopPropagation(),a()},children:`Ack`}),e.status!==`triggered`&&e.status!==`resolved`&&o&&(0,g.jsx)(i.n,{size:`sm`,variant:`outline`,className:`h-7 text-xs text-green-500`,onClick:e=>{e.stopPropagation(),o()},children:`Resolve`})]})]})})})}function gR({incidents:e}){let t=e.filter(e=>![`resolved`,`closed`].includes(e.status)),n=t.filter(e=>e.severity===`critical`),r=d.useMemo(()=>{let t=e.filter(e=>e.resolvedAt);if(t.length===0)return 0;let n=t.reduce((e,t)=>e+(t.resolvedAt.getTime()-t.createdAt.getTime()),0);return Math.round(n/t.length/6e4)},[e]);return(0,g.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-3xl font-bold text-red-500`,children:t.length}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Active Incidents`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-3xl font-bold text-orange-500`,children:n.length}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Critical`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsxs)(`div`,{className:`text-3xl font-bold`,children:[r,`m`]}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Avg MTTR`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-3xl font-bold text-green-500`,children:e.filter(e=>e.status===`resolved`).length}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Resolved Today`})]})})]})}function _R({incidents:e,onCreateIncident:o,onAcknowledge:c,onResolve:l,onEscalate:u,onAssign:f,className:m}){let[h,_]=d.useState(``),[v,y]=d.useState(`all`),[b,x]=d.useState(`active`),[S,C]=d.useState(null),w=d.useMemo(()=>e.filter(e=>!(h&&!e.title.toLowerCase().includes(h.toLowerCase())||v!==`all`&&e.severity!==v||b===`active`&&[`resolved`,`closed`].includes(e.status)||b===`resolved`&&![`resolved`,`closed`].includes(e.status))).sort((e,t)=>{let n={critical:0,high:1,medium:2,low:3},r=n[e.severity]-n[t.severity];return r===0?t.createdAt.getTime()-e.createdAt.getTime():r}),[e,h,v,b]);return(0,g.jsxs)(`div`,{className:t.t(`flex flex-col gap-6`,m),children:[(0,g.jsx)(gR,{incidents:e}),(0,g.jsxs)(`div`,{className:`flex gap-6`,children:[(0,g.jsxs)(`div`,{className:`flex-1 space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Search incidents...`,value:h,onChange:e=>_(e.target.value),className:`pl-9`})]}),(0,g.jsxs)(a.d,{value:v,onValueChange:e=>y(e),children:[(0,g.jsx)(a.y,{className:`w-32`,children:(0,g.jsx)(a.b,{placeholder:`Severity`})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`All Severity`}),(0,g.jsx)(a.m,{value:`critical`,children:`Critical`}),(0,g.jsx)(a.m,{value:`high`,children:`High`}),(0,g.jsx)(a.m,{value:`medium`,children:`Medium`}),(0,g.jsx)(a.m,{value:`low`,children:`Low`})]})]}),(0,g.jsxs)(a.d,{value:b,onValueChange:e=>x(e),children:[(0,g.jsx)(a.y,{className:`w-32`,children:(0,g.jsx)(a.b,{placeholder:`Status`})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`active`,children:`Active`}),(0,g.jsx)(a.m,{value:`resolved`,children:`Resolved`}),(0,g.jsx)(a.m,{value:`all`,children:`All`})]})]}),o&&(0,g.jsxs)(i.n,{onClick:o,children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-1`}),`Create Incident`]})]}),(0,g.jsx)(n.f,{className:`h-[600px]`,children:(0,g.jsx)(`div`,{className:`space-y-3 pr-4`,children:w.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,g.jsx)(p.Shield,{className:`h-12 w-12 mb-4 text-green-500`}),(0,g.jsx)(`p`,{className:`text-lg font-medium`,children:`No incidents`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`All systems are operational`})]}):w.map(e=>(0,g.jsx)(hR,{incident:e,onAcknowledge:c?()=>c(e):void 0,onResolve:l?()=>l(e):void 0,onSelect:()=>C(e)},e.id))})})]}),S&&(0,g.jsxs)(Y,{className:`w-96 shrink-0`,children:[(0,g.jsxs)(X,{className:`pb-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(r.t,{className:t.t(`text-white`,dR[S.severity].bgColor),children:dR[S.severity].label}),(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:()=>C(null),children:(0,g.jsx)(p.XCircle,{className:`h-4 w-4`})})]}),(0,g.jsx)(Z,{className:`mt-2`,children:S.title}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,g.jsx)(r.t,{variant:`outline`,className:fR[S.status].color,children:fR[S.status].label}),S.service&&(0,g.jsx)(r.t,{variant:`secondary`,children:S.service})]})]}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[S.description&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S.description}),S.impact&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Impact`}),(0,g.jsx)(`p`,{className:`text-sm`,children:S.impact})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Timeline`}),(0,g.jsx)(`div`,{className:`space-y-2`,children:S.events.slice(0,5).map(e=>(0,g.jsxs)(`div`,{className:`flex items-start gap-2 text-xs`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:mR(e.timestamp)}),(0,g.jsx)(`span`,{children:e.content})]},e.id))})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground mb-2`,children:`Responders`}),(0,g.jsx)(`div`,{className:`space-y-2`,children:S.responders.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(n.m,{className:`h-6 w-6`,children:[(0,g.jsx)(n.g,{src:e.avatar}),(0,g.jsx)(n.h,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]}),(0,g.jsx)(`span`,{className:`text-sm`,children:e.name}),(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs ml-auto`,children:e.role})]},e.id))})]}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 border-t`,children:[S.slackChannel&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,className:`justify-start`,children:[(0,g.jsx)(p.MessageSquare,{className:`h-4 w-4 mr-2`}),`Join #`,S.slackChannel]}),S.runbookUrl&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,className:`justify-start`,children:[(0,g.jsx)(p.ExternalLink,{className:`h-4 w-4 mr-2`}),`View Runbook`]}),u&&![`resolved`,`closed`].includes(S.status)&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,className:`justify-start text-orange-500`,onClick:()=>u(S),children:[(0,g.jsx)(p.Phone,{className:`h-4 w-4 mr-2`}),`Escalate`]})]})]})]})]})]})}var vR=[{id:`1`,title:`Database connection pool exhausted`,description:`Production database is experiencing connection pool exhaustion, causing request timeouts`,severity:`critical`,status:`investigating`,service:`api-gateway`,createdAt:new Date(Date.now()-45*6e4),acknowledgedAt:new Date(Date.now()-40*6e4),impact:`50% of API requests failing with 504 errors`,affectedUsers:12500,slackChannel:`incident-db-001`,runbookUrl:`https://runbooks.example.com/db-pool`,responders:[{id:`1`,name:`John Doe`,role:`Incident Commander`,status:`engaged`},{id:`2`,name:`Jane Smith`,role:`DBA`,status:`engaged`}],events:[{id:`e1`,type:`status_change`,timestamp:new Date(Date.now()-45*6e4),content:`Incident triggered by alerting system`},{id:`e2`,type:`assignment`,timestamp:new Date(Date.now()-43*6e4),content:`John Doe assigned as IC`,user:`System`},{id:`e3`,type:`status_change`,timestamp:new Date(Date.now()-40*6e4),content:`Incident acknowledged`,user:`John Doe`},{id:`e4`,type:`comment`,timestamp:new Date(Date.now()-35*6e4),content:`Investigating connection pool settings`,user:`Jane Smith`},{id:`e5`,type:`status_change`,timestamp:new Date(Date.now()-30*6e4),content:`Status changed to investigating`,user:`John Doe`}]},{id:`2`,title:`High latency on payment service`,description:`Payment processing latency increased to >2s, above SLA threshold`,severity:`high`,status:`acknowledged`,service:`payment-service`,createdAt:new Date(Date.now()-20*6e4),acknowledgedAt:new Date(Date.now()-15*6e4),affectedUsers:3200,responders:[{id:`3`,name:`Alice Johnson`,role:`On-Call Engineer`,status:`engaged`}],events:[{id:`e6`,type:`status_change`,timestamp:new Date(Date.now()-20*6e4),content:`Incident triggered`},{id:`e7`,type:`status_change`,timestamp:new Date(Date.now()-15*6e4),content:`Acknowledged by Alice Johnson`}]},{id:`3`,title:`Elevated error rate on search API`,severity:`medium`,status:`triggered`,service:`search-service`,createdAt:new Date(Date.now()-5*6e4),responders:[],events:[{id:`e8`,type:`status_change`,timestamp:new Date(Date.now()-5*6e4),content:`Incident triggered by alerting system`}]},{id:`4`,title:`Memory leak in recommendation engine`,description:`Gradual memory increase detected, auto-scaling keeping up but needs investigation`,severity:`low`,status:`resolved`,service:`recommendation-engine`,createdAt:new Date(Date.now()-4*36e5),acknowledgedAt:new Date(Date.now()-3.5*36e5),resolvedAt:new Date(Date.now()-2*36e5),responders:[{id:`4`,name:`Bob Wilson`,role:`Backend Engineer`,status:`available`}],events:[{id:`e9`,type:`status_change`,timestamp:new Date(Date.now()-4*36e5),content:`Incident triggered`},{id:`e10`,type:`status_change`,timestamp:new Date(Date.now()-2*36e5),content:`Resolved - deployed fix v2.3.1`}]}];t.n();var yR={region:{icon:p.Globe,color:`text-blue-500`,label:`Region`},vpc:{icon:p.Network,color:`text-purple-500`,label:`VPC`},subnet:{icon:p.Layers,color:`text-indigo-500`,label:`Subnet`},server:{icon:p.Server,color:`text-gray-500`,label:`Server`},database:{icon:p.Database,color:`text-green-500`,label:`Database`},loadbalancer:{icon:p.Activity,color:`text-cyan-500`,label:`Load Balancer`},cache:{icon:p.HardDrive,color:`text-red-500`,label:`Cache`},storage:{icon:p.HardDrive,color:`text-orange-500`,label:`Storage`},container:{icon:p.Container,color:`text-blue-400`,label:`Container`},function:{icon:p.Cpu,color:`text-yellow-500`,label:`Function`},cdn:{icon:p.Globe,color:`text-teal-500`,label:`CDN`},firewall:{icon:p.Shield,color:`text-red-400`,label:`Firewall`}},bR={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`},maintenance:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Maintenance`}},xR={aws:{label:`AWS`,color:`text-orange-500`},gcp:{label:`GCP`,color:`text-blue-500`},azure:{label:`Azure`,color:`text-cyan-500`},custom:{label:`Custom`,color:`text-gray-500`}};function SR({resource:e,depth:i=0,onClick:a,isExpanded:o,onToggle:s}){let c=yR[e.type],l=bR[e.status],u=c.icon,d=e.children&&e.children.length>0;return(0,g.jsx)(`div`,{className:t.t(`border-l-2`,i>0&&`ml-6`,l.color.replace(`text-`,`border-`)),children:(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-3 cursor-pointer rounded-r-lg transition-all`,`hover:bg-muted/50`,e.status===`critical`&&`bg-red-500/5`,e.status===`warning`&&`bg-yellow-500/5`),onClick:a,children:[d&&(0,g.jsx)(`button`,{className:`p-1 hover:bg-muted rounded`,onClick:e=>{e.stopPropagation(),s?.()},children:(0,g.jsx)(p.Layers,{className:t.t(`h-4 w-4`,o&&`rotate-90`)})}),(0,g.jsx)(`div`,{className:t.t(`p-2 rounded-lg bg-muted/50`),children:(0,g.jsx)(u,{className:t.t(`h-5 w-5`,c.color)})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs shrink-0`,children:c.label}),e.provider&&(0,g.jsx)(r.t,{variant:`secondary`,className:t.t(`text-xs shrink-0`,xR[e.provider].color),children:xR[e.provider].label})]}),e.region&&(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.region})]}),e.metrics&&(0,g.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[e.metrics.cpu!==void 0&&(0,g.jsxs)(`span`,{className:t.t(e.metrics.cpu>80&&`text-red-500`),children:[`CPU: `,e.metrics.cpu,`%`]}),e.metrics.memory!==void 0&&(0,g.jsxs)(`span`,{className:t.t(e.metrics.memory>80&&`text-red-500`),children:[`MEM: `,e.metrics.memory,`%`]}),e.metrics.latency!==void 0&&(0,g.jsxs)(`span`,{className:t.t(e.metrics.latency>500&&`text-yellow-500`),children:[e.metrics.latency,`ms`]})]}),(0,g.jsx)(n.u,{children:(0,g.jsxs)(n.c,{children:[(0,g.jsx)(n.d,{children:(0,g.jsx)(`div`,{className:t.t(`w-3 h-3 rounded-full shrink-0`,l.bgColor)})}),(0,g.jsx)(n.l,{children:l.label})]})})]})})}function CR({resources:e,depth:n=0,expandedIds:r,onToggle:i,onResourceClick:a}){return(0,g.jsx)(`div`,{className:t.t(n>0&&`ml-4`),children:e.map(e=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsx)(SR,{resource:e,depth:n,onClick:()=>a?.(e),isExpanded:r.has(e.id),onToggle:()=>i(e.id)}),r.has(e.id)&&e.children&&(0,g.jsx)(CR,{resources:e.children,depth:n+1,expandedIds:r,onToggle:i,onResourceClick:a})]},e.id))})}function wR({resources:e,onResourceClick:n}){let r=e=>e.reduce((e,t)=>(e.push(t),t.children&&e.push(...r(t.children)),e),[]);return(0,g.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3`,children:r(e).map(e=>{let r=yR[e.type],i=bR[e.status],a=r.icon;return(0,g.jsx)(Y,{className:t.t(`cursor-pointer transition-all hover:shadow-md`,e.status===`critical`&&`border-red-500/50`,e.status===`warning`&&`border-yellow-500/50`),onClick:()=>n?.(e),children:(0,g.jsxs)(Q,{className:`p-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,`${r.color.replace(`text-`,`bg-`)}/10`),children:(0,g.jsx)(a,{className:t.t(`h-5 w-5`,r.color)})}),(0,g.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,i.bgColor)})]}),(0,g.jsxs)(`div`,{className:`mt-3`,children:[(0,g.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:r.label})]}),e.metrics&&(0,g.jsx)(`div`,{className:`flex items-center gap-2 mt-2 text-xs`,children:e.metrics.cpu!==void 0&&(0,g.jsxs)(`span`,{className:t.t(e.metrics.cpu>80&&`text-red-500`),children:[e.metrics.cpu,`%`]})})]})},e.id)})})}function TR({resources:e}){let t=d.useMemo(()=>{let t=0,n=0,r=0,i=0,a=e=>{e.forEach(e=>{t++,e.status===`healthy`&&n++,e.status===`warning`&&r++,e.status===`critical`&&i++,e.children&&a(e.children)})};return a(e),{total:t,healthy:n,warning:r,critical:i}},[e]);return(0,g.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Box,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`font-medium`,children:t.total}),(0,g.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Resources`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.CheckCircle2,{className:`h-4 w-4 text-green-500`}),(0,g.jsx)(`span`,{className:`font-medium text-green-500`,children:t.healthy})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),(0,g.jsx)(`span`,{className:`font-medium text-yellow-500`,children:t.warning})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-4 w-4 text-red-500`}),(0,g.jsx)(`span`,{className:`font-medium text-red-500`,children:t.critical})]})]})}function ER({resources:e,onResourceClick:t,onRefresh:n,showConnections:r=!1,viewMode:o=`tree`,className:s}){let[c,l]=d.useState(o),[u,f]=d.useState(()=>new Set(e.map(e=>e.id))),[m,h]=d.useState(`all`),_=e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=()=>{let t=new Set,n=e=>{e.forEach(e=>{t.add(e.id),e.children&&n(e.children)})};n(e),f(t)},y=()=>{f(new Set)},b=d.useMemo(()=>{if(m===`all`)return e;let t=e=>e.filter(e=>{let n=e.children?.some(e=>t([e]).length>0);return e.status===m||n}).map(e=>({...e,children:e.children?t(e.children):void 0}));return t(e)},[e,m]);return(0,g.jsxs)(Y,{className:s,children:[(0,g.jsx)(X,{className:`pb-3`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(p.Cloud,{className:`h-5 w-5`}),(0,g.jsx)(Z,{children:`Infrastructure Map`})]}),(0,g.jsx)(TR,{resources:e})]})}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(a.d,{value:c,onValueChange:e=>l(e),children:[(0,g.jsx)(a.y,{className:`w-28`,children:(0,g.jsx)(a.b,{})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`tree`,children:`Tree View`}),(0,g.jsx)(a.m,{value:`grid`,children:`Grid View`})]})]}),(0,g.jsxs)(a.d,{value:m,onValueChange:e=>h(e),children:[(0,g.jsxs)(a.y,{className:`w-32`,children:[(0,g.jsx)(p.Filter,{className:`h-4 w-4 mr-2`}),(0,g.jsx)(a.b,{placeholder:`Status`})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`All Status`}),(0,g.jsx)(a.m,{value:`healthy`,children:`Healthy`}),(0,g.jsx)(a.m,{value:`warning`,children:`Warning`}),(0,g.jsx)(a.m,{value:`critical`,children:`Critical`}),(0,g.jsx)(a.m,{value:`maintenance`,children:`Maintenance`})]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[c===`tree`&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(i.n,{variant:`ghost`,size:`sm`,onClick:v,children:[(0,g.jsx)(p.Maximize2,{className:`h-4 w-4 mr-1`}),`Expand`]}),(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:y,children:`Collapse`})]}),n&&(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:n,children:(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4`})})]})]}),(0,g.jsx)(`div`,{className:`min-h-[400px]`,children:b.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-64 text-muted-foreground`,children:[(0,g.jsx)(p.Cloud,{className:`h-12 w-12 mb-4`}),(0,g.jsx)(`p`,{children:`No resources found`})]}):c===`tree`?(0,g.jsx)(CR,{resources:b,expandedIds:u,onToggle:_,onResourceClick:t}):(0,g.jsx)(wR,{resources:b,onResourceClick:t})})]})]})}var DR=[{id:`region-us-east-1`,name:`us-east-1`,type:`region`,status:`healthy`,provider:`aws`,region:`N. Virginia`,children:[{id:`vpc-prod`,name:`production-vpc`,type:`vpc`,status:`healthy`,provider:`aws`,metadata:{cidr:`10.0.0.0/16`},children:[{id:`subnet-public-1`,name:`public-subnet-1a`,type:`subnet`,status:`healthy`,metadata:{az:`us-east-1a`,cidr:`10.0.1.0/24`},children:[{id:`alb-1`,name:`api-load-balancer`,type:`loadbalancer`,status:`healthy`,metrics:{requests:15e3,latency:45}},{id:`nat-1`,name:`nat-gateway-1a`,type:`firewall`,status:`healthy`}]},{id:`subnet-private-1`,name:`private-subnet-1a`,type:`subnet`,status:`warning`,metadata:{az:`us-east-1a`,cidr:`10.0.10.0/24`},children:[{id:`ec2-api-1`,name:`api-server-1`,type:`server`,status:`healthy`,metrics:{cpu:45,memory:62}},{id:`ec2-api-2`,name:`api-server-2`,type:`server`,status:`warning`,metrics:{cpu:85,memory:78}},{id:`ec2-api-3`,name:`api-server-3`,type:`server`,status:`healthy`,metrics:{cpu:52,memory:55}}]},{id:`subnet-data-1`,name:`data-subnet-1a`,type:`subnet`,status:`healthy`,metadata:{az:`us-east-1a`,cidr:`10.0.20.0/24`},children:[{id:`rds-primary`,name:`postgres-primary`,type:`database`,status:`healthy`,metrics:{cpu:35,memory:68}},{id:`redis-1`,name:`redis-cluster`,type:`cache`,status:`healthy`,metrics:{memory:45}}]}]}]},{id:`region-eu-west-1`,name:`eu-west-1`,type:`region`,status:`critical`,provider:`aws`,region:`Ireland`,children:[{id:`vpc-prod-eu`,name:`production-vpc-eu`,type:`vpc`,status:`critical`,children:[{id:`ec2-eu-1`,name:`api-server-eu-1`,type:`server`,status:`critical`,metrics:{cpu:98,memory:95}},{id:`rds-eu`,name:`postgres-replica`,type:`database`,status:`warning`,metrics:{cpu:75,memory:82}}]}]}];t.n();var OR={build:{icon:p.Box,color:`text-blue-500`,label:`Build`},test:{icon:p.TestTube,color:`text-purple-500`,label:`Test`},deploy:{icon:p.Rocket,color:`text-green-500`,label:`Deploy`},script:{icon:p.Terminal,color:`text-gray-500`,label:`Script`},docker:{icon:p.Container,color:`text-cyan-500`,label:`Docker`},notify:{icon:p.Bell,color:`text-yellow-500`,label:`Notify`},approval:{icon:p.Shield,color:`text-orange-500`,label:`Approval`},artifact:{icon:p.Upload,color:`text-indigo-500`,label:`Artifact`},cache:{icon:p.Database,color:`text-pink-500`,label:`Cache`},parallel:{icon:p.Zap,color:`text-amber-500`,label:`Parallel`}},kR={pending:{color:`text-muted-foreground`,bgColor:`bg-muted`,icon:p.Clock},running:{color:`text-blue-500`,bgColor:`bg-blue-500`,icon:p.Play},success:{color:`text-green-500`,bgColor:`bg-green-500`,icon:p.CheckCircle2},failed:{color:`text-red-500`,bgColor:`bg-red-500`,icon:p.XCircle},skipped:{color:`text-gray-400`,bgColor:`bg-gray-400`,icon:p.ChevronRight},waiting:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,icon:p.Clock}};function AR({step:e,onUpdate:n,onDelete:o,readOnly:c}){let[l,u]=d.useState(!1),f=OR[e.type],m=f.icon,h=e.status?kR[e.status]:null,_=h?.icon;return(0,g.jsxs)(`div`,{className:t.t(`border rounded-lg transition-all`,e.status===`failed`&&`border-red-500/50`,e.status===`running`&&`border-blue-500/50 bg-blue-500/5`),children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 p-3 cursor-pointer`,onClick:()=>u(!l),children:[!c&&(0,g.jsx)(p.GripVertical,{className:`h-4 w-4 text-muted-foreground cursor-grab`}),(0,g.jsx)(`div`,{className:t.t(`p-1.5 rounded`,`${f.color.replace(`text-`,`bg-`)}/10`),children:(0,g.jsx)(m,{className:t.t(`h-4 w-4`,f.color)})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs`,children:f.label})]}),e.command&&(0,g.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono truncate block mt-0.5`,children:e.command})]}),_&&(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(`text-xs`,h?.color),children:[(0,g.jsx)(_,{className:`h-3 w-3 mr-1`}),e.status]}),!c&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,g.jsx)(p.MoreVertical,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{onClick:()=>u(!0),children:[(0,g.jsx)(p.Settings,{className:`h-4 w-4 mr-2`}),`Configure`]}),(0,g.jsxs)($,{children:[(0,g.jsx)(p.Copy,{className:`h-4 w-4 mr-2`}),`Duplicate`]}),(0,g.jsx)(sn,{}),(0,g.jsxs)($,{className:`text-destructive`,onClick:o,children:[(0,g.jsx)(p.Trash2,{className:`h-4 w-4 mr-2`}),`Delete`]})]})]}),(0,g.jsx)(p.ChevronRight,{className:t.t(`h-4 w-4 transition-transform`,l&&`rotate-90`)})]}),l&&(0,g.jsxs)(`div`,{className:`px-3 pb-3 pt-0 space-y-3 border-t mt-2`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Step Name`}),(0,g.jsx)(s.t,{value:e.name,onChange:t=>n({...e,name:t.target.value}),className:`h-8 mt-1`,disabled:c})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Type`}),(0,g.jsxs)(a.d,{value:e.type,onValueChange:t=>n({...e,type:t}),disabled:c,children:[(0,g.jsx)(a.y,{className:`h-8 mt-1`,children:(0,g.jsx)(a.b,{})}),(0,g.jsx)(a.f,{children:Object.entries(OR).map(([e,n])=>(0,g.jsx)(a.m,{value:e,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(n.icon,{className:t.t(`h-4 w-4`,n.color)}),n.label]})},e))})]})]})]}),(e.type===`script`||e.type===`build`||e.type===`test`)&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Command`}),(0,g.jsx)(s.t,{value:e.command||``,onChange:t=>n({...e,command:t.target.value}),placeholder:`npm run build`,className:`h-8 mt-1 font-mono text-sm`,disabled:c})]}),e.type===`docker`&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Docker Image`}),(0,g.jsx)(s.t,{value:e.image||``,onChange:t=>n({...e,image:t.target.value}),placeholder:`node:18-alpine`,className:`h-8 mt-1 font-mono text-sm`,disabled:c})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Timeout (seconds)`}),(0,g.jsx)(s.t,{type:`number`,value:e.timeout||``,onChange:t=>n({...e,timeout:parseInt(t.target.value)||void 0}),placeholder:`300`,className:`h-8 mt-1`,disabled:c})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Retries`}),(0,g.jsx)(s.t,{type:`number`,value:e.retries||``,onChange:t=>n({...e,retries:parseInt(t.target.value)||void 0}),placeholder:`0`,className:`h-8 mt-1`,disabled:c})]})]}),e.condition!==void 0&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:`Condition`}),(0,g.jsx)(s.t,{value:e.condition,onChange:t=>n({...e,condition:t.target.value}),placeholder:`$CI_COMMIT_BRANCH == 'main'`,className:`h-8 mt-1 font-mono text-sm`,disabled:c})]})]})]})}function jR({stage:e,onUpdate:n,onDelete:a,onAddStep:o,readOnly:c}){let[l,u]=d.useState(!1),f=e.status?kR[e.status]:null,m=f?.icon,h=(t,r)=>{n({...e,steps:e.steps.map(e=>e.id===t?r:e)})},_=t=>{n({...e,steps:e.steps.filter(e=>e.id!==t)})};return(0,g.jsxs)(Y,{className:t.t(e.status===`failed`&&`border-red-500/30`,e.status===`running`&&`border-blue-500/30`),children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`button`,{onClick:()=>u(!l),children:(0,g.jsx)(p.ChevronDown,{className:t.t(`h-4 w-4 transition-transform`,l&&`-rotate-90`)})}),(0,g.jsx)(s.t,{value:e.name,onChange:t=>n({...e,name:t.target.value}),className:`h-8 font-semibold border-0 p-0 focus-visible:ring-0 bg-transparent`,disabled:c}),m&&(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(`text-xs ml-auto`,f?.color),children:[(0,g.jsx)(m,{className:`h-3 w-3 mr-1`}),e.status]}),(0,g.jsxs)(r.t,{variant:`secondary`,className:`text-xs`,children:[e.steps.length,` steps`]}),!c&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,g.jsx)(p.MoreVertical,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[(0,g.jsxs)($,{children:[(0,g.jsx)(p.Copy,{className:`h-4 w-4 mr-2`}),`Duplicate Stage`]}),(0,g.jsx)(sn,{}),(0,g.jsxs)($,{className:`text-destructive`,onClick:a,children:[(0,g.jsx)(p.Trash2,{className:`h-4 w-4 mr-2`}),`Delete Stage`]})]})]})]})}),!l&&(0,g.jsxs)(Q,{className:`space-y-2`,children:[e.steps.map(e=>(0,g.jsx)(AR,{step:e,onUpdate:t=>h(e.id,t),onDelete:()=>_(e.id),readOnly:c},e.id)),!c&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,className:`w-full`,children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-1`}),`Add Step`]})}),(0,g.jsx)(nn,{className:`w-48`,children:Object.entries(OR).map(([e,n])=>(0,g.jsxs)($,{onClick:()=>o(e),children:[(0,g.jsx)(n.icon,{className:t.t(`h-4 w-4 mr-2`,n.color)}),n.label]},e))})]})]})]})}function MR({pipeline:e,onPipelineChange:a,onRun:o,onSave:c,onExport:l,readOnly:u=!1,className:f}){let[m,h]=d.useState(e),_=e=>{let t={...m,...e};h(t),a?.(t)},v=()=>{let e={id:`stage-${Date.now()}`,name:`Stage ${m.stages.length+1}`,steps:[]};_({stages:[...m.stages,e]})},y=(e,t)=>{_({stages:m.stages.map(n=>n.id===e?t:n)})},b=e=>{_({stages:m.stages.filter(t=>t.id!==e)})},x=(e,t)=>{let n=m.stages.find(t=>t.id===e);if(!n)return;let r={id:`step-${Date.now()}`,name:`${OR[t].label} Step`,type:t};y(e,{...n,steps:[...n.steps,r]})};return(0,g.jsxs)(`div`,{className:t.t(`flex flex-col gap-6`,f),children:[(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-3`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(p.GitBranch,{className:`h-5 w-5`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(s.t,{value:m.name,onChange:e=>_({name:e.target.value}),className:`h-8 text-lg font-bold border-0 p-0 focus-visible:ring-0 bg-transparent`,disabled:u}),m.description&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:m.description})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-1`}),`Export`]})}),(0,g.jsxs)(nn,{children:[(0,g.jsx)($,{onClick:()=>l(`yaml`),children:`Export as YAML`}),(0,g.jsx)($,{onClick:()=>l(`json`),children:`Export as JSON`})]})]}),c&&!u&&(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:c,children:`Save`}),o&&(0,g.jsxs)(i.n,{size:`sm`,onClick:o,children:[(0,g.jsx)(p.Play,{className:`h-4 w-4 mr-1`}),`Run Pipeline`]})]})]})}),m.trigger&&(0,g.jsx)(Q,{className:`pt-0`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Triggers:`}),m.trigger.events?.map(e=>(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs`,children:e},e)),m.trigger.branches?.map(e=>(0,g.jsxs)(r.t,{variant:`secondary`,className:`text-xs`,children:[(0,g.jsx)(p.GitBranch,{className:`h-3 w-3 mr-1`}),e]},e)),m.trigger.schedule&&(0,g.jsxs)(r.t,{variant:`outline`,className:`text-xs`,children:[(0,g.jsx)(p.Clock,{className:`h-3 w-3 mr-1`}),m.trigger.schedule]})]})})]}),(0,g.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto pb-2`,children:m.stages.map((e,n)=>(0,g.jsxs)(d.Fragment,{children:[(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,g.jsx)(`div`,{className:t.t(`w-4 h-4 rounded-full border-2`,e.status===`success`&&`bg-green-500 border-green-500`,e.status===`failed`&&`bg-red-500 border-red-500`,e.status===`running`&&`bg-blue-500 border-blue-500 animate-pulse`,!e.status&&`bg-muted border-muted-foreground`)}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:e.name})]}),n<m.stages.length-1&&(0,g.jsx)(p.ArrowRight,{className:`h-4 w-4 text-muted-foreground shrink-0`})]},e.id))}),(0,g.jsx)(n.f,{className:`h-[500px]`,children:(0,g.jsxs)(`div`,{className:`space-y-4 pr-4`,children:[m.stages.map(e=>(0,g.jsx)(jR,{stage:e,onUpdate:t=>y(e.id,t),onDelete:()=>b(e.id),onAddStep:t=>x(e.id,t),readOnly:u},e.id)),!u&&(0,g.jsxs)(i.n,{variant:`outline`,className:`w-full`,onClick:v,children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-1`}),`Add Stage`]})]})})]})}var NR={id:`1`,name:`Production Deploy`,description:`Build, test, and deploy to production`,trigger:{branches:[`main`,`release/*`],events:[`push`,`pull_request`]},stages:[{id:`build`,name:`Build`,status:`success`,steps:[{id:`install`,name:`Install Dependencies`,type:`script`,command:`npm ci`,status:`success`},{id:`build`,name:`Build Application`,type:`build`,command:`npm run build`,status:`success`},{id:`artifact`,name:`Upload Build Artifacts`,type:`artifact`,artifacts:[`dist/**`,`build/**`],status:`success`}]},{id:`test`,name:`Test`,status:`running`,steps:[{id:`unit`,name:`Unit Tests`,type:`test`,command:`npm run test:unit`,status:`success`},{id:`integration`,name:`Integration Tests`,type:`test`,command:`npm run test:integration`,status:`running`},{id:`e2e`,name:`E2E Tests`,type:`test`,command:`npm run test:e2e`,status:`pending`}]},{id:`security`,name:`Security`,status:`pending`,steps:[{id:`sast`,name:`SAST Scan`,type:`script`,command:`npm run security:sast`},{id:`deps`,name:`Dependency Check`,type:`script`,command:`npm audit`}]},{id:`deploy`,name:`Deploy`,status:`pending`,steps:[{id:`approval`,name:`Production Approval`,type:`approval`,condition:`$CI_COMMIT_BRANCH == 'main'`},{id:`docker`,name:`Build Docker Image`,type:`docker`,image:`app:$CI_COMMIT_SHA`},{id:`deploy-prod`,name:`Deploy to Production`,type:`deploy`,command:`kubectl apply -f k8s/`},{id:`notify`,name:`Notify Team`,type:`notify`}]}],variables:{NODE_ENV:`production`,REGISTRY:`gcr.io/my-project`}};t.n();var PR={feature:{icon:p.Sparkles,color:`text-green-500`,bgColor:`bg-green-500/10`,label:`New Feature`},fix:{icon:p.Bug,color:`text-red-500`,bgColor:`bg-red-500/10`,label:`Bug Fix`},improvement:{icon:p.Wrench,color:`text-blue-500`,bgColor:`bg-blue-500/10`,label:`Improvement`},breaking:{icon:p.AlertTriangle,color:`text-orange-500`,bgColor:`bg-orange-500/10`,label:`Breaking Change`},security:{icon:p.ShieldCheck,color:`text-purple-500`,bgColor:`bg-purple-500/10`,label:`Security`},performance:{icon:p.Zap,color:`text-yellow-500`,bgColor:`bg-yellow-500/10`,label:`Performance`},docs:{icon:p.BookOpen,color:`text-cyan-500`,bgColor:`bg-cyan-500/10`,label:`Documentation`},deprecation:{icon:p.AlertTriangle,color:`text-gray-500`,bgColor:`bg-gray-500/10`,label:`Deprecation`}},FR={major:{label:`Major`,color:`text-red-500`},minor:{label:`Minor`,color:`text-blue-500`},patch:{label:`Patch`,color:`text-green-500`},prerelease:{label:`Pre-release`,color:`text-purple-500`}};function IR(e){return e.toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`})}function LR({change:e}){let i=PR[e.type],a=i.icon;return(0,g.jsxs)(`div`,{className:t.t(`flex items-start gap-3 p-3 rounded-lg`,i.bgColor),children:[(0,g.jsx)(`div`,{className:`p-1.5 rounded bg-background`,children:(0,g.jsx)(a,{className:t.t(`h-4 w-4`,i.color)})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.title}),e.breaking&&(0,g.jsx)(r.t,{className:`bg-orange-500 text-xs`,children:`Breaking`}),e.pullRequest&&(0,g.jsxs)(`a`,{href:e.pullRequest.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-muted-foreground hover:text-primary flex items-center gap-1`,children:[(0,g.jsx)(p.GitPullRequest,{className:`h-3 w-3`}),`#`,e.pullRequest.number]})]}),e.description&&(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),e.contributors&&e.contributors.length>0&&(0,g.jsx)(`div`,{className:`flex items-center gap-1 mt-2`,children:e.contributors.map(e=>(0,g.jsxs)(n.m,{className:`h-5 w-5`,children:[(0,g.jsx)(n.g,{src:e.avatar}),(0,g.jsx)(n.h,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]},e.id))})]})]})}function RR({release:e,onEdit:a,onPublish:o,expanded:s=!1}){let[c,l]=d.useState(s),u=FR[e.releaseType],f=d.useMemo(()=>{let t={breaking:[],security:[],feature:[],improvement:[],performance:[],fix:[],docs:[],deprecation:[]};return e.changes.forEach(e=>{t[e.type].push(e)}),t},[e.changes]);return(0,g.jsxs)(Y,{className:t.t(e.status===`draft`&&`border-dashed`,e.status===`scheduled`&&`border-blue-500/30`),children:[(0,g.jsx)(X,{className:`pb-3`,children:(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Tag,{className:`h-5 w-5`}),(0,g.jsx)(Z,{className:`text-xl`,children:e.version}),e.name&&(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[`- `,e.name]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(r.t,{variant:`outline`,className:u.color,children:u.label}),(0,g.jsxs)(r.t,{variant:e.status===`published`?`default`:`secondary`,className:e.status===`published`?`bg-green-500`:``,children:[e.status===`published`?(0,g.jsx)(p.CheckCircle2,{className:`h-3 w-3 mr-1`}):e.status===`scheduled`?(0,g.jsx)(p.Clock,{className:`h-3 w-3 mr-1`}):(0,g.jsx)(p.Edit,{className:`h-3 w-3 mr-1`}),e.status]}),(0,g.jsxs)(`span`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,g.jsx)(p.Calendar,{className:`h-3 w-3`}),e.publishedAt?IR(e.publishedAt):IR(e.createdAt)]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.compareUrl&&(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,g.jsxs)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noopener noreferrer`,children:[(0,g.jsx)(p.GitCommit,{className:`h-4 w-4 mr-1`}),`Compare`]})}),a&&e.status===`draft`&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:a,children:[(0,g.jsx)(p.Edit,{className:`h-4 w-4 mr-1`}),`Edit`]}),o&&e.status===`draft`&&(0,g.jsxs)(i.n,{size:`sm`,onClick:o,children:[(0,g.jsx)(p.Rocket,{className:`h-4 w-4 mr-1`}),`Publish`]})]})]})}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[e.summary&&(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:e.summary}),e.upgradeNotes&&(0,g.jsxs)(`div`,{className:`p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-yellow-600 mb-1`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-4 w-4`}),`Upgrade Notes`]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.upgradeNotes})]}),(0,g.jsx)(`div`,{className:`space-y-4`,children:Object.entries(f).map(([e,n])=>{if(n.length===0)return null;let r=PR[e];return(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h4`,{className:`font-medium flex items-center gap-2 mb-2`,children:[(0,g.jsx)(r.icon,{className:t.t(`h-4 w-4`,r.color)}),r.label,`s (`,n.length,`)`]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(c?n:n.slice(0,3)).map(e=>(0,g.jsx)(LR,{change:e},e.id)),!c&&n.length>3&&(0,g.jsxs)(i.n,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>l(!0),children:[`Show `,n.length-3,` more...`]})]})]},e)})}),e.contributors.length>0&&(0,g.jsxs)(`div`,{className:`pt-4 border-t`,children:[(0,g.jsxs)(`h4`,{className:`font-medium flex items-center gap-2 mb-2`,children:[(0,g.jsx)(p.Users,{className:`h-4 w-4`}),`Contributors (`,e.contributors.length,`)`]}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.contributors.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 bg-muted rounded-full`,children:[(0,g.jsxs)(n.m,{className:`h-5 w-5`,children:[(0,g.jsx)(n.g,{src:e.avatar}),(0,g.jsx)(n.h,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]}),(0,g.jsxs)(`span`,{className:`text-sm`,children:[`@`,e.username]})]},e.id))})]}),e.downloadUrl&&(0,g.jsx)(`div`,{className:`pt-4 border-t`,children:(0,g.jsx)(i.n,{variant:`outline`,asChild:!0,children:(0,g.jsxs)(`a`,{href:e.downloadUrl,download:!0,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Download Release`]})})})]})]})}function zR({releases:e,onCreateRelease:r,onEditRelease:o,onPublishRelease:s,onAddChange:c,showEditor:l=!1,className:u}){let[f,m]=d.useState(`all`),[h,_]=d.useState(`all`),v=d.useMemo(()=>e.filter(e=>!(f!==`all`&&e.releaseType!==f||h!==`all`&&e.status!==h)).sort((e,t)=>{let n=e=>e.replace(/^v/,``).split(/[.-]/).map(e=>parseInt(e)||0),r=n(e.version),i=n(t.version);for(let e=0;e<Math.max(r.length,i.length);e++){let t=(i[e]||0)-(r[e]||0);if(t!==0)return t}return 0}),[e,f,h]),y=d.useMemo(()=>({total:e.length,published:e.filter(e=>e.status===`published`).length,draft:e.filter(e=>e.status===`draft`).length,features:e.reduce((e,t)=>e+t.changes.filter(e=>e.type===`feature`).length,0),fixes:e.reduce((e,t)=>e+t.changes.filter(e=>e.type===`fix`).length,0)}),[e]);return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,u),children:[(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(p.Rocket,{className:`h-6 w-6`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{children:`Release Notes`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Track changes and publish releases`})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-6 text-sm`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Tag,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`strong`,{children:y.total}),` releases`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Sparkles,{className:`h-4 w-4 text-green-500`}),(0,g.jsx)(`strong`,{children:y.features}),` features`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Bug,{className:`h-4 w-4 text-red-500`}),(0,g.jsx)(`strong`,{children:y.fixes}),` fixes`]})]}),r&&(0,g.jsxs)(i.n,{onClick:r,children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-1`}),`New Release`]})]})]})}),(0,g.jsx)(Q,{className:`pt-0`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsxs)(a.d,{value:f,onValueChange:e=>m(e),children:[(0,g.jsx)(a.y,{className:`w-32`,children:(0,g.jsx)(a.b,{placeholder:`Type`})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`All Types`}),(0,g.jsx)(a.m,{value:`major`,children:`Major`}),(0,g.jsx)(a.m,{value:`minor`,children:`Minor`}),(0,g.jsx)(a.m,{value:`patch`,children:`Patch`}),(0,g.jsx)(a.m,{value:`prerelease`,children:`Pre-release`})]})]}),(0,g.jsxs)(a.d,{value:h,onValueChange:e=>_(e),children:[(0,g.jsx)(a.y,{className:`w-32`,children:(0,g.jsx)(a.b,{placeholder:`Status`})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`All Status`}),(0,g.jsx)(a.m,{value:`published`,children:`Published`}),(0,g.jsx)(a.m,{value:`draft`,children:`Draft`}),(0,g.jsx)(a.m,{value:`scheduled`,children:`Scheduled`})]})]})]})})]}),(0,g.jsx)(n.f,{className:`h-[600px]`,children:(0,g.jsx)(`div`,{className:`space-y-4 pr-4`,children:v.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,g.jsx)(p.Tag,{className:`h-12 w-12 mb-4`}),(0,g.jsx)(`p`,{className:`text-lg font-medium`,children:`No releases found`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`Create your first release to get started`})]}):v.map((e,t)=>(0,g.jsx)(RR,{release:e,expanded:t===0,onEdit:o?()=>o(e):void 0,onPublish:s?()=>s(e):void 0},e.id))})})]})}var BR=[{id:`1`,name:`John Doe`,username:`johndoe`,avatar:``},{id:`2`,name:`Jane Smith`,username:`janesmith`,avatar:``},{id:`3`,name:`Bob Wilson`,username:`bobwilson`,avatar:``}],VR=[{id:`1`,version:`v2.5.0`,name:`Aurora`,releaseType:`minor`,status:`published`,publishedAt:new Date(Date.now()-48*36e5),createdAt:new Date(Date.now()-120*36e5),summary:`This release introduces new authentication features, performance improvements, and several bug fixes.`,contributors:BR,compareUrl:`https://github.com/example/repo/compare/v2.4.0...v2.5.0`,changes:[{id:`c1`,type:`feature`,title:`Added OAuth 2.0 support for GitHub and Google`,description:`Users can now sign in using their GitHub or Google accounts`,pullRequest:{number:234,url:`#`},contributors:[BR[0]]},{id:`c2`,type:`feature`,title:`New dashboard widgets for analytics`,pullRequest:{number:238,url:`#`},contributors:[BR[1]]},{id:`c3`,type:`improvement`,title:`Redesigned settings page with better UX`,pullRequest:{number:241,url:`#`}},{id:`c4`,type:`performance`,title:`Reduced initial bundle size by 30%`,description:`Implemented code splitting and lazy loading for major routes`,pullRequest:{number:245,url:`#`},contributors:[BR[2]]},{id:`c5`,type:`fix`,title:`Fixed memory leak in WebSocket connection`,pullRequest:{number:250,url:`#`}},{id:`c6`,type:`fix`,title:`Fixed date picker not respecting timezone`,pullRequest:{number:252,url:`#`}},{id:`c7`,type:`security`,title:`Updated dependencies with security vulnerabilities`,description:`Updated axios, lodash, and other packages with known CVEs`,pullRequest:{number:248,url:`#`}}]},{id:`2`,version:`v2.4.1`,releaseType:`patch`,status:`published`,publishedAt:new Date(Date.now()-336*36e5),createdAt:new Date(Date.now()-360*36e5),contributors:[BR[0]],changes:[{id:`c8`,type:`fix`,title:`Fixed critical authentication bypass vulnerability`,breaking:!1,pullRequest:{number:230,url:`#`}},{id:`c9`,type:`fix`,title:`Fixed incorrect pagination in search results`,pullRequest:{number:231,url:`#`}}]},{id:`3`,version:`v3.0.0-beta.1`,name:`Next Generation`,releaseType:`prerelease`,status:`draft`,createdAt:new Date(Date.now()-24*36e5),contributors:BR,upgradeNotes:`This is a major release with breaking changes. Please review the migration guide before upgrading.`,changes:[{id:`c10`,type:`breaking`,title:`Removed deprecated API endpoints`,description:`The v1 API endpoints have been removed. Please migrate to v2 endpoints.`,breaking:!0},{id:`c11`,type:`feature`,title:`New real-time collaboration features`,description:`Multiple users can now edit documents simultaneously with live cursors`},{id:`c12`,type:`feature`,title:`Dark mode support throughout the application`},{id:`c13`,type:`breaking`,title:`Changed authentication token format`,description:`Tokens now use JWT format. Old tokens will be invalidated.`,breaking:!0}]}];t.n();var HR={1:{label:`Primary`,color:`text-green-500`,bgColor:`bg-green-500`},2:{label:`Secondary`,color:`text-yellow-500`,bgColor:`bg-yellow-500`},3:{label:`Tertiary`,color:`text-red-500`,bgColor:`bg-red-500`}},UR={available:{color:`bg-green-500`,label:`Available`},busy:{color:`bg-yellow-500`,label:`Busy`},dnd:{color:`bg-red-500`,label:`Do Not Disturb`},offline:{color:`bg-gray-500`,label:`Offline`}};function WR(e){let t=new Date;return e.startTime<=t&&e.endTime>t}function GR({shift:e,nextShift:a,onContact:o}){if(!e)return(0,g.jsx)(Y,{className:`border-dashed`,children:(0,g.jsxs)(Q,{className:`p-6 text-center text-muted-foreground`,children:[(0,g.jsx)(p.AlertCircle,{className:`h-8 w-8 mx-auto mb-2`}),(0,g.jsx)(`p`,{children:`No one is currently on call`})]})});let s=HR[e.level],c=e.user.status?UR[e.user.status]:null,l=e.endTime.getTime()-Date.now(),u=Math.floor(l/36e5),d=Math.floor(l%36e5/6e4);return(0,g.jsxs)(Y,{className:`border-green-500/30 bg-green-500/5`,children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(r.t,{className:t.t(`text-white`,s.bgColor),children:[s.label,` On-Call`]}),(0,g.jsxs)(`span`,{className:`text-sm text-muted-foreground flex items-center gap-1`,children:[(0,g.jsx)(p.Clock,{className:`h-4 w-4`}),u,`h `,d,`m remaining`]})]})}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsxs)(n.m,{className:`h-16 w-16`,children:[(0,g.jsx)(n.g,{src:e.user.avatar}),(0,g.jsx)(n.h,{className:`text-xl`,children:e.user.name.slice(0,2).toUpperCase()})]}),c&&(0,g.jsx)(`div`,{className:t.t(`absolute bottom-0 right-0 w-4 h-4 rounded-full border-2 border-background`,c.color)})]}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsx)(`div`,{className:`text-xl font-semibold`,children:e.user.name}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.user.email}),e.user.timezone&&(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`Timezone: `,e.user.timezone]})]}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.user.phone&&(0,g.jsxs)(i.n,{size:`sm`,variant:`outline`,onClick:()=>o?.(e.user),children:[(0,g.jsx)(p.Phone,{className:`h-4 w-4 mr-1`}),`Call`]}),(0,g.jsxs)(i.n,{size:`sm`,variant:`outline`,onClick:()=>o?.(e.user),children:[(0,g.jsx)(p.MessageSquare,{className:`h-4 w-4 mr-1`}),`Message`]})]})]}),e.overrideReason&&(0,g.jsxs)(`div`,{className:`text-sm text-muted-foreground bg-muted/50 p-2 rounded`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Override:`}),` `,e.overrideReason]}),a&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 border-t text-sm`,children:[(0,g.jsx)(p.ArrowRight,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Next:`}),(0,g.jsxs)(n.m,{className:`h-5 w-5`,children:[(0,g.jsx)(n.g,{src:a.user.avatar}),(0,g.jsx)(n.h,{className:`text-xs`,children:a.user.name.slice(0,2).toUpperCase()})]}),(0,g.jsx)(`span`,{children:a.user.name}),(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[`at `,a.startTime.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`})]})]})]})]})}function KR({policy:e,currentLevel:n}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.Shield,{className:`h-4 w-4`}),`Escalation Policy`]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(`div`,{className:`space-y-3`,children:[1,2,3].map(i=>{let a=HR[i],o=i===1?e.level1Timeout:i===2?e.level2Timeout:e.level3Timeout,s=n===i;return(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded`,s&&`${a.bgColor}/10 border ${a.bgColor}/30`),children:[(0,g.jsx)(`div`,{className:t.t(`w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-bold`,a.bgColor),children:i}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsx)(`div`,{className:`font-medium`,children:a.label}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Escalates after `,o,` minutes`]})]}),s&&(0,g.jsx)(r.t,{variant:`outline`,className:a.color,children:`Active`})]},i)})})})]})}function qR({shifts:e,weekStart:r,onShiftClick:i}){let a=d.useMemo(()=>{let e=[];for(let t=0;t<7;t++){let n=new Date(r);n.setDate(n.getDate()+t),e.push(n)}return e},[r]),o=t=>e.filter(e=>new Date(e.startTime).toDateString()===t.toDateString()),s=e=>e.toDateString()===new Date().toDateString();return(0,g.jsx)(`div`,{className:`grid grid-cols-7 gap-2`,children:a.map(e=>{let r=o(e),a=s(e);return(0,g.jsxs)(`div`,{className:t.t(`border rounded-lg p-2 min-h-[120px]`,a&&`border-primary bg-primary/5`),children:[(0,g.jsxs)(`div`,{className:t.t(`text-center mb-2`,a&&`font-bold text-primary`),children:[(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.toLocaleDateString(`en-US`,{weekday:`short`})}),(0,g.jsx)(`div`,{className:t.t(`text-lg`,a&&`text-primary`),children:e.getDate()})]}),(0,g.jsx)(`div`,{className:`space-y-1`,children:r.map(e=>{let r=HR[e.level],a=WR(e);return(0,g.jsxs)(`button`,{className:t.t(`w-full text-left p-1.5 rounded text-xs transition-colors`,`${r.bgColor}/10 hover:${r.bgColor}/20`,a&&`ring-2 ring-${r.bgColor}`),onClick:()=>i?.(e),children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsxs)(n.m,{className:`h-4 w-4`,children:[(0,g.jsx)(n.g,{src:e.user.avatar}),(0,g.jsx)(n.h,{className:`text-[8px]`,children:e.user.name.slice(0,2).toUpperCase()})]}),(0,g.jsx)(`span`,{className:`truncate`,children:e.user.name.split(` `)[0]})]}),(0,g.jsx)(`div`,{className:`text-muted-foreground mt-0.5`,children:e.startTime.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`})})]},e.id)})})]},e.toISOString())})})}function JR({users:e,shifts:i}){let a=d.useMemo(()=>e.map(e=>{let t=i.filter(t=>t.user.id===e.id),n=t.reduce((e,t)=>e+(t.endTime.getTime()-t.startTime.getTime())/36e5,0),r=t.some(WR);return{user:e,totalHours:n,shiftCount:t.length,isOnCall:r}}),[e,i]);return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.Users,{className:`h-4 w-4`}),`Team Members`]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(`div`,{className:`space-y-2`,children:a.map(({user:e,totalHours:i,shiftCount:a,isOnCall:o})=>{let s=e.status?UR[e.status]:null;return(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded`,o&&`bg-green-500/10 border border-green-500/30`),children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsxs)(n.m,{className:`h-8 w-8`,children:[(0,g.jsx)(n.g,{src:e.avatar}),(0,g.jsx)(n.h,{className:`text-xs`,children:e.name.slice(0,2).toUpperCase()})]}),s&&(0,g.jsx)(`div`,{className:t.t(`absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-background`,s.color)})]}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`font-medium truncate flex items-center gap-2`,children:[e.name,o&&(0,g.jsx)(r.t,{className:`bg-green-500 text-xs`,children:`On-Call`})]}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[a,` shifts • `,Math.round(i),`h total`]})]})]},e.id)})})})]})}function YR({schedule:e,onEditSchedule:n,onAddOverride:a,onSwapShift:o,onContactOnCall:s,className:c}){let[l,u]=d.useState(0),f=d.useMemo(()=>{let e=new Date,t=e.getDay(),n=new Date(e);return n.setDate(e.getDate()-t+l*7),n.setHours(0,0,0,0),n},[l]),m=e.shifts.find(WR),h=e.shifts.filter(e=>e.startTime>new Date).sort((e,t)=>e.startTime.getTime()-t.startTime.getTime())[0];return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,c),children:[(0,g.jsx)(Y,{children:(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(p.Phone,{className:`h-6 w-6`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{children:e.name}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,g.jsx)(r.t,{variant:`outline`,children:e.team}),(0,g.jsxs)(r.t,{variant:`secondary`,children:[(0,g.jsx)(p.Repeat,{className:`h-3 w-3 mr-1`}),e.rotation]})]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a&&(0,g.jsxs)(i.n,{variant:`outline`,onClick:()=>a(new Date),children:[(0,g.jsx)(p.Plus,{className:`h-4 w-4 mr-1`}),`Add Override`]}),n&&(0,g.jsxs)(i.n,{variant:`outline`,onClick:n,children:[(0,g.jsx)(p.Settings,{className:`h-4 w-4 mr-1`}),`Settings`]})]})]})})}),(0,g.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,g.jsxs)(`div`,{className:`col-span-2 space-y-4`,children:[(0,g.jsx)(GR,{shift:m,nextShift:h,onContact:s}),(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.Calendar,{className:`h-4 w-4`}),`Schedule`]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:()=>u(e=>e-1),children:(0,g.jsx)(p.ChevronLeft,{className:`h-4 w-4`})}),(0,g.jsxs)(`span`,{className:`text-sm min-w-[120px] text-center`,children:[f.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`}),` -`,new Date(f.getTime()+144*36e5).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})]}),(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:()=>u(e=>e+1),children:(0,g.jsx)(p.ChevronRight,{className:`h-4 w-4`})}),l!==0&&(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:()=>u(0),children:`Today`})]})]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(qR,{shifts:e.shifts,weekStart:f,onShiftClick:o})})]})]}),(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(KR,{policy:e.escalationPolicy,currentLevel:m?.level}),(0,g.jsx)(JR,{users:e.users,shifts:e.shifts})]})]})]})}var XR=[{id:`1`,name:`John Doe`,email:`john@example.com`,phone:`+1 555-0101`,status:`available`,timezone:`America/New_York`},{id:`2`,name:`Jane Smith`,email:`jane@example.com`,phone:`+1 555-0102`,status:`available`,timezone:`America/Los_Angeles`},{id:`3`,name:`Bob Wilson`,email:`bob@example.com`,phone:`+1 555-0103`,status:`busy`,timezone:`Europe/London`},{id:`4`,name:`Alice Brown`,email:`alice@example.com`,phone:`+1 555-0104`,status:`available`,timezone:`Europe/Paris`}];function ZR(){let e=[],t=new Date,n=new Date(t);n.setDate(t.getDate()-t.getDay()),n.setHours(0,0,0,0);for(let t=-1;t<3;t++)for(let r=0;r<7;r++){let i=new Date(n);i.setDate(n.getDate()+t*7+r),i.setHours(9,0,0,0);let a=new Date(i);a.setDate(a.getDate()+1);let o=(t+1+r)%XR.length;e.push({id:`shift-${t}-${r}`,user:XR[o],startTime:i,endTime:a,level:1})}return e}var QR={id:`1`,name:`Platform Team On-Call`,description:`Primary on-call rotation for the platform engineering team`,team:`Platform Engineering`,rotation:`weekly`,escalationPolicy:{level1Timeout:15,level2Timeout:30,level3Timeout:60},shifts:ZR(),users:XR};t.n();var $R={compute:{icon:p.Cpu,color:`text-blue-500`,label:`Compute`},storage:{icon:p.HardDrive,color:`text-green-500`,label:`Storage`},database:{icon:p.Database,color:`text-purple-500`,label:`Database`},network:{icon:p.Network,color:`text-cyan-500`,label:`Network`},security:{icon:p.Shield,color:`text-red-500`,label:`Security`},other:{icon:p.Cloud,color:`text-gray-500`,label:`Other`}},ez={aws:{label:`AWS`,color:`text-orange-500`},gcp:{label:`GCP`,color:`text-blue-500`},azure:{label:`Azure`,color:`text-cyan-500`},all:{label:`All Providers`,color:`text-gray-500`}};function tz(e){return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function nz(e){return`${e>=0?`+`:``}${e.toFixed(1)}%`}function rz({title:e,value:n,previousValue:i,icon:a,trend:o,budget:s,forecast:c}){let l=i===void 0?o:(n-i)/i*100,u=s!==void 0&&n>s,d=s===void 0?void 0:n/s*100;return(0,g.jsx)(Y,{className:t.t(u&&`border-red-500/50`),children:(0,g.jsxs)(Q,{className:`p-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsx)(`div`,{className:`p-2 rounded-lg bg-muted`,children:(0,g.jsx)(a,{className:`h-5 w-5 text-muted-foreground`})}),l!==void 0&&(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(l>0?`text-red-500`:`text-green-500`),children:[l>0?(0,g.jsx)(p.ArrowUpRight,{className:`h-3 w-3 mr-1`}):(0,g.jsx)(p.ArrowDownRight,{className:`h-3 w-3 mr-1`}),nz(Math.abs(l))]})]}),(0,g.jsxs)(`div`,{className:`mt-3`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:tz(n)}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e})]}),d!==void 0&&(0,g.jsxs)(`div`,{className:`mt-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Budget`}),(0,g.jsxs)(`span`,{className:t.t(u&&`text-red-500`),children:[tz(n),` / `,tz(s)]})]}),(0,g.jsx)(Yn,{value:Math.min(d,100),className:t.t(`h-2`,d>100&&`[&>div]:bg-red-500`,d>80&&d<=100&&`[&>div]:bg-yellow-500`)})]}),c!==void 0&&(0,g.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Forecast: `,tz(c)]})]})})}function iz({data:e}){let n=Object.values(e).reduce((e,t)=>e+t,0),r=Object.entries(e).sort(([,e],[,t])=>t-e).filter(([,e])=>e>0);return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.PieChart,{className:`h-4 w-4`}),`Cost by Category`]})}),(0,g.jsx)(Q,{className:`space-y-3`,children:r.map(([e,r])=>{let i=$R[e],a=i.icon,o=r/n*100;return(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(a,{className:t.t(`h-4 w-4`,i.color)}),(0,g.jsx)(`span`,{className:`text-sm`,children:i.label})]}),(0,g.jsxs)(`div`,{className:`text-sm font-medium`,children:[tz(r),(0,g.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,o.toFixed(0),`%)`]})]})]}),(0,g.jsx)(Yn,{value:o,className:`h-2`})]},e)})})]})}function az({data:e}){let n=Object.values(e).reduce((e,t)=>e+t,0),r=Object.entries(e).filter(([e])=>e!==`all`).sort(([,e],[,t])=>t-e).filter(([,e])=>e>0);return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.Cloud,{className:`h-4 w-4`}),`Cost by Provider`]})}),(0,g.jsx)(Q,{className:`space-y-3`,children:r.map(([e,r])=>{let i=ez[e],a=r/n*100;return(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,g.jsx)(`span`,{className:t.t(`text-sm font-medium`,i.color),children:i.label}),(0,g.jsxs)(`div`,{className:`text-sm font-medium`,children:[tz(r),(0,g.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,a.toFixed(0),`%)`]})]})]}),(0,g.jsx)(Yn,{value:a,className:`h-2`})]},e)})})]})}function oz({items:e}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.BarChart3,{className:`h-4 w-4`}),`Top Services by Cost`]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(n.f,{className:`h-[300px]`,children:(0,g.jsx)(`div`,{className:`space-y-2`,children:e.map((e,n)=>{let r=$R[e.category],i=r.icon,a=ez[e.provider],o=e.previousCost===void 0?e.trend:(e.cost-e.previousCost)/e.previousCost*100;return(0,g.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors`,children:[(0,g.jsx)(`div`,{className:`text-lg font-bold text-muted-foreground w-6 text-center`,children:n+1}),(0,g.jsx)(`div`,{className:t.t(`p-1.5 rounded`,`${r.color.replace(`text-`,`bg-`)}/10`),children:(0,g.jsx)(i,{className:t.t(`h-4 w-4`,r.color)})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:a.color,children:a.label}),(0,g.jsx)(`span`,{children:`•`}),(0,g.jsx)(`span`,{children:r.label}),e.usage!==void 0&&e.unit&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`span`,{children:`•`}),(0,g.jsxs)(`span`,{children:[e.usage,` `,e.unit]})]})]})]}),(0,g.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,g.jsx)(`div`,{className:`font-semibold`,children:tz(e.cost)}),o!==void 0&&(0,g.jsxs)(`div`,{className:t.t(`text-xs flex items-center justify-end gap-0.5`,o>0?`text-red-500`:`text-green-500`),children:[o>0?(0,g.jsx)(p.TrendingUp,{className:`h-3 w-3`}):(0,g.jsx)(p.TrendingDown,{className:`h-3 w-3`}),nz(Math.abs(o))]})]})]},e.id)})})})})]})}function sz({anomalies:e,onAcknowledge:n}){let i=e.filter(e=>e.status===`new`);return(0,g.jsxs)(Y,{className:t.t(i.length>0&&`border-yellow-500/50`),children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),`Cost Anomalies`]}),i.length>0&&(0,g.jsxs)(r.t,{className:`bg-yellow-500`,children:[i.length,` new`]})]})}),(0,g.jsx)(Q,{children:e.length===0?(0,g.jsxs)(`div`,{className:`text-center text-muted-foreground py-4`,children:[(0,g.jsx)(p.Zap,{className:`h-8 w-8 mx-auto mb-2 text-green-500`}),(0,g.jsx)(`p`,{children:`No anomalies detected`})]}):(0,g.jsx)(`div`,{className:`space-y-2`,children:e.slice(0,5).map(e=>(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded-lg`,e.status===`new`&&`bg-yellow-500/10`),children:[(0,g.jsx)(p.AlertTriangle,{className:t.t(`h-4 w-4 shrink-0`,e.deviation>100?`text-red-500`:`text-yellow-500`)}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`div`,{className:`font-medium truncate`,children:e.service}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Expected `,tz(e.expectedCost),` • Actual `,tz(e.actualCost)]})]}),(0,g.jsxs)(r.t,{variant:`outline`,className:`text-red-500 shrink-0`,children:[`+`,e.deviation.toFixed(0),`%`]})]},e.id))})})]})}function cz({summary:e,items:n,anomalies:r=[],timeRange:o=`month`,onTimeRangeChange:s,onProviderFilter:c,onExport:l,onRefresh:u,className:f}){let[m,h]=d.useState(`all`),_=e=>{h(e),c?.(e)},v=d.useMemo(()=>m===`all`?n:n.filter(e=>e.provider===m),[n,m]);return e.previousTotalCost!==void 0&&(e.totalCost-e.previousTotalCost)/e.previousTotalCost*100,(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,f),children:[(0,g.jsx)(Y,{children:(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(p.DollarSign,{className:`h-6 w-6`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{children:`Cloud Cost Dashboard`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor and optimize your cloud spending`})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(a.d,{value:o,onValueChange:e=>s?.(e),children:[(0,g.jsxs)(a.y,{className:`w-32`,children:[(0,g.jsx)(p.Calendar,{className:`h-4 w-4 mr-2`}),(0,g.jsx)(a.b,{})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`day`,children:`Today`}),(0,g.jsx)(a.m,{value:`week`,children:`This Week`}),(0,g.jsx)(a.m,{value:`month`,children:`This Month`}),(0,g.jsx)(a.m,{value:`quarter`,children:`This Quarter`}),(0,g.jsx)(a.m,{value:`year`,children:`This Year`})]})]}),(0,g.jsxs)(a.d,{value:m,onValueChange:e=>_(e),children:[(0,g.jsxs)(a.y,{className:`w-32`,children:[(0,g.jsx)(p.Cloud,{className:`h-4 w-4 mr-2`}),(0,g.jsx)(a.b,{})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`All Providers`}),(0,g.jsx)(a.m,{value:`aws`,children:`AWS`}),(0,g.jsx)(a.m,{value:`gcp`,children:`GCP`}),(0,g.jsx)(a.m,{value:`azure`,children:`Azure`})]})]}),u&&(0,g.jsx)(i.n,{variant:`outline`,size:`icon`,onClick:u,children:(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4`})}),l&&(0,g.jsxs)(i.n,{variant:`outline`,onClick:l,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-1`}),`Export`]})]})]})})}),(0,g.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,g.jsx)(rz,{title:`Total Cost`,value:e.totalCost,previousValue:e.previousTotalCost,icon:p.DollarSign,budget:e.budget}),(0,g.jsx)(rz,{title:`Compute`,value:e.byCategory.compute,icon:p.Cpu,trend:-5.2}),(0,g.jsx)(rz,{title:`Storage`,value:e.byCategory.storage,icon:p.HardDrive,trend:12.3}),(0,g.jsx)(rz,{title:`Forecast (EOM)`,value:e.forecast||e.totalCost*1.1,icon:p.TrendingUp,budget:e.budget})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,g.jsx)(`div`,{className:`col-span-2 space-y-6`,children:(0,g.jsx)(oz,{items:v.slice(0,10)})}),(0,g.jsxs)(`div`,{className:`space-y-6`,children:[(0,g.jsx)(iz,{data:e.byCategory}),(0,g.jsx)(az,{data:e.byProvider}),(0,g.jsx)(sz,{anomalies:r})]})]})]})}var lz={totalCost:45230,previousTotalCost:42100,budget:5e4,forecast:48500,byProvider:{aws:28500,gcp:12300,azure:4430,all:45230},byCategory:{compute:22e3,storage:8500,database:7200,network:4100,security:1800,other:1630},topServices:[]},uz=[{id:`1`,name:`EC2 Instances`,category:`compute`,provider:`aws`,cost:12500,previousCost:11800,usage:450,unit:`hours`},{id:`2`,name:`RDS PostgreSQL`,category:`database`,provider:`aws`,cost:4200,previousCost:4e3},{id:`3`,name:`S3 Storage`,category:`storage`,provider:`aws`,cost:3800,previousCost:3200,usage:12,unit:`TB`},{id:`4`,name:`GKE Clusters`,category:`compute`,provider:`gcp`,cost:6500,previousCost:6800},{id:`5`,name:`Cloud SQL`,category:`database`,provider:`gcp`,cost:2800,previousCost:2600},{id:`6`,name:`BigQuery`,category:`database`,provider:`gcp`,cost:1800,previousCost:1500,usage:45,unit:`TB scanned`},{id:`7`,name:`Azure VMs`,category:`compute`,provider:`azure`,cost:2400,previousCost:2200},{id:`8`,name:`Blob Storage`,category:`storage`,provider:`azure`,cost:1200,previousCost:1100},{id:`9`,name:`CloudFront CDN`,category:`network`,provider:`aws`,cost:2100,previousCost:1900,usage:85,unit:`TB`},{id:`10`,name:`Lambda Functions`,category:`compute`,provider:`aws`,cost:850,previousCost:720,usage:12e6,unit:`invocations`}],dz=[{id:`1`,service:`EC2 Spot Instances`,expectedCost:500,actualCost:1250,deviation:150,timestamp:new Date,status:`new`},{id:`2`,service:`Data Transfer`,expectedCost:800,actualCost:1400,deviation:75,timestamp:new Date(Date.now()-36e5),status:`new`},{id:`3`,service:`Lambda`,expectedCost:200,actualCost:320,deviation:60,timestamp:new Date(Date.now()-72e5),status:`acknowledged`}];t.n();var fz={synced:{icon:p.CheckCircle2,color:`text-green-500`,bgColor:`bg-green-500`,label:`Synced`},out_of_sync:{icon:p.AlertTriangle,color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Out of Sync`},syncing:{icon:p.Loader2,color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Syncing`},failed:{icon:p.XCircle,color:`text-red-500`,bgColor:`bg-red-500`,label:`Failed`},unknown:{icon:p.Clock,color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`},suspended:{icon:p.Pause,color:`text-orange-500`,bgColor:`bg-orange-500`,label:`Suspended`}},pz={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},degraded:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Degraded`},progressing:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Progressing`},missing:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Missing`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`}};function mz(e){let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function hz(e){return e.slice(0,7)}function gz({status:e}){let n=fz[e],i=n.icon;return(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(`gap-1`,n.color),children:[(0,g.jsx)(i,{className:t.t(`h-3 w-3`,e===`syncing`&&`animate-spin`)}),n.label]})}function _z({status:e}){let n=pz[e];return(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,n.bgColor)}),(0,g.jsx)(`span`,{className:t.t(`text-sm`,n.color),children:n.label})]})}function vz({app:e,onSync:n,onSuspend:a,onResume:o,onViewDetails:s}){let c=fz[e.syncStatus];pz[e.healthStatus];let l=c.icon,u=d.useMemo(()=>({synced:e.resources.filter(e=>e.syncStatus===`synced`).length,healthy:e.resources.filter(e=>e.healthStatus===`healthy`).length,total:e.resources.length}),[e.resources]);return(0,g.jsx)(Y,{className:t.t(e.syncStatus===`failed`&&`border-red-500/50`,e.syncStatus===`out_of_sync`&&`border-yellow-500/30`,e.healthStatus===`degraded`&&`border-red-500/30`),children:(0,g.jsx)(Q,{className:`p-4`,children:(0,g.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,g.jsx)(`div`,{className:t.t(`w-12 h-12 rounded-lg flex items-center justify-center shrink-0`,`${c.bgColor}/10`),children:(0,g.jsx)(l,{className:t.t(`h-6 w-6`,c.color,e.syncStatus===`syncing`&&`animate-spin`)})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`h3`,{className:`font-semibold`,children:e.name}),(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:e.project})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.Server,{className:`h-3 w-3`}),(0,g.jsx)(`span`,{children:e.destination.namespace}),(0,g.jsx)(`span`,{children:`@`}),(0,g.jsx)(`span`,{className:`truncate max-w-[200px]`,children:e.destination.server})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,g.jsx)(gz,{status:e.syncStatus}),(0,g.jsx)(_z,{status:e.healthStatus})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,g.jsx)(p.GitBranch,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{children:e.repo.branch})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,g.jsx)(p.Folder,{className:`h-4 w-4`}),(0,g.jsx)(`span`,{className:`truncate max-w-[150px]`,children:e.repo.path})]}),e.lastSyncedRevision&&(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(p.GitCommit,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`code`,{className:`text-xs bg-muted px-1.5 py-0.5 rounded`,children:hz(e.lastSyncedRevision)}),e.targetRevision&&e.lastSyncedRevision!==e.targetRevision&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.ArrowRight,{className:`h-3 w-3 text-muted-foreground`}),(0,g.jsx)(`code`,{className:`text-xs bg-yellow-500/20 text-yellow-600 px-1.5 py-0.5 rounded`,children:hz(e.targetRevision)})]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Resources Synced`}),(0,g.jsxs)(`span`,{children:[u.synced,`/`,u.total]})]}),(0,g.jsx)(Yn,{value:u.synced/u.total*100,className:`h-1.5`})]}),(0,g.jsxs)(`div`,{className:`flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Resources Healthy`}),(0,g.jsxs)(`span`,{children:[u.healthy,`/`,u.total]})]}),(0,g.jsx)(Yn,{value:u.healthy/u.total*100,className:t.t(`h-1.5`,u.healthy<u.total&&`[&>div]:bg-yellow-500`)})]})]}),e.message&&(e.syncStatus===`failed`||e.healthStatus===`degraded`)&&(0,g.jsx)(`div`,{className:`text-sm text-red-500 bg-red-500/10 p-2 rounded`,children:e.message}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.lastSyncedAt&&(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Clock,{className:`h-3 w-3`}),`Last synced `,mz(e.lastSyncedAt)]}),e.autoSync&&(0,g.jsxs)(r.t,{variant:`outline`,className:`text-xs`,children:[(0,g.jsx)(p.RefreshCw,{className:`h-3 w-3 mr-1`}),`Auto-sync`]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[s&&(0,g.jsxs)(i.n,{variant:`ghost`,size:`sm`,onClick:s,children:[(0,g.jsx)(p.Eye,{className:`h-4 w-4 mr-1`}),`Details`]}),e.syncStatus===`suspended`&&o?(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:o,children:[(0,g.jsx)(p.Play,{className:`h-4 w-4 mr-1`}),`Resume`]}):(0,g.jsxs)(g.Fragment,{children:[a&&e.syncStatus!==`suspended`&&(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:a,children:(0,g.jsx)(p.Pause,{className:`h-4 w-4`})}),n&&e.syncStatus!==`syncing`&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:n,children:[(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4 mr-1`}),`Sync`]})]})]})]})]})]})})})}function yz({applications:e}){let t=d.useMemo(()=>({total:e.length,synced:e.filter(e=>e.syncStatus===`synced`).length,outOfSync:e.filter(e=>e.syncStatus===`out_of_sync`).length,failed:e.filter(e=>e.syncStatus===`failed`).length,healthy:e.filter(e=>e.healthStatus===`healthy`).length,degraded:e.filter(e=>e.healthStatus===`degraded`).length}),[e]);return(0,g.jsxs)(`div`,{className:`grid grid-cols-6 gap-4`,children:[(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:t.total}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Total Apps`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.synced}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Synced`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold text-yellow-500`,children:t.outOfSync}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Out of Sync`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold text-red-500`,children:t.failed}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Failed`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.healthy}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Healthy`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold text-red-500`,children:t.degraded}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Degraded`})]})})]})}function bz({applications:e,onSync:r,onRefresh:a,onSuspend:o,onResume:s,onViewDetails:c,className:l}){let[u,f]=d.useState(`all`),m=d.useMemo(()=>u===`all`?e:e.filter(e=>e.syncStatus===u),[e,u]);return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,l),children:[(0,g.jsx)(Y,{children:(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(p.GitBranch,{className:`h-6 w-6`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{children:`GitOps Sync Status`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor application synchronization with Git`})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[[`all`,`synced`,`out_of_sync`,`failed`,`syncing`].map(e=>(0,g.jsx)(i.n,{variant:u===e?`default`:`ghost`,size:`sm`,onClick:()=>f(e),children:e===`all`?`All`:fz[e].label},e)),a&&(0,g.jsxs)(i.n,{variant:`outline`,onClick:a,children:[(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4 mr-1`}),`Refresh All`]})]})]})})}),(0,g.jsx)(yz,{applications:e}),(0,g.jsx)(n.f,{className:`h-[500px]`,children:(0,g.jsx)(`div`,{className:`space-y-4 pr-4`,children:m.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,g.jsx)(p.Cloud,{className:`h-12 w-12 mb-4`}),(0,g.jsx)(`p`,{className:`text-lg font-medium`,children:`No applications found`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`Adjust your filters or add new applications`})]}):m.map(e=>(0,g.jsx)(vz,{app:e,onSync:r?()=>r(e):void 0,onSuspend:o?()=>o(e):void 0,onResume:s?()=>s(e):void 0,onViewDetails:c?()=>c(e):void 0},e.id))})})]})}var xz=[{id:`1`,name:`api-gateway`,project:`production`,repo:{url:`https://github.com/example/infra`,branch:`main`,path:`apps/api-gateway`},destination:{server:`https://kubernetes.default.svc`,namespace:`production`},syncStatus:`synced`,healthStatus:`healthy`,lastSyncedAt:new Date(Date.now()-5*6e4),lastSyncedRevision:`a1b2c3d4e5f6789`,autoSync:!0,resources:[{kind:`Deployment`,name:`api-gateway`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Service`,name:`api-gateway`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`ConfigMap`,name:`api-gateway-config`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Ingress`,name:`api-gateway`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`}]},{id:`2`,name:`user-service`,project:`production`,repo:{url:`https://github.com/example/infra`,branch:`main`,path:`apps/user-service`},destination:{server:`https://kubernetes.default.svc`,namespace:`production`},syncStatus:`out_of_sync`,healthStatus:`healthy`,lastSyncedAt:new Date(Date.now()-2*36e5),lastSyncedRevision:`old123456789`,targetRevision:`new987654321`,autoSync:!1,resources:[{kind:`Deployment`,name:`user-service`,namespace:`production`,syncStatus:`out_of_sync`,healthStatus:`healthy`},{kind:`Service`,name:`user-service`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Secret`,name:`user-service-secrets`,namespace:`production`,syncStatus:`out_of_sync`,healthStatus:`healthy`}]},{id:`3`,name:`payment-service`,project:`production`,repo:{url:`https://github.com/example/infra`,branch:`main`,path:`apps/payment-service`},destination:{server:`https://kubernetes.default.svc`,namespace:`production`},syncStatus:`failed`,healthStatus:`degraded`,lastSyncedAt:new Date(Date.now()-30*6e4),lastSyncedRevision:`abc123def456`,message:`Failed to apply resource: Deployment/payment-service: ImagePullBackOff`,autoSync:!0,resources:[{kind:`Deployment`,name:`payment-service`,namespace:`production`,syncStatus:`failed`,healthStatus:`degraded`,message:`ImagePullBackOff`},{kind:`Service`,name:`payment-service`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`},{kind:`Secret`,name:`payment-service-secrets`,namespace:`production`,syncStatus:`synced`,healthStatus:`healthy`}]},{id:`4`,name:`notification-service`,project:`staging`,repo:{url:`https://github.com/example/infra`,branch:`develop`,path:`apps/notification-service`},destination:{server:`https://staging.k8s.example.com`,namespace:`staging`},syncStatus:`syncing`,healthStatus:`progressing`,lastSyncedAt:new Date(Date.now()-6e4),lastSyncedRevision:`syncing123`,autoSync:!0,resources:[{kind:`Deployment`,name:`notification-service`,namespace:`staging`,syncStatus:`syncing`,healthStatus:`progressing`},{kind:`Service`,name:`notification-service`,namespace:`staging`,syncStatus:`synced`,healthStatus:`healthy`}]}];t.n();var Sz={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},unknown:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Unknown`}},Cz={api:{icon:p.Globe,color:`text-blue-500`},web:{icon:p.Globe,color:`text-purple-500`},worker:{icon:p.Cpu,color:`text-orange-500`},database:{icon:p.Database,color:`text-green-500`},cache:{icon:p.HardDrive,color:`text-red-500`},queue:{icon:p.Activity,color:`text-cyan-500`}};function wz(e){return e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(2)}s`}function Tz(e){return e<1e3?e.toFixed(0):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function Ez({current:e,previous:n}){if(n===void 0)return null;let r=(e-n)/n*100,i=r>0;return(0,g.jsxs)(`span`,{className:t.t(`text-xs flex items-center gap-0.5`,i?`text-red-500`:`text-green-500`),children:[i?(0,g.jsx)(p.TrendingUp,{className:`h-3 w-3`}):(0,g.jsx)(p.TrendingDown,{className:`h-3 w-3`}),Math.abs(r).toFixed(1),`%`]})}function Dz({title:e,value:n,unit:r,previousValue:i,status:a,icon:o}){let s=a?Sz[a]:null;return(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsx)(`div`,{className:`p-2 rounded-lg bg-muted`,children:(0,g.jsx)(o,{className:`h-4 w-4 text-muted-foreground`})}),s&&(0,g.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,s.bgColor)})]}),(0,g.jsxs)(`div`,{className:`mt-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-baseline gap-1`,children:[(0,g.jsx)(`span`,{className:`text-2xl font-bold`,children:Tz(n)}),r&&(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:r})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between mt-1`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e}),(0,g.jsx)(Ez,{current:n,previous:i})]})]})]})})}function Oz({service:e,onClick:n}){let i=Sz[e.status],a=Cz[e.type],o=a.icon,{metrics:s,previousMetrics:c}=e;return s.successRate/100*(1-s.p95ResponseTime/3e3),(0,g.jsx)(Y,{className:t.t(`cursor-pointer transition-all hover:shadow-md`,e.status===`critical`&&`border-red-500/50`,e.status===`warning`&&`border-yellow-500/30`),onClick:n,children:(0,g.jsxs)(Q,{className:`p-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,g.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,`${a.color.replace(`text-`,`bg-`)}/10`),children:(0,g.jsx)(o,{className:t.t(`h-5 w-5`,a.color)})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`h4`,{className:`font-semibold truncate`,children:e.name}),(0,g.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full shrink-0`,i.bgColor)}),e.version&&(0,g.jsxs)(r.t,{variant:`outline`,className:`text-xs`,children:[`v`,e.version]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-sm`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Zap,{className:`h-3 w-3 text-muted-foreground`}),s.requestsPerSecond,`/s`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Clock,{className:`h-3 w-3 text-muted-foreground`}),wz(s.avgResponseTime)]}),(0,g.jsxs)(`span`,{className:t.t(`flex items-center gap-1`,s.errorRate>5&&`text-red-500`,s.errorRate>1&&s.errorRate<=5&&`text-yellow-500`),children:[(0,g.jsx)(p.AlertTriangle,{className:`h-3 w-3`}),s.errorRate.toFixed(2),`%`]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4 mt-3 text-xs text-muted-foreground`,children:[(0,g.jsxs)(`span`,{children:[`p50: `,wz(s.p50ResponseTime)]}),(0,g.jsxs)(`span`,{children:[`p95: `,wz(s.p95ResponseTime)]}),(0,g.jsxs)(`span`,{children:[`p99: `,wz(s.p99ResponseTime)]})]}),e.tags&&e.tags.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[e.tags.slice(0,3).map(e=>(0,g.jsx)(r.t,{variant:`secondary`,className:`text-xs`,children:e},e)),e.tags.length>3&&(0,g.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`+`,e.tags.length-3]})]})]}),(0,g.jsxs)(`div`,{className:`text-right shrink-0 space-y-1`,children:[(0,g.jsxs)(`div`,{className:`text-lg font-bold text-green-500`,children:[s.successRate.toFixed(1),`%`]}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Success`}),e.instances&&(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.instances,` instances`]})]})]}),(s.cpuUsage!==void 0||s.memoryUsage!==void 0)&&(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mt-4 pt-3 border-t`,children:[s.cpuUsage!==void 0&&(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,g.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,g.jsx)(p.Cpu,{className:`h-3 w-3`}),` CPU`]}),(0,g.jsxs)(`span`,{className:t.t(s.cpuUsage>80&&`text-red-500`),children:[s.cpuUsage,`%`]})]}),(0,g.jsx)(Yn,{value:s.cpuUsage,className:t.t(`h-1.5`,s.cpuUsage>80&&`[&>div]:bg-red-500`)})]}),s.memoryUsage!==void 0&&(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-1`,children:[(0,g.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,g.jsx)(p.MemoryStick,{className:`h-3 w-3`}),` Memory`]}),(0,g.jsxs)(`span`,{className:t.t(s.memoryUsage>80&&`text-red-500`),children:[s.memoryUsage,`%`]})]}),(0,g.jsx)(Yn,{value:s.memoryUsage,className:t.t(`h-1.5`,s.memoryUsage>80&&`[&>div]:bg-red-500`)})]})]})]})})}function kz({transactions:e,onClick:r}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.Activity,{className:`h-4 w-4`}),`Recent Transactions`]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(n.f,{className:`h-[300px]`,children:(0,g.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 cursor-pointer transition-colors`,onClick:()=>r?.(e),children:[e.status===`success`?(0,g.jsx)(p.CheckCircle2,{className:`h-4 w-4 text-green-500 shrink-0`}):(0,g.jsx)(p.XCircle,{className:`h-4 w-4 text-red-500 shrink-0`}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`div`,{className:`font-medium text-sm truncate`,children:e.name}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.service})]}),(0,g.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,g.jsx)(`div`,{className:t.t(`text-sm font-medium`,e.duration>1e3&&`text-yellow-500`,e.duration>3e3&&`text-red-500`),children:wz(e.duration)}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.timestamp.toLocaleTimeString()})]})]},e.id))})})})]})}function Az({services:e,recentTransactions:r=[],timeRange:o=`1h`,onTimeRangeChange:s,onServiceClick:c,onTransactionClick:l,onRefresh:u,className:f}){let[m,h]=d.useState(`all`),_=d.useMemo(()=>({totalRequests:e.reduce((e,t)=>e+t.metrics.requestsPerSecond,0),avgResponseTime:e.reduce((e,t)=>e+t.metrics.avgResponseTime,0)/e.length,avgErrorRate:e.reduce((e,t)=>e+t.metrics.errorRate,0)/e.length,healthyCount:e.filter(e=>e.status===`healthy`).length,totalServices:e.length}),[e]),v=d.useMemo(()=>m===`all`?e:e.filter(e=>e.status===m),[e,m]);return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,f),children:[(0,g.jsx)(Y,{children:(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(p.Activity,{className:`h-6 w-6`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{children:`Application Performance`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Monitor service health and performance metrics`})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(a.d,{value:o,onValueChange:e=>s?.(e),children:[(0,g.jsxs)(a.y,{className:`w-28`,children:[(0,g.jsx)(p.Clock,{className:`h-4 w-4 mr-2`}),(0,g.jsx)(a.b,{})]}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`1h`,children:`Last 1h`}),(0,g.jsx)(a.m,{value:`6h`,children:`Last 6h`}),(0,g.jsx)(a.m,{value:`24h`,children:`Last 24h`}),(0,g.jsx)(a.m,{value:`7d`,children:`Last 7d`}),(0,g.jsx)(a.m,{value:`30d`,children:`Last 30d`})]})]}),u&&(0,g.jsx)(i.n,{variant:`outline`,onClick:u,children:(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,g.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,g.jsx)(Dz,{title:`Total Requests`,value:_.totalRequests,unit:`/s`,icon:p.Zap}),(0,g.jsx)(Dz,{title:`Avg Response Time`,value:_.avgResponseTime,unit:`ms`,icon:p.Clock,status:_.avgResponseTime>500?`warning`:`healthy`}),(0,g.jsx)(Dz,{title:`Error Rate`,value:_.avgErrorRate,unit:`%`,icon:p.AlertTriangle,status:_.avgErrorRate>5?`critical`:_.avgErrorRate>1?`warning`:`healthy`}),(0,g.jsx)(Dz,{title:`Services Healthy`,value:_.healthyCount,unit:`/ ${_.totalServices}`,icon:p.CheckCircle2,status:_.healthyCount===_.totalServices?`healthy`:`warning`})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-3 gap-6`,children:[(0,g.jsxs)(`div`,{className:`col-span-2 space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`h3`,{className:`font-semibold`,children:`Services`}),(0,g.jsx)(`div`,{className:`flex items-center gap-2`,children:[`all`,`healthy`,`warning`,`critical`].map(e=>(0,g.jsx)(i.n,{variant:m===e?`default`:`ghost`,size:`sm`,onClick:()=>h(e),children:e===`all`?`All`:Sz[e].label},e))})]}),(0,g.jsx)(n.f,{className:`h-[500px]`,children:(0,g.jsx)(`div`,{className:`space-y-4 pr-4`,children:v.map(e=>(0,g.jsx)(Oz,{service:e,onClick:()=>c?.(e)},e.id))})})]}),(0,g.jsx)(`div`,{children:(0,g.jsx)(kz,{transactions:r,onClick:l})})]})]})}var jz=[{id:`1`,name:`api-gateway`,type:`api`,status:`healthy`,version:`2.4.1`,instances:3,metrics:{requestsPerSecond:1250,avgResponseTime:45,p50ResponseTime:32,p95ResponseTime:120,p99ResponseTime:250,errorRate:.12,successRate:99.88,activeConnections:450,cpuUsage:45,memoryUsage:62},tags:[`production`,`critical`]},{id:`2`,name:`user-service`,type:`api`,status:`healthy`,version:`1.8.0`,instances:2,metrics:{requestsPerSecond:350,avgResponseTime:85,p50ResponseTime:65,p95ResponseTime:180,p99ResponseTime:450,errorRate:.5,successRate:99.5,activeConnections:120,cpuUsage:35,memoryUsage:55},tags:[`production`]},{id:`3`,name:`payment-service`,type:`api`,status:`warning`,version:`3.1.0`,instances:2,metrics:{requestsPerSecond:150,avgResponseTime:520,p50ResponseTime:280,p95ResponseTime:1200,p99ResponseTime:2500,errorRate:2.5,successRate:97.5,activeConnections:85,cpuUsage:78,memoryUsage:82},tags:[`production`,`payment`]},{id:`4`,name:`notification-worker`,type:`worker`,status:`healthy`,instances:5,metrics:{requestsPerSecond:500,avgResponseTime:25,p50ResponseTime:18,p95ResponseTime:55,p99ResponseTime:120,errorRate:.05,successRate:99.95,activeConnections:0,cpuUsage:25,memoryUsage:40}},{id:`5`,name:`postgres-primary`,type:`database`,status:`healthy`,instances:1,metrics:{requestsPerSecond:2500,avgResponseTime:8,p50ResponseTime:5,p95ResponseTime:25,p99ResponseTime:80,errorRate:.01,successRate:99.99,activeConnections:120,cpuUsage:55,memoryUsage:72}},{id:`6`,name:`redis-cache`,type:`cache`,status:`healthy`,instances:3,metrics:{requestsPerSecond:15e3,avgResponseTime:.5,p50ResponseTime:.3,p95ResponseTime:1.2,p99ResponseTime:3,errorRate:.001,successRate:99.999,activeConnections:500,memoryUsage:45}}],Mz=[{id:`1`,name:`POST /api/users`,service:`user-service`,duration:85,timestamp:new Date(Date.now()-5e3),status:`success`},{id:`2`,name:`GET /api/products`,service:`api-gateway`,duration:42,timestamp:new Date(Date.now()-12e3),status:`success`},{id:`3`,name:`POST /api/payments`,service:`payment-service`,duration:1250,timestamp:new Date(Date.now()-25e3),status:`error`},{id:`4`,name:`GET /api/orders/:id`,service:`api-gateway`,duration:65,timestamp:new Date(Date.now()-45e3),status:`success`},{id:`5`,name:`POST /api/notifications`,service:`notification-worker`,duration:22,timestamp:new Date(Date.now()-6e4),status:`success`},{id:`6`,name:`GET /api/users/:id`,service:`user-service`,duration:95,timestamp:new Date(Date.now()-9e4),status:`success`},{id:`7`,name:`PUT /api/cart`,service:`api-gateway`,duration:180,timestamp:new Date(Date.now()-12e4),status:`success`},{id:`8`,name:`POST /api/checkout`,service:`payment-service`,duration:3200,timestamp:new Date(Date.now()-18e4),status:`error`}];t.n();var Nz={running:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Running`},stopped:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Stopped`},paused:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Paused`},restarting:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Restarting`},creating:{color:`text-blue-400`,bgColor:`bg-blue-400`,label:`Creating`},removing:{color:`text-orange-500`,bgColor:`bg-orange-500`,label:`Removing`},exited:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Exited`},dead:{color:`text-red-600`,bgColor:`bg-red-600`,label:`Dead`}},Pz={running:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Running`},updating:{color:`text-blue-500`,bgColor:`bg-blue-500`,label:`Updating`},scaled:{color:`text-purple-500`,bgColor:`bg-purple-500`,label:`Scaling`},failed:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Failed`},pending:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Pending`}};function Fz(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Iz(e){if(!e)return`N/A`;let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function Lz({container:e,onViewLogs:n,onExecShell:a}){let o=Nz[e.status],s=e.resources.memory/e.resources.memoryLimit*100;return(0,g.jsx)(`div`,{className:t.t(`border rounded-lg p-3 transition-all hover:bg-muted/30`,e.status===`exited`&&`border-red-500/30 bg-red-500/5`,e.healthCheck===`unhealthy`&&`border-yellow-500/30`),children:(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Container,{className:t.t(`h-5 w-5`,o.color)}),e.healthCheck&&e.healthCheck!==`none`&&(0,g.jsx)(`div`,{className:t.t(`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-background`,e.healthCheck===`healthy`&&`bg-green-500`,e.healthCheck===`unhealthy`&&`bg-red-500`,e.healthCheck===`starting`&&`bg-yellow-500`)})]}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`font-mono text-sm truncate`,children:e.name}),(0,g.jsx)(r.t,{variant:`outline`,className:t.t(`text-xs`,o.color),children:o.label})]}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 truncate`,children:e.image}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 mt-2`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-0.5`,children:[(0,g.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,g.jsx)(p.Cpu,{className:`h-3 w-3`}),` CPU`]}),(0,g.jsxs)(`span`,{children:[e.resources.cpu.toFixed(1),`%`]})]}),(0,g.jsx)(Yn,{value:e.resources.cpu,className:t.t(`h-1`,e.resources.cpu>80&&`[&>div]:bg-red-500`)})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-xs mb-0.5`,children:[(0,g.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,g.jsx)(p.MemoryStick,{className:`h-3 w-3`}),` MEM`]}),(0,g.jsxs)(`span`,{children:[e.resources.memory,`MB`]})]}),(0,g.jsx)(Yn,{value:s,className:t.t(`h-1`,s>80&&`[&>div]:bg-red-500`)})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Clock,{className:`h-3 w-3`}),Iz(e.startedAt)]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.ArrowDown,{className:`h-3 w-3`}),Fz(e.resources.networkRx),`/s`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.ArrowUp,{className:`h-3 w-3`}),Fz(e.resources.networkTx),`/s`]}),e.restartCount!==void 0&&e.restartCount>0&&(0,g.jsxs)(`span`,{className:`flex items-center gap-1 text-yellow-500`,children:[(0,g.jsx)(p.RefreshCw,{className:`h-3 w-3`}),e.restartCount,` restarts`]})]})]}),(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,g.jsx)(p.MoreVertical,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[n&&(0,g.jsxs)($,{onClick:n,children:[(0,g.jsx)(p.FileText,{className:`h-4 w-4 mr-2`}),`View Logs`]}),a&&(0,g.jsxs)($,{onClick:a,children:[(0,g.jsx)(p.Terminal,{className:`h-4 w-4 mr-2`}),`Shell`]})]})]})]})})}function Rz({service:e,onScale:n,onRestart:a,onStop:o,onDelete:c,onViewLogs:l,onExecShell:u}){let[f,m]=d.useState(!1),[h,_]=d.useState(e.replicas.desired),v=Pz[e.status],y=e.containers.every(e=>e.status===`running`),b=e.replicas.running/e.replicas.desired*100;return(0,g.jsx)(Y,{className:t.t(e.status===`failed`&&`border-red-500/50`,!y&&`border-yellow-500/30`),children:(0,g.jsxs)(Q,{className:`p-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,g.jsx)(`div`,{className:t.t(`p-2 rounded-lg`,`${v.bgColor}/10`),children:(0,g.jsx)(p.Layers,{className:t.t(`h-5 w-5`,v.color)})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`h4`,{className:`font-semibold`,children:e.name}),(0,g.jsx)(r.t,{className:t.t(`text-white text-xs`,v.bgColor),children:v.label})]}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground mt-1`,children:e.image}),(0,g.jsxs)(`div`,{className:`mt-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm mb-1`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Replicas`}),(0,g.jsxs)(`span`,{className:t.t(e.replicas.running<e.replicas.desired&&`text-yellow-500`),children:[e.replicas.running,`/`,e.replicas.desired,` running`,e.replicas.ready<e.replicas.running&&(0,g.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,e.replicas.ready,` ready)`]})]})]}),(0,g.jsx)(Yn,{value:b,className:t.t(`h-2`,b<100&&`[&>div]:bg-yellow-500`,e.status===`failed`&&`[&>div]:bg-red-500`)})]}),e.updateStatus&&(0,g.jsxs)(`div`,{className:`mt-3 p-2 bg-muted/50 rounded text-sm`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-1 text-blue-500`,children:[(0,g.jsx)(p.RefreshCw,{className:`h-3 w-3 animate-spin`}),e.updateStatus.state]}),(0,g.jsxs)(`span`,{children:[e.updateStatus.progress,`%`]})]}),e.updateStatus.message&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e.updateStatus.message}),(0,g.jsx)(Yn,{value:e.updateStatus.progress,className:`h-1 mt-2`})]}),e.ports&&e.ports.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mt-3 text-xs text-muted-foreground`,children:[(0,g.jsx)(p.Network,{className:`h-3 w-3`}),e.ports.map((t,n)=>(0,g.jsxs)(`span`,{children:[t.published,`:`,t.target,n<e.ports.length-1&&`,`]},n))]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1 border rounded`,children:[(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>{let e=Math.max(0,h-1);_(e),n?.(e)},children:(0,g.jsx)(p.Minus,{className:`h-4 w-4`})}),(0,g.jsx)(s.t,{type:`number`,value:h,onChange:e=>{_(parseInt(e.target.value)||0)},onBlur:()=>n?.(h),className:`w-12 h-8 text-center border-0 p-0`,min:0}),(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>{let e=h+1;_(e),n?.(e)},children:(0,g.jsx)(p.Plus,{className:`h-4 w-4`})})]}),(0,g.jsxs)(Jt,{children:[(0,g.jsx)(Yt,{asChild:!0,children:(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,g.jsx)(p.MoreVertical,{className:`h-4 w-4`})})}),(0,g.jsxs)(nn,{align:`end`,children:[a&&(0,g.jsxs)($,{onClick:a,children:[(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4 mr-2`}),`Restart`]}),o&&(0,g.jsxs)($,{onClick:o,children:[(0,g.jsx)(p.Square,{className:`h-4 w-4 mr-2`}),`Stop`]}),(0,g.jsx)(sn,{}),c&&(0,g.jsxs)($,{onClick:c,className:`text-destructive`,children:[(0,g.jsx)(p.Trash2,{className:`h-4 w-4 mr-2`}),`Delete`]})]})]}),(0,g.jsxs)(i.n,{variant:`ghost`,size:`sm`,onClick:()=>m(!f),children:[(0,g.jsx)(p.Eye,{className:`h-4 w-4 mr-1`}),f?`Hide`:`Show`,` Containers`]})]})]}),f&&(0,g.jsx)(`div`,{className:`mt-4 pt-4 border-t space-y-2`,children:e.containers.length===0?(0,g.jsx)(`div`,{className:`text-center text-muted-foreground py-4`,children:`No containers running`}):e.containers.map(e=>(0,g.jsx)(Lz,{container:e,onViewLogs:l?()=>l(e):void 0,onExecShell:u?()=>u(e):void 0},e.id))})]})})}function zz({services:e}){let t=d.useMemo(()=>{let t=e.length,n=e.reduce((e,t)=>e+t.containers.length,0),r=e.reduce((e,t)=>e+t.containers.filter(e=>e.status===`running`).length,0),i=e.reduce((e,t)=>e+t.containers.reduce((e,t)=>e+t.resources.cpu,0),0),a=e.reduce((e,t)=>e+t.containers.reduce((e,t)=>e+t.resources.memory,0),0);return{totalServices:t,totalContainers:n,runningContainers:r,avgCpu:i/n,totalMemory:a}},[e]);return(0,g.jsxs)(`div`,{className:`grid grid-cols-5 gap-4`,children:[(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:t.totalServices}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Services`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:t.totalContainers}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Containers`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:t.runningContainers}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Running`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsxs)(`div`,{className:`text-2xl font-bold`,children:[t.avgCpu.toFixed(1),`%`]}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Avg CPU`})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4 text-center`,children:[(0,g.jsxs)(`div`,{className:`text-2xl font-bold`,children:[(t.totalMemory/1024).toFixed(1),`GB`]}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Total Memory`})]})})]})}function Bz({services:e,onScaleService:r,onRestartService:o,onStopService:c,onDeleteService:l,onViewLogs:u,onExecShell:f,onRefresh:m,className:h}){let[_,v]=d.useState(``),[y,b]=d.useState(`all`),x=d.useMemo(()=>e.filter(e=>!(_&&!e.name.toLowerCase().includes(_.toLowerCase())||y!==`all`&&e.status!==y)),[e,_,y]);return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,h),children:[(0,g.jsx)(Y,{children:(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(p.Container,{className:`h-6 w-6`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{children:`Container Orchestrator`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage and monitor containerized services`})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Search services...`,value:_,onChange:e=>v(e.target.value),className:`pl-9 w-64`})]}),(0,g.jsxs)(a.d,{value:y,onValueChange:e=>b(e),children:[(0,g.jsx)(a.y,{className:`w-32`,children:(0,g.jsx)(a.b,{placeholder:`Status`})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`All Status`}),(0,g.jsx)(a.m,{value:`running`,children:`Running`}),(0,g.jsx)(a.m,{value:`updating`,children:`Updating`}),(0,g.jsx)(a.m,{value:`failed`,children:`Failed`}),(0,g.jsx)(a.m,{value:`pending`,children:`Pending`})]})]}),m&&(0,g.jsx)(i.n,{variant:`outline`,onClick:m,children:(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,g.jsx)(zz,{services:e}),(0,g.jsx)(n.f,{className:`h-[500px]`,children:(0,g.jsx)(`div`,{className:`space-y-4 pr-4`,children:x.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,g.jsx)(p.Container,{className:`h-12 w-12 mb-4`}),(0,g.jsx)(`p`,{className:`text-lg font-medium`,children:`No services found`})]}):x.map(e=>(0,g.jsx)(Rz,{service:e,onScale:r?t=>r(e,t):void 0,onRestart:o?()=>o(e):void 0,onStop:c?()=>c(e):void 0,onDelete:l?()=>l(e):void 0,onViewLogs:u,onExecShell:f},e.id))})})]})}function Vz(e,t){return Array.from({length:t},(t,n)=>({id:`${e}-${n+1}`,name:`${e}-${n+1}`,image:`myregistry/${e}:latest`,status:`running`,createdAt:new Date(Date.now()-(n+1)*36e5),startedAt:new Date(Date.now()-n*36e5),healthCheck:`healthy`,restartCount:Math.floor(Math.random()*3),node:`node-${Math.floor(Math.random()*3)+1}`,resources:{cpu:Math.random()*50+10,memory:Math.floor(Math.random()*500+200),memoryLimit:1024,networkRx:Math.floor(Math.random()*1e6),networkTx:Math.floor(Math.random()*5e5)}}))}var Hz=[{id:`1`,name:`api-gateway`,image:`myregistry/api-gateway:v2.4.1`,status:`running`,replicas:{desired:3,running:3,ready:3},containers:Vz(`api-gateway`,3),ports:[{published:80,target:8080},{published:443,target:8443}],createdAt:new Date(Date.now()-168*36e5),updatedAt:new Date(Date.now()-48*36e5)},{id:`2`,name:`user-service`,image:`myregistry/user-service:v1.8.0`,status:`updating`,replicas:{desired:2,running:2,ready:1},containers:Vz(`user-service`,2),updateStatus:{state:`updating`,progress:50,message:`Updating replica 1 of 2`},ports:[{published:8081,target:8080}],createdAt:new Date(Date.now()-336*36e5),updatedAt:new Date},{id:`3`,name:`payment-service`,image:`myregistry/payment-service:v3.1.0`,status:`running`,replicas:{desired:2,running:2,ready:2},containers:Vz(`payment-service`,2),ports:[{published:8082,target:8080}],createdAt:new Date(Date.now()-720*36e5),updatedAt:new Date(Date.now()-120*36e5)},{id:`4`,name:`notification-worker`,image:`myregistry/notification-worker:v2.0.0`,status:`running`,replicas:{desired:5,running:5,ready:5},containers:Vz(`notification-worker`,5),createdAt:new Date(Date.now()-504*36e5),updatedAt:new Date(Date.now()-168*36e5)},{id:`5`,name:`analytics-pipeline`,image:`myregistry/analytics:v1.2.0`,status:`failed`,replicas:{desired:3,running:1,ready:1},containers:[...Vz(`analytics-pipeline`,1),{id:`analytics-pipeline-2`,name:`analytics-pipeline-2`,image:`myregistry/analytics:v1.2.0`,status:`exited`,createdAt:new Date(Date.now()-2*36e5),healthCheck:`unhealthy`,restartCount:5,node:`node-2`,resources:{cpu:0,memory:0,memoryLimit:1024,networkRx:0,networkTx:0}}],createdAt:new Date(Date.now()-240*36e5),updatedAt:new Date(Date.now()-24*36e5)}];t.n();var Uz={healthy:{color:`text-green-500`,bgColor:`bg-green-500`,label:`Healthy`},warning:{color:`text-yellow-500`,bgColor:`bg-yellow-500`,label:`Warning`},critical:{color:`text-red-500`,bgColor:`bg-red-500`,label:`Critical`},offline:{color:`text-gray-500`,bgColor:`bg-gray-500`,label:`Offline`}},Wz={active:{color:`text-green-500`,label:`Active`},idle:{color:`text-gray-500`,label:`Idle`},idle_in_transaction:{color:`text-yellow-500`,label:`Idle in Transaction`},waiting:{color:`text-orange-500`,label:`Waiting`}};function Gz(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Kz(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${Math.floor(e/60)}m ${Math.floor(e%60)}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function qz(e){return e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(2)}ms`:`${(e/1e3).toFixed(2)}s`}function Jz({metrics:e,status:n}){let i=Uz[n],a=e.connections.active/e.connections.max*100,o=e.storage.used/e.storage.total*100;return(0,g.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,g.jsx)(p.Users,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsx)(`div`,{className:t.t(`w-2 h-2 rounded-full`,i.bgColor)})]}),(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:e.connections.active}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Active Connections`}),(0,g.jsxs)(`div`,{className:`mt-2`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between text-xs mb-1`,children:[(0,g.jsxs)(`span`,{children:[e.connections.idle,` idle`]}),(0,g.jsxs)(`span`,{children:[`max `,e.connections.max]})]}),(0,g.jsx)(Yn,{value:a,className:t.t(`h-1.5`,a>80&&`[&>div]:bg-red-500`)})]})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,g.jsx)(p.Zap,{className:`h-4 w-4 text-muted-foreground`}),(0,g.jsxs)(r.t,{variant:`secondary`,className:`text-xs`,children:[e.transactions.perSecond,`/s`]})]}),(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:e.transactions.committed}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Transactions`}),(0,g.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,g.jsx)(`span`,{className:`text-red-500`,children:e.transactions.rolledBack}),` rolled back`]})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4`,children:[(0,g.jsx)(`div`,{className:`flex items-center justify-between mb-2`,children:(0,g.jsx)(p.Activity,{className:`h-4 w-4 text-muted-foreground`})}),(0,g.jsxs)(`div`,{className:t.t(`text-2xl font-bold`,e.cache.hitRatio<90&&`text-yellow-500`,e.cache.hitRatio<80&&`text-red-500`),children:[e.cache.hitRatio.toFixed(1),`%`]}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Cache Hit Ratio`}),(0,g.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Buffer: `,e.cache.bufferHit,` • Disk: `,e.cache.diskRead]})]})}),(0,g.jsx)(Y,{children:(0,g.jsxs)(Q,{className:`p-4`,children:[(0,g.jsx)(`div`,{className:`flex items-center justify-between mb-2`,children:(0,g.jsx)(p.HardDrive,{className:`h-4 w-4 text-muted-foreground`})}),(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:Gz(e.storage.used)}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Storage Used`}),(0,g.jsxs)(`div`,{className:`mt-2`,children:[(0,g.jsx)(Yn,{value:o,className:t.t(`h-1.5`,o>80&&`[&>div]:bg-red-500`)}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`of `,Gz(e.storage.total)]})]})]})})]})}function Yz({connections:e,onKill:a}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.Users,{className:`h-4 w-4`}),`Active Connections`]}),(0,g.jsx)(r.t,{variant:`secondary`,children:e.length})]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(n.f,{className:`h-[300px]`,children:(0,g.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let n=Wz[e.state];return(0,g.jsxs)(`div`,{className:t.t(`flex items-center gap-3 p-2 rounded-lg border`,e.state===`idle_in_transaction`&&`border-yellow-500/30`,e.duration>60&&`bg-yellow-500/5`),children:[(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.user}),(0,g.jsx)(r.t,{variant:`outline`,className:t.t(`text-xs`,n.color),children:n.label}),(0,g.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`@ `,e.database]})]}),e.query&&(0,g.jsx)(`code`,{className:`text-xs text-muted-foreground block truncate mt-1`,children:e.query})]}),(0,g.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,g.jsx)(`div`,{className:t.t(`text-sm font-medium`,e.duration>60&&`text-yellow-500`,e.duration>300&&`text-red-500`),children:Kz(e.duration)}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.client})]}),a&&e.state!==`idle`&&(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 text-red-500`,onClick:()=>a(e),children:(0,g.jsx)(p.XCircle,{className:`h-4 w-4`})})]},e.id)})})})})]})}function Xz({backups:e,onRestore:t,onCreate:a}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4`}),`Backups`]}),a&&(0,g.jsxs)(i.n,{size:`sm`,onClick:a,children:[(0,g.jsx)(p.Upload,{className:`h-4 w-4 mr-1`}),`Create Backup`]})]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(n.f,{className:`h-[200px]`,children:(0,g.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-lg border`,children:[e.status===`completed`?(0,g.jsx)(p.CheckCircle2,{className:`h-4 w-4 text-green-500 shrink-0`}):e.status===`failed`?(0,g.jsx)(p.XCircle,{className:`h-4 w-4 text-red-500 shrink-0`}):e.status===`running`?(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4 text-blue-500 animate-spin shrink-0`}):(0,g.jsx)(p.Clock,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,g.jsx)(r.t,{variant:`outline`,className:`text-xs`,children:e.type})]}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.startedAt.toLocaleString(),e.duration&&` • ${Kz(e.duration)}`]})]}),(0,g.jsx)(`div`,{className:`text-right shrink-0`,children:e.size&&(0,g.jsx)(`div`,{className:`text-sm font-medium`,children:Gz(e.size)})}),t&&e.status===`completed`&&(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:()=>t(e),children:(0,g.jsx)(p.RotateCcw,{className:`h-4 w-4`})})]},e.id))})})})]})}function Zz({queries:e}){let[t,r]=d.useState(null),a=e=>{navigator.clipboard.writeText(e.query),r(e.id),setTimeout(()=>r(null),2e3)};return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-4 w-4 text-yellow-500`}),`Slow Queries`]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(n.f,{className:`h-[300px]`,children:(0,g.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`p-2 rounded-lg border bg-muted/30`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,g.jsx)(`code`,{className:`text-xs font-mono line-clamp-2 flex-1`,children:e.query}),(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 shrink-0`,onClick:()=>a(e),children:t===e.id?(0,g.jsx)(p.CheckCircle2,{className:`h-3 w-3 text-green-500`}):(0,g.jsx)(p.Copy,{className:`h-3 w-3`})})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-xs text-muted-foreground`,children:[(0,g.jsxs)(`span`,{children:[`Calls: `,(0,g.jsx)(`strong`,{children:e.calls})]}),(0,g.jsxs)(`span`,{children:[`Mean: `,(0,g.jsx)(`strong`,{className:`text-yellow-500`,children:qz(e.meanTime)})]}),(0,g.jsxs)(`span`,{children:[`Max: `,(0,g.jsx)(`strong`,{className:`text-red-500`,children:qz(e.maxTime)})]}),(0,g.jsxs)(`span`,{children:[`Total: `,(0,g.jsx)(`strong`,{children:qz(e.totalTime)})]}),(0,g.jsxs)(`span`,{children:[`Rows: `,(0,g.jsx)(`strong`,{children:e.rows})]})]})]},e.id))})})})]})}function Qz({onExecute:e}){let[t,n]=d.useState(``),[r,s]=d.useState([]);return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{className:`pb-2`,children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.Terminal,{className:`h-4 w-4`}),`Query Editor`]})}),(0,g.jsxs)(Q,{className:`space-y-3`,children:[(0,g.jsx)(o.t,{value:t,onChange:e=>n(e.target.value),placeholder:`SELECT * FROM users LIMIT 10;`,className:`font-mono text-sm min-h-[120px]`}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`div`,{className:`flex items-center gap-2`,children:r.length>0&&(0,g.jsxs)(a.d,{onValueChange:e=>n(e),children:[(0,g.jsxs)(a.y,{className:`w-40`,children:[(0,g.jsx)(p.History,{className:`h-4 w-4 mr-2`}),`History`]}),(0,g.jsx)(a.f,{children:r.map((e,t)=>(0,g.jsx)(a.m,{value:e,children:(0,g.jsx)(`span`,{className:`truncate max-w-[300px]`,children:e})},t))})]})}),(0,g.jsxs)(i.n,{onClick:()=>{t.trim()&&(e?.(t),s(e=>[t,...e.slice(0,9)]))},disabled:!t.trim(),children:[(0,g.jsx)(p.Play,{className:`h-4 w-4 mr-1`}),`Execute`]})]})]})]})}function $z({instance:e,onExecuteQuery:n,onCreateBackup:a,onRestoreBackup:o,onKillConnection:s,onRefresh:c,className:l}){let u=Uz[e.status];return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,l),children:[(0,g.jsx)(Y,{children:(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(p.Database,{className:`h-6 w-6`}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(Z,{children:e.name}),(0,g.jsx)(r.t,{className:t.t(`text-white`,u.bgColor),children:u.label}),(0,g.jsx)(r.t,{variant:`outline`,children:e.role})]}),(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e.type,` `,e.version,` • `,e.host,`:`,e.port]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.metrics.replication&&(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(e.metrics.replication.lag>1e3?`text-red-500`:e.metrics.replication.lag>100?`text-yellow-500`:`text-green-500`),children:[`Replication: `,qz(e.metrics.replication.lag),` lag`]}),c&&(0,g.jsx)(i.n,{variant:`outline`,onClick:c,children:(0,g.jsx)(p.RefreshCw,{className:`h-4 w-4`})})]})]})})}),(0,g.jsx)(Jz,{metrics:e.metrics,status:e.status}),(0,g.jsxs)(yr,{defaultValue:`connections`,children:[(0,g.jsxs)(br,{children:[(0,g.jsxs)(xr,{value:`connections`,children:[(0,g.jsx)(p.Users,{className:`h-4 w-4 mr-1`}),`Connections`]}),(0,g.jsxs)(xr,{value:`queries`,children:[(0,g.jsx)(p.Terminal,{className:`h-4 w-4 mr-1`}),`Query`]}),(0,g.jsxs)(xr,{value:`slow`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-4 w-4 mr-1`}),`Slow Queries`]}),(0,g.jsxs)(xr,{value:`backups`,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-1`}),`Backups`]})]}),(0,g.jsx)(Sr,{value:`connections`,className:`mt-4`,children:(0,g.jsx)(Yz,{connections:e.connections,onKill:s})}),(0,g.jsx)(Sr,{value:`queries`,className:`mt-4`,children:(0,g.jsx)(Qz,{onExecute:n})}),(0,g.jsx)(Sr,{value:`slow`,className:`mt-4`,children:(0,g.jsx)(Zz,{queries:e.slowQueries})}),(0,g.jsx)(Sr,{value:`backups`,className:`mt-4`,children:(0,g.jsx)(Xz,{backups:e.backups,onRestore:o,onCreate:a})})]})]})}var eB={id:`1`,name:`production-db`,type:`postgresql`,version:`15.4`,host:`db.example.com`,port:5432,status:`healthy`,role:`primary`,metrics:{connections:{active:45,idle:25,max:100},transactions:{committed:125e3,rolledBack:15,perSecond:250},cache:{hitRatio:98.5,bufferHit:15e3,diskRead:250},storage:{used:85*1024*1024*1024,total:200*1024*1024*1024,tablespace:75*1024*1024*1024,indexes:10*1024*1024*1024},replication:{lag:25,state:`streaming`,replicas:2}},connections:[{id:`1`,user:`api_user`,database:`production`,state:`active`,query:`SELECT * FROM users WHERE id = $1`,duration:.5,client:`192.168.1.10`},{id:`2`,user:`api_user`,database:`production`,state:`active`,query:`UPDATE orders SET status = $1 WHERE id = $2`,duration:1.2,client:`192.168.1.11`},{id:`3`,user:`analytics`,database:`production`,state:`idle_in_transaction`,query:`SELECT COUNT(*) FROM events WHERE...`,duration:125,client:`192.168.1.20`},{id:`4`,user:`admin`,database:`production`,state:`idle`,duration:300,client:`192.168.1.5`},{id:`5`,user:`api_user`,database:`production`,state:`active`,duration:.1,client:`192.168.1.12`}],backups:[{id:`1`,name:`daily-backup-20240110`,type:`full`,status:`completed`,size:45*1024*1024*1024,startedAt:new Date(Date.now()-4*36e5),completedAt:new Date(Date.now()-2*36e5),duration:7200},{id:`2`,name:`hourly-backup-20240110-12`,type:`incremental`,status:`completed`,size:250*1024*1024,startedAt:new Date(Date.now()-1*36e5),completedAt:new Date(Date.now()-50*6e4),duration:600},{id:`3`,name:`hourly-backup-20240110-13`,type:`incremental`,status:`running`,startedAt:new Date(Date.now()-5*6e4)},{id:`4`,name:`daily-backup-20240111`,type:`full`,status:`scheduled`,startedAt:new Date(Date.now()+8*36e5)}],slowQueries:[{id:`1`,query:`SELECT * FROM orders o JOIN order_items oi ON o.id = oi.order_id WHERE o.created_at > $1 AND o.status = $2`,calls:1250,totalTime:45e3,meanTime:36,maxTime:520,rows:15e3},{id:`2`,query:`SELECT u.*, COUNT(o.id) as order_count FROM users u LEFT JOIN orders o ON u.id = o.user_id GROUP BY u.id ORDER BY order_count DESC LIMIT 100`,calls:500,totalTime:85e3,meanTime:170,maxTime:1200,rows:100},{id:`3`,query:`UPDATE products SET view_count = view_count + 1 WHERE id = $1`,calls:5e4,totalTime:25e3,meanTime:.5,maxTime:15,rows:1},{id:`4`,query:`SELECT * FROM analytics_events WHERE event_type = $1 AND created_at BETWEEN $2 AND $3`,calls:250,totalTime:125e3,meanTime:500,maxTime:3500,rows:5e4}]};t.n();var tB={healthy:{color:`text-green-500 bg-green-500/10`,icon:(0,g.jsx)(p.ShieldCheck,{className:`h-4 w-4`}),label:`Healthy`},degraded:{color:`text-yellow-500 bg-yellow-500/10`,icon:(0,g.jsx)(p.ShieldAlert,{className:`h-4 w-4`}),label:`Degraded`},down:{color:`text-red-500 bg-red-500/10`,icon:(0,g.jsx)(p.ShieldX,{className:`h-4 w-4`}),label:`Down`}},nB={clean:{color:`text-green-500`,icon:(0,g.jsx)(p.CheckCircle,{className:`h-4 w-4`}),label:`Clean`,bgColor:`bg-green-500`},infected:{color:`text-red-500`,icon:(0,g.jsx)(p.XCircle,{className:`h-4 w-4`}),label:`Infected`,bgColor:`bg-red-500`},error:{color:`text-orange-500`,icon:(0,g.jsx)(p.AlertCircle,{className:`h-4 w-4`}),label:`Error`,bgColor:`bg-orange-500`}},rB={critical:{color:`text-red-500`,bgColor:`bg-red-500`},high:{color:`text-orange-500`,bgColor:`bg-orange-500`},medium:{color:`text-yellow-500`,bgColor:`bg-yellow-500`},low:{color:`text-blue-500`,bgColor:`bg-blue-500`}};function iB(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function aB(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`}function oB(e){let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`}function sB({health:e}){let n=tB[e];return(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(`gap-1`,n.color),children:[n.icon,n.label]})}function cB({result:e}){let n=nB[e];return(0,g.jsxs)(r.t,{variant:`outline`,className:t.t(`gap-1`,n.color),children:[n.icon,n.label]})}function lB({title:e,value:n,icon:r,trend:i,color:a=`text-primary`}){return(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`p-6`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mb-1`,children:e}),(0,g.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,g.jsx)(`p`,{className:t.t(`text-3xl font-bold`,a),children:n}),i&&(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i})]})]}),(0,g.jsx)(`div`,{className:t.t(`p-3 rounded-lg`,`${a.replace(`text-`,`bg-`)}/10`),children:r})]})})})}function uB({stats:e}){let t=Math.max(...e.map(e=>Math.max(e.scans,e.threats)),1);return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.TrendingUp,{className:`h-4 w-4`}),`Weekly Activity`]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(`div`,{className:`space-y-4`,children:e.map((e,n)=>{let r=e.scans/t*100,i=e.threats/t*100;return(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground min-w-12`,children:e.day}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4 text-xs`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-500`}),e.scans,` scans`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-red-500`}),e.threats,` threats`]})]})]}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`div`,{className:`h-2 w-full bg-muted rounded-full overflow-hidden`,children:(0,g.jsx)(`div`,{className:`h-full bg-blue-500 rounded-full transition-all`,style:{width:`${r}%`}})}),e.threats>0&&(0,g.jsx)(`div`,{className:`h-2 w-full bg-muted rounded-full overflow-hidden`,children:(0,g.jsx)(`div`,{className:`h-full bg-red-500 rounded-full transition-all`,style:{width:`${i}%`}})})]})]},e.day)})})})]})}function dB({scans:e}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.Activity,{className:`h-4 w-4`}),`Recent Scans`]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,g.jsxs)(`div`,{className:`text-center py-8 text-muted-foreground`,children:[(0,g.jsx)(p.Shield,{className:`h-12 w-12 mx-auto mb-3 opacity-50`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`No scans yet`})]}):e.map(e=>(0,g.jsx)(`div`,{className:t.t(`flex items-center justify-between p-3 rounded-lg border transition-colors`,e.result===`infected`&&`border-red-500/50 bg-red-500/5`),children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3 flex-1 min-w-0`,children:[(0,g.jsx)(`div`,{className:t.t(`p-2 rounded-lg shrink-0`,nB[e.result].color.replace(`text-`,`bg-`)+`/10`),children:nB[e.result].icon}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.filename}),(0,g.jsx)(cB,{result:e.result})]}),e.threatName&&(0,g.jsxs)(`p`,{className:`text-xs text-red-500 mt-1 flex items-center gap-1`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-3 w-3`}),e.threatName]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs text-muted-foreground`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Clock,{className:`h-3 w-3`}),oB(e.scanDate)]}),(0,g.jsx)(`span`,{children:aB(e.duration)}),(0,g.jsx)(`span`,{children:iB(e.fileSize)})]})]})]})},e.id))})})]})}function fB({threats:e}){return(0,g.jsxs)(Y,{children:[(0,g.jsx)(X,{children:(0,g.jsxs)(Z,{className:`text-base flex items-center gap-2`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-4 w-4`}),`Top Threats`]})}),(0,g.jsx)(Q,{children:(0,g.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,g.jsxs)(`div`,{className:`text-center py-8 text-muted-foreground`,children:[(0,g.jsx)(p.ShieldCheck,{className:`h-12 w-12 mx-auto mb-3 text-green-500 opacity-50`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`No threats detected`})]}):e.map((n,i)=>{let a=rB[n.severity];return(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-full bg-muted text-sm font-medium`,children:i+1}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`p`,{className:`text-sm font-medium truncate`,children:n.name}),(0,g.jsx)(r.t,{variant:`outline`,className:t.t(`text-xs capitalize`,a.color),children:n.severity})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,g.jsx)(`div`,{className:`flex-1 h-2 bg-muted rounded-full overflow-hidden`,children:(0,g.jsx)(`div`,{className:t.t(`h-full rounded-full`,a.bgColor),style:{width:`${Math.min(n.count/Math.max(...e.map(e=>e.count))*100,100)}%`}})}),(0,g.jsxs)(`span`,{className:`text-xs text-muted-foreground font-medium min-w-12 text-right`,children:[n.count,` `,n.count===1?`time`:`times`]})]})]})]},n.name)})})})]})}function pB({serviceHealth:e=`healthy`,clamavVersion:n=`1.0.3`,signatureCount:r=8642758,lastSignatureUpdate:a,scansToday:o=0,threatsDetected:s=0,quarantinedFiles:c=0,detectionRate:l=0,recentScans:u=[],weeklyStats:d=[],topThreats:f=[],onStartScan:m,onViewQuarantine:h,className:_}){return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,_),children:[(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-between items-start`,children:[(0,g.jsx)(`div`,{children:(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10`,children:(0,g.jsx)(p.Shield,{className:`h-6 w-6 text-primary`})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Antivirus ClamAV`}),(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,n,` • `,r.toLocaleString(),` signatures`,a&&(0,g.jsxs)(g.Fragment,{children:[` • Updated `,oB(a)]})]})]})]})}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(sB,{health:e}),h&&(0,g.jsxs)(i.n,{variant:`outline`,onClick:h,children:[(0,g.jsx)(p.Archive,{className:`h-4 w-4 mr-2`}),`Quarantine`]}),m&&(0,g.jsxs)(i.n,{onClick:m,children:[(0,g.jsx)(p.PlayCircle,{className:`h-4 w-4 mr-2`}),`Start Scan`]})]})]}),(0,g.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,g.jsx)(lB,{title:`Scans Today`,value:o.toLocaleString(),icon:(0,g.jsx)(p.Activity,{className:`h-6 w-6`}),color:`text-blue-500`}),(0,g.jsx)(lB,{title:`Threats Detected`,value:s.toLocaleString(),icon:(0,g.jsx)(p.AlertTriangle,{className:`h-6 w-6`}),color:`text-red-500`}),(0,g.jsx)(lB,{title:`Quarantined Files`,value:c.toLocaleString(),icon:(0,g.jsx)(p.Archive,{className:`h-6 w-6`}),color:`text-orange-500`}),(0,g.jsx)(lB,{title:`Detection Rate`,value:`${l.toFixed(1)}%`,icon:(0,g.jsx)(p.ShieldCheck,{className:`h-6 w-6`}),color:`text-green-500`})]}),(0,g.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,g.jsx)(uB,{stats:d}),(0,g.jsx)(fB,{threats:f})]}),(0,g.jsx)(dB,{scans:u})]})}var mB=[{id:`scan1`,filename:`document.pdf`,result:`clean`,scanDate:new Date(Date.now()-5*6e4),duration:234,fileSize:2048576,userId:`user123`},{id:`scan2`,filename:`malicious_script.js`,result:`infected`,threatName:`Trojan.GenericKD.67890123`,scanDate:new Date(Date.now()-15*6e4),duration:156,fileSize:45678,userId:`user456`},{id:`scan3`,filename:`eicar_test.txt`,result:`infected`,threatName:`Eicar-Test-Signature`,scanDate:new Date(Date.now()-30*6e4),duration:89,fileSize:68,userId:`admin`},{id:`scan4`,filename:`report_2024.xlsx`,result:`clean`,scanDate:new Date(Date.now()-45*6e4),duration:567,fileSize:5242880,userId:`user789`},{id:`scan5`,filename:`suspicious_archive.zip`,result:`infected`,threatName:`Win.Trojan.Genome-9999999`,scanDate:new Date(Date.now()-60*6e4),duration:1234,fileSize:10485760,userId:`user321`}],hB=[{day:`Mon`,scans:145,threats:3},{day:`Tue`,scans:198,threats:5},{day:`Wed`,scans:167,threats:2},{day:`Thu`,scans:223,threats:8},{day:`Fri`,scans:189,threats:4},{day:`Sat`,scans:98,threats:1},{day:`Sun`,scans:76,threats:0}],gB=[{name:`Eicar-Test-Signature`,count:12,severity:`low`},{name:`Trojan.GenericKD.67890123`,count:8,severity:`high`},{name:`Win.Trojan.Genome-9999999`,count:5,severity:`critical`},{name:`JS.Downloader.Nemucod`,count:4,severity:`medium`},{name:`PHP.Webshell.Generic`,count:3,severity:`high`}];t.n();var _B=e=>{if(e===0)return`0 Bytes`;let t=1024,n=[`Bytes`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/t**+r*100)/100+` `+n[r]},vB=e=>{switch(e){case`pending`:return(0,g.jsx)(p.Shield,{className:`h-4 w-4 text-muted-foreground`});case`scanning`:return(0,g.jsx)(p.Scan,{className:`h-4 w-4 text-blue-500 animate-pulse`});case`clean`:return(0,g.jsx)(p.CheckCircle2,{className:`h-4 w-4 text-green-500`});case`infected`:return(0,g.jsx)(p.ShieldAlert,{className:`h-4 w-4 text-red-500`});case`error`:return(0,g.jsx)(p.AlertCircle,{className:`h-4 w-4 text-orange-500`})}},yB=e=>{switch(e){case`pending`:return(0,g.jsx)(r.t,{variant:`outline`,children:`En attente`});case`scanning`:return(0,g.jsx)(r.t,{variant:`outline`,className:`border-blue-500 text-blue-500`,children:`Scan en cours`});case`clean`:return(0,g.jsx)(r.t,{variant:`outline`,className:`border-green-500 text-green-500`,children:`Sain`});case`infected`:return(0,g.jsx)(r.t,{variant:`destructive`,children:`Infecté`});case`error`:return(0,g.jsx)(r.t,{variant:`outline`,className:`border-orange-500 text-orange-500`,children:`Erreur`})}};function bB({files:e=[],maxFileSize:n=100*1024*1024,acceptedTypes:a=[`*/*`],maxConcurrentScans:o=3,onFilesAdded:s,onScanStart:c,onScanComplete:l,onFileRemove:u,onScanAll:f,className:m}){let[h,_]=(0,d.useState)(!1),v=(0,d.useRef)(null),y=(0,d.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),_(!0)},[]),b=(0,d.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),_(!1)},[]),x=(0,d.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),_(!1);let t=Array.from(e.dataTransfer.files);s&&s(t)},[s]),S=(0,d.useCallback)(e=>{let t=e.target.files?Array.from(e.target.files):[];s&&s(t)},[s]),C=()=>{v.current?.click()},w=e.filter(e=>e.status===`pending`).length,T=e.filter(e=>e.status===`scanning`).length,E=e.filter(e=>e.status===`clean`).length,D=e.filter(e=>e.status===`infected`).length,O=e.filter(e=>e.status===`error`).length;return(0,g.jsxs)(Y,{className:t.t(`w-full`,m),children:[(0,g.jsx)(X,{children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Z,{children:`Scan Antivirus (ClamAV)`}),(0,g.jsx)(be,{children:`Uploadez vos fichiers pour analyse de sécurité`})]}),e.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[e.length,` fichier`,e.length>1?`s`:``]}),w>0&&(0,g.jsxs)(i.n,{size:`sm`,variant:`outline`,onClick:f,className:`gap-2`,children:[(0,g.jsx)(p.Scan,{className:`h-4 w-4`}),`Scanner tout`]}),(0,g.jsx)(i.n,{size:`sm`,variant:`ghost`,onClick:()=>e.forEach(e=>u?.(e.id)),children:`Tout supprimer`})]})]})}),(0,g.jsxs)(Q,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{onDragOver:y,onDragLeave:b,onDrop:x,onClick:C,className:t.t(`relative flex min-h-[200px] cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-8 transition-colors`,h?`border-primary bg-primary/5`:`border-muted-foreground/25 hover:border-primary/50 hover:bg-muted/50`),children:[(0,g.jsx)(p.Upload,{className:`h-10 w-10 text-muted-foreground`}),(0,g.jsxs)(`div`,{className:`text-center`,children:[(0,g.jsx)(`p`,{className:`text-sm font-medium`,children:`Glissez vos fichiers ici ou cliquez pour parcourir`}),(0,g.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Taille max: `,_B(n)]})]}),(0,g.jsx)(`input`,{ref:v,type:`file`,multiple:!0,accept:a.join(`,`),onChange:S,className:`hidden`})]}),e.length>0&&(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[E>0&&(0,g.jsxs)(r.t,{variant:`outline`,className:`border-green-500 text-green-500`,children:[(0,g.jsx)(p.CheckCircle2,{className:`mr-1 h-3 w-3`}),E,` sain`,E>1?`s`:``]}),D>0&&(0,g.jsxs)(r.t,{variant:`destructive`,children:[(0,g.jsx)(p.ShieldAlert,{className:`mr-1 h-3 w-3`}),D,` infecté`,D>1?`s`:``]}),T>0&&(0,g.jsxs)(r.t,{variant:`outline`,className:`border-blue-500 text-blue-500`,children:[(0,g.jsx)(p.Scan,{className:`mr-1 h-3 w-3`}),T,` en cours`]}),w>0&&(0,g.jsxs)(r.t,{variant:`outline`,children:[(0,g.jsx)(p.Shield,{className:`mr-1 h-3 w-3`}),w,` en attente`]}),O>0&&(0,g.jsxs)(r.t,{variant:`outline`,className:`border-orange-500 text-orange-500`,children:[(0,g.jsx)(p.AlertCircle,{className:`mr-1 h-3 w-3`}),O,` erreur`,O>1?`s`:``]})]}),e.length>0&&(0,g.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,g.jsx)(`div`,{className:t.t(`rounded-lg border p-4 transition-colors`,e.status===`infected`&&`border-red-500/50 bg-red-50/50 dark:bg-red-950/20`,e.status===`clean`&&`border-green-500/50 bg-green-50/50 dark:bg-green-950/20`),children:(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex flex-1 items-start gap-3`,children:[(0,g.jsx)(`div`,{className:`mt-1`,children:vB(e.status)}),(0,g.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`font-medium text-sm`,children:e.file.name}),yB(e.status)]}),(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[_B(e.file.size),e.scanDuration&&(0,g.jsxs)(g.Fragment,{children:[` • Scanné en `,e.scanDuration,`ms`]})]}),e.status===`scanning`&&(0,g.jsxs)(`div`,{className:`mt-2`,children:[(0,g.jsx)(Yn,{value:e.progress,className:`h-1.5`}),(0,g.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Scan en cours... `,e.progress,`%`]})]}),e.status===`infected`&&e.threatName&&(0,g.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-md bg-red-100 px-2 py-1 dark:bg-red-950/50`,children:[(0,g.jsx)(p.ShieldAlert,{className:`h-3 w-3 text-red-600 dark:text-red-400`}),(0,g.jsxs)(`span`,{className:`text-xs font-medium text-red-600 dark:text-red-400`,children:[`Menace détectée: `,e.threatName]})]}),e.status===`clean`&&e.scannedAt&&(0,g.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,g.jsx)(p.CheckCircle2,{className:`h-3 w-3 text-green-600 dark:text-green-400`}),(0,g.jsx)(`span`,{className:`text-xs text-green-600 dark:text-green-400`,children:`Fichier sain, aucune menace détectée`})]})]})]}),(0,g.jsx)(i.n,{size:`sm`,variant:`ghost`,onClick:()=>u?.(e.id),className:`h-8 w-8 p-0`,children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]})},e.id))})]})]})}t.n();var xB={critical:{label:`Critique`,color:`bg-red-500/10 text-red-700 dark:text-red-400 border-red-500/20`},high:{label:`Élevée`,color:`bg-orange-500/10 text-orange-700 dark:text-orange-400 border-orange-500/20`},medium:{label:`Moyenne`,color:`bg-yellow-500/10 text-yellow-700 dark:text-yellow-400 border-yellow-500/20`},low:{label:`Faible`,color:`bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/20`}},SB=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`,CB=e=>new Intl.DateTimeFormat(`fr-FR`,{dateStyle:`short`,timeStyle:`short`}).format(e),wB=({files:e=[],totalCount:o=0,onDelete:c,onRestore:l,onRescan:u,onPurgeAll:f,onDownloadReport:m,className:h})=>{let[_,v]=d.useState(``),[y,b]=d.useState(`all`),[x,S]=d.useState(`all`),[C,w]=d.useState(!1),[T,E]=d.useState(!1),[D,O]=d.useState(!1),[k,A]=d.useState(null),j=d.useMemo(()=>{let t=e;if(_){let e=_.toLowerCase();t=t.filter(t=>t.originalName.toLowerCase().includes(e)||t.threatName.toLowerCase().includes(e)||t.originalPath.toLowerCase().includes(e))}if(y!==`all`&&(t=t.filter(e=>e.severity===y)),x!==`all`){let e=new Date,n=new Date;switch(x){case`today`:n.setHours(0,0,0,0);break;case`week`:n.setDate(e.getDate()-7);break;case`month`:n.setMonth(e.getMonth()-1);break}x!==`all`&&(t=t.filter(e=>new Date(e.quarantinedAt)>=n))}return t},[e,_,y,x]),M=d.useMemo(()=>{let t={critical:0,high:0,medium:0,low:0};return e.forEach(e=>{t[e.severity]++}),t},[e]),N=e=>{A(e),w(!0)},P=e=>{A(e),E(!0)};return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,h),children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight`,children:`Quarantaine`}),(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[o||e.length,` fichier`,(o||e.length)>1?`s`:``,` en quarantaine`]})]}),(0,g.jsxs)(i.n,{variant:`destructive`,onClick:()=>O(!0),disabled:e.length===0,children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-4 w-4`}),`Vider la quarantaine`]})]}),(0,g.jsx)(`div`,{className:`grid gap-4 md:grid-cols-4`,children:[`critical`,`high`,`medium`,`low`].map(e=>(0,g.jsx)(Y,{className:`p-4`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:xB[e].label}),(0,g.jsx)(`p`,{className:`text-2xl font-bold`,children:M[e]})]}),(0,g.jsx)(p.AlertTriangle,{className:t.t(`h-5 w-5`,e===`critical`&&`text-red-500`,e===`high`&&`text-orange-500`,e===`medium`&&`text-yellow-500`,e===`low`&&`text-blue-500`)})]})},e))}),(0,g.jsx)(Y,{className:`p-4`,children:(0,g.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher par nom, menace ou chemin...`,value:_,onChange:e=>v(e.target.value),className:`pl-9`})]}),(0,g.jsxs)(a.d,{value:y,onValueChange:e=>b(e),children:[(0,g.jsx)(`option`,{value:`all`,children:`Toutes les sévérités`}),(0,g.jsx)(`option`,{value:`critical`,children:`Critique`}),(0,g.jsx)(`option`,{value:`high`,children:`Élevée`}),(0,g.jsx)(`option`,{value:`medium`,children:`Moyenne`}),(0,g.jsx)(`option`,{value:`low`,children:`Faible`})]}),(0,g.jsxs)(a.d,{value:x,onValueChange:S,children:[(0,g.jsx)(`option`,{value:`all`,children:`Toutes les dates`}),(0,g.jsx)(`option`,{value:`today`,children:`Aujourd'hui`}),(0,g.jsx)(`option`,{value:`week`,children:`7 derniers jours`}),(0,g.jsx)(`option`,{value:`month`,children:`30 derniers jours`})]})]})}),(0,g.jsx)(Y,{children:(0,g.jsx)(n.f,{className:`h-[600px]`,children:(0,g.jsx)(`div`,{className:`p-4`,children:j.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,g.jsx)(p.AlertTriangle,{className:`mb-4 h-12 w-12 text-muted-foreground`}),(0,g.jsx)(`h3`,{className:`mb-1 text-lg font-semibold`,children:`Aucun fichier trouvé`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.length===0?`La quarantaine est vide`:`Aucun fichier ne correspond aux filtres`})]}):(0,g.jsx)(`div`,{className:`space-y-4`,children:j.map(e=>(0,g.jsx)(Y,{className:`p-4`,children:(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsx)(`div`,{className:`flex items-start justify-between`,children:(0,g.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`h4`,{className:`font-medium`,children:e.originalName}),(0,g.jsx)(r.t,{className:xB[e.severity].color,children:xB[e.severity].label})]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.originalPath})]})}),(0,g.jsxs)(`div`,{className:`grid gap-3 text-sm md:grid-cols-2`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Menace détectée:`}),` `,(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.threatName})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Date quarantaine:`}),` `,(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:CB(e.quarantinedAt)})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Taille:`}),` `,(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:SB(e.fileSize)})]}),e.uploadedBy&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Uploadé par:`}),` `,(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.uploadedBy})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Hash:`}),` `,(0,g.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[e.fileHash.substring(0,16),`...`]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`Moteur:`}),` `,(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.scanEngine,` (`,e.signatureVersion,`)`]})]})]}),(0,g.jsxs)(`div`,{className:`flex gap-2 border-t pt-3`,children:[(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>u?.(e.id),children:[(0,g.jsx)(p.RefreshCw,{className:`mr-2 h-3 w-3`}),`Re-scanner`]}),(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>P(e),children:[(0,g.jsx)(p.RotateCcw,{className:`mr-2 h-3 w-3`}),`Restaurer`]}),(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>m?.(e.id),children:[(0,g.jsx)(p.Download,{className:`mr-2 h-3 w-3`}),`Rapport`]}),(0,g.jsxs)(i.n,{variant:`destructive`,size:`sm`,onClick:()=>N(e),children:[(0,g.jsx)(p.Trash2,{className:`mr-2 h-3 w-3`}),`Supprimer`]})]})]})},e.id))})})})}),(0,g.jsx)(mt,{open:C,onOpenChange:w,children:(0,g.jsxs)(yt,{children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:`Supprimer définitivement`}),(0,g.jsxs)(Ct,{children:[`Êtes-vous sûr de vouloir supprimer définitivement le fichier`,` `,(0,g.jsx)(`span`,{className:`font-medium`,children:k?.originalName}),` ?`,(0,g.jsx)(`br`,{}),`Cette action est irréversible.`]})]}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>w(!1),children:`Annuler`}),(0,g.jsx)(i.n,{variant:`destructive`,onClick:()=>{k&&c&&c(k.id),w(!1),A(null)},children:`Supprimer`})]})]})}),(0,g.jsx)(mt,{open:T,onOpenChange:E,children:(0,g.jsxs)(yt,{children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:`Restaurer le fichier`}),(0,g.jsxs)(Ct,{children:[`Êtes-vous sûr de vouloir restaurer le fichier`,` `,(0,g.jsx)(`span`,{className:`font-medium`,children:k?.originalName}),` ?`,(0,g.jsx)(`br`,{}),`Le fichier sera replacé à son emplacement d'origine :`,` `,(0,g.jsx)(`span`,{className:`font-mono text-xs`,children:k?.originalPath})]})]}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>E(!1),children:`Annuler`}),(0,g.jsx)(i.n,{onClick:()=>{k&&l&&l(k.id),E(!1),A(null)},children:`Restaurer`})]})]})}),(0,g.jsx)(mt,{open:D,onOpenChange:O,children:(0,g.jsxs)(yt,{children:[(0,g.jsxs)(bt,{children:[(0,g.jsx)(St,{children:`Vider la quarantaine`}),(0,g.jsxs)(Ct,{children:[`Êtes-vous sûr de vouloir supprimer définitivement tous les fichiers en quarantaine ?`,(0,g.jsx)(`br`,{}),e.length,` fichier`,e.length>1?`s`:``,` ser`,e.length>1?`ont`:`a`,` `,`supprimé`,e.length>1?`s`:``,`. Cette action est irréversible.`]})]}),(0,g.jsxs)(xt,{children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:()=>O(!1),children:`Annuler`}),(0,g.jsx)(i.n,{variant:`destructive`,onClick:()=>{f&&f(),O(!1)},children:`Vider la quarantaine`})]})]})})]})};t.n();var TB=[];function EB({entries:e=TB,totalEntries:o=e.length,currentPage:c=1,pageSize:l=10,periodFilter:u=`7d`,onPageChange:f,onFilterChange:m,onExport:h,className:_}){let[v,y]=(0,d.useState)(``),[b,x]=(0,d.useState)(`all`),[S,C]=(0,d.useState)(u),[w,T]=(0,d.useState)(`all`),[E,D]=(0,d.useState)(null),O=e.filter(e=>!(v&&!e.filename.toLowerCase().includes(v.toLowerCase())||b!==`all`&&e.result!==b||w!==`all`&&e.userId!==w)),k=O.slice((c-1)*l,c*l),A=Math.ceil(O.length/l),j={total:O.length,clean:O.filter(e=>e.result===`clean`).length,infected:O.filter(e=>e.result===`infected`).length,errors:O.filter(e=>e.result===`error`).length},M=Array.from(new Set(e.map(e=>e.userId))),N=e=>{navigator.clipboard.writeText(e),D(e),setTimeout(()=>D(null),2e3)},P=(e,t)=>{m?.({search:v,result:b,period:S,user:w,[e]:t})},F=e=>{switch(e){case`clean`:return(0,g.jsx)(r.t,{variant:`secondary`,className:`bg-green-500/10 text-green-600 border-green-500/20`,children:`Clean`});case`infected`:return(0,g.jsx)(r.t,{variant:`destructive`,children:`Infected`});case`error`:return(0,g.jsx)(r.t,{variant:`secondary`,className:`bg-yellow-500/10 text-yellow-600 border-yellow-500/20`,children:`Error`})}},I=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`,L=e=>new Intl.DateTimeFormat(`fr-FR`,{day:`2-digit`,month:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e),R=e=>`${e.slice(0,8)}...${e.slice(-8)}`;return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,_),children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:`Historique des scans`}),(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:[o,` scan`,o>1?`s`:``,` au total`]})]}),(0,g.jsxs)(i.n,{onClick:h,variant:`outline`,children:[(0,g.jsx)(p.Download,{className:`w-4 h-4 mr-2`}),`Exporter le journal`]})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,g.jsxs)(Y,{className:`p-4`,children:[(0,g.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Total scans`}),(0,g.jsx)(`div`,{className:`text-2xl font-bold mt-1`,children:j.total})]}),(0,g.jsxs)(Y,{className:`p-4`,children:[(0,g.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Clean`}),(0,g.jsx)(`div`,{className:`text-2xl font-bold mt-1 text-green-600 dark:text-green-500`,children:j.clean})]}),(0,g.jsxs)(Y,{className:`p-4`,children:[(0,g.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Infected`}),(0,g.jsx)(`div`,{className:`text-2xl font-bold mt-1 text-red-600 dark:text-red-500`,children:j.infected})]}),(0,g.jsxs)(Y,{className:`p-4`,children:[(0,g.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:`Errors`}),(0,g.jsx)(`div`,{className:`text-2xl font-bold mt-1 text-orange-600 dark:text-orange-500`,children:j.errors})]})]}),(0,g.jsx)(Y,{className:`p-4`,children:(0,g.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p.Search,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground`}),(0,g.jsx)(s.t,{placeholder:`Rechercher un fichier...`,value:v,onChange:e=>{y(e.target.value),P(`search`,e.target.value)},className:`pl-9`})]}),(0,g.jsxs)(a.d,{value:b,onValueChange:e=>{x(e),P(`result`,e)},children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{placeholder:`Résultat`})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`Tous les résultats`}),(0,g.jsx)(a.m,{value:`clean`,children:`Clean`}),(0,g.jsx)(a.m,{value:`infected`,children:`Infected`}),(0,g.jsx)(a.m,{value:`error`,children:`Error`})]})]}),(0,g.jsxs)(a.d,{value:S,onValueChange:e=>{C(e),P(`period`,e)},children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{placeholder:`Période`})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`today`,children:`Aujourd'hui`}),(0,g.jsx)(a.m,{value:`7d`,children:`7 derniers jours`}),(0,g.jsx)(a.m,{value:`30d`,children:`30 derniers jours`}),(0,g.jsx)(a.m,{value:`custom`,children:`Personnalisé`})]})]}),(0,g.jsxs)(a.d,{value:w,onValueChange:e=>{T(e),P(`user`,e)},children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{placeholder:`Utilisateur`})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`all`,children:`Tous les utilisateurs`}),M.map(t=>(0,g.jsx)(a.m,{value:t,children:e.find(e=>e.userId===t)?.userName||t},t))]})]})]})}),(0,g.jsxs)(Y,{children:[(0,g.jsx)(n.f,{className:`h-[600px]`,children:(0,g.jsx)(`div`,{className:`min-w-full`,children:(0,g.jsxs)(`table`,{className:`w-full`,children:[(0,g.jsx)(`thead`,{className:`sticky top-0 bg-muted/50 backdrop-blur-sm border-b`,children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Date/Heure`}),(0,g.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Fichier`}),(0,g.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Taille`}),(0,g.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Hash SHA256`}),(0,g.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Résultat`}),(0,g.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Menace`}),(0,g.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Utilisateur`}),(0,g.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Durée`}),(0,g.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Moteur`})]})}),(0,g.jsx)(`tbody`,{className:`divide-y`,children:k.length===0?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{colSpan:9,className:`px-4 py-8 text-center text-muted-foreground`,children:`Aucun scan trouvé`})}):k.map(e=>(0,g.jsxs)(`tr`,{className:`hover:bg-muted/50 transition-colors`,children:[(0,g.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:L(e.scanDate)}),(0,g.jsx)(`td`,{className:`px-4 py-3 text-sm font-medium max-w-xs truncate`,children:e.filename}),(0,g.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:I(e.fileSize)}),(0,g.jsx)(`td`,{className:`px-4 py-3 text-sm`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`code`,{className:`text-xs bg-muted px-2 py-1 rounded`,children:R(e.fileHash)}),(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:()=>N(e.fileHash),className:`h-6 w-6 p-0`,children:E===e.fileHash?(0,g.jsx)(p.Check,{className:`w-3 h-3 text-green-600`}):(0,g.jsx)(p.Copy,{className:`w-3 h-3`})})]})}),(0,g.jsx)(`td`,{className:`px-4 py-3 text-sm`,children:F(e.result)}),(0,g.jsx)(`td`,{className:`px-4 py-3 text-sm`,children:e.threatName?(0,g.jsx)(`code`,{className:`text-xs bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-400 px-2 py-1 rounded`,children:e.threatName}):(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`-`})}),(0,g.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:e.userName}),(0,g.jsxs)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:[e.duration,`ms`]}),(0,g.jsx)(`td`,{className:`px-4 py-3 text-sm whitespace-nowrap`,children:(0,g.jsxs)(`div`,{className:`text-xs`,children:[(0,g.jsx)(`div`,{className:`font-medium`,children:e.engineVersion}),(0,g.jsx)(`div`,{className:`text-muted-foreground`,children:e.signatureVersion})]})})]},e.id))})]})})}),A>1&&(0,g.jsxs)(`div`,{className:`border-t px-4 py-3 flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`Page `,c,` sur `,A]}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:()=>f?.(c-1),disabled:c===1,children:`Précédent`}),(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:()=>f?.(c+1),disabled:c===A,children:`Suivant`})]})]})]})]})}t.n();var DB=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`},OB=e=>{let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(t/36e5),i=Math.floor(t/864e5);return n<60?`${n}m ago`:r<24?`${r}h ago`:`${i}d ago`},kB={running:{color:`text-green-500`,bgColor:`bg-green-500/10`,borderColor:`border-green-500/20`,icon:p.CheckCircle,label:`Running`},stopped:{color:`text-gray-500`,bgColor:`bg-gray-500/10`,borderColor:`border-gray-500/20`,icon:p.Activity,label:`Stopped`},error:{color:`text-red-500`,bgColor:`bg-red-500/10`,borderColor:`border-red-500/20`,icon:p.AlertTriangle,label:`Error`},restarting:{color:`text-yellow-500`,bgColor:`bg-yellow-500/10`,borderColor:`border-yellow-500/20`,icon:p.Loader2,label:`Restarting`}},AB={running:{color:`text-green-500`,label:`Running`},stopped:{color:`text-gray-500`,label:`Stopped`},error:{color:`text-red-500`,label:`Error`},updating:{color:`text-blue-500`,label:`Updating`}},jB={up:`bg-green-500`,degraded:`bg-yellow-500`,down:`bg-red-500`},MB=({status:e=`running`,version:n=`1.0.3`,uptime:a=259200,metrics:o={cpuUsage:2.5,memoryUsage:512,threads:4,scanQueue:0,activeConnections:3},signatures:s={version:`27456`,count:8764532,lastUpdate:new Date(Date.now()-36e5),freshclamStatus:`running`,nextScheduledUpdate:new Date(Date.now()+36e5)},socketType:c=`tcp`,socketPath:l=`3310`,uptimeHistory:u=[],onRestart:d,onUpdateSignatures:f,onViewLogs:m,className:h})=>{let _=kB[e],v=_.icon;return(0,g.jsxs)(`div`,{className:t.t(`space-y-4`,h),children:[(0,g.jsx)(Y,{className:t.t(`p-6 border-2`,_.borderColor,_.bgColor),children:(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,g.jsx)(`div`,{className:t.t(`p-3 rounded-xl`,_.bgColor),children:(0,g.jsx)(v,{className:t.t(`w-8 h-8`,_.color,e===`restarting`&&`animate-spin`)})}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`h3`,{className:`text-2xl font-semibold`,children:`ClamAV Daemon`}),(0,g.jsx)(r.t,{variant:e===`error`?`destructive`:`secondary`,className:e===`running`?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:_.label})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-muted-foreground`,children:[(0,g.jsxs)(`span`,{children:[`Version `,n]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(p.Clock,{className:`w-3.5 h-3.5`}),`Uptime: `,DB(a)]})]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:m,children:[(0,g.jsx)(p.Terminal,{className:`w-4 h-4 mr-2`}),`Logs`]}),(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:d,disabled:e===`restarting`,children:[(0,g.jsx)(p.RefreshCw,{className:t.t(`w-4 h-4 mr-2`,e===`restarting`&&`animate-spin`)}),`Restart`]})]})]})}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,g.jsxs)(Y,{className:`p-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,g.jsx)(p.Activity,{className:`w-5 h-5 text-primary`}),(0,g.jsx)(`h4`,{className:`font-semibold`,children:`System Metrics`})]}),(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`CPU Usage`}),(0,g.jsxs)(`span`,{className:`font-medium`,children:[o.cpuUsage.toFixed(1),`%`]})]}),(0,g.jsx)(Yn,{value:o.cpuUsage,className:t.t(`h-2`,o.cpuUsage>80&&`bg-red-500/20`,o.cpuUsage>50&&o.cpuUsage<=80&&`bg-yellow-500/20`)})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Memory Usage`}),(0,g.jsxs)(`span`,{className:`font-medium`,children:[o.memoryUsage,` MB`]})]}),(0,g.jsx)(Yn,{value:o.memoryUsage/1024*100,className:t.t(`h-2`,o.memoryUsage>800&&`bg-red-500/20`,o.memoryUsage>600&&o.memoryUsage<=800&&`bg-yellow-500/20`)})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 pt-2`,children:[(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Threads`}),(0,g.jsx)(`div`,{className:`text-2xl font-semibold`,children:o.threads})]}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Scan Queue`}),(0,g.jsx)(`div`,{className:`text-2xl font-semibold`,children:o.scanQueue})]}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Connections`}),(0,g.jsxs)(`div`,{className:`text-2xl font-semibold flex items-center gap-1`,children:[o.activeConnections,(0,g.jsx)(p.Wifi,{className:`w-4 h-4 text-muted-foreground`})]})]})]})]})]}),(0,g.jsxs)(Y,{className:`p-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Database,{className:`w-5 h-5 text-primary`}),(0,g.jsx)(`h4`,{className:`font-semibold`,children:`Signature Database`})]}),(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:f,children:[(0,g.jsx)(p.RefreshCw,{className:`w-4 h-4 mr-2`}),`Update`]})]}),(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Version`}),(0,g.jsx)(`div`,{className:`text-lg font-semibold`,children:s.version})]}),(0,g.jsxs)(`div`,{className:`space-y-1`,children:[(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Signatures`}),(0,g.jsx)(`div`,{className:`text-lg font-semibold`,children:s.count.toLocaleString()})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2 pt-2 border-t`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Last Updated`}),(0,g.jsx)(`span`,{className:`font-medium`,children:OB(s.lastUpdate)})]}),s.nextScheduledUpdate&&(0,g.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Next Update`}),(0,g.jsxs)(`span`,{className:`font-medium`,children:[`in `,OB(new Date(Date.now()-(Date.now()-s.nextScheduledUpdate.getTime())))]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Freshclam Status`}),(0,g.jsx)(r.t,{variant:s.freshclamStatus===`error`?`destructive`:s.freshclamStatus===`updating`?`default`:`secondary`,className:s.freshclamStatus===`running`?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:(0,g.jsx)(`span`,{className:t.t(AB[s.freshclamStatus].color),children:AB[s.freshclamStatus].label})})]})]})]})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,g.jsxs)(Y,{className:`p-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,g.jsx)(p.Wifi,{className:`w-5 h-5 text-primary`}),(0,g.jsx)(`h4`,{className:`font-semibold`,children:`Connection`})]}),(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Socket Type`}),(0,g.jsx)(r.t,{variant:`outline`,children:c.toUpperCase()})]}),(0,g.jsxs)(`div`,{className:`flex justify-between`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:c===`tcp`?`Port`:`Path`}),(0,g.jsx)(`span`,{className:`text-sm font-mono font-medium`,children:l})]}),(0,g.jsxs)(`div`,{className:`flex justify-between pt-2 border-t`,children:[(0,g.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Active Connections`}),(0,g.jsx)(`span`,{className:`text-lg font-semibold`,children:o.activeConnections})]})]})]}),(0,g.jsxs)(Y,{className:`p-6 lg:col-span-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,g.jsx)(p.HardDrive,{className:`w-5 h-5 text-primary`}),(0,g.jsx)(`h4`,{className:`font-semibold`,children:`Uptime History (Last 7 Days)`})]}),u.length>0?(0,g.jsx)(`div`,{className:`flex items-end justify-between gap-1 h-20`,children:u.map((e,n)=>(0,g.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-1`,children:[(0,g.jsx)(`div`,{className:t.t(`w-full rounded-t transition-all`,jB[e.status],e.status===`up`&&`h-full`,e.status===`degraded`&&`h-3/4`,e.status===`down`&&`h-1/4`)}),(0,g.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.hour})]},n))}):(0,g.jsx)(`div`,{className:`h-20 flex items-center justify-center text-sm text-muted-foreground`,children:`No uptime history available`}),(0,g.jsxs)(`div`,{className:`flex items-center justify-center gap-4 mt-4 pt-4 border-t`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(`div`,{className:`w-3 h-3 rounded bg-green-500`}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(`div`,{className:`w-3 h-3 rounded bg-yellow-500`}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Degraded`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(`div`,{className:`w-3 h-3 rounded bg-red-500`}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Down`})]})]})]})]})]})};t.n();var NB=[{name:`main.cvd`,version:`62`,signatureCount:6647427,size:162.5*1024*1024,lastUpdated:new Date(`2024-12-15T10:30:00`),buildTime:new Date(`2024-12-15T08:00:00`)},{name:`daily.cvd`,version:`27458`,signatureCount:2145789,size:89.3*1024*1024,lastUpdated:new Date(`2025-01-15T14:20:00`),buildTime:new Date(`2025-01-15T12:00:00`)},{name:`bytecode.cvd`,version:`334`,signatureCount:52438,size:2.8*1024*1024,lastUpdated:new Date(`2025-01-10T09:15:00`),buildTime:new Date(`2025-01-10T06:00:00`)}],PB=[{id:`upd-1`,date:new Date(`2025-01-15T14:20:00`),fromVersion:`27457`,toVersion:`27458`,newSignatures:1247,removedSignatures:89,duration:45,status:`success`,source:`daily.cvd`},{id:`upd-2`,date:new Date(`2025-01-14T14:15:00`),fromVersion:`27456`,toVersion:`27457`,newSignatures:2134,removedSignatures:156,duration:52,status:`success`,source:`daily.cvd`},{id:`upd-3`,date:new Date(`2025-01-13T14:10:00`),fromVersion:`27455`,toVersion:`27456`,newSignatures:1876,removedSignatures:203,duration:48,status:`success`,source:`daily.cvd`},{id:`upd-4`,date:new Date(`2025-01-12T14:05:00`),fromVersion:`27454`,toVersion:`27455`,newSignatures:0,removedSignatures:0,duration:12,status:`failed`,source:`daily.cvd`},{id:`upd-5`,date:new Date(`2025-01-11T14:00:00`),fromVersion:`27453`,toVersion:`27454`,newSignatures:3245,removedSignatures:178,duration:67,status:`success`,source:`daily.cvd`}],FB={updateFrequency:24,mirror:`database.clamav.net`,lastCheck:new Date(`2025-01-15T14:20:00`),checksToday:12,proxyEnabled:!1},IB=e=>e<1024?e+` B`:e<1024*1024?(e/1024).toFixed(2)+` KB`:(e/(1024*1024)).toFixed(2)+` MB`,LB=e=>new Intl.DateTimeFormat(`fr-FR`,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(e),RB=e=>new Intl.NumberFormat(`fr-FR`).format(e),zB=e=>{switch(e){case`success`:return(0,g.jsx)(p.CheckCircle2,{className:`size-4 text-green-600 dark:text-green-400`});case`failed`:return(0,g.jsx)(p.XCircle,{className:`size-4 text-red-600 dark:text-red-400`});case`in_progress`:return(0,g.jsx)(p.Loader2,{className:`size-4 text-blue-600 dark:text-blue-400 animate-spin`});case`scheduled`:return(0,g.jsx)(p.Clock,{className:`size-4 text-amber-600 dark:text-amber-400`})}},BB=e=>{switch(e){case`success`:return(0,g.jsx)(r.t,{variant:`secondary`,className:`bg-green-500/10 text-green-600 border-green-500/20`,children:`Réussie`});case`failed`:return(0,g.jsx)(r.t,{variant:`destructive`,children:`Échouée`});case`in_progress`:return(0,g.jsx)(r.t,{variant:`default`,children:`En cours`});case`scheduled`:return(0,g.jsx)(r.t,{variant:`secondary`,className:`bg-yellow-500/10 text-yellow-600 border-yellow-500/20`,children:`Planifiée`})}};function VB({databases:e=NB,updates:a=PB,freshclamConfig:o=FB,totalSignatures:s=e.reduce((e,t)=>e+t.signatureCount,0),isUpdating:c=!1,onUpdateNow:l,onScheduleUpdate:u,onViewChangelog:d,className:f}){let m=a[0];return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,f),children:[(0,g.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,g.jsx)(Y,{className:`p-6`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Version DB`}),(0,g.jsx)(`h3`,{className:`text-2xl font-bold`,children:m?.toVersion||`N/A`})]}),(0,g.jsx)(p.Database,{className:`size-8 text-blue-600 dark:text-blue-400`})]})}),(0,g.jsx)(Y,{className:`p-6`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Total Signatures`}),(0,g.jsx)(`h3`,{className:`text-2xl font-bold`,children:RB(s)})]}),(0,g.jsx)(p.FileText,{className:`size-8 text-purple-600 dark:text-purple-400`})]})}),(0,g.jsx)(Y,{className:`p-6`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Dernière MAJ`}),(0,g.jsx)(`h3`,{className:`text-sm font-bold`,children:m?LB(m.date):`N/A`})]}),(0,g.jsx)(p.Clock,{className:`size-8 text-green-600 dark:text-green-400`})]})}),(0,g.jsx)(Y,{className:`p-6`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Taille Totale`}),(0,g.jsx)(`h3`,{className:`text-2xl font-bold`,children:IB(e.reduce((e,t)=>e+t.size,0))})]}),(0,g.jsx)(p.HardDrive,{className:`size-8 text-amber-600 dark:text-amber-400`})]})})]}),(0,g.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,g.jsxs)(Y,{className:`p-6`,children:[(0,g.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,g.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Bases de données`}),(0,g.jsxs)(r.t,{variant:`outline`,children:[e.length,` bases`]})]}),(0,g.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/50 p-4 space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.Database,{className:`size-4 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`font-medium`,children:e.name})]}),(0,g.jsxs)(r.t,{variant:`secondary`,children:[`v`,e.version]})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Signatures`}),(0,g.jsx)(`p`,{className:`font-medium`,children:RB(e.signatureCount)})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Taille`}),(0,g.jsx)(`p`,{className:`font-medium`,children:IB(e.size)})]}),(0,g.jsxs)(`div`,{className:`col-span-2`,children:[(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Dernière mise à jour`}),(0,g.jsx)(`p`,{className:`font-medium`,children:LB(e.lastUpdated)})]})]})]},e.name))})]}),(0,g.jsxs)(Y,{className:`p-6`,children:[(0,g.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,g.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Configuration Freshclam`}),(0,g.jsxs)(i.n,{size:`sm`,variant:`outline`,onClick:()=>u?.(o.updateFrequency),children:[(0,g.jsx)(p.Calendar,{className:`mr-2 size-4`}),`Planifier`]})]}),(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Fréquence de MAJ`}),(0,g.jsxs)(`p`,{className:`text-lg font-semibold`,children:[`Toutes les `,o.updateFrequency,`h`]})]}),(0,g.jsx)(p.Clock,{className:`size-6 text-blue-600 dark:text-blue-400`})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Mirror utilisé`}),(0,g.jsx)(`p`,{className:`text-lg font-semibold`,children:o.mirror})]}),(0,g.jsx)(p.Globe,{className:`size-6 text-purple-600 dark:text-purple-400`})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Dernier check`}),(0,g.jsx)(`p`,{className:`text-lg font-semibold`,children:LB(o.lastCheck)})]}),(0,g.jsx)(p.RefreshCw,{className:`size-6 text-green-600 dark:text-green-400`})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-muted/50 p-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Checks aujourd'hui`}),(0,g.jsx)(`p`,{className:`text-lg font-semibold`,children:o.checksToday})]}),(0,g.jsx)(p.AlertCircle,{className:`size-6 text-amber-600 dark:text-amber-400`})]}),o.proxyEnabled&&(0,g.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/50 p-3`,children:(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-amber-800 dark:text-amber-200`,children:[(0,g.jsx)(p.AlertCircle,{className:`size-4`}),(0,g.jsx)(`span`,{children:`Proxy activé`})]})}),(0,g.jsx)(i.n,{className:`w-full`,onClick:l,disabled:c,children:c?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Loader2,{className:`mr-2 size-4 animate-spin`}),`Mise à jour en cours...`]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.Download,{className:`mr-2 size-4`}),`Mettre à jour maintenant`]})})]})]})]}),(0,g.jsxs)(Y,{className:`p-6`,children:[(0,g.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,g.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Historique des mises à jour`}),(0,g.jsxs)(r.t,{variant:`outline`,children:[a.length,` mises à jour`]})]}),(0,g.jsx)(n.f,{className:`h-[400px]`,children:(0,g.jsx)(`div`,{className:`space-y-3`,children:a.map((e,t)=>(0,g.jsxs)(`div`,{className:`relative rounded-lg border border-border bg-muted/50 p-4`,children:[t<a.length-1&&(0,g.jsx)(`div`,{className:`absolute left-6 top-12 h-full w-px bg-border`}),(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border border-border bg-background`,children:zB(e.status)}),(0,g.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`p`,{className:`font-medium`,children:[e.source,` - v`,e.fromVersion,` → v`,e.toVersion]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:LB(e.date)})]}),BB(e.status)]}),e.status===`success`&&(0,g.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Ajoutées`}),(0,g.jsxs)(`p`,{className:`font-medium text-green-600 dark:text-green-400`,children:[`+`,RB(e.newSignatures)]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Supprimées`}),(0,g.jsxs)(`p`,{className:`font-medium text-red-600 dark:text-red-400`,children:[`-`,RB(e.removedSignatures)]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`Durée`}),(0,g.jsxs)(`p`,{className:`font-medium`,children:[e.duration,`s`]})]})]}),e.status===`failed`&&(0,g.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950/50 p-2`,children:(0,g.jsx)(`p`,{className:`text-sm text-red-800 dark:text-red-200`,children:`Échec de la mise à jour`})}),(0,g.jsxs)(i.n,{size:`sm`,variant:`ghost`,onClick:()=>d?.(e.id),children:[(0,g.jsx)(p.FileText,{className:`mr-2 size-3`}),`Voir le changelog`]})]})]})]},e.id))})})]})]})}t.n();var HB={autoScanOnUpload:!0,maxFileSize:100,maxFileSizeUnit:`MB`,scanTimeout:120,maxConcurrentScans:4,scanArchives:!0,maxArchiveDepth:3,excludedExtensions:[`.log`,`.tmp`,`.lock`],excludedPaths:[`/tmp`,`/var/cache`],whitelistedHashes:[],detectionAction:`quarantine`,notifyAdmin:!0,notifyUser:!0,auditLog:!0},UB=[{value:`quarantine`,label:`Quarantaine`},{value:`delete`,label:`Suppression`},{value:`notify_only`,label:`Notification seule`},{value:`block_and_notify`,label:`Bloquer + notifier`}],WB=[{value:`MB`,label:`MB`},{value:`GB`,label:`GB`}];function GB({policy:e=HB,isLoading:n=!1,onSave:c,onCancel:l,onResetDefaults:u,className:f}){let[m,h]=(0,d.useState)(e),[_,v]=(0,d.useState)(``),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(``),C=e=>{h(t=>({...t,...e}))},w=()=>{_.trim()&&!m.excludedExtensions.includes(_.trim())&&(C({excludedExtensions:[...m.excludedExtensions,_.trim()]}),v(``))},T=e=>{C({excludedExtensions:m.excludedExtensions.filter(t=>t!==e)})},E=()=>{y.trim()&&!m.excludedPaths.includes(y.trim())&&(C({excludedPaths:[...m.excludedPaths,y.trim()]}),b(``))},D=e=>{C({excludedPaths:m.excludedPaths.filter(t=>t!==e)})},O=()=>{x.trim()&&!m.whitelistedHashes.includes(x.trim())&&(C({whitelistedHashes:[...m.whitelistedHashes,x.trim()]}),S(``))},k=e=>{C({whitelistedHashes:m.whitelistedHashes.filter(t=>t!==e)})};return(0,g.jsxs)(Y,{className:t.t(`w-full`,f),children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 p-6 border-b border-border/50`,children:[(0,g.jsx)(p.Shield,{className:`w-5 h-5 text-primary`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h3`,{className:`font-semibold text-foreground`,children:`Configuration des politiques de scan`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Definissez les regles de scan antivirus`})]})]}),(0,g.jsxs)(yr,{defaultValue:`general`,className:`w-full`,children:[(0,g.jsxs)(br,{className:`w-full justify-start border-b border-border/50 rounded-none px-6`,children:[(0,g.jsx)(xr,{value:`general`,children:`Regles generales`}),(0,g.jsx)(xr,{value:`exclusions`,children:`Exclusions`}),(0,g.jsx)(xr,{value:`actions`,children:`Actions`}),(0,g.jsx)(xr,{value:`notifications`,children:`Notifications`})]}),(0,g.jsxs)(Sr,{value:`general`,className:`p-6 space-y-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(o.n,{children:`Scan automatique a l'upload`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scanner tous les fichiers lors de l'envoi`})]}),(0,g.jsx)(ur,{checked:m.autoScanOnUpload,onCheckedChange:e=>C({autoScanOnUpload:e}),disabled:n})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Taille maximale de fichier`}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(s.t,{type:`number`,value:m.maxFileSize,onChange:e=>C({maxFileSize:parseInt(e.target.value)||0}),disabled:n,className:`flex-1`}),(0,g.jsxs)(a.d,{value:m.maxFileSizeUnit,onValueChange:e=>C({maxFileSizeUnit:e}),disabled:n,children:[(0,g.jsx)(a.y,{className:`w-24`,children:(0,g.jsx)(a.b,{})}),(0,g.jsx)(a.f,{children:WB.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Timeout de scan (secondes)`}),(0,g.jsx)(s.t,{type:`number`,value:m.scanTimeout,onChange:e=>C({scanTimeout:parseInt(e.target.value)||0}),disabled:n})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Nombre maximum de scans concurrents`}),(0,g.jsx)(s.t,{type:`number`,value:m.maxConcurrentScans,onChange:e=>C({maxConcurrentScans:parseInt(e.target.value)||1}),disabled:n})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(o.n,{children:`Scanner les archives (zip, tar, 7z)`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Analyser le contenu des fichiers archives`})]}),(0,g.jsx)(ur,{checked:m.scanArchives,onCheckedChange:e=>C({scanArchives:e}),disabled:n})]}),m.scanArchives&&(0,g.jsxs)(`div`,{className:`space-y-2 pl-6`,children:[(0,g.jsx)(o.n,{children:`Profondeur maximale d'archives imbriquees`}),(0,g.jsx)(s.t,{type:`number`,value:m.maxArchiveDepth,onChange:e=>C({maxArchiveDepth:parseInt(e.target.value)||1}),disabled:n})]})]}),(0,g.jsxs)(Sr,{value:`exclusions`,className:`p-6 space-y-6`,children:[(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsx)(o.n,{children:`Extensions exclues`}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(s.t,{placeholder:`.ext`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>e.key===`Enter`&&w(),disabled:n,className:`flex-1`}),(0,g.jsx)(i.n,{onClick:w,disabled:n,size:`sm`,children:(0,g.jsx)(p.Plus,{className:`w-4 h-4`})})]}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.excludedExtensions.map(e=>(0,g.jsxs)(r.t,{variant:`secondary`,className:`flex items-center gap-1`,children:[e,(0,g.jsx)(`button`,{onClick:()=>T(e),disabled:n,className:`ml-1 hover:text-destructive`,children:(0,g.jsx)(p.X,{className:`w-3 h-3`})})]},e))})]}),(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsx)(o.n,{children:`Chemins exclus`}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(s.t,{placeholder:`/path/to/exclude`,value:y,onChange:e=>b(e.target.value),onKeyDown:e=>e.key===`Enter`&&E(),disabled:n,className:`flex-1`}),(0,g.jsx)(i.n,{onClick:E,disabled:n,size:`sm`,children:(0,g.jsx)(p.Plus,{className:`w-4 h-4`})})]}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.excludedPaths.map(e=>(0,g.jsxs)(r.t,{variant:`secondary`,className:`flex items-center gap-1`,children:[e,(0,g.jsx)(`button`,{onClick:()=>D(e),disabled:n,className:`ml-1 hover:text-destructive`,children:(0,g.jsx)(p.X,{className:`w-3 h-3`})})]},e))})]}),(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsx)(o.n,{children:`Hash exclus (whitelist)`}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(s.t,{placeholder:`SHA256 hash`,value:x,onChange:e=>S(e.target.value),onKeyDown:e=>e.key===`Enter`&&O(),disabled:n,className:`flex-1`}),(0,g.jsx)(i.n,{onClick:O,disabled:n,size:`sm`,children:(0,g.jsx)(p.Plus,{className:`w-4 h-4`})})]}),(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.whitelistedHashes.map(e=>(0,g.jsxs)(r.t,{variant:`secondary`,className:`flex items-center gap-1`,children:[e.substring(0,12),`...`,(0,g.jsx)(`button`,{onClick:()=>k(e),disabled:n,className:`ml-1 hover:text-destructive`,children:(0,g.jsx)(p.X,{className:`w-3 h-3`})})]},e))})]})]}),(0,g.jsxs)(Sr,{value:`actions`,className:`p-6 space-y-6`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{children:`Action sur detection`}),(0,g.jsxs)(a.d,{value:m.detectionAction,onValueChange:e=>C({detectionAction:e}),disabled:n,children:[(0,g.jsx)(a.y,{children:(0,g.jsx)(a.b,{})}),(0,g.jsx)(a.f,{children:UB.map(e=>(0,g.jsx)(a.m,{value:e.value,children:e.label},e.value))})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(o.n,{children:`Logger dans l'audit trail`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Enregistrer toutes les detections`})]}),(0,g.jsx)(ur,{checked:m.auditLog,onCheckedChange:e=>C({auditLog:e}),disabled:n})]})]}),(0,g.jsxs)(Sr,{value:`notifications`,className:`p-6 space-y-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(o.n,{children:`Notifier l'administrateur`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Alerter en cas de menace detectee`})]}),(0,g.jsx)(ur,{checked:m.notifyAdmin,onCheckedChange:e=>C({notifyAdmin:e}),disabled:n})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,g.jsx)(o.n,{children:`Notifier l'utilisateur`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Informer l'utilisateur de l'action prise`})]}),(0,g.jsx)(ur,{checked:m.notifyUser,onCheckedChange:e=>C({notifyUser:e}),disabled:n})]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between p-6 border-t border-border/50`,children:[(0,g.jsxs)(i.n,{variant:`outline`,onClick:()=>{h(HB),u?.()},disabled:n,children:[(0,g.jsx)(p.RotateCcw,{className:`w-4 h-4 mr-2`}),`Restaurer defauts`]}),(0,g.jsxs)(`div`,{className:`flex gap-3`,children:[(0,g.jsx)(i.n,{variant:`outline`,onClick:l,disabled:n,children:`Annuler`}),(0,g.jsx)(i.n,{onClick:()=>{c?.(m)},disabled:n,children:`Sauvegarder`})]})]})]})}t.n();var KB={critical:{icon:p.ShieldAlert,bgColor:`bg-red-950/50 border-red-800`,iconColor:`text-red-400`,badgeVariant:`destructive`},high:{icon:p.AlertTriangle,bgColor:`bg-orange-950/50 border-orange-800`,iconColor:`text-orange-400`,badgeVariant:`destructive`},medium:{icon:p.AlertCircle,bgColor:`bg-yellow-950/50 border-yellow-800`,iconColor:`text-yellow-400`,badgeVariant:`secondary`},low:{icon:p.Info,bgColor:`bg-blue-950/50 border-blue-800`,iconColor:`text-blue-400`,badgeVariant:`default`}},qB={quarantined:`Mis en quarantaine`,deleted:`Supprimé`,blocked:`Bloqué`,allowed:`Autorisé`},JB={quarantined:`text-orange-400`,deleted:`text-red-400`,blocked:`text-red-400`,allowed:`text-green-400`},YB=({alerts:e=[],maxVisible:n=3,autoHideAfter:a=0,onDismiss:o,onDismissAll:s,onViewDetails:c,onViewQuarantine:l,className:u})=>{let[f,m]=(0,d.useState)(new Set),h=e.filter(e=>!e.dismissed);if(h.length===0)return null;let _=e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=h.slice(0,n),y=h.length-n,b=e=>{let t=new Date().getTime()-e.getTime(),n=Math.floor(t/6e4),r=Math.floor(t/36e5);return n<1?`À l'instant`:n<60?`Il y a ${n}m`:r<24?`Il y a ${r}h`:e.toLocaleDateString(`fr-FR`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})};return(0,g.jsxs)(`div`,{className:t.t(`space-y-2`,u),children:[h.length>1&&(0,g.jsxs)(`div`,{className:`flex items-center justify-between bg-red-950/30 border border-red-800/50 rounded-lg px-4 py-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(p.ShieldAlert,{className:`h-4 w-4 text-red-400`}),(0,g.jsxs)(`span`,{className:`text-sm font-medium text-red-200`,children:[h.length,` alerte`,h.length>1?`s`:``,` active`,h.length>1?`s`:``]})]}),s&&(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:s,className:`text-red-300 hover:text-red-200`,children:`Tout ignorer`})]}),v.map(e=>{let n=KB[e.severity],a=n.icon,s=f.has(e.id);return(0,g.jsx)(Y,{className:t.t(`border-2 backdrop-blur-sm transition-all duration-200`,n.bgColor,s&&`shadow-lg`),children:(0,g.jsx)(`div`,{className:`p-4`,children:(0,g.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,g.jsx)(`div`,{className:t.t(`mt-0.5 flex-shrink-0`,n.iconColor),children:(0,g.jsx)(a,{className:`h-5 w-5`})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsx)(`h4`,{className:`text-sm font-semibold text-white truncate`,children:e.threatName}),(0,g.jsx)(r.t,{variant:n.badgeVariant,className:`text-xs`,children:e.severity.toUpperCase()})]}),(0,g.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-gray-400`,children:[(0,g.jsx)(`span`,{className:`truncate`,title:e.filePath,children:e.filename}),(0,g.jsx)(`span`,{children:`•`}),(0,g.jsx)(`span`,{className:JB[e.action],children:qB[e.action]}),(0,g.jsx)(`span`,{children:`•`}),(0,g.jsx)(`span`,{children:b(e.detectedAt)})]})]}),(0,g.jsx)(i.n,{variant:`ghost`,size:`sm`,onClick:()=>o?.(e.id),className:`flex-shrink-0 h-8 w-8 p-0 text-gray-400 hover:text-white`,children:(0,g.jsx)(p.X,{className:`h-4 w-4`})})]}),s&&(0,g.jsx)(`div`,{className:`mt-3 pt-3 border-t border-white/10 space-y-2 text-xs text-gray-300`,children:(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-gray-500`,children:`Chemin complet:`}),(0,g.jsx)(`p`,{className:`font-mono break-all`,children:e.filePath})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-gray-500`,children:`Moteur antivirus:`}),(0,g.jsx)(`p`,{className:`font-mono`,children:e.engineVersion})]}),e.userId&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-gray-500`,children:`Utilisateur:`}),(0,g.jsx)(`p`,{className:`font-mono`,children:e.userId})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-gray-500`,children:`Détecté le:`}),(0,g.jsx)(`p`,{children:e.detectedAt.toLocaleString(`fr-FR`,{dateStyle:`medium`,timeStyle:`short`})})]})]})}),(0,g.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,g.jsx)(i.n,{variant:`outline`,size:`sm`,onClick:()=>_(e.id),className:`text-xs`,children:s?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.ChevronUp,{className:`h-3 w-3 mr-1`}),`Masquer`]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(p.ChevronDown,{className:`h-3 w-3 mr-1`}),`Détails`]})}),c&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:()=>c(e.id),className:`text-xs`,children:[(0,g.jsx)(p.Eye,{className:`h-3 w-3 mr-1`}),`Analyse complète`]}),e.action===`quarantined`&&l&&(0,g.jsxs)(i.n,{variant:`outline`,size:`sm`,onClick:l,className:`text-xs`,children:[(0,g.jsx)(p.Archive,{className:`h-3 w-3 mr-1`}),`Quarantaine`]})]})]})]})})},e.id)}),y>0&&(0,g.jsx)(`div`,{className:`text-center`,children:(0,g.jsxs)(i.n,{variant:`ghost`,size:`sm`,className:`text-xs text-gray-400 hover:text-white`,children:[`+ `,y,` autre`,y>1?`s`:``,` alerte`,y>1?`s`:``]})})]})},XB=[{id:`1`,threatName:`Trojan.GenericKD.12345678`,filename:`invoice_2024.pdf.exe`,filePath:`/home/user/Downloads/invoice_2024.pdf.exe`,severity:`critical`,action:`quarantined`,detectedAt:new Date(Date.now()-5*6e4),userId:`user@example.com`,engineVersion:`ClamAV 1.4.1`,dismissed:!1},{id:`2`,threatName:`Malware.Suspicious.Archive`,filename:`files.zip`,filePath:`/var/www/uploads/files.zip`,severity:`high`,action:`blocked`,detectedAt:new Date(Date.now()-15*6e4),engineVersion:`ClamAV 1.4.1`,dismissed:!1},{id:`3`,threatName:`PUA.Win.Adware.Generic`,filename:`installer.exe`,filePath:`/tmp/installer.exe`,severity:`medium`,action:`deleted`,detectedAt:new Date(Date.now()-36e5),userId:`admin@example.com`,engineVersion:`ClamAV 1.4.1`,dismissed:!1}];t.n();var ZB={startDate:new Date(Date.now()-720*60*60*1e3),endDate:new Date,format:`pdf`,type:`executive_summary`,includeSections:{generalStats:!0,threatDetails:!0,scannedFiles:!0,actionsTaken:!0,recommendations:!0}},QB={totalScans:1247,totalThreats:34,detectionRate:98.5,quarantinedFiles:28,threatsBySeverity:[{severity:`critical`,count:3},{severity:`high`,count:8},{severity:`medium`,count:15},{severity:`low`,count:8}],complianceChecks:[{name:`Antivirus actif`,passed:!0,details:`ClamAV opérationnel`},{name:`Scans automatisés`,passed:!0,details:`Planification quotidienne`},{name:`Quarantaine sécurisée`,passed:!0,details:`Isolation cryptographique`},{name:`Audit trail`,passed:!0,details:`Logs immutables activés`}],weeklyTrend:[{week:`S1`,scans:280,threats:7},{week:`S2`,scans:295,threats:9},{week:`S3`,scans:340,threats:11},{week:`S4`,scans:332,threats:7}]};function $B({config:e,preview:n,isGenerating:c=!1,generationProgress:l=0,onGenerate:u,onSchedule:f,onSendEmail:m,className:h}){let[_,v]=(0,d.useState)({...ZB,...e}),[y]=(0,d.useState)(n||QB),[b,x]=(0,d.useState)(``),[S,C]=(0,d.useState)(`config`),w={pdf:(0,g.jsx)(p.FileText,{className:`h-4 w-4`}),csv:(0,g.jsx)(p.FileSpreadsheet,{className:`h-4 w-4`}),json:(0,g.jsx)(p.FileJson,{className:`h-4 w-4`})},T={executive_summary:`Résumé exécutif`,detailed:`Détail complet`,iso27001_compliance:`Conformité ISO27001`,hds_audit:`Audit HDS`},E={critical:`bg-red-500`,high:`bg-orange-500`,medium:`bg-yellow-500`,low:`bg-blue-500`},D=(e,t)=>{v({..._,includeSections:{..._.includeSections,[e]:t}})},O=Math.max(...y.threatsBySeverity.map(e=>e.count)),k=Math.max(...y.weeklyTrend.map(e=>Math.max(e.scans,e.threats)));return(0,g.jsxs)(`div`,{className:t.t(`space-y-6`,h),children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Générateur de rapports`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Créez des rapports de scan personnalisés pour vos audits de sécurité`})]}),(0,g.jsxs)(r.t,{variant:`outline`,className:`gap-1.5`,children:[(0,g.jsx)(p.Shield,{className:`h-3.5 w-3.5`}),`ISO27001 / HDS`]})]}),(0,g.jsxs)(yr,{value:S,onValueChange:C,children:[(0,g.jsxs)(br,{children:[(0,g.jsx)(xr,{value:`config`,children:`Configuration`}),(0,g.jsx)(xr,{value:`preview`,children:`Aperçu`})]}),(0,g.jsxs)(Sr,{value:`config`,className:`space-y-6`,children:[(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Période du rapport`}),(0,g.jsx)(be,{children:`Sélectionnez la plage de dates à analyser`})]}),(0,g.jsxs)(Q,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`startDate`,children:`Date de début`}),(0,g.jsx)(s.t,{id:`startDate`,type:`date`,value:_.startDate.toISOString().split(`T`)[0],onChange:e=>v({..._,startDate:new Date(e.target.value)})})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`endDate`,children:`Date de fin`}),(0,g.jsx)(s.t,{id:`endDate`,type:`date`,value:_.endDate.toISOString().split(`T`)[0],onChange:e=>v({..._,endDate:new Date(e.target.value)})})]})]})]}),(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Type et format`}),(0,g.jsx)(be,{children:`Choisissez le type de rapport et le format de sortie`})]}),(0,g.jsxs)(Q,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`reportType`,children:`Type de rapport`}),(0,g.jsxs)(a.d,{value:_.type,onValueChange:e=>v({..._,type:e}),children:[(0,g.jsx)(a.y,{id:`reportType`,children:(0,g.jsx)(a.b,{})}),(0,g.jsx)(a.f,{children:Object.entries(T).map(([e,t])=>(0,g.jsx)(a.m,{value:e,children:t},e))})]})]}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsx)(o.n,{htmlFor:`format`,children:`Format de sortie`}),(0,g.jsxs)(a.d,{value:_.format,onValueChange:e=>v({..._,format:e}),children:[(0,g.jsx)(a.y,{id:`format`,children:(0,g.jsx)(a.b,{})}),(0,g.jsxs)(a.f,{children:[(0,g.jsx)(a.m,{value:`pdf`,children:(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[w.pdf,`PDF`]})}),(0,g.jsx)(a.m,{value:`csv`,children:(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[w.csv,`CSV`]})}),(0,g.jsx)(a.m,{value:`json`,children:(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[w.json,`JSON`]})})]})]})]})]})]}),(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Sections à inclure`}),(0,g.jsx)(be,{children:`Personnalisez le contenu du rapport`})]}),(0,g.jsxs)(Q,{className:`space-y-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(Se,{id:`generalStats`,checked:_.includeSections.generalStats,onCheckedChange:e=>D(`generalStats`,e)}),(0,g.jsx)(o.n,{htmlFor:`generalStats`,className:`cursor-pointer`,children:`Statistiques générales`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(Se,{id:`threatDetails`,checked:_.includeSections.threatDetails,onCheckedChange:e=>D(`threatDetails`,e)}),(0,g.jsx)(o.n,{htmlFor:`threatDetails`,className:`cursor-pointer`,children:`Détails des menaces détectées`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(Se,{id:`scannedFiles`,checked:_.includeSections.scannedFiles,onCheckedChange:e=>D(`scannedFiles`,e)}),(0,g.jsx)(o.n,{htmlFor:`scannedFiles`,className:`cursor-pointer`,children:`Liste des fichiers scannés`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(Se,{id:`actionsTaken`,checked:_.includeSections.actionsTaken,onCheckedChange:e=>D(`actionsTaken`,e)}),(0,g.jsx)(o.n,{htmlFor:`actionsTaken`,className:`cursor-pointer`,children:`Actions prises`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(Se,{id:`recommendations`,checked:_.includeSections.recommendations,onCheckedChange:e=>D(`recommendations`,e)}),(0,g.jsx)(o.n,{htmlFor:`recommendations`,className:`cursor-pointer`,children:`Recommandations`})]})]})]}),(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,g.jsxs)(i.n,{className:`flex-1`,onClick:()=>u?.(_),disabled:c,children:[(0,g.jsx)(p.Download,{className:`h-4 w-4 mr-2`}),`Générer le rapport`]}),(0,g.jsxs)(i.n,{variant:`outline`,className:`flex-1`,onClick:()=>f?.(_,`weekly`),disabled:c,children:[(0,g.jsx)(p.Calendar,{className:`h-4 w-4 mr-2`}),`Planifier génération`]})]}),(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Envoi par email`}),(0,g.jsx)(be,{children:`Envoyez le rapport directement par email`})]}),(0,g.jsxs)(Q,{className:`flex gap-2`,children:[(0,g.jsx)(s.t,{placeholder:`email@example.com`,type:`email`,value:b,onChange:e=>x(e.target.value),className:`flex-1`}),(0,g.jsxs)(i.n,{variant:`outline`,onClick:()=>m?.(_,b),disabled:!b||c,children:[(0,g.jsx)(p.Mail,{className:`h-4 w-4 mr-2`}),`Envoyer`]})]})]}),c&&(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`pt-6`,children:(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Génération en cours...`}),(0,g.jsxs)(`span`,{className:`font-medium`,children:[l,`%`]})]}),(0,g.jsx)(Yn,{value:l})]})})})]}),(0,g.jsxs)(Sr,{value:`preview`,className:`space-y-6`,children:[(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`pt-6`,children:(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`h-12 w-12 rounded-lg bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center mb-3`,children:(0,g.jsx)(p.Shield,{className:`h-6 w-6 text-white`})}),(0,g.jsx)(`h3`,{className:`text-xl font-bold`,children:`Rapport de scan de sécurité`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:T[_.type]})]}),(0,g.jsxs)(r.t,{variant:`secondary`,children:[_.startDate.toLocaleDateString(),` -`,` `,_.endDate.toLocaleDateString()]})]}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Généré le `,new Date().toLocaleString()]})]})})}),_.includeSections.generalStats&&(0,g.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`pt-6`,children:(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.BarChart3,{className:`h-4 w-4`}),`Total scans`]}),(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:y.totalScans.toLocaleString()})]})})}),(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`pt-6`,children:(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.AlertTriangle,{className:`h-4 w-4`}),`Menaces détectées`]}),(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:y.totalThreats})]})})}),(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`pt-6`,children:(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.TrendingUp,{className:`h-4 w-4`}),`Taux de détection`]}),(0,g.jsxs)(`div`,{className:`text-2xl font-bold`,children:[y.detectionRate,`%`]})]})})}),(0,g.jsx)(Y,{children:(0,g.jsx)(Q,{className:`pt-6`,children:(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(p.Shield,{className:`h-4 w-4`}),`Fichiers en quarantaine`]}),(0,g.jsx)(`div`,{className:`text-2xl font-bold`,children:y.quarantinedFiles})]})})})]}),_.includeSections.threatDetails&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Menaces par sévérité`}),(0,g.jsx)(be,{children:`Distribution des menaces détectées`})]}),(0,g.jsx)(Q,{className:`space-y-4`,children:y.threatsBySeverity.map(e=>(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,g.jsx)(`span`,{className:`capitalize font-medium`,children:e.severity}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e.count})]}),(0,g.jsx)(`div`,{className:`h-2 bg-muted rounded-full overflow-hidden`,children:(0,g.jsx)(`div`,{className:t.t(`h-full rounded-full`,E[e.severity]),style:{width:`${e.count/O*100}%`}})})]},e.severity))})]}),_.includeSections.generalStats&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Tendance hebdomadaire`}),(0,g.jsx)(be,{children:`Évolution des scans et menaces`})]}),(0,g.jsx)(Q,{children:(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(`div`,{className:`flex items-end gap-4 h-48`,children:y.weeklyTrend.map(e=>(0,g.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-2`,children:[(0,g.jsxs)(`div`,{className:`flex-1 w-full flex items-end gap-1`,children:[(0,g.jsx)(`div`,{className:`flex-1 bg-blue-500 rounded-t`,style:{height:`${e.scans/k*100}%`},title:`Scans: ${e.scans}`}),(0,g.jsx)(`div`,{className:`flex-1 bg-orange-500 rounded-t`,style:{height:`${e.threats/k*100}%`},title:`Menaces: ${e.threats}`})]}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.week})]},e.week))}),(0,g.jsxs)(`div`,{className:`flex items-center justify-center gap-6 text-xs`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`div`,{className:`h-3 w-3 rounded bg-blue-500`}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Scans`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`div`,{className:`h-3 w-3 rounded bg-orange-500`}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Menaces`})]})]})]})})]}),(_.type===`iso27001_compliance`||_.type===`hds_audit`)&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Vérifications de conformité`}),(0,g.jsx)(be,{children:_.type===`iso27001_compliance`?`Conformité ISO27001`:`Audit HDS`})]}),(0,g.jsx)(Q,{className:`space-y-3`,children:y.complianceChecks.map((e,t)=>(0,g.jsxs)(`div`,{className:`flex items-start gap-3 p-3 rounded-lg border bg-card`,children:[e.passed?(0,g.jsx)(p.CheckCircle2,{className:`h-5 w-5 text-green-500 mt-0.5`}):(0,g.jsx)(p.XCircle,{className:`h-5 w-5 text-red-500 mt-0.5`}),(0,g.jsxs)(`div`,{className:`flex-1 space-y-1`,children:[(0,g.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,g.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.details})]}),(0,g.jsx)(r.t,{variant:e.passed?`default`:`destructive`,className:e.passed?`bg-green-500/10 text-green-600 border-green-500/20`:``,children:e.passed?`Conforme`:`Non conforme`})]},t))})]}),_.includeSections.recommendations&&(0,g.jsxs)(Y,{children:[(0,g.jsxs)(X,{children:[(0,g.jsx)(Z,{children:`Recommandations`}),(0,g.jsx)(be,{children:`Actions suggérées pour améliorer la sécurité`})]}),(0,g.jsx)(Q,{children:(0,g.jsxs)(`ul`,{className:`space-y-2 text-sm`,children:[(0,g.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,g.jsx)(`span`,{children:`Augmenter la fréquence des scans pour les répertoires critiques`})]}),(0,g.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,g.jsx)(`span`,{children:`Mettre à jour les signatures de virus (dernière mise à jour: il y a 2h)`})]}),(0,g.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,g.jsx)(`span`,{children:`Configurer des alertes en temps réel pour les menaces critiques`})]}),(0,g.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground mt-1`,children:`•`}),(0,g.jsx)(`span`,{children:`Réviser la politique de quarantaine automatique`})]})]})})]})]})]})]})}init_cn(),init_tweak(),n.a(),exports.AD_SIZES=Oj,exports.APMOverview=Az,exports.Accordion=ee,exports.AccordionContent=ne,exports.AccordionItem=J,exports.AccordionTrigger=te,exports.AdmincrumbProvider=vP,exports.Alert=he,exports.AlertDescription=_e,exports.AlertDialog=re,exports.AlertDialogAction=fe,exports.AlertDialogCancel=pe,exports.AlertDialogContent=se,exports.AlertDialogDescription=de,exports.AlertDialogFooter=le,exports.AlertDialogHeader=ce,exports.AlertDialogOverlay=oe,exports.AlertDialogPortal=ae,exports.AlertDialogTitle=ue,exports.AlertDialogTrigger=ie,exports.AlertTitle=ge,exports.AntivirusDashboard=pB,exports.AspectRatio=ve,exports.Auth2FA=BL,exports.Avatar=n.m,exports.AvatarFallback=n.h,exports.AvatarImage=n.g,exports.Badge=r.t,exports.BlockEmptyState=XF,exports.BlockLanguageSelector=TP,exports.Blockquote=ni,exports.Button=i.n,exports.CHART_SIZE_MAP=l.t,exports.CICDBuilder=MR,exports.COUNTRIES=JE,exports.Calendar=ye,exports.Card=Y,exports.CardContent=Q,exports.CardDescription=be,exports.CardFooter=xe,exports.CardHeader=X,exports.CardTitle=Z,exports.ChatInterface=YL,exports.Checkbox=Se,exports.CheckoutFlow=xL,exports.CheckoutNavigation=Px,exports.CheckoutProgressBar=Fx,exports.ClamAVServiceStatus=MB,exports.CloudCostDashboard=cz,exports.Code=ut,exports.Collapsible=dt,exports.CollapsibleContent=pt,exports.CollapsibleTrigger=ft,exports.Command=wt,exports.CommandDialog=Tt,exports.CommandEmpty=Ot,exports.CommandGroup=kt,exports.CommandInput=Et,exports.CommandItem=jt,exports.CommandList=Dt,exports.CommandSeparator=At,exports.CommandShortcut=Mt,exports.ContainerOrchestrator=Bz,exports.ContextMenu=Nt,exports.ContextMenuCheckboxItem=Ut,exports.ContextMenuContent=Vt,exports.ContextMenuGroup=Ft,exports.ContextMenuItem=Ht,exports.ContextMenuLabel=Gt,exports.ContextMenuPortal=It,exports.ContextMenuRadioGroup=Rt,exports.ContextMenuRadioItem=Wt,exports.ContextMenuSeparator=Kt,exports.ContextMenuShortcut=qt,exports.ContextMenuSub=Lt,exports.ContextMenuSubContent=Bt,exports.ContextMenuSubTrigger=zt,exports.ContextMenuTrigger=Pt,exports.DEFAULT_CHART_COLORS=l.n,exports.DashboardKPI=gL,exports.DataTable=bi,exports.DataTableAdvanced=Di,exports.DataTableColumnResizer=Oi,exports.DataTableContextMenu=Mi,exports.DataTableEditCell=vi,exports.DataTableFilters=_i,exports.DataTableGroupTotals=Ai,exports.DataTableGrouping=ki,exports.DataTableGroupingControls=ji,exports.DataTablePagination=gi,exports.DataTableSelection=Ni,exports.DataTableToolbar=hi,exports.DatabaseAdmin=$z,exports.DeploymentDashboard=sR,exports.Dialog=mt,exports.DialogClose=_t,exports.DialogContent=yt,exports.DialogDescription=Ct,exports.DialogFooter=xt,exports.DialogHeader=bt,exports.DialogOverlay=vt,exports.DialogPortal=gt,exports.DialogTitle=St,exports.DialogTrigger=ht,exports.DrawerBody=Aa,exports.DrawerClose=La,exports.DrawerDescription=Na,exports.DrawerFooter=ja,exports.DrawerHeader=ka,exports.DrawerTitle=Ma,exports.DrawerTrigger=Ia,exports.DropdownMenu=Jt,exports.DropdownMenuCheckboxItem=rn,exports.DropdownMenuContent=nn,exports.DropdownMenuGroup=Xt,exports.DropdownMenuItem=$,exports.DropdownMenuLabel=on,exports.DropdownMenuPortal=Zt,exports.DropdownMenuRadioGroup=$t,exports.DropdownMenuRadioItem=an,exports.DropdownMenuSeparator=sn,exports.DropdownMenuShortcut=cn,exports.DropdownMenuSub=Qt,exports.DropdownMenuSubContent=tn,exports.DropdownMenuSubTrigger=en,exports.DropdownMenuTrigger=Yt,exports.EmptyCartState=tI,exports.Error403Page=lI,exports.Error404Page=sI,exports.Error500Page=cI,exports.ErrorState=rI,exports.FileScanUploader=bB,exports.Footer=SP,exports.Form=ln,exports.FormControl=gn,exports.FormDescription=_n,exports.FormField=dn,exports.FormItem=mn,exports.FormLabel=hn,exports.FormMessage=vn,exports.GitOpsSyncStatus=bz,exports.Heading=ei,exports.Headtab=CP,exports.HeadtabBreadcrumb=wP,exports.HoverCard=yn,exports.HoverCardContent=xn,exports.HoverCardTrigger=bn,exports.IncidentManager=_R,exports.InfrastructureMap=ER,exports.Input=s.t,exports.InputOTP=Sn,exports.KPICard=XT,exports.Kbd=ii,exports.Label=o.n,exports.LanguageProvider=aP,exports.LanguageSelector=Cn,exports.Layout=EP,exports.LegacyThemeProvider=cP,exports.Login=DP,exports.MaintenancePage=uI,exports.Menubar=kn,exports.MenubarCheckboxItem=Fn,exports.MenubarContent=Nn,exports.MenubarGroup=Tn,exports.MenubarItem=Pn,exports.MenubarLabel=Ln,exports.MenubarMenu=wn,exports.MenubarPortal=En,exports.MenubarRadioGroup=On,exports.MenubarRadioItem=In,exports.MenubarSeparator=Rn,exports.MenubarShortcut=zn,exports.MenubarSub=Dn,exports.MenubarSubContent=Mn,exports.MenubarSubTrigger=jn,exports.MenubarTrigger=An,exports.ModalBody=no,exports.ModalContent=Qa,exports.ModalDescription=to,exports.ModalFooter=ro,exports.ModalHeader=$a,exports.ModalOverlay=Za,exports.ModalTitle=eo,exports.NavigationMenu=Bn,exports.NavigationMenuContent=Gn,exports.NavigationMenuIndicator=Jn,exports.NavigationMenuItem=Hn,exports.NavigationMenuLink=Kn,exports.NavigationMenuList=Vn,exports.NavigationMenuTrigger=Wn,exports.NavigationMenuViewport=qn,exports.NoDataState=ZF,exports.NoFilesState=eI,exports.NoMessagesState=$F,exports.NoNotificationsState=nI,exports.NoResultsState=QF,exports.OfflinePage=dI,exports.OnCallScheduleBlock=YR,exports.POINTS_PRESETS=ay,exports.PlayerProfile=jL,exports.Popover=c.n,exports.PopoverContent=c.r,exports.PopoverTrigger=c.i,exports.Progress=Yn,exports.QuarantineManager=wB,exports.RadioGroup=Xn,exports.RadioGroupItem=Zn,exports.ReleaseNotes=zR,exports.ScanHistoryLog=EB,exports.ScanPolicyEditor=GB,exports.ScanReportGenerator=$B,exports.ScrollArea=n.f,exports.ScrollBar=n.p,exports.Select=a.d,exports.SelectContent=a.f,exports.SelectGroup=a.p,exports.SelectItem=a.m,exports.SelectLabel=a.h,exports.SelectScrollDownButton=a.g,exports.SelectScrollUpButton=a._,exports.SelectSeparator=a.v,exports.SelectTrigger=a.y,exports.SelectValue=a.b,exports.Separator=i.t,exports.SessionCard=jS,exports.SessionConfirmDialog=AS,exports.Sheet=Qn,exports.SheetClose=er,exports.SheetContent=ir,exports.SheetDescription=cr,exports.SheetFooter=or,exports.SheetHeader=ar,exports.SheetOverlay=nr,exports.SheetPortal=tr,exports.SheetTitle=sr,exports.SheetTrigger=$n,exports.SidebarLayout=IP,exports.SignatureDatabaseManager=VB,exports.Skeleton=l.m,exports.Slider=lr,exports.StepperNavigation=Wo,exports.SuggestionDropdown=yD,exports.Switch=ur,exports.Table=dr,exports.TableBody=pr,exports.TableCaption=vr,exports.TableCell=_r,exports.TableFooter=mr,exports.TableHead=gr,exports.TableHeader=fr,exports.TableRow=hr,exports.Tabs=yr,exports.TabsContent=Sr,exports.TabsList=br,exports.TabsTrigger=xr,exports.TagChip=vD,exports.Text=Qr,exports.Textarea=o.t,exports.ThemeLoader=nt,exports.ThemeProvider=wr,exports.ThemeSelector=Dr,exports.ThreatAlertBanner=YB,exports.Toast=jr,exports.ToastAction=Mr,exports.ToastClose=Nr,exports.ToastDescription=Fr,exports.ToastProvider=Or,exports.ToastTitle=Pr,exports.ToastViewport=kr,exports.Toaster=Jr,exports.Toggle=Xr,exports.Tooltip=n.c,exports.TooltipContent=n.l,exports.TooltipProvider=n.u,exports.TooltipTrigger=n.d,exports.Waka3DPieChart=ll,exports.WakaAchievementBadge=hd,exports.WakaAchievementGrid=gd,exports.WakaAchievementUnlock=md,exports.WakaActivityFeed=Iv,exports.WakaActivityTimeline=_F,exports.WakaAdBanner=Rj,exports.WakaAdFallback=Ij,exports.WakaAdInline=Bj,exports.WakaAdInterstitial=Vj,exports.WakaAdPlaceholder=Fj,exports.WakaAdProvider=Pj,exports.WakaAdSidebar=zj,exports.WakaAdStickyFooter=Hj,exports.WakaAddressAutocomplete=qE,exports.WakaAdmincrumb=Vi,exports.WakaAlertPanel=Ek,exports.WakaAlertStack=_g,exports.WakaAllocationMatrix=Mh,exports.WakaAppDock=ap,exports.WakaApprovalChain=Yh,exports.WakaAreaChart=l.c,exports.WakaArtifactList=CA,exports.WakaAsyncButton=uc,exports.WakaAuditLog=nC,exports.WakaAutocomplete=Ui,exports.WakaAutocompleteForm=Wi,exports.WakaBadgeShowcase=$g,exports.WakaBadgeShowcaseCompact=e_,exports.WakaBadgeShowcaseHero=n_,exports.WakaBadgeShowcaseList=t_,exports.WakaBadgeStats=r_,exports.WakaBarChart=l.u,exports.WakaBarcode=Qi,exports.WakaBiometricPrompt=kC,exports.WakaBottomSheet=Ks,exports.WakaBreadcrumb=ta,exports.WakaBreadcrumbPath=Yc,exports.WakaBudgetBurn=Eu,exports.WakaBuildMatrix=cA,exports.WakaCalendarView=kF,exports.WakaCapacityPlanner=vh,exports.WakaCarousel=ra,exports.WakaCartSummary=Cx,exports.WakaChallengeTimer=B_,exports.WakaChallengeTimerSkeleton=V_,exports.WakaChart=l.d,exports.WakaChat=WF,exports.WakaChatBubble=ow,exports.WakaChatDateSeparator=cw,exports.WakaChatSystemMessage=lw,exports.WakaChatTypingIndicator=sw,exports.WakaChatWidget=PF,exports.WakaChecklist=EO,exports.WakaCheckoutStepper=Ix,exports.WakaCohortTable=HT,exports.WakaColorPicker=da,exports.WakaColorPickerForm=fa,exports.WakaComboCounter=Dd,exports.WakaCombobox=ma,exports.WakaCommandBar=Bf,exports.WakaCompactDailyReward=d_,exports.WakaCompactGoalProgress=uE,exports.WakaCompactLevelProgress=Nd,exports.WakaComparePeriod=ax,exports.WakaConfigComparator=$A,exports.WakaConnectionMatrix=cg,exports.WakaContainerList=Mk,exports.WakaContentRecommendation=Gj,exports.WakaContributionGraph=eu,exports.WakaCostBreakdown=mu,exports.WakaCouponInput=zx,exports.WakaCpuGauge=yl,exports.WakaCreditActivityFeed=ZM,exports.WakaCreditAlert=DM,exports.WakaCreditBalance=nM,exports.WakaCreditBreakdown=TN,exports.WakaCreditBurnRate=mN,exports.WakaCreditCardInput=gD,exports.WakaCreditHistory=WM,exports.WakaCreditMeter=pM,exports.WakaCreditPricingPack=RN,exports.WakaCreditProjection=NN,exports.WakaCreditQuota=CM,exports.WakaCreditReceipt=eP,exports.WakaCreditTopUp=KN,exports.WakaCreditTransaction=MM,exports.WakaCreditTransferForm=rP,exports.WakaCreditUsageChart=aN,exports.WakaDailyReward=u_,exports.WakaDashboard=GP,exports.WakaDatabaseCard=uj,exports.WakaDateRangePicker=_a,exports.WakaDateTimePicker=Ca,exports.WakaDateTimePickerForm=wa,exports.WakaDependencyTree=LA,exports.WakaDeploymentLane=zh,exports.WakaDeviceTrust=qC,exports.WakaDocBreadcrumb=a.r,exports.WakaDocCallout=a.u,exports.WakaDocCodeBlock=a.l,exports.WakaDocNav=a.s,exports.WakaDocRenderer=a.t,exports.WakaDocSearch=a.o,exports.WakaDocTable=a.n,exports.WakaDocToc=a.c,exports.WakaDocToolbar=a.i,exports.WakaDocVersion=a.a,exports.WakaDock=rp,exports.WakaDrawer=Pa,exports.WakaEmptyState=NO,exports.WakaEmptyStateError=FO,exports.WakaEmptyStateSearch=PO,exports.WakaEnvVarEditor=BA,exports.WakaErrorPage=oI,exports.WakaErrorShake=Ku,exports.WakaFAQ=hI,exports.WakaFeatureAnnouncement=GO,exports.WakaFeatureFlagRow=rj,exports.WakaFileManager=SI,exports.WakaFileUpload=Ba,exports.WakaFloatingDock=ip,exports.WakaFloatingNav=Wc,exports.WakaFlowDiagram=cp,exports.WakaFormFieldShake=Ju,exports.WakaFunnelChart=DT,exports.WakaFunnelChartCompact=kT,exports.WakaFunnelChartSimple=OT,exports.WakaGlowCard=Kf,exports.WakaGlowCardDanger=Xf,exports.WakaGlowCardPrimary=qf,exports.WakaGlowCardRainbow=Zf,exports.WakaGlowCardSuccess=Jf,exports.WakaGlowCardWarning=Yf,exports.WakaGlowGrid=Qf,exports.WakaGoalCard=dE,exports.WakaGoalProgress=lE,exports.WakaHapticButton=Qs,exports.WakaHapticIconButton=$s,exports.WakaHeader=LP,exports.WakaHealthPulse=tm,exports.WakaHeatmap=bE,exports.WakaHotspot=mO,exports.WakaHotspotGroup=gO,exports.WakaI18nEditor=uL,exports.WakaImage=Va,exports.WakaImageGallery=Ha,exports.WakaIncidentTimeline=Fm,exports.WakaInvoicePreview=pS,exports.WakaKPIDashboard=ZT,exports.WakaKanban=Ka,exports.WakaKanbanBoard=OI,exports.WakaKubernetesOverview=zk,exports.WakaLanding=RI,exports.WakaLeaderboard=Bd,exports.WakaLevelBadge=jd,exports.WakaLevelProgress=Md,exports.WakaLineChart=l.l,exports.WakaLiquidButton=_c,exports.WakaLiquidButtonDestructive=bc,exports.WakaLiquidButtonGradient=Sc,exports.WakaLiquidButtonNeon=Cc,exports.WakaLiquidButtonPrimary=vc,exports.WakaLiquidButtonSecondary=yc,exports.WakaLiquidButtonSuccess=xc,exports.WakaLoadingOrbit=td,exports.WakaLoadingOrbitAtom=ad,exports.WakaLoadingOrbitGalaxy=sd,exports.WakaLoadingOrbitMinimal=od,exports.WakaLoadingOrbitSimple=rd,exports.WakaLoadingOrbitSolar=id,exports.WakaLogViewer=mk,exports.WakaLootBox=b_,exports.WakaMagicLink=tp,exports.WakaMagneticButton=jc,exports.WakaMagneticIconButton=Mc,exports.WakaMagneticLink=Nc,exports.WakaMentionInput=Gb,exports.WakaMetricSparkline=lm,exports.WakaMigrationList=_j,exports.WakaMilestoneRoad=$d,exports.WakaMiniChart=l.a,exports.WakaMiniLeaderboard=Vd,exports.WakaMiniStreak=af,exports.WakaModal=io,exports.WakaModalTrigger=ao,exports.WakaMorphButton=cc,exports.WakaMultiQuotaBar=th,exports.WakaNetworkGauge=Sl,exports.WakaNetworkTopology=Xp,exports.WakaNotifications=ho,exports.WakaNumberInput=yo,exports.WakaOrbitalMenu=rl,exports.WakaOrbitalMenuCompact=il,exports.WakaOrderTracker=$x,exports.WakaOutstreamVideo=qj,exports.WakaPagination=So,exports.WakaPasswordStrength=SS,exports.WakaPasswordStrengthIndicator=CS,exports.WakaPaymentMethodPicker=db,exports.WakaPaymentMethodPickerCards=mb,exports.WakaPaymentMethodPickerCompact=gb,exports.WakaPaymentMethodPickerRadio=hb,exports.WakaPermissionMatrix=US,exports.WakaPhoneInput=rD,exports.WakaPieChart=l.s,exports.WakaPipelineView=gp,exports.WakaPlayerCard=Sy,exports.WakaPodCard=Xk,exports.WakaPodium=Rd,exports.WakaPointsPopup=ry,exports.WakaPowerUp=Yv,exports.WakaPowerUpList=Zv,exports.WakaPresenceAvatarStack=eb,exports.WakaPresenceCard=Qy,exports.WakaPresenceIndicator=qy,exports.WakaPresenceLastSeen=Zy,exports.WakaPresenceList=$y,exports.WakaPresenceSelector=Xy,exports.WakaPresenceStatusBadge=Yy,exports.WakaPresenceWithAvatar=Jy,exports.WakaPricing=XI,exports.WakaPricingTable=px,exports.WakaProductCard=Eb,exports.WakaProductCardSkeleton=Ob,exports.WakaProductGrid=Db,exports.WakaProfile=tF,exports.WakaProgressOnboarding=XO,exports.WakaProvider=mP,exports.WakaPullToRefresh=zs,exports.WakaQRCode=To,exports.WakaQueryExplain=Ej,exports.WakaQuestCard=_f,exports.WakaQuestCardSkeleton=vf,exports.WakaQuestList=yf,exports.WakaQuotaBar=eh,exports.WakaRadarScore=ol,exports.WakaRadarScoreCompare=cl,exports.WakaRadarScoreSimple=sl,exports.WakaRamGauge=bl,exports.WakaRankBadge=tv,exports.WakaRankBadgeGroup=nv,exports.WakaRatingDisplay=zD,exports.WakaRatingInput=LD,exports.WakaReactionPicker=dT,exports.WakaRegionMap=Pp,exports.WakaResourceGauge=vl,exports.WakaResourceGaugeGroup=Cl,exports.WakaResourcePool=Km,exports.WakaResourcePoolComparison=qm,exports.WakaRichTextEditor=c.t,exports.WakaRollbackSlider=Ep,exports.WakaSLATracker=Ng,exports.WakaSankeyDiagram=EE,exports.WakaSchedulePicker=nO,exports.WakaScratchCard=Tf,exports.WakaSeasonPass=By,exports.WakaSecretCard=JA,exports.WakaSecurityScanResult=kA,exports.WakaSecurityScore=vC,exports.WakaSecurityScoreCompact=yC,exports.WakaSegmentedControl=Do,exports.WakaServerRack=Vp,exports.WakaServerRackDemo=Hp,exports.WakaServiceGraph=nA,exports.WakaSessionManager=MS,exports.WakaSettings=YP,exports.WakaSidebar=PP,exports.WakaSignaturePad=RE,exports.WakaSkeletonAvatar=Vu,exports.WakaSkeletonCard=Hu,exports.WakaSkeletonGrid=Wu,exports.WakaSkeletonList=Uu,exports.WakaSkeletonText=zu,exports.WakaSkeletonWave=Lu,exports.WakaSkillTree=O_,exports.WakaSliderRange=jD,exports.WakaSparkline=l.o,exports.WakaSpinWheel=py,exports.WakaSpinner=Ao,exports.WakaSponsoredBadge=Lj,exports.WakaSponsoredCard=Uj,exports.WakaSponsoredFeed=Wj,exports.WakaSpotlight=Wf,exports.WakaStat=Fo,exports.WakaStatGroup=Io,exports.WakaStatsHexagon=Dy,exports.WakaStatsHexagonRPG=ky,exports.WakaStatsHexagonSimple=Oy,exports.WakaStatsHexagonSkills=Ay,exports.WakaStatusMatrix=zl,exports.WakaStepper=Uo,exports.WakaStorageGauge=xl,exports.WakaStreakCounter=rf,exports.WakaSuccessExplosion=Mu,exports.WakaSwipeCard=As,exports.WakaSwipeCardActions=Ms,exports.WakaTabPanel=tl,exports.WakaTabsMorph=$c,exports.WakaTagInput=xD,exports.WakaTeamBanner=Tv,exports.WakaTeamBannerCompact=Ev,exports.WakaTeamBannerExpanded=Dv,exports.WakaTerminalOutput=ym,exports.WakaTestReport=hA,exports.WakaThemeCreator=Go,exports.WakaThemeManager=Jo,exports.WakaThreadView=Yw,exports.WakaTiltCard=$f,exports.WakaTiltShowcaseCard=ep,exports.WakaTimePicker=ns,exports.WakaTimeline=ss,exports.WakaTooltipTour=dk,exports.WakaTourGuide=cO,exports.WakaTournamentBracket=mv,exports.WakaTraceViewer=bk,exports.WakaTree=fs,exports.WakaTreemapChart=PE,exports.WakaTwoFactorSetup=Rb,exports.WakaTypewriter=Rc,exports.WakaTypewriterCode=Vc,exports.WakaTypewriterHeading=zc,exports.WakaTypewriterLines=Bc,exports.WakaTypingIndicator=xw,exports.WakaTypingIndicatorDots=Cw,exports.WakaTypingIndicatorPulse=Tw,exports.WakaTypingIndicatorText=ww,exports.WakaUserManagement=uF,exports.WakaVersusCard=If,exports.WakaVideo=ys,exports.WakaVideoAd=Kj,exports.WakaVideoCall=Rw,exports.WakaVideoOverlay=Jj,exports.WakaVirtualList=Ss,exports.WakaVoiceMessage=vT,exports.WakaWelcomeModal=fo,exports.WakaWizard=rL,exports.WakaXPBar=Ug,exports.addChildNode=gs,exports.applyTheme=st,exports.badgeVariants=r.n,exports.blockquoteVariants=ti,exports.calculateDuration=Le,exports.cn=t.t,exports.compareRanges=$e,exports.createBookingDateValidator=We,exports.createCardExpiryValidator=Ue,exports.createChartColumn=l.r,exports.createCommonPresets=Ce,exports.createCustomPreset=Ee,exports.createHighlightRegex=n.t,exports.createLastDaysPresets=we,exports.createMaxAgeValidator=Fe,exports.createMaxRangeDaysValidator=Ge,exports.createMinAgeValidator=Pe,exports.createMonthlyPresets=Ye,exports.createNextDaysPresets=Te,exports.createQuarterPresets=Je,exports.createSafeRegex=n.n,exports.dateToTimestamp=Xe,exports.defaultAPMServices=jz,exports.defaultAPMTransactions=Mz,exports.defaultAchievements=NL,exports.defaultActivities=yF,exports.defaultActivityFilters=vF,exports.defaultArtifacts=wA,exports.defaultAuth2FAStatus=HL,exports.defaultBackupCodes=VL,exports.defaultBadges=PL,exports.defaultBuildMatrixColumns=lA,exports.defaultBuildMatrixRows=uA,exports.defaultCalendarEvents=AF,exports.defaultCartItems=wL,exports.defaultCategories=_D,exports.defaultChatConversations=KF,exports.defaultChatInterfaceConversations=ZL,exports.defaultChatInterfaceMessages=QL,exports.defaultChatInterfaceUsers=XL,exports.defaultChatMessages=qF,exports.defaultChatUser=GF,exports.defaultCloudCostItems=uz,exports.defaultCloudCostSummary=lz,exports.defaultConfigEnvironments=ej,exports.defaultConnections=iA,exports.defaultContainers=Nk,exports.defaultCostAnomalies=dz,exports.defaultCoverage=_A,exports.defaultDashboardStats=KP,exports.defaultDatabase=dj,exports.defaultDatabaseInstance=eB,exports.defaultDatabases=fj,exports.defaultDependencies=RA,exports.defaultDeployments=cR,exports.defaultEnvVariables=VA,exports.defaultEnvironments=uR,exports.defaultFAQCategories=gI,exports.defaultFAQItems=_I,exports.defaultFeatureFlags=ij,exports.defaultFeatures=gx,exports.defaultFileManagerBreadcrumbs=wI,exports.defaultFiles=CI,exports.defaultGitOpsApplications=xz,exports.defaultGoals=vL,exports.defaultIncidents=vR,exports.defaultInfraResources=DR,exports.defaultK8sDeployments=Hk,exports.defaultK8sNamespaces=Wk,exports.defaultK8sNodes=Bk,exports.defaultK8sPods=Vk,exports.defaultK8sServices=Uk,exports.defaultKPIMetrics=_L,exports.defaultKanbanColumns=kI,exports.defaultKanbanLabels=AI,exports.defaultLandingCTA=UI,exports.defaultLandingFeatures=BI,exports.defaultLandingHero=HI,exports.defaultLandingNavItems=zI,exports.defaultLandingTestimonials=VI,exports.defaultLogs=hk,exports.defaultMatchHistory=FL,exports.defaultMigrations=vj,exports.defaultOnCallSchedule=QR,exports.defaultOrchestratorServices=Hz,exports.defaultPanelAlerts=Dk,exports.defaultPaymentMethods=CL,exports.defaultPermissions=fF,exports.defaultPipeline=NR,exports.defaultPipelines=lR,exports.defaultPlayerStats=ML,exports.defaultPodDetails=Zk,exports.defaultPresets=ga,exports.defaultPricingFAQ=QI,exports.defaultPricingPlans=ZI,exports.defaultProfileData=nF,exports.defaultQueryPlan=Dj,exports.defaultRecentScans=mB,exports.defaultReleases=VR,exports.defaultScanPolicy=HB,exports.defaultSecret=YA,exports.defaultServices=rA,exports.defaultSettingsTabs=XP,exports.defaultShippingMethods=SL,exports.defaultTestSuites=gA,exports.defaultThreatAlerts=XB,exports.defaultTiers=hx,exports.defaultTopThreats=gB,exports.defaultTraceSpans=xk,exports.defaultUsers=dF,exports.defaultVulnerabilities=AA,exports.defaultWeeklyStats=hB,exports.defaultWelcomeSteps=so,exports.defaultWizardSteps=iL,exports.escapeHtml=n.r,exports.escapeRegex=n.i,exports.exportToCSV=oi,exports.exportToJSON=si,exports.findNodeById=ps,exports.formatCurrency=nS,exports.formatDate=rS,exports.formatDateRange=Re,exports.formatPhoneNumber=YE,exports.getCountryByCode=$E,exports.getCountryByDialCode=eD,exports.getDatesInMonth=Be,exports.getFrenchHolidays=ze,exports.getThemeLoader=at,exports.getWeekdaysInMonth=He,exports.getWeekendsInMonth=Ve,exports.getWorkingDays=qe,exports.headingVariants=$r,exports.initThemeLoader=it,exports.isDateInRange=Ne,exports.isFutureDate=De,exports.isHoliday=Me,exports.isNotExpired=Ie,exports.isPastDate=Oe,exports.isSameDay=Ke,exports.isToday=ke,exports.isWeekday=Ae,exports.isWeekend=je,exports.kbdVariants=ri,exports.loadTableState=ui,exports.loadTheme=ot,exports.mergeRanges=et,exports.moveNode=_s,exports.navigationMenuTriggerStyle=Un,exports.normalizeDate=Qe,exports.orbitPresets=nd,exports.parseCSV=ci,exports.rangesOverlap=tt,exports.reducer=Hr,exports.removeNode=hs,exports.safeNavigate=n.o,exports.sanitizeUrl=n.s,exports.saveTableState=li,exports.sparklineTemplate=l.i,exports.textVariants=Zr,exports.themeManagerVariants=qo,exports.timestampToDate=Ze,exports.toast=Kr,exports.toggleVariants=Yr,exports.tweak=t.i,exports.unformatPhoneNumber=XE,exports.updateNode=ms,exports.useAchievements=_d,exports.useActivityFeed=Lv,exports.useAdConsent=Mj,exports.useAdContext=Aj,exports.useAdSlot=Nj,exports.useAdVisibility=jj,exports.useAddressAutocomplete=HE,exports.useAdmincrumb=Hi,exports.useAdmincrumbContext=yP,exports.useAdmincrumbContextOptional=bP,exports.useAlertStack=mg,exports.useAllocationMatrix=Dh,exports.useAuditLog=rC,exports.useBiometricPrompt=bC,exports.useBottomSheet=qs,exports.useBreadcrumbFromPath=na,exports.useBreadcrumbPath=Xc,exports.useBudgetBurn=Du,exports.useCapacityPlanner=ph,exports.useCartSummary=wx,exports.useChallengeTimer=A_,exports.useChartTheme=l.f,exports.useChatWidget=FF,exports.useChecklist=xO,exports.useCheckoutStepper=Ex,exports.useCheckoutStepperContext=Ox,exports.useCohortTable=UT,exports.useComboCounter=Od,exports.useCombobox=ha,exports.useCommandBar=Hf,exports.useComparePeriod=ox,exports.useConnectionMatrix=tg,exports.useCostBreakdown=hu,exports.useCouponInput=Lx,exports.useCreditCardInput=hD,exports.useDailyRewards=f_,exports.useDataTable=fi,exports.useDataTableAdvanced=xi,exports.useDataTableEdit=mi,exports.useDataTableExport=u.n,exports.useDataTableImport=u.t,exports.useDataTableSelection=Pi,exports.useDataTableTheme=Ei,exports.useDataTableVirtualization=Ti,exports.useDateForm=Ta,exports.useDateRangePicker=va,exports.useDeploymentLane=Bh,exports.useDeviceTrust=JC,exports.useDrawer=Fa,exports.useEmptyState=IO,exports.useErrorShake=qu,exports.useFeatureAnnouncement=KO,exports.useFloatingNav=Gc,exports.useFlowDiagram=lp,exports.useFormField=fn,exports.useFunnelChart=yT,exports.useGoalProgress=aE,exports.useHeatmap=hE,exports.useHotspot=hO,exports.useInvoice=mS,exports.useKPIDashboard=QT,exports.useKanban=qa,exports.useLanguage=oP,exports.useLeaderboard=Hd,exports.useLegacyTheme=pP,exports.useLevelProgress=Pd,exports.useLoadingOrbit=cd,exports.useLootBox=y_,exports.useMagicLink=np,exports.useMentionInput=Bb,exports.useMilestoneRoad=ef,exports.useModal=oo,exports.useMorphButton=lc,exports.useNotifications=go,exports.useNumberInput=bo,exports.useOrbitalMenu=nl,exports.useOrderTracker=Hx,exports.usePagination=Co,exports.usePasswordStrength=_S,exports.usePaymentMethodPicker=_b,exports.usePermissionMatrix=RS,exports.usePhoneInput=nD,exports.usePointsPopup=iy,exports.usePointsPopupWithPresets=oy,exports.usePowerUp=Xv,exports.usePresence=Wy,exports.usePricingTable=mx,exports.useProgressOnboarding=ZO,exports.usePullToRefresh=Bs,exports.useQRCode=Eo,exports.useQuests=bf,exports.useQuota=nh,exports.useRadarScore=al,exports.useRank=rv,exports.useRatingInput=RD,exports.useReactionPicker=rT,exports.useRechartsLoader=l.p,exports.useResourceGauge=_l,exports.useResourcePool=Jm,exports.useRollbackSlider=Tp,exports.useSLATracker=Pg,exports.useSankeyDiagram=SE,exports.useSchedulePicker=XD,exports.useScratchCard=Sf,exports.useSeasonPass=Vy,exports.useSecurityScore=pC,exports.useSegmentedControl=Oo,exports.useSessionManager=NS,exports.useSidebar=FP,exports.useSignaturePad=FE,exports.useSkillTree=k_,exports.useSliderRange=OD,exports.useSparklineData=um,exports.useSpotlight=Gf,exports.useStat=Lo,exports.useStatsHexagon=Ey,exports.useStepperContext=zo,exports.useSuccessExplosion=Nu,exports.useTableLayout=pi,exports.useTabs=el,exports.useTagInput=SD,exports.useTeamBanner=yv,exports.useTerminalOutput=bm,exports.useTheme=Er,exports.useThemeLoader=ct,exports.useThreadView=Xw,exports.useTimePicker=rs,exports.useToast=qr,exports.useTooltipTour=ck,exports.useTourGuide=rO,exports.useTournamentBracket=hv,exports.useTranslation=Sa,exports.useTreemapChart=OE,exports.useTwoFactorSetup=jb,exports.useTypewriter=Ic,exports.useTypingIndicator=Sw,exports.useVersusCard=Lf,exports.useVideo=bs,exports.useVideoCall=zw,exports.useVirtualList=Cs,exports.useVoiceMessage=mT,exports.useWaka=gP,exports.useWelcomeModal=co,exports.useWizard=eL,exports.useXPBar=Wg;
|