tekivex-ui 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TkxForm-DSMDo2Ol.js +388 -0
- package/dist/TkxForm-DwV_n-eE.cjs +12 -0
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +396 -195
- package/dist/i18n.cjs +1 -0
- package/dist/i18n.js +757 -0
- package/dist/index.cjs +27 -22
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4994 -5089
- package/dist/quantum.cjs +91 -0
- package/dist/quantum.js +2312 -0
- package/dist/realtime.cjs +25 -0
- package/dist/realtime.js +944 -0
- package/dist/security-C369oOWH.cjs +1 -0
- package/dist/security-CzAmaMqa.js +97 -0
- package/dist/src/components/TkxDataGrid.d.ts +9 -1
- package/dist/src/components/TkxDataGrid.d.ts.map +1 -1
- package/dist/src/components/TkxDropdown.d.ts +41 -0
- package/dist/src/components/TkxDropdown.d.ts.map +1 -0
- package/dist/src/components/TkxLiveFeed.d.ts +891 -0
- package/dist/src/components/TkxLiveFeed.d.ts.map +1 -0
- package/dist/src/components/TkxLiveLog.d.ts +892 -0
- package/dist/src/components/TkxLiveLog.d.ts.map +1 -0
- package/dist/src/components/TkxLiveMetrics.d.ts +24 -0
- package/dist/src/components/TkxLiveMetrics.d.ts.map +1 -0
- package/dist/src/components/TkxPlayground.d.ts +15 -0
- package/dist/src/components/TkxPlayground.d.ts.map +1 -0
- package/dist/src/components/TkxQuantumForm.d.ts +20 -0
- package/dist/src/components/TkxQuantumForm.d.ts.map +1 -0
- package/dist/src/components/TkxRealTimeChart.d.ts +27 -0
- package/dist/src/components/TkxRealTimeChart.d.ts.map +1 -0
- package/dist/src/components/TkxTable.d.ts +11 -1
- package/dist/src/components/TkxTable.d.ts.map +1 -1
- package/dist/src/components/TkxThemeBuilder.d.ts +9 -0
- package/dist/src/components/TkxThemeBuilder.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/engine/index.d.ts +2 -0
- package/dist/src/engine/index.d.ts.map +1 -1
- package/dist/src/engine/quantum-ai.d.ts +201 -0
- package/dist/src/engine/quantum-ai.d.ts.map +1 -0
- package/dist/src/engine/tkx.d.ts.map +1 -1
- package/dist/src/headless/index.d.ts +6 -0
- package/dist/src/headless/index.d.ts.map +1 -1
- package/dist/src/headless/useInfiniteQuery.d.ts +35 -0
- package/dist/src/headless/useInfiniteQuery.d.ts.map +1 -0
- package/dist/src/headless/useSSE.d.ts +36 -0
- package/dist/src/headless/useSSE.d.ts.map +1 -0
- package/dist/src/headless/useWebSocket.d.ts +33 -0
- package/dist/src/headless/useWebSocket.d.ts.map +1 -0
- package/dist/src/quantum/index.d.ts +9 -0
- package/dist/src/quantum/index.d.ts.map +1 -0
- package/dist/src/realtime/index.d.ts +9 -0
- package/dist/src/realtime/index.d.ts.map +1 -0
- package/dist/{TkxForm-BWK4LqY3.js → tkx-BJ10JtMv.js} +372 -721
- package/dist/tkx-BeNyC0w7.cjs +4 -0
- package/package.json +16 -1
- package/src/components/TkxDataGrid.tsx +72 -0
- package/src/components/TkxDropdown.tsx +802 -0
- package/src/components/TkxLiveFeed.tsx +329 -0
- package/src/components/TkxLiveLog.tsx +470 -0
- package/src/components/TkxLiveMetrics.tsx +291 -0
- package/src/components/TkxPlayground.tsx +736 -0
- package/src/components/TkxQuantumForm.tsx +592 -0
- package/src/components/TkxRealTimeChart.tsx +381 -0
- package/src/components/TkxTable.tsx +351 -77
- package/src/components/TkxThemeBuilder.tsx +685 -0
- package/src/components/index.ts +4 -0
- package/src/engine/index.ts +2 -0
- package/src/engine/quantum-ai.ts +1045 -0
- package/src/engine/tkx.ts +95 -4
- package/src/headless/index.ts +6 -0
- package/src/headless/useInfiniteQuery.ts +153 -0
- package/src/headless/useSSE.ts +165 -0
- package/src/headless/useWebSocket.ts +229 -0
- package/src/quantum/index.ts +39 -0
- package/src/realtime/index.ts +21 -0
- package/dist/TkxForm-ljQjX7KD.cjs +0 -15
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./index-BINBzXuY.cjs"),e=require("react/jsx-runtime"),a=require("react"),s=require("./TkxForm-ljQjX7KD.cjs"),Le=require("react-dom"),fs={sm:"text-xs font-semibold",md:"text-sm font-semibold",lg:"text-base font-semibold",xl:"text-lg font-semibold"},xs={sm:"py-1.5 px-3",md:"py-2 px-4",lg:"py-2.5 px-5",xl:"py-3 px-6"},Kt={sm:"min-h-[32px]",md:"min-h-[40px]",lg:"min-h-[48px]",xl:"min-h-[56px]"},ps={sm:14,md:16,lg:18,xl:20};function hs({size:t}){const r=ps[t];return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:s.tkx("animate-spin shrink-0"),children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeOpacity:"0.25"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}const Fr=a.forwardRef(({variant:t="solid",size:r="md",colorScheme:n="primary",isLoading:i=!1,loadingText:o,leftIcon:l,rightIcon:c,isFullWidth:d=!1,glow:u=!1,disabled:x,children:f,className:m,style:p,...h},y)=>{const k=B.useTheme(),b=s.useReducedMotion(),g=x||i,j={primary:k.primary,secondary:k.secondary,danger:k.danger,warning:k.warning,success:k.success}[n],S=B.getAccessibleForeground(j,["#ffffff","#000000",k.bg]),z=typeof f=="string"?s.sanitizeString(f):f,v=o?s.sanitizeString(o):void 0,N=t==="solid"?{backgroundColor:j,color:S,border:"none",boxShadow:u&&!b?`0 0 20px ${j}55`:void 0}:t==="outline"?{backgroundColor:"transparent",color:j,border:`2px solid ${j}`}:t==="ghost"?{backgroundColor:"transparent",color:j,border:"none"}:{backgroundColor:"transparent",color:j,border:"none",textDecoration:"underline"},C=s.tkx("inline-flex items-center justify-center gap-2","rounded-lg font-sans font-semibold","select-none relative overflow-hidden",fs[r],xs[r],Kt[r],t!=="link"&&Kt[r],d&&"w-full",g?"cursor-not-allowed opacity-60":"cursor-pointer",!b&&"transition-all duration-200","focus-visible:focus-ring");return e.jsx("button",{ref:y,"aria-busy":i,"aria-disabled":g,disabled:g,className:s.cx(C,m),style:{...N,...p},...h,children:i?e.jsxs(e.Fragment,{children:[e.jsx(hs,{size:r}),v??z]}):e.jsxs(e.Fragment,{children:[l&&e.jsx("span",{"aria-hidden":"true",children:l}),z,c&&e.jsx("span",{"aria-hidden":"true",children:c})]})})});Fr.displayName="TkxButton";const ms={none:"",sm:"p-3",md:"p-5",lg:"p-7"},Wr=a.forwardRef(({variant:t="default",isHoverable:r,isClickable:n,padding:i="md",as:o,children:l,className:c,style:d,...u},x)=>{const f=B.useTheme(),m=s.useReducedMotion(),p=o??(n?"button":"div"),h={default:{backgroundColor:f.surface,border:`1px solid ${f.border}`},glass:{backgroundColor:`${f.surface}cc`,backdropFilter:"blur(12px)",border:`1px solid ${f.border}55`,boxShadow:`0 4px 24px ${f.bg}40`},quantum:{backgroundColor:f.surfaceAlt,border:`1px solid ${f.primary}33`,boxShadow:`0 0 24px ${f.primary}18`},elevated:{backgroundColor:f.surface,boxShadow:`0 4px 20px ${f.bg}60`},outlined:{backgroundColor:"transparent",border:`2px solid ${f.border}`}}[t],y=s.tkx("rounded-xl w-full text-left block font-sans focus-visible:focus-ring",ms[i],(r||n)&&!m&&"transition-transform duration-150 hover:scale-[1.01]",n?"cursor-pointer":"cursor-default");return e.jsx(p,{ref:x,className:s.cx("tkx-card",y,c),style:{color:f.text,...h,...d},...u,children:l})});Wr.displayName="TkxCard";function gs({title:t,subtitle:r,action:n,children:i,className:o,...l}){const c=B.useTheme();return e.jsxs("div",{className:s.cx(s.tkx("flex justify-between items-start mb-4"),o),...l,children:[e.jsxs("div",{className:s.tkx("flex-1 min-w-0"),children:[t&&e.jsx("h3",{className:s.tkx("text-base font-semibold m-0"),style:{color:c.text},children:t}),r&&e.jsx("p",{className:s.tkx("text-sm mt-1 mb-0"),style:{color:c.textMuted},children:r}),i]}),n&&e.jsx("div",{className:s.tkx("ml-3 shrink-0"),children:n})]})}function bs({children:t,className:r,...n}){return e.jsx("div",{className:s.cx(s.tkx(""),r),...n,children:t})}function ys({children:t,className:r,style:n,...i}){const o=B.useTheme();return e.jsx("div",{className:s.cx(s.tkx("flex items-center justify-end gap-2 mt-4 pt-4"),r),style:{borderTop:`1px solid ${o.border}`,...n},...i,children:t})}const Hr=a.forwardRef(({label:t,id:r,error:n,hint:i,leftAddon:o,rightAddon:l,isInvalid:c,isRequired:d,disabled:u,className:x,style:f,...m},p)=>{const h=B.useTheme(),y=a.useId(),k=r??y,b=`${k}-hint`,g=`${k}-error`,w=c||!!n,j=[i&&b,w&&g].filter(Boolean).join(" ")||void 0,S=s.sanitizeString(t),z=n?s.sanitizeString(n):void 0,v=i?s.sanitizeString(i):void 0,N=w?h.danger:h.border;return e.jsxs("div",{className:s.cx(s.tkx("flex flex-col gap-1 w-full"),x),style:f,children:[e.jsxs("label",{htmlFor:k,className:s.tkx("text-sm font-medium font-sans"),style:{color:h.text},children:[S,d&&e.jsx("span",{"aria-hidden":"true",className:s.tkx("ml-1"),style:{color:h.danger},children:"*"})]}),e.jsxs("div",{className:s.tkx("flex items-center rounded-lg overflow-hidden","transition-colors duration-150",u?"opacity-60":""),style:{border:`1.5px solid ${N}`,backgroundColor:h.surface},children:[o&&e.jsx("div",{className:s.tkx("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:h.surfaceAlt,color:h.textMuted,borderRight:`1px solid ${h.border}`},children:o}),e.jsx("input",{ref:p,id:k,"aria-invalid":w,"aria-required":d,"aria-describedby":j,disabled:u,className:s.cx(s.tkx("flex-1 border-none bg-transparent text-sm font-sans py-2.5 px-3 outline-none min-w-0 focus-visible:focus-ring")),style:{color:h.text},...m}),l&&e.jsx("div",{className:s.tkx("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:h.surfaceAlt,color:h.textMuted,borderLeft:`1px solid ${h.border}`},children:l})]}),v&&!z&&e.jsx("span",{id:b,className:s.tkx("text-xs"),style:{color:h.textMuted},children:v}),z&&e.jsxs("span",{id:g,role:"alert",className:s.tkx("text-xs flex items-center gap-1"),style:{color:h.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),z]})]})});Hr.displayName="TkxInput";const ks={sm:"text-xs px-1.5 py-[2px] min-h-[16px]",md:"text-xs px-2 py-[3px] min-h-[20px]",lg:"text-sm px-3 py-1 min-h-[24px]"},vs={sm:"size-[6px]",md:"size-2",lg:"size-2.5"},Vr=a.forwardRef(({variant:t="default",size:r="md",dot:n=!1,pulse:i=!1,outlined:o=!1,children:l,className:c,style:d,...u},x)=>{const f=B.useTheme(),p={default:f.border,primary:f.primary,secondary:f.secondary,danger:f.danger,warning:f.warning,success:f.success,info:f.info}[t],h=B.getAccessibleForeground(p,["#ffffff","#000000",f.bg]),y=typeof l=="string"?s.sanitizeString(l):l;return n?e.jsx("span",{ref:x,"aria-label":typeof l=="string"?s.sanitizeString(l):void 0,className:s.cx(s.tkx("inline-block rounded-full",vs[r],i&&"animate-pulse"),c),style:{backgroundColor:p,...d},...u}):e.jsx("span",{ref:x,className:s.cx(s.tkx("inline-flex items-center justify-center rounded-full font-semibold font-sans tracking-wide",ks[r],i&&"animate-pulse"),c),style:{backgroundColor:o?"transparent":p,color:o?p:h,border:o?`1px solid ${p}`:"none",...d},...u,children:y})});Vr.displayName="TkxBadge";const ws={sm:"4px",md:"8px",lg:"12px"},js={sm:32,md:48,lg:64},Or=a.forwardRef(({value:t,variant:r="linear",size:n="md",label:i,showValue:o,color:l,className:c,style:d,...u},x)=>{const f=B.useTheme(),m=s.useReducedMotion(),p=l??f.primary,h=t===void 0,y=t!==void 0?Math.min(100,Math.max(0,t)):0;if(t!==void 0){const{errors:b}=s.validateProps({value:t},{value:{type:"number",min:0,max:100}});b.length>0&&console.warn("[TkxProgress]",b.join(", "))}if(r==="circular"){const b=js[n],g=n==="sm"?3:n==="md"?4:5,w=(b-g*2)/2,j=2*Math.PI*w,S=h?0:j-y/100*j;return e.jsxs("div",{ref:x,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":h?void 0:y,"aria-label":i??(h?"Loading":`${y}%`),className:s.cx(s.tkx("inline-flex flex-col items-center gap-1"),c),style:d,...u,children:[e.jsxs("svg",{width:b,height:b,viewBox:`0 0 ${b} ${b}`,"aria-hidden":"true",children:[e.jsx("circle",{cx:b/2,cy:b/2,r:w,fill:"none",stroke:f.border,strokeWidth:g}),e.jsx("circle",{cx:b/2,cy:b/2,r:w,fill:"none",stroke:p,strokeWidth:g,strokeLinecap:"round",strokeDasharray:j,strokeDashoffset:S,transform:`rotate(-90 ${b/2} ${b/2})`,style:{transition:m?"none":"stroke-dashoffset 300ms ease",animation:h&&!m?"tkx-spin 1s linear infinite":void 0}})]}),o&&!h&&e.jsxs("span",{className:s.tkx("text-xs"),style:{color:f.textMuted},children:[y,"%"]})]})}const k=ws[n];return e.jsxs("div",{ref:x,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":h?void 0:y,"aria-label":i??(h?"Loading":`${y}%`),className:s.cx(s.tkx("flex flex-col gap-1 w-full"),c),style:d,...u,children:[i&&e.jsxs("div",{className:s.tkx("flex justify-between text-sm"),style:{color:f.text},children:[e.jsx("span",{children:i}),o&&!h&&e.jsxs("span",{children:[y,"%"]})]}),e.jsx("div",{className:s.tkx("w-full overflow-hidden"),style:{height:k,borderRadius:k,backgroundColor:f.border},children:e.jsx("div",{style:{height:"100%",borderRadius:k,backgroundColor:p,width:h?"40%":`${y}%`,transition:m?"none":"width 300ms ease",animation:h&&!m?"tkx-shimmer 1.5s ease-in-out infinite":void 0}})})]})});Or.displayName="TkxProgress";const Ss={sm:{tw:28,th:16,td:10,gap:3},md:{tw:40,th:22,td:14,gap:4},lg:{tw:52,th:28,td:18,gap:5}},_r=a.forwardRef(({checked:t,onChange:r,label:n,size:i="md",hideLabel:o,disabled:l,className:c,style:d,...u},x)=>{const f=B.useTheme(),m=s.useReducedMotion(),p=a.useId();s.validateProps({label:n,checked:t},{label:{type:"string",required:!0},checked:{type:"boolean",required:!0}});const{tw:h,th:y,td:k,gap:b}=Ss[i],g=t?h-k-b:b,w=t?f.primary:f.border;return e.jsxs("div",{className:s.cx(s.tkx("inline-flex items-center gap-2",l?"opacity-50":""),c),style:d,children:[!o&&e.jsx("label",{htmlFor:p,className:s.tkx("text-sm font-sans",l?"cursor-not-allowed":"cursor-pointer","select-none"),style:{color:f.text},children:n}),e.jsx("button",{ref:x,id:p,role:"switch","aria-checked":t,"aria-label":o?n:void 0,disabled:l,onClick:()=>!l&&r(!t),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&!l&&(j.preventDefault(),r(!t))},className:s.cx(s.tkx("relative border-none p-0 outline-none shrink-0 focus-visible:focus-ring",l?"cursor-not-allowed":"cursor-pointer",!m&&"transition-colors duration-200")),style:{width:h,height:y,borderRadius:y,backgroundColor:w},...u,children:e.jsx("span",{"aria-hidden":"true",className:s.tkx("absolute rounded-full"),style:{top:"50%",left:g,width:k,height:k,transform:"translateY(-50%)",backgroundColor:"#ffffff",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",transition:m?"none":"left 200ms ease"}})})]})});_r.displayName="TkxToggle";const Cs={info:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),success:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),warning:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),danger:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})})};function Ts({variant:t,title:r,children:n,dismissible:i,onDismiss:o,icon:l,style:c,className:d}){const u=B.useTheme(),x=s.useAnnounce(),f=r?s.sanitizeString(r):void 0;a.useEffect(()=>{f&&x(f,t==="danger"||t==="warning"?"assertive":"polite")},[f,t,x]);const p={info:u.info,success:u.success,warning:u.warning,danger:u.danger}[t],h=t==="danger"||t==="warning"?"alert":"status";return e.jsxs("div",{role:h,className:s.tkx("flex items-start gap-3 px-4 py-3 rounded-lg border animate-fade-in font-sans",d??""),style:{backgroundColor:`${p}18`,borderColor:p,color:u.text,...c},children:[e.jsx("span",{className:s.tkx("shrink-0 mt-[1px]"),style:{color:p},children:l??Cs[t]}),e.jsxs("div",{className:s.tkx("flex-1 min-w-0"),children:[f&&e.jsx("p",{className:s.tkx("m-0 font-semibold text-sm mb-1"),children:f}),e.jsx("div",{className:s.tkx("text-sm leading-relaxed"),children:n})]}),i&&o&&e.jsx("button",{"aria-label":"Dismiss alert",onClick:o,className:s.tkx("bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring"),style:{color:u.textMuted},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}const Ms={sm:"400px",md:"560px",lg:"720px",full:"100vw"};let Pt=0;function $s(){++Pt===1&&(document.body.style.overflow="hidden")}function Xt(){--Pt<=0&&(Pt=0,document.body.style.overflow="")}function zs({isOpen:t,onClose:r,title:n,size:i="md",closeOnOverlayClick:o=!0,closeOnEscape:l=!0,children:c,footer:d}){const u=B.useTheme(),x=a.useId(),f=s.useFocusTrap(t),m=s.useReducedMotion(),p=s.useAnnounce(),h=s.sanitizeString(n),y=i==="full";return s.useEscapeKey(r,l&&t),a.useEffect(()=>(t?($s(),p(h,"polite")):Xt(),()=>{t&&Xt()}),[t,h,p]),!t||typeof document>"u"?null:Le.createPortal(e.jsxs("div",{role:"presentation",className:s.tkx("fixed inset-0 z-[9000] flex",y?"items-stretch":"items-center justify-center",y?"":"p-4"),children:[e.jsx("div",{"aria-hidden":"true",onClick:o?r:void 0,className:s.tkx("absolute inset-0",!m&&"animate-fade-in"),style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}),e.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":x,className:s.tkx("relative z-10 flex flex-col overflow-hidden",!m&&"animate-slide-up",y?"":"rounded-xl"),style:{backgroundColor:u.surface,border:`1px solid ${u.border}`,width:Ms[i],maxWidth:"100%",maxHeight:y?"100vh":"90vh",boxShadow:`0 20px 60px ${u.bg}80`},children:[e.jsxs("div",{className:s.tkx("flex items-center justify-between px-6 py-5 shrink-0"),style:{borderBottom:`1px solid ${u.border}`},children:[e.jsx("h2",{id:x,className:s.tkx("m-0 text-lg font-semibold font-sans"),style:{color:u.text},children:h}),e.jsx("button",{onClick:r,"aria-label":"Close dialog",className:s.tkx("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:u.textMuted},children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("div",{className:s.tkx("flex-1 overflow-y-auto px-6 py-6 font-sans"),style:{color:u.text},children:c}),d&&e.jsx("div",{className:s.tkx("flex justify-end gap-2 px-6 py-4 shrink-0"),style:{borderTop:`1px solid ${u.border}`},children:d})]})]}),document.body)}const Yr=a.createContext(null);function Ur(){const t=a.useContext(Yr);if(!t)throw new Error("TkxTab must be used inside TkxTabs");return t}function Is({defaultIndex:t=0,activeIndex:r,onChange:n,children:i,tabCount:o=0,style:l,className:c}){const[d,u]=a.useState(t),x=a.useId(),f=r!==void 0?r:d,m=p=>{r===void 0&&u(p),n==null||n(p)};return e.jsx(Yr.Provider,{value:{activeIndex:f,setActiveIndex:m,baseId:x,tabCount:o},children:e.jsx("div",{className:c,style:l,children:i})})}function Es({children:t,className:r,style:n,...i}){const o=B.useTheme();return e.jsx("div",{role:"tablist",className:s.cx(s.tkx("flex gap-1"),r),style:{borderBottom:`2px solid ${o.border}`,...n},...i,children:t})}function Ns({index:t,children:r,disabled:n=!1,className:i,style:o}){const l=B.useTheme(),{activeIndex:c,setActiveIndex:d,baseId:u,tabCount:x}=Ur(),f=a.useRef(null),m=c===t;return e.jsx("button",{ref:f,role:"tab",id:`${u}-tab-${t}`,"aria-controls":`${u}-panel-${t}`,"aria-selected":m,tabIndex:m?0:-1,disabled:n,className:s.cx(s.tkx("border-none bg-transparent font-sans text-sm rounded-t cursor-pointer select-none","py-2.5 px-4 transition-colors duration-150 focus-visible:focus-ring",n?"opacity-50 cursor-not-allowed":""),i),style:{color:m?l.primary:l.textMuted,fontWeight:m?600:400,borderBottom:m?`2px solid ${l.primary}`:"2px solid transparent",marginBottom:"-2px",...o},onClick:()=>!n&&d(t),onKeyDown:p=>B.handleTabsKeyboard(p,t,x,h=>{var y;d(h),(y=document.getElementById(`${u}-tab-${h}`))==null||y.focus()}),children:r})}function Rs({children:t,className:r,...n}){return e.jsx("div",{className:r,...n,children:t})}function Ls({index:t,children:r,style:n,className:i}){const{activeIndex:o,baseId:l}=Ur();return o!==t?null:e.jsx("div",{role:"tabpanel",id:`${l}-panel-${t}`,"aria-labelledby":`${l}-tab-${t}`,tabIndex:0,className:s.cx(s.tkx("pt-4"),i),style:n,children:r})}const Ds={top:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:6},bottom:{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:6},left:{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:6},right:{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:6}};function As({content:t,children:r,placement:n="top",delay:i=300}){const o=B.useTheme(),[l,c]=a.useState(!1),d=a.useRef(null),u=a.useId(),x=a.useRef(null),f=s.useReducedMotion(),m=s.sanitizeString(t),p=B.getAccessibleForeground(o.surfaceAlt,[o.text,"#ffffff","#000000"]);function h(){x.current=setTimeout(()=>c(!0),i)}function y(){x.current&&clearTimeout(x.current),c(!1)}s.useEscapeKey(y,l),s.useClickOutside(d,y);const k=a.cloneElement(r,{"aria-describedby":l?u:void 0,onMouseEnter:b=>{var g,w;(w=(g=r.props).onMouseEnter)==null||w.call(g,b),h()},onMouseLeave:b=>{var g,w;(w=(g=r.props).onMouseLeave)==null||w.call(g,b),y()},onFocus:b=>{var g,w;(w=(g=r.props).onFocus)==null||w.call(g,b),h()},onBlur:b=>{var g,w;(w=(g=r.props).onBlur)==null||w.call(g,b),y()}});return e.jsxs("span",{ref:d,className:s.tkx("relative inline-flex"),children:[k,l&&e.jsx("span",{id:u,role:"tooltip",className:s.tkx("absolute z-[9000] text-xs font-sans py-1.5 px-2.5 rounded-md whitespace-nowrap pointer-events-none",!f&&"animate-fade-in"),style:{backgroundColor:o.surfaceAlt,color:p,border:`1px solid ${o.border}`,boxShadow:`0 4px 12px ${o.bg}40`,maxWidth:280,...Ds[n]},children:m})]})}function qt({variant:t,width:r,height:n,animation:i,bgColor:o,accentColor:l}){const c=r!==void 0?typeof r=="number"?`${r}px`:r:"100%",u=n!==void 0?typeof n=="number"?`${n}px`:n:{text:"1em",circular:c,rectangular:"80px"}[t],x=s.tkx(t==="circular"?"rounded-full":t==="text"?"rounded":"rounded-lg"),f=i==="pulse"?s.tkx("animate-pulse"):i==="wave"?s.tkx("animate-shimmer"):"",m=i==="wave"?{background:`linear-gradient(90deg,${o} 25%,${l} 50%,${o} 75%)`,backgroundSize:"200% 100%"}:{backgroundColor:o};return e.jsx("div",{className:s.cx(x,f),style:{width:c,height:u,...m}})}const Ct=a.forwardRef(({variant:t="rectangular",width:r,height:n,lines:i,animation:o="pulse",className:l,style:c,...d},u)=>{const x=B.useTheme(),m=s.useReducedMotion()?!1:o;return t==="text"&&i&&i>1?e.jsx("div",{ref:u,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:s.cx(s.tkx("flex flex-col gap-2"),l),style:c,...d,children:Array.from({length:i},(p,h)=>e.jsx(qt,{variant:"text",width:h===i-1?"75%":r,height:n,animation:m,bgColor:x.surfaceAlt,accentColor:x.border},h))}):e.jsx("div",{ref:u,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:l,style:c,...d,children:e.jsx(qt,{variant:t,width:r,height:n,animation:m,bgColor:x.surfaceAlt,accentColor:x.border})})});Ct.displayName="TkxSkeleton";const Ps={xs:24,sm:32,md:40,lg:56,xl:72},Bs={online:"#06d6a0",offline:"#8888aa",away:"#ffbe0b",busy:"#f72585"},Kr=a.forwardRef(({src:t,alt:r,initials:n,size:i="md",shape:o="circle",status:l,className:c,style:d,...u},x)=>{const f=B.useTheme(),[m,p]=a.useState(!1),h=Ps[i],y=o==="circle",k=f.surfaceAlt,b=B.getAccessibleForeground(k,[f.text,f.textMuted]),g=t&&!m,w=!g&&n,j=Math.max(8,h*.22),S=s.tkx("relative inline-flex shrink-0",y?"rounded-full":"rounded-lg"),z=s.tkx("block object-cover",y?"rounded-full":"rounded-lg"),v=s.tkx("flex items-center justify-center font-semibold font-sans select-none",y?"rounded-full":"rounded-lg");return e.jsxs("div",{ref:x,className:s.cx(S,c),style:{width:h,height:h,...d},...u,children:[g?e.jsx("img",{src:s.sanitizeString(t),alt:s.sanitizeString(r),onError:()=>p(!0),className:z,style:{width:h,height:h}}):e.jsx("div",{role:"img","aria-label":s.sanitizeString(r),className:v,style:{width:h,height:h,backgroundColor:k,color:b,fontSize:h*.38},children:w?s.sanitizeString(n).slice(0,2).toUpperCase():e.jsxs("svg",{width:h*.5,height:h*.5,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}),l&&e.jsx("span",{"aria-label":`Status: ${l}`,className:s.tkx("absolute bottom-0 right-0 rounded-full"),style:{width:j,height:j,backgroundColor:Bs[l],border:`2px solid ${f.bg}`}})]})});Kr.displayName="TkxAvatar";function Fs({dir:t}){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:s.tkx("shrink-0"),children:t==="asc"?e.jsx("path",{d:"M7 14l5-5 5 5H7z"}):t==="desc"?e.jsx("path",{d:"M7 10l5 5 5-5H7z"}):e.jsx("path",{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.4"})})}function Ws({columns:t,data:r,caption:n,sortable:i,stickyHeader:o,isLoading:l,emptyState:c,style:d,className:u,striped:x}){const f=B.useTheme(),[m,p]=a.useState(null),[h,y]=a.useState("asc"),k=a.useMemo(()=>!m||!i?r:[...r].sort((w,j)=>{const S=w[m],z=j[m];let v=0;return typeof S=="string"&&typeof z=="string"?v=S.localeCompare(z):typeof S=="number"&&typeof z=="number"&&(v=S-z),h==="asc"?v:-v}),[r,m,h,i]);function b(w){m===w?y(j=>j==="asc"?"desc":"asc"):(p(w),y("asc"))}function g(w){return m!==w?"none":h}return e.jsx("div",{className:s.tkx("w-full overflow-x-auto rounded-lg",u??""),style:{border:`1px solid ${f.border}`,...d},children:e.jsxs("table",{className:s.tkx("w-full font-sans text-sm"),style:{borderCollapse:"collapse",color:f.text},children:[n&&e.jsx("caption",{className:s.tkx("text-sm text-left p-2"),style:{color:f.textMuted},children:s.sanitizeString(n)}),e.jsx("thead",{style:o?{position:"sticky",top:0,backgroundColor:f.surfaceAlt,zIndex:1}:{backgroundColor:f.surfaceAlt},children:e.jsx("tr",{children:t.map(w=>{const j=i&&w.sortable!==!1,S=g(w.key);return e.jsx("th",{scope:"col","aria-sort":j?S==="none"?"none":S==="asc"?"ascending":"descending":void 0,className:s.tkx("px-4 py-3 text-left font-semibold whitespace-nowrap",j?"cursor-pointer select-none focus-visible:focus-ring":""),style:{color:f.textMuted,borderBottom:`2px solid ${f.border}`,width:w.width},onClick:()=>j&&b(w.key),onKeyDown:z=>{j&&(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),b(w.key))},tabIndex:j?0:void 0,children:e.jsxs("span",{className:s.tkx("inline-flex items-center gap-1.5"),children:[s.sanitizeString(w.header),j&&e.jsx(Fs,{dir:S})]})},String(w.key))})})}),e.jsx("tbody",{children:l?Array.from({length:5},(w,j)=>e.jsx("tr",{children:t.map(S=>e.jsx("td",{className:s.tkx("px-4 py-3"),children:e.jsx(Ct,{variant:"text",height:"16px"})},String(S.key)))},j)):k.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:s.tkx("px-4 py-8 text-center"),style:{color:f.textMuted},children:c??"No data available"})}):k.map((w,j)=>e.jsx("tr",{style:{backgroundColor:x&&j%2===1?f.surfaceAlt:"transparent",borderBottom:`1px solid ${f.border}`},children:t.map(S=>{const z=w[S.key],v=S.render?S.render(z,w):typeof z=="string"?s.sanitizeString(z):String(z??"");return e.jsx("td",{className:s.tkx("px-4 py-3"),style:{color:f.text},children:v},String(S.key))})},j))})]})})}const Xr=a.forwardRef(({orientation:t="horizontal",label:r,variant:n="solid",className:i,style:o,...l},c)=>{const d=B.useTheme(),u=r?s.sanitizeString(r):void 0,x=t==="vertical",f=x?"borderLeft":"borderTop",m=`1px ${n} ${d.border}`;return u?e.jsxs("div",{role:"separator","aria-orientation":t,className:s.cx(s.tkx("flex items-center gap-3 text-xs"),i),style:{color:d.textMuted,...o},...l,children:[e.jsx("hr",{className:s.tkx("flex-1 m-0 border-none"),style:{[f]:m}}),e.jsx("span",{children:u}),e.jsx("hr",{className:s.tkx("flex-1 m-0 border-none"),style:{[f]:m}})]}):e.jsx("hr",{ref:c,role:"separator","aria-orientation":t,className:s.cx(s.tkx(x?"inline-block self-stretch border-none w-0 h-full":"w-full border-none m-0"),i),style:{[f]:m,...o},...l})});Xr.displayName="TkxDivider";const Hs={sm:{py:"6px",px:"10px",fontSize:"13px",iconSize:14,tagPy:"1px",tagPx:"6px"},md:{py:"9px",px:"12px",fontSize:"14px",iconSize:16,tagPy:"2px",tagPx:"8px"},lg:{py:"12px",px:"14px",fontSize:"15px",iconSize:18,tagPy:"3px",tagPx:"10px"}};function Zt(t){return t===void 0?[]:Array.isArray(t)?t:[t]}function Vs(t,r){const n=t.getBoundingClientRect(),i=window.innerHeight,o=6,l=i-n.bottom-o,c=n.top-o,d=l>=Math.min(r,200)||l>=c?"below":"above";return{top:d==="below"?n.bottom+window.scrollY+o:n.top+window.scrollY-o-Math.min(r,280),left:n.left+window.scrollX,width:n.width,placement:d}}function Os({size:t,color:r}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",style:{animation:"tkx-spin 0.7s linear infinite"},children:[e.jsx("style",{children:"@keyframes tkx-spin{to{transform:rotate(360deg)}}"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10"})]})}function qr({options:t,value:r,defaultValue:n,placeholder:i="Select an option…",size:o="md",isDisabled:l=!1,isInvalid:c=!1,label:d,hint:u,errorMessage:x,multiple:f=!1,searchable:m=!1,clearable:p=!1,isLoading:h=!1,onChange:y,renderOption:k,maxMenuHeight:b=280,virtualScroll:g,optionHeight:w=36,id:j,className:S,style:z}){const v=B.useTheme(),N=a.useId(),C=j??N,M=`${C}-listbox`,T=`${C}-hint`,E=`${C}-error`,$=r!==void 0,[F,I]=a.useState(Zt(n)),W=$?Zt(r):F,[L,Y]=a.useState(!1),[D,V]=a.useState(""),[R,P]=a.useState(-1),[A,O]=a.useState(null),[G,ee]=a.useState(""),oe=a.useRef(null),ae=a.useRef(null),fe=a.useRef(null),de=a.useRef(null),ge=a.useRef(null),U=Hs[o],se=c||!!x,he=a.useRef(null),[we,ce]=a.useState(0),[me,re]=a.useState(0),le=a.useCallback(()=>{he.current&&ce(he.current.scrollTop)},[]);a.useEffect(()=>{if(!L){ce(0);return}const H=he.current;if(!H)return;re(H.clientHeight);const Q=new ResizeObserver(()=>{re(H.clientHeight)});return Q.observe(H),()=>Q.disconnect()},[L]);const J=m&&D?t.filter(H=>H.label.toLowerCase().includes(D.toLowerCase())):t,X=J.filter(H=>!H.disabled),ne=J.some(H=>!!H.group),ke=(g!==void 0?g:J.length>=100)&&!ne,Te=8,Me=J.length*w,He=ke?Math.max(0,Math.floor(we/w)-Te):0,$e=ke?Math.min(J.length,Math.ceil((we+me)/w)+Te):J.length,ze=ke?J.slice(He,$e):J,Ke=He*w,Xe=J.reduce((H,Q)=>{const ie=Q.group??"";return H[ie]||(H[ie]=[]),H[ie].push(Q),H},{}),De=a.useCallback(H=>{var ie;let Q;f?Q=W.includes(H)?W.filter(be=>be!==H):[...W,H]:Q=[H],$||I(Q),y==null||y(f?Q:Q[0]??""),f||(Y(!1),V(""),P(-1),(ie=ae.current)==null||ie.focus())},[$,f,y,W]),Pe=a.useCallback((H,Q)=>{Q.stopPropagation();const ie=W.filter(be=>be!==H);$||I(ie),y==null||y(f?ie:ie[0]??"")},[$,f,y,W]),Oe=a.useCallback(H=>{H.stopPropagation(),$||I([]),y==null||y(f?[]:"")},[$,f,y]),Ie=a.useCallback(()=>{!ae.current||!L||O(Vs(ae.current,b))},[L,b]);a.useEffect(()=>{if(L)return Ie(),window.addEventListener("scroll",Ie,!0),window.addEventListener("resize",Ie),()=>{window.removeEventListener("scroll",Ie,!0),window.removeEventListener("resize",Ie)}},[L,Ie]),a.useEffect(()=>{if(!L)return;const H=Q=>{var be,Ye;const ie=Q.target;(be=ae.current)!=null&&be.contains(ie)||(Ye=de.current)!=null&&Ye.contains(ie)||(Y(!1),V(""))};return document.addEventListener("pointerdown",H),()=>document.removeEventListener("pointerdown",H)},[L]),a.useEffect(()=>{L&&m&&setTimeout(()=>{var H;return(H=fe.current)==null?void 0:H.focus()},0)},[L,m]),a.useEffect(()=>{var H;if(!(!L||R<0))if(ke&&he.current){const Q=R*w,ie=Q+w,be=he.current;Q<be.scrollTop?be.scrollTop=Q:ie>be.scrollTop+be.clientHeight&&(be.scrollTop=ie-be.clientHeight)}else{const Q=(H=ge.current)==null?void 0:H.querySelector(`[data-idx="${R}"]`);Q==null||Q.scrollIntoView({block:"nearest"})}},[R,L,ke,w]);const qe=H=>{switch(H.key){case"Enter":case" ":H.preventDefault(),L?R>=0&&X[R]&&De(X[R].value):q();break;case"Escape":H.preventDefault(),Y(!1),V("");break;case"ArrowDown":H.preventDefault(),L?P(Q=>Math.min(Q+1,X.length-1)):q();break;case"ArrowUp":H.preventDefault(),L?P(Q=>Math.max(Q-1,0)):q();break;case"Home":H.preventDefault(),L&&P(0);break;case"End":H.preventDefault(),L&&P(X.length-1);break;default:H.key.length===1&&!H.ctrlKey&&!H.metaKey&&(L||q(),Je(H.key))}},_e=H=>{var Q;switch(H.key){case"Escape":H.preventDefault(),Y(!1),V(""),(Q=ae.current)==null||Q.focus();break;case"ArrowDown":H.preventDefault(),P(ie=>Math.min(ie+1,X.length-1));break;case"ArrowUp":H.preventDefault(),P(ie=>Math.max(ie-1,0));break;case"Home":H.preventDefault(),P(0);break;case"End":H.preventDefault(),P(X.length-1);break;case"Enter":H.preventDefault(),R>=0&&X[R]&&De(X[R].value);break}};function Je(H){oe.current&&clearTimeout(oe.current);const Q=G+H.toLowerCase();ee(Q);const ie=X.findIndex(be=>be.label.toLowerCase().startsWith(Q));ie>=0&&P(ie),oe.current=setTimeout(()=>ee(""),800)}function q(){if(l||h)return;Y(!0);const H=X.findIndex(Q=>W.includes(Q.value));P(H>=0?H:0)}const te=se?v.danger:L?v.primary:v.border,ve=R>=0&&X[R]?`${C}-opt-${X[R].value}`:void 0,Se=[u&&T,se&&E].filter(Boolean).join(" ")||void 0,ye=W.map(H=>t.find(Q=>Q.value===H)).filter(Boolean),Be=L&&A?Le.createPortal(e.jsxs("div",{ref:de,role:"listbox",id:M,"aria-label":d?s.sanitizeString(d):"Options","aria-multiselectable":f,style:{position:"absolute",top:A.top,left:A.left,width:A.width,zIndex:9999,backgroundColor:v.surface,border:`1.5px solid ${v.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",overflow:"hidden",minWidth:A.width,maxHeight:b,display:"flex",flexDirection:"column"},children:[m&&e.jsxs("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${v.border}`,flexShrink:0,display:"flex",alignItems:"center",gap:6},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.textMuted,strokeWidth:"2","aria-hidden":"true",style:{flexShrink:0},children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]}),e.jsx("input",{ref:fe,type:"text",value:D,onChange:H=>{V(H.target.value),P(0)},onKeyDown:_e,placeholder:"Search…","aria-label":"Search options",style:{border:"none",outline:"none",background:"transparent",color:v.text,fontSize:U.fontSize,fontFamily:"inherit",width:"100%"}})]}),e.jsx("div",{ref:H=>{ge.current=H,he.current=H},onScroll:ke?le:void 0,style:{overflowY:"auto",flexGrow:1,maxHeight:b-(m?48:0)},children:ke?e.jsxs("div",{style:{height:Me,position:"relative"},children:[e.jsx("div",{style:{position:"absolute",top:Ke,left:0,right:0},children:ze.map(H=>{const Q=X.indexOf(H),ie=Q===R,be=W.includes(H.value),Ye=k?k(H,be):e.jsxs("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[H.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:H.icon}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.sanitizeString(H.label)})]}),H.description&&e.jsx("span",{style:{fontSize:"12px",color:v.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.sanitizeString(H.description)})]});return e.jsxs("div",{id:`${C}-opt-${H.value}`,"data-idx":Q>=0?Q:void 0,role:"option","aria-selected":be,"aria-disabled":H.disabled||void 0,onClick:()=>!H.disabled&&De(H.value),onMouseEnter:()=>!H.disabled&&Q>=0&&P(Q),style:{height:w,boxSizing:"border-box",padding:`0 ${U.px}`,fontSize:U.fontSize,fontFamily:"inherit",color:H.disabled?v.textMuted:v.text,backgroundColor:ie?`${v.primary}22`:be?`${v.primary}12`:"transparent",cursor:H.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:H.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[Ye,be&&!k&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})]},H.value)})}),J.length===0&&e.jsx("div",{style:{padding:`${U.py} ${U.px}`,fontSize:U.fontSize,fontFamily:"inherit",color:v.textMuted,textAlign:"center",position:"absolute",top:0,left:0,right:0},children:h?"Loading…":"No options found"})]}):e.jsxs(e.Fragment,{children:[Object.entries(Xe).map(([H,Q])=>e.jsxs("div",{children:[H&&e.jsx("div",{"aria-hidden":"true",style:{padding:"8px 12px 4px",fontSize:"11px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:v.textMuted,fontFamily:"inherit",position:"sticky",top:0,backgroundColor:v.surface,zIndex:1,borderBottom:`1px solid ${v.border}`},children:s.sanitizeString(H)}),Q.map(ie=>{const be=X.indexOf(ie),Ye=be===R,Qe=W.includes(ie.value),lt=k?k(ie,Qe):e.jsxs("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[ie.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:ie.icon}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.sanitizeString(ie.label)})]}),ie.description&&e.jsx("span",{style:{fontSize:"12px",color:v.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.sanitizeString(ie.description)})]});return e.jsxs("div",{id:`${C}-opt-${ie.value}`,"data-idx":be>=0?be:void 0,role:"option","aria-selected":Qe,"aria-disabled":ie.disabled||void 0,onClick:()=>!ie.disabled&&De(ie.value),onMouseEnter:()=>!ie.disabled&&be>=0&&P(be),style:{padding:`${U.py} ${U.px}`,fontSize:U.fontSize,fontFamily:"inherit",color:ie.disabled?v.textMuted:v.text,backgroundColor:Ye?`${v.primary}22`:Qe?`${v.primary}12`:"transparent",cursor:ie.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:ie.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[lt,Qe&&!k&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})]},ie.value)})]},H)),J.length===0&&e.jsx("div",{style:{padding:`${U.py} ${U.px}`,fontSize:U.fontSize,fontFamily:"inherit",color:v.textMuted,textAlign:"center"},children:h?"Loading…":"No options found"})]})})]}),document.body):null,Ee=p&&W.length>0&&!l&&!h;return e.jsxs("div",{className:s.cx(s.tkx("flex flex-col gap-1 w-full"),S),style:z,children:[d&&e.jsx("label",{htmlFor:C,style:{fontSize:"14px",fontWeight:500,fontFamily:"inherit",color:v.text,userSelect:"none"},children:s.sanitizeString(d)}),e.jsx("div",{style:{position:"relative",width:"100%",opacity:l?.55:1},children:e.jsxs("button",{ref:ae,id:C,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":L,"aria-controls":M,"aria-activedescendant":ve,"aria-invalid":se||void 0,"aria-describedby":Se,"aria-multiselectable":f,disabled:l,onClick:()=>L?Y(!1):q(),onKeyDown:qe,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:f&&W.length>0?`4px ${U.px}`:`${U.py} ${U.px}`,fontSize:U.fontSize,fontFamily:"inherit",backgroundColor:v.surface,color:W.length>0?v.text:v.textMuted,border:`1.5px solid ${te}`,borderRadius:8,boxSizing:"border-box",transition:"border-color 150ms",textAlign:"left",cursor:l?"not-allowed":"pointer",outline:"none",minHeight:o==="sm"?34:o==="lg"?50:42,flexWrap:"wrap",touchAction:"manipulation"},children:[e.jsx("span",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4,flex:1,minWidth:0},children:f&&ye.length>0?ye.map(H=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:`${U.tagPy} ${U.tagPx}`,fontSize:`calc(${U.fontSize} - 1px)`,fontFamily:"inherit",backgroundColor:`${v.primary}22`,color:v.primary,borderRadius:6,border:`1px solid ${v.primary}44`,lineHeight:1.4,maxWidth:150,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},children:s.sanitizeString(H.label)}),e.jsx("span",{role:"button","aria-label":`Remove ${s.sanitizeString(H.label)}`,tabIndex:-1,onClick:Q=>Pe(H.value,Q),style:{cursor:"pointer",flexShrink:0,display:"flex",alignItems:"center",opacity:.8},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]},H.value)):!f&&W.length>0?(()=>{const H=t.find(Q=>Q.value===W[0]);return e.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},children:[(H==null?void 0:H.icon)&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:H.icon}),H?s.sanitizeString(H.label):""]})})():e.jsx("span",{style:{opacity:.6},children:s.sanitizeString(i)})}),e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,color:v.textMuted},children:[h&&e.jsx(Os,{size:U.iconSize,color:v.primary}),Ee&&!h&&e.jsx("span",{role:"button","aria-label":"Clear selection",tabIndex:-1,onClick:Oe,style:{cursor:"pointer",display:"flex",alignItems:"center",lineHeight:1,opacity:.7,transition:"opacity 120ms"},onMouseEnter:H=>H.currentTarget.style.opacity="1",onMouseLeave:H=>H.currentTarget.style.opacity="0.7",children:e.jsx("svg",{width:U.iconSize,height:U.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),e.jsx("svg",{width:U.iconSize,height:U.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",style:{transform:L?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms",flexShrink:0},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]})]})}),u&&!se&&e.jsx("span",{id:T,style:{fontSize:"12px",color:v.textMuted,fontFamily:"inherit"},children:s.sanitizeString(u)}),se&&x&&e.jsxs("span",{id:E,role:"alert",style:{fontSize:"12px",color:v.danger,display:"flex",alignItems:"center",gap:4,fontFamily:"inherit"},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),s.sanitizeString(x)]}),Be]})}qr.displayName="TkxSelect";const _s={sm:{box:16,fontSize:"13px",iconStroke:2.5},md:{box:20,fontSize:"14px",iconStroke:2.5},lg:{box:24,fontSize:"15px",iconStroke:2}},Zr=a.forwardRef(({label:t,hint:r,isInvalid:n,errorMessage:i,isIndeterminate:o=!1,size:l="md",colorScheme:c="primary",checked:d,defaultChecked:u,onChange:x,disabled:f,className:m,style:p,id:h,...y},k)=>{const b=B.useTheme(),g=s.useReducedMotion(),w=a.useId(),j=h??w,S=`${j}-hint`,z=`${j}-error`,v=a.useRef(null),[N,C]=a.useState(!1),M=_s[l],T=n||!!i,$={primary:b.primary,success:b.success,danger:b.danger,warning:b.warning}[c]??b.primary,F=d!==void 0?d:void 0;a.useEffect(()=>{const P=(k==null?void 0:k.current)??v.current;P&&(P.indeterminate=o)},[o,k]);const I=o||(F??!1),W=I?$:b.surface,L=T?b.danger:I?$:b.border,Y=B.getAccessibleForeground($),D=N?{outline:`2px solid ${$}`,outlineOffset:"2px"}:{},V=[r&&S,T&&z].filter(Boolean).join(" ")||void 0,R=!g&&I?{animation:"tkx-check-scale-in 120ms ease forwards"}:{};return e.jsxs("div",{className:s.cx(s.tkx("flex flex-col gap-1"),m),style:{opacity:f?.5:1,...p},children:[e.jsx("style",{children:`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./index-BINBzXuY.cjs"),e=require("react/jsx-runtime"),i=require("react"),A=require("./security-C369oOWH.cjs"),Q=require("./TkxForm-DwV_n-eE.cjs"),x=require("./tkx-BeNyC0w7.cjs"),Le=require("react-dom"),nt=require("./i18n.cjs"),Vr={sm:"text-xs font-semibold",md:"text-sm font-semibold",lg:"text-base font-semibold",xl:"text-lg font-semibold"},Or={sm:"py-1.5 px-3",md:"py-2 px-4",lg:"py-2.5 px-5",xl:"py-3 px-6"},Xt={sm:"min-h-[32px]",md:"min-h-[40px]",lg:"min-h-[48px]",xl:"min-h-[56px]"},_r={sm:14,md:16,lg:18,xl:20};function Yr({size:t}){const n=_r[t];return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:x.tkx("animate-spin shrink-0"),children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeOpacity:"0.25"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}const _n=i.forwardRef(({variant:t="solid",size:n="md",colorScheme:r="primary",isLoading:o=!1,loadingText:s,leftIcon:l,rightIcon:a,isFullWidth:c=!1,glow:d=!1,disabled:f,children:u,className:h,style:p,...m},y)=>{const k=_.useTheme(),b=Q.useReducedMotion(),g=f||o,j={primary:k.primary,secondary:k.secondary,danger:k.danger,warning:k.warning,success:k.success}[r],w=_.getAccessibleForeground(j,["#ffffff","#000000",k.bg]),I=typeof u=="string"?A.sanitizeString(u):u,v=s?A.sanitizeString(s):void 0,N=t==="solid"?{backgroundColor:j,color:w,border:"none",boxShadow:d&&!b?`0 0 20px ${j}55`:void 0}:t==="outline"?{backgroundColor:"transparent",color:j,border:`2px solid ${j}`}:t==="ghost"?{backgroundColor:"transparent",color:j,border:"none"}:{backgroundColor:"transparent",color:j,border:"none",textDecoration:"underline"},$=x.tkx("inline-flex items-center justify-center gap-2","rounded-lg font-sans font-semibold","select-none relative overflow-hidden",Vr[n],Or[n],Xt[n],t!=="link"&&Xt[n],c&&"w-full",g?"cursor-not-allowed opacity-60":"cursor-pointer",!b&&"transition-all duration-200","focus-visible:focus-ring");return e.jsx("button",{ref:y,"aria-busy":o,"aria-disabled":g,disabled:g,className:x.cx($,h),style:{...N,...p},...m,children:o?e.jsxs(e.Fragment,{children:[e.jsx(Yr,{size:n}),v??I]}):e.jsxs(e.Fragment,{children:[l&&e.jsx("span",{"aria-hidden":"true",children:l}),I,a&&e.jsx("span",{"aria-hidden":"true",children:a})]})})});_n.displayName="TkxButton";const Kr={none:"",sm:"p-3",md:"p-5",lg:"p-7"},Yn=i.forwardRef(({variant:t="default",isHoverable:n,isClickable:r,padding:o="md",as:s,children:l,className:a,style:c,...d},f)=>{const u=_.useTheme(),h=Q.useReducedMotion(),p=s??(r?"button":"div"),m={default:{backgroundColor:u.surface,border:`1px solid ${u.border}`},glass:{backgroundColor:`${u.surface}cc`,backdropFilter:"blur(12px)",border:`1px solid ${u.border}55`,boxShadow:`0 4px 24px ${u.bg}40`},quantum:{backgroundColor:u.surfaceAlt,border:`1px solid ${u.primary}33`,boxShadow:`0 0 24px ${u.primary}18`},elevated:{backgroundColor:u.surface,boxShadow:`0 4px 20px ${u.bg}60`},outlined:{backgroundColor:"transparent",border:`2px solid ${u.border}`}}[t],y=x.tkx("rounded-xl w-full text-left block font-sans focus-visible:focus-ring",Kr[o],(n||r)&&!h&&"transition-transform duration-150 hover:scale-[1.01]",r?"cursor-pointer":"cursor-default");return e.jsx(p,{ref:f,className:x.cx("tkx-card",y,a),style:{color:u.text,...m,...c},...d,children:l})});Yn.displayName="TkxCard";function Ur({title:t,subtitle:n,action:r,children:o,className:s,...l}){const a=_.useTheme();return e.jsxs("div",{className:x.cx(x.tkx("flex justify-between items-start mb-4"),s),...l,children:[e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[t&&e.jsx("h3",{className:x.tkx("text-base font-semibold m-0"),style:{color:a.text},children:t}),n&&e.jsx("p",{className:x.tkx("text-sm mt-1 mb-0"),style:{color:a.textMuted},children:n}),o]}),r&&e.jsx("div",{className:x.tkx("ml-3 shrink-0"),children:r})]})}function Xr({children:t,className:n,...r}){return e.jsx("div",{className:x.cx(x.tkx(""),n),...r,children:t})}function Zr({children:t,className:n,style:r,...o}){const s=_.useTheme();return e.jsx("div",{className:x.cx(x.tkx("flex items-center justify-end gap-2 mt-4 pt-4"),n),style:{borderTop:`1px solid ${s.border}`,...r},...o,children:t})}const Kn=i.forwardRef(({label:t,id:n,error:r,hint:o,leftAddon:s,rightAddon:l,isInvalid:a,isRequired:c,disabled:d,className:f,style:u,...h},p)=>{const m=_.useTheme(),y=i.useId(),k=n??y,b=`${k}-hint`,g=`${k}-error`,M=a||!!r,j=[o&&b,M&&g].filter(Boolean).join(" ")||void 0,w=A.sanitizeString(t),I=r?A.sanitizeString(r):void 0,v=o?A.sanitizeString(o):void 0,N=M?m.danger:m.border;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),f),style:u,children:[e.jsxs("label",{htmlFor:k,className:x.tkx("text-sm font-medium font-sans"),style:{color:m.text},children:[w,c&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("ml-1"),style:{color:m.danger},children:"*"})]}),e.jsxs("div",{className:x.tkx("flex items-center rounded-lg overflow-hidden","transition-colors duration-150",d?"opacity-60":""),style:{border:`1.5px solid ${N}`,backgroundColor:m.surface},children:[s&&e.jsx("div",{className:x.tkx("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:m.surfaceAlt,color:m.textMuted,borderRight:`1px solid ${m.border}`},children:s}),e.jsx("input",{ref:p,id:k,"aria-invalid":M,"aria-required":c,"aria-describedby":j,disabled:d,className:x.cx(x.tkx("flex-1 border-none bg-transparent text-sm font-sans py-2.5 px-3 outline-none min-w-0 focus-visible:focus-ring")),style:{color:m.text},...h}),l&&e.jsx("div",{className:x.tkx("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:m.surfaceAlt,color:m.textMuted,borderLeft:`1px solid ${m.border}`},children:l})]}),v&&!I&&e.jsx("span",{id:b,className:x.tkx("text-xs"),style:{color:m.textMuted},children:v}),I&&e.jsxs("span",{id:g,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:m.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),I]})]})});Kn.displayName="TkxInput";const Gr={sm:"text-xs px-1.5 py-[2px] min-h-[16px]",md:"text-xs px-2 py-[3px] min-h-[20px]",lg:"text-sm px-3 py-1 min-h-[24px]"},qr={sm:"size-[6px]",md:"size-2",lg:"size-2.5"},Un=i.forwardRef(({variant:t="default",size:n="md",dot:r=!1,pulse:o=!1,outlined:s=!1,children:l,className:a,style:c,...d},f)=>{const u=_.useTheme(),p={default:u.border,primary:u.primary,secondary:u.secondary,danger:u.danger,warning:u.warning,success:u.success,info:u.info}[t],m=_.getAccessibleForeground(p,["#ffffff","#000000",u.bg]),y=typeof l=="string"?A.sanitizeString(l):l;return r?e.jsx("span",{ref:f,"aria-label":typeof l=="string"?A.sanitizeString(l):void 0,className:x.cx(x.tkx("inline-block rounded-full",qr[n],o&&"animate-pulse"),a),style:{backgroundColor:p,...c},...d}):e.jsx("span",{ref:f,className:x.cx(x.tkx("inline-flex items-center justify-center rounded-full font-semibold font-sans tracking-wide",Gr[n],o&&"animate-pulse"),a),style:{backgroundColor:s?"transparent":p,color:s?p:m,border:s?`1px solid ${p}`:"none",...c},...d,children:y})});Un.displayName="TkxBadge";const Qr={sm:"4px",md:"8px",lg:"12px"},Jr={sm:32,md:48,lg:64},Xn=i.forwardRef(({value:t,variant:n="linear",size:r="md",label:o,showValue:s,color:l,className:a,style:c,...d},f)=>{const u=_.useTheme(),h=Q.useReducedMotion(),p=l??u.primary,m=t===void 0,y=t!==void 0?Math.min(100,Math.max(0,t)):0;if(t!==void 0){const{errors:b}=A.validateProps({value:t},{value:{type:"number",min:0,max:100}});b.length>0&&console.warn("[TkxProgress]",b.join(", "))}if(n==="circular"){const b=Jr[r],g=r==="sm"?3:r==="md"?4:5,M=(b-g*2)/2,j=2*Math.PI*M,w=m?0:j-y/100*j;return e.jsxs("div",{ref:f,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m?void 0:y,"aria-label":o??(m?"Loading":`${y}%`),className:x.cx(x.tkx("inline-flex flex-col items-center gap-1"),a),style:c,...d,children:[e.jsxs("svg",{width:b,height:b,viewBox:`0 0 ${b} ${b}`,"aria-hidden":"true",children:[e.jsx("circle",{cx:b/2,cy:b/2,r:M,fill:"none",stroke:u.border,strokeWidth:g}),e.jsx("circle",{cx:b/2,cy:b/2,r:M,fill:"none",stroke:p,strokeWidth:g,strokeLinecap:"round",strokeDasharray:j,strokeDashoffset:w,transform:`rotate(-90 ${b/2} ${b/2})`,style:{transition:h?"none":"stroke-dashoffset 300ms ease",animation:m&&!h?"tkx-spin 1s linear infinite":void 0}})]}),s&&!m&&e.jsxs("span",{className:x.tkx("text-xs"),style:{color:u.textMuted},children:[y,"%"]})]})}const k=Qr[r];return e.jsxs("div",{ref:f,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m?void 0:y,"aria-label":o??(m?"Loading":`${y}%`),className:x.cx(x.tkx("flex flex-col gap-1 w-full"),a),style:c,...d,children:[o&&e.jsxs("div",{className:x.tkx("flex justify-between text-sm"),style:{color:u.text},children:[e.jsx("span",{children:o}),s&&!m&&e.jsxs("span",{children:[y,"%"]})]}),e.jsx("div",{className:x.tkx("w-full overflow-hidden"),style:{height:k,borderRadius:k,backgroundColor:u.border},children:e.jsx("div",{style:{height:"100%",borderRadius:k,backgroundColor:p,width:m?"40%":`${y}%`,transition:h?"none":"width 300ms ease",animation:m&&!h?"tkx-shimmer 1.5s ease-in-out infinite":void 0}})})]})});Xn.displayName="TkxProgress";const es={sm:{tw:28,th:16,td:10,gap:3},md:{tw:40,th:22,td:14,gap:4},lg:{tw:52,th:28,td:18,gap:5}},Zn=i.forwardRef(({checked:t,onChange:n,label:r,size:o="md",hideLabel:s,disabled:l,className:a,style:c,...d},f)=>{const u=_.useTheme(),h=Q.useReducedMotion(),p=i.useId();A.validateProps({label:r,checked:t},{label:{type:"string",required:!0},checked:{type:"boolean",required:!0}});const{tw:m,th:y,td:k,gap:b}=es[o],g=t?m-k-b:b,M=t?u.primary:u.border;return e.jsxs("div",{className:x.cx(x.tkx("inline-flex items-center gap-2",l?"opacity-50":""),a),style:c,children:[!s&&e.jsx("label",{htmlFor:p,className:x.tkx("text-sm font-sans",l?"cursor-not-allowed":"cursor-pointer","select-none"),style:{color:u.text},children:r}),e.jsx("button",{ref:f,id:p,role:"switch","aria-checked":t,"aria-label":s?r:void 0,disabled:l,onClick:()=>!l&&n(!t),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&!l&&(j.preventDefault(),n(!t))},className:x.cx(x.tkx("relative border-none p-0 outline-none shrink-0 focus-visible:focus-ring",l?"cursor-not-allowed":"cursor-pointer",!h&&"transition-colors duration-200")),style:{width:m,height:y,borderRadius:y,backgroundColor:M},...d,children:e.jsx("span",{"aria-hidden":"true",className:x.tkx("absolute rounded-full"),style:{top:"50%",left:g,width:k,height:k,transform:"translateY(-50%)",backgroundColor:"#ffffff",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",transition:h?"none":"left 200ms ease"}})})]})});Zn.displayName="TkxToggle";const ts={info:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),success:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),warning:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),danger:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})})};function ns({variant:t,title:n,children:r,dismissible:o,onDismiss:s,icon:l,style:a,className:c}){const d=_.useTheme(),f=Q.useAnnounce(),u=n?A.sanitizeString(n):void 0;i.useEffect(()=>{u&&f(u,t==="danger"||t==="warning"?"assertive":"polite")},[u,t,f]);const p={info:d.info,success:d.success,warning:d.warning,danger:d.danger}[t],m=t==="danger"||t==="warning"?"alert":"status";return e.jsxs("div",{role:m,className:x.tkx("flex items-start gap-3 px-4 py-3 rounded-lg border animate-fade-in font-sans",c??""),style:{backgroundColor:`${p}18`,borderColor:p,color:d.text,...a},children:[e.jsx("span",{className:x.tkx("shrink-0 mt-[1px]"),style:{color:p},children:l??ts[t]}),e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[u&&e.jsx("p",{className:x.tkx("m-0 font-semibold text-sm mb-1"),children:u}),e.jsx("div",{className:x.tkx("text-sm leading-relaxed"),children:r})]}),o&&s&&e.jsx("button",{"aria-label":"Dismiss alert",onClick:s,className:x.tkx("bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring"),style:{color:d.textMuted},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}const rs={sm:"400px",md:"560px",lg:"720px",full:"100vw"};let Wt=0;function ss(){++Wt===1&&(document.body.style.overflow="hidden")}function Zt(){--Wt<=0&&(Wt=0,document.body.style.overflow="")}function os({isOpen:t,onClose:n,title:r,size:o="md",closeOnOverlayClick:s=!0,closeOnEscape:l=!0,children:a,footer:c}){const d=_.useTheme(),f=i.useId(),u=Q.useFocusTrap(t),h=Q.useReducedMotion(),p=Q.useAnnounce(),m=A.sanitizeString(r),y=o==="full";return Q.useEscapeKey(n,l&&t),i.useEffect(()=>(t?(ss(),p(m,"polite")):Zt(),()=>{t&&Zt()}),[t,m,p]),!t||typeof document>"u"?null:Le.createPortal(e.jsxs("div",{role:"presentation",className:x.tkx("fixed inset-0 z-[9000] flex",y?"items-stretch":"items-center justify-center",y?"":"p-4"),children:[e.jsx("div",{"aria-hidden":"true",onClick:s?n:void 0,className:x.tkx("absolute inset-0",!h&&"animate-fade-in"),style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}),e.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-labelledby":f,className:x.tkx("relative z-10 flex flex-col overflow-hidden",!h&&"animate-slide-up",y?"":"rounded-xl"),style:{backgroundColor:d.surface,border:`1px solid ${d.border}`,width:rs[o],maxWidth:"100%",maxHeight:y?"100vh":"90vh",boxShadow:`0 20px 60px ${d.bg}80`},children:[e.jsxs("div",{className:x.tkx("flex items-center justify-between px-6 py-5 shrink-0"),style:{borderBottom:`1px solid ${d.border}`},children:[e.jsx("h2",{id:f,className:x.tkx("m-0 text-lg font-semibold font-sans"),style:{color:d.text},children:m}),e.jsx("button",{onClick:n,"aria-label":"Close dialog",className:x.tkx("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:d.textMuted},children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("div",{className:x.tkx("flex-1 overflow-y-auto px-6 py-6 font-sans"),style:{color:d.text},children:a}),c&&e.jsx("div",{className:x.tkx("flex justify-end gap-2 px-6 py-4 shrink-0"),style:{borderTop:`1px solid ${d.border}`},children:c})]})]}),document.body)}const Gn=i.createContext(null);function qn(){const t=i.useContext(Gn);if(!t)throw new Error("TkxTab must be used inside TkxTabs");return t}function is({defaultIndex:t=0,activeIndex:n,onChange:r,children:o,tabCount:s=0,style:l,className:a}){const[c,d]=i.useState(t),f=i.useId(),u=n!==void 0?n:c,h=p=>{n===void 0&&d(p),r==null||r(p)};return e.jsx(Gn.Provider,{value:{activeIndex:u,setActiveIndex:h,baseId:f,tabCount:s},children:e.jsx("div",{className:a,style:l,children:o})})}function ls({children:t,className:n,style:r,...o}){const s=_.useTheme();return e.jsx("div",{role:"tablist",className:x.cx(x.tkx("flex gap-1"),n),style:{borderBottom:`2px solid ${s.border}`,...r},...o,children:t})}function as({index:t,children:n,disabled:r=!1,className:o,style:s}){const l=_.useTheme(),{activeIndex:a,setActiveIndex:c,baseId:d,tabCount:f}=qn(),u=i.useRef(null),h=a===t;return e.jsx("button",{ref:u,role:"tab",id:`${d}-tab-${t}`,"aria-controls":`${d}-panel-${t}`,"aria-selected":h,tabIndex:h?0:-1,disabled:r,className:x.cx(x.tkx("border-none bg-transparent font-sans text-sm rounded-t cursor-pointer select-none","py-2.5 px-4 transition-colors duration-150 focus-visible:focus-ring",r?"opacity-50 cursor-not-allowed":""),o),style:{color:h?l.primary:l.textMuted,fontWeight:h?600:400,borderBottom:h?`2px solid ${l.primary}`:"2px solid transparent",marginBottom:"-2px",...s},onClick:()=>!r&&c(t),onKeyDown:p=>_.handleTabsKeyboard(p,t,f,m=>{var y;c(m),(y=document.getElementById(`${d}-tab-${m}`))==null||y.focus()}),children:n})}function cs({children:t,className:n,...r}){return e.jsx("div",{className:n,...r,children:t})}function ds({index:t,children:n,style:r,className:o}){const{activeIndex:s,baseId:l}=qn();return s!==t?null:e.jsx("div",{role:"tabpanel",id:`${l}-panel-${t}`,"aria-labelledby":`${l}-tab-${t}`,tabIndex:0,className:x.cx(x.tkx("pt-4"),o),style:r,children:n})}const us={top:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:6},bottom:{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:6},left:{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:6},right:{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:6}};function fs({content:t,children:n,placement:r="top",delay:o=300}){const s=_.useTheme(),[l,a]=i.useState(!1),c=i.useRef(null),d=i.useId(),f=i.useRef(null),u=Q.useReducedMotion(),h=A.sanitizeString(t),p=_.getAccessibleForeground(s.surfaceAlt,[s.text,"#ffffff","#000000"]);function m(){f.current=setTimeout(()=>a(!0),o)}function y(){f.current&&clearTimeout(f.current),a(!1)}Q.useEscapeKey(y,l),Q.useClickOutside(c,y);const k=i.cloneElement(n,{"aria-describedby":l?d:void 0,onMouseEnter:b=>{var g,M;(M=(g=n.props).onMouseEnter)==null||M.call(g,b),m()},onMouseLeave:b=>{var g,M;(M=(g=n.props).onMouseLeave)==null||M.call(g,b),y()},onFocus:b=>{var g,M;(M=(g=n.props).onFocus)==null||M.call(g,b),m()},onBlur:b=>{var g,M;(M=(g=n.props).onBlur)==null||M.call(g,b),y()}});return e.jsxs("span",{ref:c,className:x.tkx("relative inline-flex"),children:[k,l&&e.jsx("span",{id:d,role:"tooltip",className:x.tkx("absolute z-[9000] text-xs font-sans py-1.5 px-2.5 rounded-md whitespace-nowrap pointer-events-none",!u&&"animate-fade-in"),style:{backgroundColor:s.surfaceAlt,color:p,border:`1px solid ${s.border}`,boxShadow:`0 4px 12px ${s.bg}40`,maxWidth:280,...us[r]},children:h})]})}function Gt({variant:t,width:n,height:r,animation:o,bgColor:s,accentColor:l}){const a=n!==void 0?typeof n=="number"?`${n}px`:n:"100%",d=r!==void 0?typeof r=="number"?`${r}px`:r:{text:"1em",circular:a,rectangular:"80px"}[t],f=x.tkx(t==="circular"?"rounded-full":t==="text"?"rounded":"rounded-lg"),u=o==="pulse"?x.tkx("animate-pulse"):o==="wave"?x.tkx("animate-shimmer"):"",h=o==="wave"?{background:`linear-gradient(90deg,${s} 25%,${l} 50%,${s} 75%)`,backgroundSize:"200% 100%"}:{backgroundColor:s};return e.jsx("div",{className:x.cx(f,u),style:{width:a,height:d,...h}})}const xt=i.forwardRef(({variant:t="rectangular",width:n,height:r,lines:o,animation:s="pulse",className:l,style:a,...c},d)=>{const f=_.useTheme(),h=Q.useReducedMotion()?!1:s;return t==="text"&&o&&o>1?e.jsx("div",{ref:d,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:x.cx(x.tkx("flex flex-col gap-2"),l),style:a,...c,children:Array.from({length:o},(p,m)=>e.jsx(Gt,{variant:"text",width:m===o-1?"75%":n,height:r,animation:h,bgColor:f.surfaceAlt,accentColor:f.border},m))}):e.jsx("div",{ref:d,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:l,style:a,...c,children:e.jsx(Gt,{variant:t,width:n,height:r,animation:h,bgColor:f.surfaceAlt,accentColor:f.border})})});xt.displayName="TkxSkeleton";const xs={xs:24,sm:32,md:40,lg:56,xl:72},ps={online:"#06d6a0",offline:"#8888aa",away:"#ffbe0b",busy:"#f72585"},Qn=i.forwardRef(({src:t,alt:n,initials:r,size:o="md",shape:s="circle",status:l,className:a,style:c,...d},f)=>{const u=_.useTheme(),[h,p]=i.useState(!1),m=xs[o],y=s==="circle",k=u.surfaceAlt,b=_.getAccessibleForeground(k,[u.text,u.textMuted]),g=t&&!h,M=!g&&r,j=Math.max(8,m*.22),w=x.tkx("relative inline-flex shrink-0",y?"rounded-full":"rounded-lg"),I=x.tkx("block object-cover",y?"rounded-full":"rounded-lg"),v=x.tkx("flex items-center justify-center font-semibold font-sans select-none",y?"rounded-full":"rounded-lg");return e.jsxs("div",{ref:f,className:x.cx(w,a),style:{width:m,height:m,...c},...d,children:[g?e.jsx("img",{src:A.sanitizeString(t),alt:A.sanitizeString(n),onError:()=>p(!0),className:I,style:{width:m,height:m}}):e.jsx("div",{role:"img","aria-label":A.sanitizeString(n),className:v,style:{width:m,height:m,backgroundColor:k,color:b,fontSize:m*.38},children:M?A.sanitizeString(r).slice(0,2).toUpperCase():e.jsxs("svg",{width:m*.5,height:m*.5,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}),l&&e.jsx("span",{"aria-label":`Status: ${l}`,className:x.tkx("absolute bottom-0 right-0 rounded-full"),style:{width:j,height:j,backgroundColor:ps[l],border:`2px solid ${u.bg}`}})]})});Qn.displayName="TkxAvatar";function hs({dir:t}){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:x.tkx("shrink-0"),children:t==="asc"?e.jsx("path",{d:"M7 14l5-5 5 5H7z"}):t==="desc"?e.jsx("path",{d:"M7 10l5 5 5-5H7z"}):e.jsx("path",{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.4"})})}function ms({columns:t,data:n,caption:r,sortable:o,stickyHeader:s,isLoading:l,emptyState:a,style:c,className:d,striped:f,maxHeight:u,rowHeight:h=44,virtualScroll:p,onLoadMore:m,hasMore:y,loadingMore:k=!1,onRowClick:b,selectedRows:g,bordered:M,compact:j}){const w=_.useTheme(),[I,v]=i.useState(null),[N,$]=i.useState("asc"),S=i.useMemo(()=>!I||!o?n:[...n].sort((te,ce)=>{const Y=te[I],se=ce[I];let le=0;return typeof Y=="string"&&typeof se=="string"?le=Y.localeCompare(se):typeof Y=="number"&&typeof se=="number"&&(le=Y-se),N==="asc"?le:-le}),[n,I,N,o]),T=i.useCallback(te=>{I===te?$(ce=>ce==="asc"?"desc":"asc"):(v(te),$("asc"))},[I]);function E(te){return I!==te?"none":N}const C=5,H=p!==void 0?p:u!==void 0&&S.length>=50,z=i.useRef(null),[R,B]=i.useState(0),[V,D]=i.useState(400),O=i.useCallback(()=>{z.current&&B(z.current.scrollTop)},[]);i.useEffect(()=>{if(!H||!z.current)return;const te=z.current;D(te.clientHeight);const ce=new ResizeObserver(()=>D(te.clientHeight));return ce.observe(te),()=>ce.disconnect()},[H]);const L=H?Math.max(0,Math.floor(R/h)-C):0,P=H?Math.min(S.length,Math.ceil((R+V)/h)+C):S.length,W=H?S.slice(L,P):S,K=i.useRef(null),ne=i.useRef(!1);i.useEffect(()=>{ne.current=!1},[n.length]),i.useEffect(()=>{if(!m)return;const te=K.current;if(!te)return;const ce=new IntersectionObserver(Y=>{Y[0].isIntersecting&&!ne.current&&y!==!1&&(ne.current=!0,m())},{root:z.current,rootMargin:"0px 0px 200px 0px",threshold:0});return ce.observe(te),()=>ce.disconnect()},[m,y]);const Z=j?"4px":"12px",ie=j?"8px":"16px",fe=M?`1px solid ${w.border}`:"none",pe=i.useMemo(()=>new Set(g??[]),[g]);return e.jsx("div",{className:x.tkx("w-full rounded-lg",d??""),style:{border:`1px solid ${w.border}`,overflow:"hidden",...c},children:e.jsxs("div",{ref:z,onScroll:H?O:void 0,style:{overflowX:"auto",overflowY:u?"auto":"visible",maxHeight:u??"none"},children:[e.jsxs("table",{className:x.tkx("w-full font-sans text-sm"),style:{borderCollapse:"collapse",color:w.text},children:[r&&e.jsx("caption",{className:x.tkx("text-sm text-left p-2"),style:{color:w.textMuted},children:A.sanitizeString(r)}),e.jsx("thead",{style:s?{position:"sticky",top:0,backgroundColor:w.surfaceAlt,zIndex:1}:{backgroundColor:w.surfaceAlt},children:e.jsx("tr",{children:t.map(te=>{const ce=o&&te.sortable!==!1,Y=E(te.key);return e.jsx("th",{scope:"col","aria-sort":ce?Y==="none"?"none":Y==="asc"?"ascending":"descending":void 0,className:x.tkx("text-left font-semibold whitespace-nowrap",ce?"cursor-pointer select-none":""),style:{padding:`${Z} ${ie}`,color:w.textMuted,borderBottom:`2px solid ${w.border}`,borderRight:fe,width:te.width},onClick:()=>ce&&T(te.key),onKeyDown:se=>{ce&&(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),T(te.key))},tabIndex:ce?0:void 0,children:e.jsxs("span",{className:x.tkx("inline-flex items-center gap-1.5"),children:[A.sanitizeString(te.header),ce&&e.jsx(hs,{dir:Y})]})},String(te.key))})})}),e.jsx("tbody",{children:l?Array.from({length:5},(te,ce)=>e.jsx("tr",{children:t.map(Y=>e.jsx("td",{style:{padding:`${Z} ${ie}`},children:e.jsx(xt,{variant:"text",height:"16px"})},String(Y.key)))},ce)):S.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:x.tkx("text-center"),style:{padding:"32px 16px",color:w.textMuted},children:a??"No data available"})}):e.jsxs(e.Fragment,{children:[H&&L>0&&e.jsx("tr",{"aria-hidden":"true",style:{height:L*h},children:e.jsx("td",{colSpan:t.length,style:{padding:0,border:"none"}})}),W.map((te,ce)=>{const Y=L+ce,se=pe.has(Y);return e.jsx("tr",{"aria-rowindex":Y+1,"aria-selected":se||void 0,onClick:b?()=>b(te,Y):void 0,onKeyDown:b?le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),b(te,Y))}:void 0,tabIndex:b?0:void 0,className:x.tkx(b?"cursor-pointer":""),style:{backgroundColor:se?`${w.primary}22`:f&&Y%2===1?w.surfaceAlt:"transparent",borderBottom:`1px solid ${w.border}`,...H?{height:h,boxSizing:"border-box"}:{}},children:t.map(le=>{const ge=te[le.key],he=le.render?le.render(ge,te):typeof ge=="string"?A.sanitizeString(ge):String(ge??"");return e.jsx("td",{style:{padding:`${Z} ${ie}`,color:w.text,borderRight:fe},children:he},String(le.key))})},Y)}),H&&P<S.length&&e.jsx("tr",{"aria-hidden":"true",style:{height:(S.length-P)*h},children:e.jsx("td",{colSpan:t.length,style:{padding:0,border:"none"}})})]})})]}),(y||k)&&e.jsx("div",{ref:K,style:{height:1,width:"100%"},children:k&&e.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:e.jsx("tbody",{children:Array.from({length:3},(te,ce)=>e.jsx("tr",{children:t.map(Y=>e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(xt,{variant:"text",height:"16px"})},String(Y.key)))},ce))})})}),!y&&m&&e.jsx("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:w.textMuted},children:"✓ All rows loaded"})]})})}const Jn=i.forwardRef(({orientation:t="horizontal",label:n,variant:r="solid",className:o,style:s,...l},a)=>{const c=_.useTheme(),d=n?A.sanitizeString(n):void 0,f=t==="vertical",u=f?"borderLeft":"borderTop",h=`1px ${r} ${c.border}`;return d?e.jsxs("div",{role:"separator","aria-orientation":t,className:x.cx(x.tkx("flex items-center gap-3 text-xs"),o),style:{color:c.textMuted,...s},...l,children:[e.jsx("hr",{className:x.tkx("flex-1 m-0 border-none"),style:{[u]:h}}),e.jsx("span",{children:d}),e.jsx("hr",{className:x.tkx("flex-1 m-0 border-none"),style:{[u]:h}})]}):e.jsx("hr",{ref:a,role:"separator","aria-orientation":t,className:x.cx(x.tkx(f?"inline-block self-stretch border-none w-0 h-full":"w-full border-none m-0"),o),style:{[u]:h,...s},...l})});Jn.displayName="TkxDivider";const gs={sm:{py:"6px",px:"10px",fontSize:"13px",iconSize:14,tagPy:"1px",tagPx:"6px"},md:{py:"9px",px:"12px",fontSize:"14px",iconSize:16,tagPy:"2px",tagPx:"8px"},lg:{py:"12px",px:"14px",fontSize:"15px",iconSize:18,tagPy:"3px",tagPx:"10px"}};function qt(t){return t===void 0?[]:Array.isArray(t)?t:[t]}function bs(t,n){const r=t.getBoundingClientRect(),o=window.innerHeight,s=6,l=o-r.bottom-s,a=r.top-s,c=l>=Math.min(n,200)||l>=a?"below":"above";return{top:c==="below"?r.bottom+window.scrollY+s:r.top+window.scrollY-s-Math.min(n,280),left:r.left+window.scrollX,width:r.width,placement:c}}function ys({size:t,color:n}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",style:{animation:"tkx-spin 0.7s linear infinite"},children:[e.jsx("style",{children:"@keyframes tkx-spin{to{transform:rotate(360deg)}}"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10"})]})}function er({options:t,value:n,defaultValue:r,placeholder:o="Select an option…",size:s="md",isDisabled:l=!1,isInvalid:a=!1,label:c,hint:d,errorMessage:f,multiple:u=!1,searchable:h=!1,clearable:p=!1,isLoading:m=!1,onChange:y,renderOption:k,maxMenuHeight:b=280,virtualScroll:g,optionHeight:M=36,id:j,className:w,style:I}){const v=_.useTheme(),N=i.useId(),$=j??N,S=`${$}-listbox`,T=`${$}-hint`,E=`${$}-error`,C=n!==void 0,[H,z]=i.useState(qt(r)),R=C?qt(n):H,[B,V]=i.useState(!1),[D,O]=i.useState(""),[L,P]=i.useState(-1),[W,K]=i.useState(null),[ne,Z]=i.useState(""),ie=i.useRef(null),fe=i.useRef(null),pe=i.useRef(null),te=i.useRef(null),ce=i.useRef(null),Y=gs[s],se=a||!!f,le=i.useRef(null),[ge,he]=i.useState(0),[ye,de]=i.useState(0),xe=i.useCallback(()=>{le.current&&he(le.current.scrollTop)},[]);i.useEffect(()=>{if(!B){he(0);return}const F=le.current;if(!F)return;de(F.clientHeight);const J=new ResizeObserver(()=>{de(F.clientHeight)});return J.observe(F),()=>J.disconnect()},[B]);const oe=h&&D?t.filter(F=>F.label.toLowerCase().includes(D.toLowerCase())):t,G=oe.filter(F=>!F.disabled),ue=oe.some(F=>!!F.group),ve=(g!==void 0?g:oe.length>=100)&&!ue,Me=8,$e=oe.length*M,We=ve?Math.max(0,Math.floor(ge/M)-Me):0,Te=ve?Math.min(oe.length,Math.ceil((ge+ye)/M)+Me):oe.length,ze=ve?oe.slice(We,Te):oe,Ke=We*M,Ze=oe.reduce((F,J)=>{const re=J.group??"";return F[re]||(F[re]=[]),F[re].push(J),F},{}),Pe=i.useCallback(F=>{var re;let J;u?J=R.includes(F)?R.filter(ae=>ae!==F):[...R,F]:J=[F],C||z(J),y==null||y(u?J:J[0]??""),u||(V(!1),O(""),P(-1),(re=fe.current)==null||re.focus())},[C,u,y,R]),Oe=i.useCallback((F,J)=>{J.stopPropagation();const re=R.filter(ae=>ae!==F);C||z(re),y==null||y(u?re:re[0]??"")},[C,u,y,R]),Ge=i.useCallback(F=>{F.stopPropagation(),C||z([]),y==null||y(u?[]:"")},[C,u,y]),Ee=i.useCallback(()=>{!fe.current||!B||K(bs(fe.current,b))},[B,b]);i.useEffect(()=>{if(B)return Ee(),window.addEventListener("scroll",Ee,!0),window.addEventListener("resize",Ee),()=>{window.removeEventListener("scroll",Ee,!0),window.removeEventListener("resize",Ee)}},[B,Ee]),i.useEffect(()=>{if(!B)return;const F=J=>{var ae,Ce;const re=J.target;(ae=fe.current)!=null&&ae.contains(re)||(Ce=te.current)!=null&&Ce.contains(re)||(V(!1),O(""))};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[B]),i.useEffect(()=>{B&&h&&setTimeout(()=>{var F;return(F=pe.current)==null?void 0:F.focus()},0)},[B,h]),i.useEffect(()=>{var F;if(!(!B||L<0))if(ve&&le.current){const J=L*M,re=J+M,ae=le.current;J<ae.scrollTop?ae.scrollTop=J:re>ae.scrollTop+ae.clientHeight&&(ae.scrollTop=re-ae.clientHeight)}else{const J=(F=ce.current)==null?void 0:F.querySelector(`[data-idx="${L}"]`);J==null||J.scrollIntoView({block:"nearest"})}},[L,B,ve,M]);const qe=F=>{switch(F.key){case"Enter":case" ":F.preventDefault(),B?L>=0&&G[L]&&Pe(G[L].value):Re();break;case"Escape":F.preventDefault(),V(!1),O("");break;case"ArrowDown":F.preventDefault(),B?P(J=>Math.min(J+1,G.length-1)):Re();break;case"ArrowUp":F.preventDefault(),B?P(J=>Math.max(J-1,0)):Re();break;case"Home":F.preventDefault(),B&&P(0);break;case"End":F.preventDefault(),B&&P(G.length-1);break;default:F.key.length===1&&!F.ctrlKey&&!F.metaKey&&(B||Re(),Qe(F.key))}},rt=F=>{var J;switch(F.key){case"Escape":F.preventDefault(),V(!1),O(""),(J=fe.current)==null||J.focus();break;case"ArrowDown":F.preventDefault(),P(re=>Math.min(re+1,G.length-1));break;case"ArrowUp":F.preventDefault(),P(re=>Math.max(re-1,0));break;case"Home":F.preventDefault(),P(0);break;case"End":F.preventDefault(),P(G.length-1);break;case"Enter":F.preventDefault(),L>=0&&G[L]&&Pe(G[L].value);break}};function Qe(F){ie.current&&clearTimeout(ie.current);const J=ne+F.toLowerCase();Z(J);const re=G.findIndex(ae=>ae.label.toLowerCase().startsWith(J));re>=0&&P(re),ie.current=setTimeout(()=>Z(""),800)}function Re(){if(l||m)return;V(!0);const F=G.findIndex(J=>R.includes(J.value));P(F>=0?F:0)}const Fe=se?v.danger:B?v.primary:v.border,Ae=L>=0&&G[L]?`${$}-opt-${G[L].value}`:void 0,Je=[d&&T,se&&E].filter(Boolean).join(" ")||void 0,Ue=R.map(F=>t.find(J=>J.value===F)).filter(Boolean),lt=B&&W?Le.createPortal(e.jsxs("div",{ref:te,role:"listbox",id:S,"aria-label":c?A.sanitizeString(c):"Options","aria-multiselectable":u,style:{position:"absolute",top:W.top,left:W.left,width:W.width,zIndex:9999,backgroundColor:v.surface,border:`1.5px solid ${v.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",overflow:"hidden",minWidth:W.width,maxHeight:b,display:"flex",flexDirection:"column"},children:[h&&e.jsxs("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${v.border}`,flexShrink:0,display:"flex",alignItems:"center",gap:6},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.textMuted,strokeWidth:"2","aria-hidden":"true",style:{flexShrink:0},children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]}),e.jsx("input",{ref:pe,type:"text",value:D,onChange:F=>{O(F.target.value),P(0)},onKeyDown:rt,placeholder:"Search…","aria-label":"Search options",style:{border:"none",outline:"none",background:"transparent",color:v.text,fontSize:Y.fontSize,fontFamily:"inherit",width:"100%"}})]}),e.jsx("div",{ref:F=>{ce.current=F,le.current=F},onScroll:ve?xe:void 0,style:{overflowY:"auto",flexGrow:1,maxHeight:b-(h?48:0)},children:ve?e.jsxs("div",{style:{height:$e,position:"relative"},children:[e.jsx("div",{style:{position:"absolute",top:Ke,left:0,right:0},children:ze.map(F=>{const J=G.indexOf(F),re=J===L,ae=R.includes(F.value),Ce=k?k(F,ae):e.jsxs("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[F.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:F.icon}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(F.label)})]}),F.description&&e.jsx("span",{style:{fontSize:"12px",color:v.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(F.description)})]});return e.jsxs("div",{id:`${$}-opt-${F.value}`,"data-idx":J>=0?J:void 0,role:"option","aria-selected":ae,"aria-disabled":F.disabled||void 0,onClick:()=>!F.disabled&&Pe(F.value),onMouseEnter:()=>!F.disabled&&J>=0&&P(J),style:{height:M,boxSizing:"border-box",padding:`0 ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:F.disabled?v.textMuted:v.text,backgroundColor:re?`${v.primary}22`:ae?`${v.primary}12`:"transparent",cursor:F.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:F.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[Ce,ae&&!k&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})]},F.value)})}),oe.length===0&&e.jsx("div",{style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:v.textMuted,textAlign:"center",position:"absolute",top:0,left:0,right:0},children:m?"Loading…":"No options found"})]}):e.jsxs(e.Fragment,{children:[Object.entries(Ze).map(([F,J])=>e.jsxs("div",{children:[F&&e.jsx("div",{"aria-hidden":"true",style:{padding:"8px 12px 4px",fontSize:"11px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:v.textMuted,fontFamily:"inherit",position:"sticky",top:0,backgroundColor:v.surface,zIndex:1,borderBottom:`1px solid ${v.border}`},children:A.sanitizeString(F)}),J.map(re=>{const ae=G.indexOf(re),Ce=ae===L,Ie=R.includes(re.value),we=k?k(re,Ie):e.jsxs("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[re.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:re.icon}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(re.label)})]}),re.description&&e.jsx("span",{style:{fontSize:"12px",color:v.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(re.description)})]});return e.jsxs("div",{id:`${$}-opt-${re.value}`,"data-idx":ae>=0?ae:void 0,role:"option","aria-selected":Ie,"aria-disabled":re.disabled||void 0,onClick:()=>!re.disabled&&Pe(re.value),onMouseEnter:()=>!re.disabled&&ae>=0&&P(ae),style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:re.disabled?v.textMuted:v.text,backgroundColor:Ce?`${v.primary}22`:Ie?`${v.primary}12`:"transparent",cursor:re.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:re.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[we,Ie&&!k&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})]},re.value)})]},F)),oe.length===0&&e.jsx("div",{style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:v.textMuted,textAlign:"center"},children:m?"Loading…":"No options found"})]})})]}),document.body):null,q=p&&R.length>0&&!l&&!m;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),w),style:I,children:[c&&e.jsx("label",{htmlFor:$,style:{fontSize:"14px",fontWeight:500,fontFamily:"inherit",color:v.text,userSelect:"none"},children:A.sanitizeString(c)}),e.jsx("div",{style:{position:"relative",width:"100%",opacity:l?.55:1},children:e.jsxs("button",{ref:fe,id:$,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":B,"aria-controls":S,"aria-activedescendant":Ae,"aria-invalid":se||void 0,"aria-describedby":Je,"aria-multiselectable":u,disabled:l,onClick:()=>B?V(!1):Re(),onKeyDown:qe,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:u&&R.length>0?`4px ${Y.px}`:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",backgroundColor:v.surface,color:R.length>0?v.text:v.textMuted,border:`1.5px solid ${Fe}`,borderRadius:8,boxSizing:"border-box",transition:"border-color 150ms",textAlign:"left",cursor:l?"not-allowed":"pointer",outline:"none",minHeight:s==="sm"?34:s==="lg"?50:42,flexWrap:"wrap",touchAction:"manipulation"},children:[e.jsx("span",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4,flex:1,minWidth:0},children:u&&Ue.length>0?Ue.map(F=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:`${Y.tagPy} ${Y.tagPx}`,fontSize:`calc(${Y.fontSize} - 1px)`,fontFamily:"inherit",backgroundColor:`${v.primary}22`,color:v.primary,borderRadius:6,border:`1px solid ${v.primary}44`,lineHeight:1.4,maxWidth:150,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},children:A.sanitizeString(F.label)}),e.jsx("span",{role:"button","aria-label":`Remove ${A.sanitizeString(F.label)}`,tabIndex:-1,onClick:J=>Oe(F.value,J),style:{cursor:"pointer",flexShrink:0,display:"flex",alignItems:"center",opacity:.8},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]},F.value)):!u&&R.length>0?(()=>{const F=t.find(J=>J.value===R[0]);return e.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},children:[(F==null?void 0:F.icon)&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:F.icon}),F?A.sanitizeString(F.label):""]})})():e.jsx("span",{style:{opacity:.6},children:A.sanitizeString(o)})}),e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,color:v.textMuted},children:[m&&e.jsx(ys,{size:Y.iconSize,color:v.primary}),q&&!m&&e.jsx("span",{role:"button","aria-label":"Clear selection",tabIndex:-1,onClick:Ge,style:{cursor:"pointer",display:"flex",alignItems:"center",lineHeight:1,opacity:.7,transition:"opacity 120ms"},onMouseEnter:F=>F.currentTarget.style.opacity="1",onMouseLeave:F=>F.currentTarget.style.opacity="0.7",children:e.jsx("svg",{width:Y.iconSize,height:Y.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),e.jsx("svg",{width:Y.iconSize,height:Y.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",style:{transform:B?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms",flexShrink:0},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]})]})}),d&&!se&&e.jsx("span",{id:T,style:{fontSize:"12px",color:v.textMuted,fontFamily:"inherit"},children:A.sanitizeString(d)}),se&&f&&e.jsxs("span",{id:E,role:"alert",style:{fontSize:"12px",color:v.danger,display:"flex",alignItems:"center",gap:4,fontFamily:"inherit"},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),A.sanitizeString(f)]}),lt]})}er.displayName="TkxSelect";const ks={sm:{box:16,fontSize:"13px",iconStroke:2.5},md:{box:20,fontSize:"14px",iconStroke:2.5},lg:{box:24,fontSize:"15px",iconStroke:2}},tr=i.forwardRef(({label:t,hint:n,isInvalid:r,errorMessage:o,isIndeterminate:s=!1,size:l="md",colorScheme:a="primary",checked:c,defaultChecked:d,onChange:f,disabled:u,className:h,style:p,id:m,...y},k)=>{const b=_.useTheme(),g=Q.useReducedMotion(),M=i.useId(),j=m??M,w=`${j}-hint`,I=`${j}-error`,v=i.useRef(null),[N,$]=i.useState(!1),S=ks[l],T=r||!!o,C={primary:b.primary,success:b.success,danger:b.danger,warning:b.warning}[a]??b.primary,H=c!==void 0?c:void 0;i.useEffect(()=>{const P=(k==null?void 0:k.current)??v.current;P&&(P.indeterminate=s)},[s,k]);const z=s||(H??!1),R=z?C:b.surface,B=T?b.danger:z?C:b.border,V=_.getAccessibleForeground(C),D=N?{outline:`2px solid ${C}`,outlineOffset:"2px"}:{},O=[n&&w,T&&I].filter(Boolean).join(" ")||void 0,L=!g&&z?{animation:"tkx-check-scale-in 120ms ease forwards"}:{};return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1"),h),style:{opacity:u?.5:1,...p},children:[e.jsx("style",{children:`
|
|
2
2
|
@keyframes tkx-check-scale-in {
|
|
3
3
|
from { transform: scale(0.4); opacity: 0; }
|
|
4
4
|
to { transform: scale(1); opacity: 1; }
|
|
5
5
|
}
|
|
6
|
-
`}),e.jsxs("label",{htmlFor:j,className:
|
|
6
|
+
`}),e.jsxs("label",{htmlFor:j,className:x.tkx("flex items-center gap-2 select-none"),style:{cursor:u?"not-allowed":"pointer",fontFamily:"inherit"},children:[e.jsx("input",{ref:P=>{v.current=P,typeof k=="function"?k(P):k&&(k.current=P)},id:j,type:"checkbox",checked:c,defaultChecked:d,onChange:f,disabled:u,"aria-invalid":T,"aria-describedby":O,onFocus:P=>{P.target.matches(":focus-visible")&&$(!0)},onBlur:()=>$(!1),className:x.tkx("sr-only"),...y}),e.jsx("span",{"aria-hidden":"true",style:{width:S.box,height:S.box,minWidth:S.box,borderRadius:"4px",border:`2px solid ${B}`,backgroundColor:R,display:"flex",alignItems:"center",justifyContent:"center",transition:g?"none":"background-color 120ms, border-color 120ms",boxSizing:"border-box",...D},children:s?e.jsx("span",{"aria-hidden":"true",style:{display:"block",width:S.box*.5,height:2,backgroundColor:V,borderRadius:"1px",...L}}):z?e.jsx("svg",{width:S.box*.6,height:S.box*.6,viewBox:"0 0 24 24",fill:"none",stroke:V,strokeWidth:S.iconStroke,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:L,children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}):null}),t&&e.jsx("span",{style:{fontSize:S.fontSize,color:b.text,lineHeight:1.4},children:typeof t=="string"?A.sanitizeString(t):t})]}),n&&!T&&e.jsx("span",{id:w,className:x.tkx("text-xs ml-7"),style:{color:b.textMuted,marginLeft:S.box+8},children:A.sanitizeString(n)}),T&&o&&e.jsxs("span",{id:I,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:b.danger,marginLeft:S.box+8},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),A.sanitizeString(o)]})]})});tr.displayName="TkxCheckbox";const nr=i.createContext(null);function vs(){return i.useContext(nr)}const ws={sm:{outer:16,inner:7,fontSize:"13px"},md:{outer:20,inner:9,fontSize:"14px"},lg:{outer:24,inner:11,fontSize:"15px"}},rr=i.forwardRef(({label:t,hint:n,size:r="md",colorScheme:o="primary",value:s,checked:l,onChange:a,disabled:c,name:d,className:f,style:u,id:h,...p},m)=>{const y=_.useTheme(),k=Q.useReducedMotion(),b=i.useId(),g=h??b,M=vs(),j=M?M.value===String(s??""):l??!1,w=c??(M==null?void 0:M.isDisabled)??!1,I=d??(M==null?void 0:M.name)??"",v=()=>{w||(M?M.onChange(String(s??"")):a==null||a({target:{value:String(s??"")}}))},N=ws[r],S={primary:y.primary,success:y.success,danger:y.danger}[o]??y.primary;_.getAccessibleForeground(S);const T=j?S:y.border,E=y.surface;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-0.5"),f),style:{opacity:w?.5:1,...u},children:[e.jsx("style",{children:`
|
|
7
7
|
@keyframes tkx-radio-dot-in {
|
|
8
8
|
from { transform: scale(0) translate(-50%, -50%); opacity: 0; }
|
|
9
9
|
to { transform: scale(1) translate(-50%, -50%); opacity: 1; }
|
|
10
10
|
}
|
|
11
|
-
`}),e.jsxs("label",{htmlFor:g,className:
|
|
11
|
+
`}),e.jsxs("label",{htmlFor:g,className:x.tkx("flex items-center gap-2 select-none"),style:{cursor:w?"not-allowed":"pointer",fontFamily:"inherit"},children:[e.jsx("input",{ref:m,id:g,type:"radio",name:I,value:s,checked:j,onChange:v,disabled:w,"aria-invalid":M==null?void 0:M.isInvalid,className:x.tkx("sr-only"),...p}),e.jsx("span",{"aria-hidden":"true",style:{position:"relative",width:N.outer,height:N.outer,minWidth:N.outer,borderRadius:"50%",border:`2px solid ${T}`,backgroundColor:E,display:"inline-block",boxSizing:"border-box",transition:k?"none":"border-color 120ms"},children:j&&e.jsx("span",{"aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",width:N.inner,height:N.inner,borderRadius:"50%",backgroundColor:S,transform:"translate(-50%, -50%)",transformOrigin:"center",...k?{}:{animation:"tkx-radio-dot-in 130ms ease forwards"}}})}),t&&e.jsx("span",{style:{fontSize:N.fontSize,color:y.text,lineHeight:1.4},children:typeof t=="string"?A.sanitizeString(t):t})]}),n&&e.jsx("span",{className:x.tkx("text-xs"),style:{color:y.textMuted,marginLeft:N.outer+8},children:A.sanitizeString(n)})]})});rr.displayName="TkxRadio";function js({name:t,value:n,defaultValue:r="",onChange:o,label:s,orientation:l="vertical",isDisabled:a=!1,isInvalid:c=!1,errorMessage:d,children:f}){const u=_.useTheme(),p=`${i.useId()}-error`,[m,y]=i.useState(r),k=n!==void 0,b=k?n:m,g=j=>{k||y(j),o==null||o(j)},M=c||!!d;return e.jsx(nr.Provider,{value:{name:t,value:b,onChange:g,isDisabled:a,isInvalid:c},children:e.jsxs("div",{role:"radiogroup","aria-label":s?A.sanitizeString(s):void 0,"aria-describedby":M?p:void 0,"aria-invalid":M,children:[s&&e.jsx("div",{className:x.tkx("text-sm font-medium font-sans mb-2"),style:{color:u.text},children:A.sanitizeString(s)}),e.jsx("div",{className:x.tkx(l==="horizontal"?"flex flex-row flex-wrap gap-4":"flex flex-col gap-2"),children:f}),M&&d&&e.jsxs("span",{id:p,role:"alert",className:x.tkx("text-xs flex items-center gap-1 mt-1"),style:{color:u.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),A.sanitizeString(d)]})]})})}const sr=5;let ft=[],Ve=[];const Pt=new Set,yt=new Map;function _t(){const t=[...Ve];Pt.forEach(n=>n(t))}function or(t,n){n!==0&&yt.set(t,setTimeout(()=>Yt(t),n))}function Yt(t){clearTimeout(yt.get(t)),yt.delete(t);const n=Ve.some(r=>r.id===t);if(Ve=Ve.filter(r=>r.id!==t),ft=ft.filter(r=>r.id!==t),n&&ft.length>0&&Ve.length<sr){const r=ft.shift();Ve=[...Ve,r],or(r.id,r.duration??4e3)}_t()}function Ss(t){const n=`tkx-toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,r={...t,id:n,duration:t.duration??4e3};return Ve.length<sr?(Ve=[...Ve,r],or(n,r.duration)):ft=[...ft,r],_t(),n}function Ms(){yt.forEach(t=>clearTimeout(t)),yt.clear(),Ve=[],ft=[],_t()}function Ts(){const t=i.useCallback(o=>Ss(o),[]),n=i.useCallback(o=>Yt(o),[]),r=i.useCallback(()=>Ms(),[]);return{toast:t,dismiss:n,dismissAll:r}}const Cs={default:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),success:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),danger:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),warning:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),info:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})})},$s={"top-right":{top:16,right:16,alignItems:"flex-end"},"top-left":{top:16,left:16,alignItems:"flex-start"},"top-center":{top:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"},"bottom-right":{bottom:16,right:16,alignItems:"flex-end"},"bottom-left":{bottom:16,left:16,alignItems:"flex-start"},"bottom-center":{bottom:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"}};function Is(t,n){return n?{}:{animation:`tkx-toast-slide-${t.startsWith("top")?"down":"up"} 220ms cubic-bezier(0.16,1,0.3,1) both`}}function zs({toast:t,position:n,onDismiss:r,reduced:o}){const s=_.useTheme(),l=i.useId(),a={default:s.textMuted,success:s.success,danger:s.danger,warning:s.warning,info:s.info},c=t.variant??"default",d=a[c],f=c==="danger",u=t.title?A.sanitizeString(t.title):void 0,h=t.description?A.sanitizeString(t.description):void 0;return e.jsxs("div",{role:f?"alert":"status","aria-live":f?"assertive":"polite","aria-atomic":"true","aria-labelledby":u?l:void 0,className:x.tkx("flex items-start gap-3 px-4 py-3 rounded-lg shadow-lg font-sans min-w-[280px] max-w-[380px]"),style:{backgroundColor:s.surface,border:`1px solid ${d}55`,boxShadow:`0 8px 24px ${s.bg}cc`,color:s.text,...Is(n,o)},children:[e.jsx("span",{className:x.tkx("shrink-0 mt-[2px]"),style:{color:d},children:Cs[c]}),e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[u&&e.jsx("p",{id:l,className:x.tkx("m-0 font-semibold text-sm leading-snug"),children:u}),h&&e.jsx("p",{className:x.tkx("m-0 text-xs mt-[2px] leading-relaxed"),style:{color:s.textMuted},children:h}),t.action&&e.jsx("button",{onClick:()=>{t.action.onClick(),r(t.id)},className:x.tkx("border-none bg-transparent cursor-pointer p-0 mt-2 text-xs font-semibold focus-visible:focus-ring"),style:{color:d},children:A.sanitizeString(t.action.label)})]}),e.jsx("button",{"aria-label":"Dismiss notification",onClick:()=>r(t.id),className:x.tkx("bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring"),style:{color:s.textMuted},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}function Es({position:t="top-right"}){const[n,r]=i.useState([...Ve]),o=Q.useReducedMotion();i.useEffect(()=>{r([...Ve]);const d=f=>r([...f]);return Pt.add(d),()=>{Pt.delete(d)}},[]);const s=t.startsWith("bottom"),l=$s[t],a=i.useRef(!1);if(i.useEffect(()=>{if(!(a.current||typeof document>"u")&&(a.current=!0,!document.getElementById("tkx-toast-kf"))){const d=document.createElement("style");d.id="tkx-toast-kf",d.textContent=`
|
|
12
12
|
@keyframes tkx-toast-slide-down {
|
|
13
13
|
from { opacity: 0; transform: translateY(-16px); }
|
|
14
14
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -17,21 +17,21 @@
|
|
|
17
17
|
from { opacity: 0; transform: translateY(16px); }
|
|
18
18
|
to { opacity: 1; transform: translateY(0); }
|
|
19
19
|
}
|
|
20
|
-
`,document.head.appendChild(u)}},[]),typeof document>"u")return null;const d=o?[...r].reverse():r;return Le.createPortal(e.jsx("div",{"aria-label":"Notifications",className:s.tkx("fixed z-[9999] flex flex-col gap-2 pointer-events-none"),style:l,children:d.map(u=>e.jsx("div",{className:s.tkx("pointer-events-auto"),children:e.jsx(eo,{toast:u,position:t,onDismiss:_t,reduced:i})},u.id))}),document.body)}const ro={sm:{triggerPadding:"10px 12px",contentPadding:"0 12px 10px 12px",fontSize:"13px",subtitleSize:"11px",iconSize:14},md:{triggerPadding:"14px 16px",contentPadding:"0 16px 14px 16px",fontSize:"14px",subtitleSize:"12px",iconSize:16},lg:{triggerPadding:"18px 20px",contentPadding:"0 20px 18px 20px",fontSize:"16px",subtitleSize:"13px",iconSize:18}};function Gt({open:t,reduced:r,iconStyle:n,size:i,color:o}){const l=r?"none":"transform 240ms cubic-bezier(0.4, 0, 0.2, 1)";return n==="chevron"?e.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:t?"rotate(180deg)":"rotate(0deg)",transition:l,flexShrink:0},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}):n==="plus"?e.jsxs("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:t?"rotate(45deg)":"rotate(0deg)",transition:l,flexShrink:0},children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):e.jsxs("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:l,flexShrink:0},children:[e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),e.jsx("polyline",{points:"12 5 19 12 12 19"})]})}function no({isOpen:t,reduced:r,children:n,id:i,triggerId:o}){const l=a.useRef(null),c=a.useRef(null),d=a.useRef(t),u=a.useRef(!1);a.useEffect(()=>{const f=l.current;f&&(t?(f.style.height="auto",f.style.overflow="visible"):(f.style.height="0px",f.style.overflow="hidden"))},[]),a.useEffect(()=>{if(d.current===t)return;d.current=t;const f=l.current,m=c.current;if(!(!f||!m)){if(r){f.style.height=t?"auto":"0px",f.style.overflow=t?"visible":"hidden";return}if(u.current){const p=f.getBoundingClientRect().height;f.style.transition="none",f.style.height=`${p}px`,f.offsetHeight}u.current=!0,f.style.overflow="hidden",t?(f.style.height="0px",f.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{f.style.height=`${m.scrollHeight}px`})})):(f.style.height=`${m.scrollHeight}px`,f.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{f.style.height="0px"})}))}},[t,r]);const x=f=>{if(f.propertyName!=="height")return;u.current=!1;const m=l.current;m&&(t?(m.style.height="auto",m.style.overflow="visible"):m.style.overflow="hidden")};return e.jsx("div",{ref:l,id:i,role:"region","aria-labelledby":o,onTransitionEnd:x,style:{willChange:"height"},children:e.jsx("div",{ref:c,children:n})})}function tn({items:t,multiple:r=!1,defaultOpen:n,value:i,onChange:o,variant:l="default",size:c="md",iconPosition:d="right",iconStyle:u="chevron",flush:x=!1,className:f,style:m}){const p=B.useTheme(),h=s.useReducedMotion(),y=a.useId(),k=i!==void 0,b=T=>T?Array.isArray(T)?new Set(T):new Set([T]):new Set,[g,w]=a.useState(()=>b(n)),j=k?b(i):g,S=a.useCallback((T,E)=>{if(E)return;let $;if(k){const I=b(i);$=new Set(I),$.has(T)?$.delete(T):(r||$.clear(),$.add(T))}else{w(I=>{$=new Set(I),$.has(T)?$.delete(T):(r||$.clear(),$.add(T));const W=[...$];return o==null||o(r?W:W[0]??""),$});return}const F=[...$];o==null||o(r?F:F[0]??"")},[r,o,k,i]),z=ro[c],v=()=>{if(x)return{};switch(l){case"bordered":return{border:`1px solid ${p.border}`,borderRadius:"10px",overflow:"hidden"};case"separated":return{};case"ghost":case"flush":return{};default:return{}}},N=(T,E,$)=>{if(x)return{};switch(l){case"default":return{borderBottom:$?"none":`1px solid ${p.border}`};case"bordered":return{borderBottom:$?"none":`1px solid ${p.border}`};case"separated":return{border:`1px solid ${p.border}`,borderRadius:"10px",overflow:"hidden",boxShadow:"0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04)"};case"ghost":return{};default:return{}}},C=T=>l==="ghost"||l==="flush"?T?`${p.primary}10`:`${p.surfaceAlt}80`:T?`${p.primary}0d`:`${p.surfaceAlt}60`,M=l==="separated";return e.jsx("div",{className:s.tkx(f??""),style:{...v(),display:M?"flex":void 0,flexDirection:M?"column":void 0,gap:M?"8px":void 0,...m},children:t.map((T,E)=>{const $=j.has(T.id),F=E===t.length-1,I=`${y}-trigger-${T.id}`,W=`${y}-panel-${T.id}`;return e.jsxs("div",{className:T.className,style:N(E,$,F),children:[e.jsxs("button",{id:I,type:"button",role:"button","aria-expanded":$,"aria-controls":W,disabled:T.disabled,onClick:()=>S(T.id,T.disabled),style:{width:"100%",display:"flex",alignItems:T.subtitle?"flex-start":"center",gap:"8px",padding:z.triggerPadding,border:"none",background:"transparent",cursor:T.disabled?"not-allowed":"pointer",textAlign:"left",fontFamily:"inherit",fontSize:z.fontSize,fontWeight:500,color:T.disabled?p.textMuted:p.text,opacity:T.disabled?.5:1,transition:h?"none":"background-color 160ms ease",outline:"none"},onMouseEnter:L=>{T.disabled||(L.currentTarget.style.backgroundColor=C($))},onMouseLeave:L=>{L.currentTarget.style.backgroundColor=$?`${p.primary}0d`:"transparent"},onFocus:L=>{T.disabled||(L.currentTarget.style.outline=`2px solid ${p.primary}`,L.currentTarget.style.outlineOffset="2px")},onBlur:L=>{L.currentTarget.style.outline="none"},children:[T.icon&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:p.primary,marginTop:T.subtitle?"1px":void 0},children:T.icon}),d==="left"&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:$?p.primary:p.textMuted,marginTop:T.subtitle?"1px":void 0},children:e.jsx(Gt,{open:$,reduced:h,iconStyle:u,size:z.iconSize,color:$?p.primary:p.textMuted})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{style:{display:"block",lineHeight:1.4},children:T.title}),T.subtitle&&e.jsx("span",{style:{display:"block",fontSize:z.subtitleSize,color:p.textMuted,fontWeight:400,marginTop:"2px",lineHeight:1.3},children:T.subtitle})]}),T.badge&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0},children:T.badge}),d==="right"&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:$?p.primary:p.textMuted,marginTop:T.subtitle?"1px":void 0},children:e.jsx(Gt,{open:$,reduced:h,iconStyle:u,size:z.iconSize,color:$?p.primary:p.textMuted})})]}),e.jsx(no,{isOpen:$,reduced:h,id:W,triggerId:I,children:e.jsx("div",{style:{padding:z.contentPadding,fontSize:z.fontSize,lineHeight:1.6,color:p.textMuted,fontFamily:"inherit"},children:T.content})})]},T.id)})})}tn.displayName="TkxAccordion";const so={sm:"280px",md:"380px",lg:"480px",xl:"600px",full:"100%"};let Ft=0;function oo(){++Ft===1&&(document.body.style.overflow="hidden")}function Jt(){--Ft<=0&&(Ft=0,document.body.style.overflow="")}function io(t){switch(t){case"left":return"translateX(-100%)";case"right":return"translateX(100%)";case"top":return"translateY(-100%)";case"bottom":return"translateY(100%)"}}function ao(t,r){const n=so[r],i=t==="left"||t==="right",o={position:"absolute"};return i?{...o,top:0,bottom:0,[t]:0,width:n,maxWidth:"100vw",height:"100%"}:{...o,left:0,right:0,[t]:0,height:n,maxHeight:"100vh",width:"100%"}}function Qt(){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function lo({isOpen:t,onClose:r,placement:n="right",size:i="md",title:o,children:l,footer:c,closeOnOverlayClick:d=!0,closeOnEsc:u=!0}){const x=B.useTheme(),f=s.useReducedMotion(),m=a.useId(),p=s.useFocusTrap(t);if(s.useEscapeKey(r,u&&t),a.useEffect(()=>(t?oo():Jt(),()=>{t&&Jt()}),[t]),typeof document>"u")return null;const h=ao(n,i),y=io(n),k=f?"none":"transform 280ms cubic-bezier(0.4,0,0.2,1), opacity 280ms ease",b=typeof o=="string"?s.sanitizeString(o):o;return Le.createPortal(e.jsxs("div",{role:"presentation",className:s.tkx("fixed inset-0 z-[9000]"),style:{pointerEvents:t?"auto":"none",visibility:t?"visible":"hidden"},children:[e.jsx("div",{"aria-hidden":"true",onClick:d?r:void 0,className:s.tkx("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(3px)",opacity:t?1:0,transition:f?"none":"opacity 280ms ease",cursor:d?"pointer":"default"}}),e.jsxs("div",{ref:p,role:"dialog","aria-modal":"true","aria-labelledby":o?m:void 0,className:s.tkx("absolute flex flex-col font-sans"),style:{...h,backgroundColor:x.surface,borderLeft:n==="right"?`1px solid ${x.border}`:void 0,borderRight:n==="left"?`1px solid ${x.border}`:void 0,borderTop:n==="bottom"?`1px solid ${x.border}`:void 0,borderBottom:n==="top"?`1px solid ${x.border}`:void 0,boxShadow:`0 20px 60px ${x.bg}99`,transform:t?"translate(0,0)":y,opacity:t?1:0,transition:k,willChange:"transform"},children:[o!==void 0&&e.jsxs("div",{className:s.tkx("flex items-center justify-between px-5 py-4 shrink-0"),style:{borderBottom:`1px solid ${x.border}`},children:[e.jsx("h2",{id:m,className:s.tkx("m-0 text-base font-semibold leading-snug"),style:{color:x.text},children:b}),e.jsx("button",{onClick:r,"aria-label":"Close drawer",className:s.tkx("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:x.textMuted},children:e.jsx(Qt,{})})]}),o===void 0&&e.jsx("div",{className:s.tkx("flex justify-end px-3 pt-3 shrink-0"),children:e.jsx("button",{onClick:r,"aria-label":"Close drawer",className:s.tkx("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:x.textMuted},children:e.jsx(Qt,{})})}),e.jsx("div",{className:s.tkx("flex-1 overflow-y-auto px-5 py-4"),style:{color:x.text},children:l}),c&&e.jsx("div",{className:s.tkx("flex items-center justify-end gap-2 px-5 py-4 shrink-0"),style:{borderTop:`1px solid ${x.border}`},children:c})]})]}),document.body)}const co=["Su","Mo","Tu","We","Th","Fr","Sa"],er=["January","February","March","April","May","June","July","August","September","October","November","December"],uo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ve(t,r){return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()}function Ae(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function fo(t,r,n){if(!r||!n)return!1;const i=Ae(t).getTime(),o=Ae(r).getTime(),l=Ae(n).getTime(),c=Math.min(o,l),d=Math.max(o,l);return i>c&&i<d}function tr(t,r,n){return!!(r&&Ve(t,r)||n&&Ve(t,n))}function tt(t,r="en-US"){return t?t.toLocaleDateString(r,{month:"2-digit",day:"2-digit",year:"numeric"}):""}function xo(t){const r=t.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(!r)return null;const[,n,i,o]=r.map(Number);if(n<1||n>12||i<1||i>31)return null;const l=new Date(o,n-1,i);return l.getMonth()!==n-1?null:l}function rr(t,r){return new Date(t,r+1,0).getDate()}function po(t,r){const n=new Date(t,r,1).getDay(),i=rr(t,r),o=[],l=rr(t,r-1);for(let d=n-1;d>=0;d--)o.push(new Date(t,r-1,l-d));for(let d=1;d<=i;d++)o.push(new Date(t,r,d));let c=1;for(;o.length<42;)o.push(new Date(t,r+1,c++));return o}function $t(t){return Math.floor(t/10)*10}function ho(){return[{label:"Today",getValue:()=>{const t=Ae(new Date);return[t,t]}},{label:"Yesterday",getValue:()=>{const t=Ae(new Date);return t.setDate(t.getDate()-1),[t,t]}},{label:"Last 7 days",getValue:()=>{const t=Ae(new Date),r=new Date(t);return r.setDate(r.getDate()-6),[r,t]}},{label:"Last 30 days",getValue:()=>{const t=Ae(new Date),r=new Date(t);return r.setDate(r.getDate()-29),[r,t]}},{label:"Last 90 days",getValue:()=>{const t=Ae(new Date),r=new Date(t);return r.setDate(r.getDate()-89),[r,t]}},{label:"This week",getValue:()=>{const t=Ae(new Date),r=new Date(t);r.setDate(r.getDate()-r.getDay());const n=new Date(r);return n.setDate(n.getDate()+6),[r,n]}},{label:"Last week",getValue:()=>{const t=Ae(new Date),r=new Date(t);r.setDate(r.getDate()-r.getDay()-1);const n=new Date(r);return n.setDate(n.getDate()-6),[n,r]}},{label:"This month",getValue:()=>{const t=new Date;return[new Date(t.getFullYear(),t.getMonth(),1),new Date(t.getFullYear(),t.getMonth()+1,0)]}},{label:"Last month",getValue:()=>{const t=new Date;return[new Date(t.getFullYear(),t.getMonth()-1,1),new Date(t.getFullYear(),t.getMonth(),0)]}},{label:"This quarter",getValue:()=>{const t=new Date,r=Math.floor(t.getMonth()/3);return[new Date(t.getFullYear(),r*3,1),new Date(t.getFullYear(),r*3+3,0)]}},{label:"Last quarter",getValue:()=>{const t=new Date,r=Math.floor(t.getMonth()/3),n=r===0?3:r-1,i=r===0?t.getFullYear()-1:t.getFullYear();return[new Date(i,n*3,1),new Date(i,n*3+3,0)]}},{label:"This year",getValue:()=>{const t=new Date().getFullYear();return[new Date(t,0,1),new Date(t,11,31)]}},{label:"Last year",getValue:()=>{const t=new Date().getFullYear()-1;return[new Date(t,0,1),new Date(t,11,31)]}}]}function mo(t,r){const n=t.getBoundingClientRect(),i=window.innerHeight,o=window.scrollY,l=window.scrollX,d=i-n.bottom<r+8&&n.top>r+8;return{top:d?o+n.top-r-4:o+n.bottom+4,left:l+n.left,flipUp:d}}function nr({values:t,selected:r,onSelect:n,label:i,theme:o,format:l}){const c=a.useRef([]),d=a.useRef(null);a.useEffect(()=>{const x=c.current[r];x&&d.current&&x.scrollIntoView({block:"nearest"})},[r]);const u=l??(x=>String(x).padStart(2,"0"));return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:o.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:i}),e.jsx("div",{ref:d,style:{height:"160px",overflowY:"auto",width:"52px",scrollbarWidth:"thin",border:`1px solid ${o.border}`,borderRadius:"8px",padding:"4px"},children:t.map(x=>{const f=x===r;return e.jsx("button",{ref:m=>{c.current[x]=m},type:"button",onClick:()=>n(x),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"32px",borderRadius:"6px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:f?600:400,backgroundColor:f?o.primary:"transparent",color:f?o.bg:o.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:u(x)},x)})})]})}function sr({year:t,month:r,today:n,mode:i,selectedDate:o,selectedRange:l,multiDates:c,hoverDate:d,focusedDate:u,isDateDisabled:x,onSelectDate:f,onHoverDate:m,onSetFocused:p,theme:h,locale:y}){const k=po(t,r);return e.jsxs("div",{children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:co.map(b=>e.jsx("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:h.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:b},b))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:k.map((b,g)=>{const w=b.getMonth()===r,j=Ve(b,n),S=b.getDay()===0||b.getDay()===6,z=x(b),v=i==="single"&&o!=null&&Ve(b,o),N=i==="multiple"&&c.some(P=>Ve(P,b)),C=i==="range"&&tr(b,l[0],null),M=i==="range"&&tr(b,null,l[1]),T=C||M,E=i==="range"&&l[0]&&!l[1]&&d?d:l[1],$=i==="range"&&fo(b,l[0],E),F=i==="range"&&l[0]&&!l[1]&&d&&Ve(b,d),I=v||N||T,W=u!=null&&Ve(b,u);let L="transparent",Y=w?S?`${h.text}cc`:h.text:`${h.textMuted}60`,D="none",V=400;I||F?(L=h.primary,Y=h.bg,V=600):$&&(L=`${h.primary}18`),j&&!I&&(D=`2px solid ${h.primary}`,V=600),z&&(Y=`${h.textMuted}50`),W&&!I&&(D=`2px solid ${h.secondary}`);const R=b.toLocaleDateString(y,{weekday:"long",year:"numeric",month:"long",day:"numeric"});return e.jsx("button",{type:"button","aria-label":R,"aria-pressed":I,"aria-disabled":z,disabled:z,onClick:()=>!z&&f(b),onMouseEnter:()=>m(b),onMouseLeave:()=>m(null),onFocus:()=>p(b),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:L,color:Y,border:D,fontSize:"13px",fontWeight:V,cursor:z?"not-allowed":"pointer",opacity:z?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:z?"line-through":"none",transition:"background-color 80ms ease"},children:b.getDate()},g)})})]})}function rn({value:t,onChange:r,rangeValue:n,onRangeChange:i,multiValue:o,onMultiChange:l,mode:c="single",minDate:d,maxDate:u,disabledDates:x,locale:f="en-US",showTime:m=!1,timeValue:p,onTimeChange:h,showPresets:y=!1,customPresets:k,label:b,placeholder:g="MM/DD/YYYY",hint:w,isDisabled:j=!1,isInvalid:S=!1,errorMessage:z,numberOfMonths:v=1,id:N,className:C,style:M}){const T=B.useTheme(),E=a.useId(),$=N??E,F=s.useReducedMotion(),I=Ae(new Date),W=t!==void 0,[L,Y]=a.useState(null),D=W?t??null:L,V=n!==void 0,[R,P]=a.useState([null,null]),A=V?n:R,O=o!==void 0,[G,ee]=a.useState([]),oe=O?o:G,[ae,fe]=a.useState("start"),de=c==="range"||c==="single"&&m,[ge,U]=a.useState([null,null]),[se,he]=a.useState(null),we=D??A[0]??I,[ce,me]=a.useState(we.getFullYear()),[re,le]=a.useState(we.getMonth()),[J,X]=a.useState("day"),[ne,xe]=a.useState({h:0,m:0}),ke=p??ne,[Te,Me]=a.useState(!1),[He,$e]=a.useState(()=>{if(c==="single")return tt(D,f);if(c==="range"){const[K,Z]=A;if(K&&Z)return`${tt(K,f)} – ${tt(Z,f)}`}return""}),[ze,Ke]=a.useState(null),[Xe,De]=a.useState(null),[Pe,Oe]=a.useState({top:0,left:0,flipUp:!1}),[,Ie]=a.useReducer(K=>K+1,0),qe=a.useRef(null),_e=a.useRef(null),Je=a.useRef(null),q=y?420:m?480:360;a.useEffect(()=>{if(c==="single")$e(tt(D,f));else if(c==="range"){const[K,Z]=A;$e(K&&Z?`${tt(K,f)} – ${tt(Z,f)}`:K?tt(K,f):"")}else c==="multiple"&&$e(oe.length>0?`${oe.length} date${oe.length!==1?"s":""} selected`:"")},[D,A,oe,c,f]);const te=a.useCallback(()=>{qe.current&&Oe(mo(qe.current,q))},[q]);a.useEffect(()=>{if(Te)return te(),window.addEventListener("scroll",te,!0),window.addEventListener("resize",te),()=>{window.removeEventListener("scroll",te,!0),window.removeEventListener("resize",te)}},[Te,te]),a.useEffect(()=>{if(!Te)return;const K=Z=>{var ue,Ce;(ue=qe.current)!=null&&ue.contains(Z.target)||(Ce=_e.current)!=null&&Ce.contains(Z.target)||Me(!1)};return document.addEventListener("pointerdown",K),()=>document.removeEventListener("pointerdown",K)},[Te]),a.useEffect(()=>{if(!Te)return;const K=Z=>{var ue;Z.key==="Escape"&&(Me(!1),(ue=Je.current)==null||ue.focus())};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[Te]);const ve=a.useCallback(K=>d&&Ae(K)<Ae(d)||u&&Ae(K)>Ae(u)?!0:x?typeof x=="function"?x(K):x.some(Z=>Ve(Z,K)):!1,[d,u,x]),Se=a.useCallback(K=>{if(!ve(K)){if(c==="single")de?he(K):(W||Y(K),r==null||r(K),$e(tt(K,f)),Me(!1));else if(c==="range")if(ae==="start"){const Z=[K,null];U(Z),V||P(Z),i==null||i(Z),fe("end")}else{const Z=ge[0]??A[0],ue=Z&&K<Z?[K,Z]:[Z,K];U(ue),de?fe("start"):(V||P(ue),i==null||i(ue),fe("start"),Me(!1))}else if(c==="multiple"){const ue=oe.some(Ce=>Ve(Ce,K))?oe.filter(Ce=>!Ve(Ce,K)):[...oe,K];O||ee(ue),l==null||l(ue)}Ie()}},[c,ve,W,V,O,r,i,l,ae,ge,A,oe,de,f]),ye=a.useCallback(()=>{if(c==="single"){const K=se??D;W||Y(K),r==null||r(K)}else c==="range"&&(V||P(ge),i==null||i(ge));Me(!1),fe("start")},[c,se,ge,D,W,V,r,i]),Be=a.useCallback(()=>{he(null),U([null,null]),fe("start"),Me(!1)},[]),Ee=()=>{re===0?(le(11),me(K=>K-1)):le(K=>K-1),X("day")},H=()=>{re===11?(le(0),me(K=>K+1)):le(K=>K+1),X("day")},Q=()=>me(K=>K-1),ie=()=>me(K=>K+1),be=()=>me(K=>K-10),Ye=()=>me(K=>K+10),Qe=K=>{if($e(K),c==="single"){const Z=xo(K);Z&&!ve(Z)&&(W||Y(Z),r==null||r(Z),me(Z.getFullYear()),le(Z.getMonth()))}},lt=K=>{if(K.stopPropagation(),c==="single")W||Y(null),r==null||r(null),$e("");else if(c==="range"){const Z=[null,null];V||P(Z),i==null||i(Z),U(Z),$e(""),fe("start")}else c==="multiple"&&(O||ee([]),l==null||l([]),$e(""))},Mt=K=>{if(J!=="day")return;const Z=ze??D??I;let ue=null;if(K.key==="ArrowRight")ue=new Date(Z.getFullYear(),Z.getMonth(),Z.getDate()+1);else if(K.key==="ArrowLeft")ue=new Date(Z.getFullYear(),Z.getMonth(),Z.getDate()-1);else if(K.key==="ArrowDown")ue=new Date(Z.getFullYear(),Z.getMonth(),Z.getDate()+7);else if(K.key==="ArrowUp")ue=new Date(Z.getFullYear(),Z.getMonth(),Z.getDate()-7);else if(K.key==="Enter"&&ze){Se(ze);return}ue&&(K.preventDefault(),Ke(ue),(ue.getMonth()!==re||ue.getFullYear()!==ce)&&(le(ue.getMonth()),me(ue.getFullYear())))},_=()=>{me(I.getFullYear()),le(I.getMonth()),X("day"),Se(I)},pe=k??ho(),je=K=>{const[Z,ue]=K.getValue(),Ce=[Z,ue];U(Ce),V||P(Ce),i==null||i(Ce),me(Z.getFullYear()),le(Z.getMonth()),fe("start"),de||Me(!1)},Ne=re===11?0:re+1,nt=re===11?ce+1:ce,et=v>=2,ct=b?s.sanitizeString(b):void 0,dt=w?s.sanitizeString(w):void 0,ut=z?s.sanitizeString(z):void 0,bt=s.sanitizeString(g),yt=c==="single"&&D!=null||c==="range"&&(A[0]!=null||A[1]!=null)||c==="multiple"&&oe.length>0,Ze=c==="range"?de?ge:A:[null,null],ls=S?T.danger:Te?T.primary:T.border,cs=Array.from({length:24},(K,Z)=>Z),ds=Array.from({length:60},(K,Z)=>Z),us=e.jsxs("div",{ref:_e,role:"dialog","aria-label":"Date picker","aria-modal":"false",onKeyDown:Mt,style:{position:"absolute",top:Pe.top,left:Pe.left,zIndex:9999,backgroundColor:T.surface,border:`1px solid ${T.border}`,borderRadius:"14px",boxShadow:"0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",display:"flex",overflow:"hidden",minWidth:et?"580px":"300px",maxWidth:et&&y?"780px":et?"620px":y?"520px":"300px",opacity:Te?1:0,transform:Te?"translateY(0) scale(1)":Pe.flipUp?"translateY(4px) scale(0.98)":"translateY(-4px) scale(0.98)",transition:F?"none":"opacity 120ms ease, transform 120ms ease",fontFamily:"inherit"},children:[y&&c==="range"&&e.jsxs("div",{style:{width:"148px",flexShrink:0,borderRight:`1px solid ${T.border}`,padding:"8px 6px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"1px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:T.textMuted,textTransform:"uppercase",letterSpacing:"0.07em",padding:"4px 8px 8px"},children:"Quick select"}),pe.map(K=>{const[Z,ue]=K.getValue(),Ce=Ze[0]&&Ze[1]&&Ve(Ze[0],Z)&&Ve(Ze[1],ue);return e.jsx("button",{type:"button",onClick:()=>je(K),style:{width:"100%",textAlign:"left",padding:"7px 10px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",backgroundColor:Ce?`${T.primary}20`:"transparent",color:Ce?T.primary:T.text,fontWeight:Ce?600:400,fontFamily:"inherit",transition:"background-color 80ms ease"},onMouseEnter:ft=>{Ce||(ft.currentTarget.style.backgroundColor=`${T.surfaceAlt}`)},onMouseLeave:ft=>{Ce||(ft.currentTarget.style.backgroundColor="transparent")},children:K.label},K.label)})]}),e.jsxs("div",{style:{flex:1,padding:"16px",display:"flex",flexDirection:"column",gap:"12px",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("button",{type:"button","aria-label":J==="day"?"Previous month":J==="month"?"Previous year":"Previous decade",onClick:()=>{J==="day"?Ee():J==="month"?Q():be()},style:{border:"none",background:"transparent",cursor:"pointer",color:T.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[J==="day"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>X("month"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:T.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:er[re]}),e.jsx("button",{type:"button",onClick:()=>X("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:T.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:ce}),et&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:T.textMuted,fontSize:"14px"},children:"–"}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:600,color:T.text},children:[er[Ne]," ",nt]})]})]}),J==="month"&&e.jsx("button",{type:"button",onClick:()=>X("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:T.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:ce}),J==="year"&&e.jsxs("span",{style:{fontSize:"14px",fontWeight:600,color:T.text},children:[$t(ce),"–",$t(ce)+9]})]}),e.jsx("button",{type:"button","aria-label":J==="day"?"Next month":J==="month"?"Next year":"Next decade",onClick:()=>{J==="day"?H():J==="month"?ie():Ye()},style:{border:"none",background:"transparent",cursor:"pointer",color:T.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),J==="day"&&e.jsxs("div",{style:{display:"flex",gap:"20px"},children:[e.jsx(sr,{year:ce,month:re,today:I,mode:c,selectedDate:D,selectedRange:Ze,multiDates:oe,hoverDate:Xe,focusedDate:ze,isDateDisabled:ve,onSelectDate:Se,onHoverDate:De,onSetFocused:Ke,theme:T,locale:f}),et&&e.jsx(sr,{year:nt,month:Ne,today:I,mode:c,selectedDate:D,selectedRange:Ze,multiDates:oe,hoverDate:Xe,focusedDate:ze,isDateDisabled:ve,onSelectDate:Se,onHoverDate:De,onSetFocused:Ke,theme:T,locale:f})]}),J==="month"&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"6px"},children:uo.map((K,Z)=>{const ue=Z===re,Ce=Z===I.getMonth()&&ce===I.getFullYear();return e.jsx("button",{type:"button",onClick:()=>{le(Z),X("day")},style:{padding:"10px",borderRadius:"8px",border:Ce&&!ue?`2px solid ${T.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:ue?600:400,backgroundColor:ue?T.primary:"transparent",color:ue?T.bg:T.text,fontFamily:"inherit",transition:"background-color 80ms ease"},children:K},K)})}),J==="year"&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"6px"},children:Array.from({length:12},(K,Z)=>{const ue=$t(ce)-1+Z,Ce=ue===ce,ft=ue===I.getFullYear(),Ut=Z===0||Z===11;return e.jsx("button",{type:"button",onClick:()=>{me(ue),X("month")},style:{padding:"10px 6px",borderRadius:"8px",border:ft&&!Ce?`2px solid ${T.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:Ce?600:400,backgroundColor:Ce?T.primary:"transparent",color:Ce?T.bg:Ut?T.textMuted:T.text,fontFamily:"inherit",transition:"background-color 80ms ease",opacity:Ut?.5:1},children:ue},ue)})}),m&&J==="day"&&e.jsxs("div",{style:{borderTop:`1px solid ${T.border}`,paddingTop:"12px",display:"flex",alignItems:"flex-start",gap:"8px",justifyContent:"center"},children:[e.jsx(nr,{values:cs,selected:ke.h,onSelect:K=>{p||xe(Z=>({...Z,h:K})),h==null||h({...ke,h:K})},label:"Hour",theme:T}),e.jsx("div",{style:{display:"flex",alignItems:"center",height:"40px",marginTop:"28px",fontSize:"16px",fontWeight:700,color:T.textMuted},children:":"}),e.jsx(nr,{values:ds,selected:ke.m,onSelect:K=>{p||xe(Z=>({...Z,m:K})),h==null||h({...ke,m:K})},label:"Min",theme:T})]}),c==="multiple"&&J==="day"&&oe.length>0&&e.jsxs("div",{style:{borderTop:`1px solid ${T.border}`,paddingTop:"8px",fontSize:"12px",color:T.textMuted,textAlign:"center"},children:[oe.length," date",oe.length!==1?"s":""," selected"]}),e.jsxs("div",{style:{borderTop:`1px solid ${T.border}`,paddingTop:"10px",display:"flex",alignItems:"center",justifyContent:de?"space-between":"flex-start",gap:"8px"},children:[e.jsx("button",{type:"button",onClick:_,style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"13px",color:T.primary,fontWeight:500,padding:"6px 10px",borderRadius:"6px",fontFamily:"inherit"},children:"Today"}),de&&e.jsxs("div",{style:{display:"flex",gap:"6px"},children:[e.jsx("button",{type:"button",onClick:Be,style:{padding:"6px 14px",borderRadius:"7px",border:`1px solid ${T.border}`,cursor:"pointer",fontSize:"13px",fontWeight:500,backgroundColor:"transparent",color:T.text,fontFamily:"inherit"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:ye,style:{padding:"6px 14px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:600,backgroundColor:T.primary,color:T.bg,fontFamily:"inherit"},children:"Apply"})]})]})]})]});return e.jsxs("div",{className:C,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...M},children:[ct&&e.jsx("label",{htmlFor:$,style:{fontSize:"13px",fontWeight:500,color:T.text,marginBottom:"2px"},children:ct}),e.jsxs("div",{ref:qe,style:{display:"flex",alignItems:"center",border:`1.5px solid ${ls}`,borderRadius:"8px",backgroundColor:T.surface,overflow:"hidden",transition:F?"none":"border-color 120ms ease",opacity:j?.5:1},children:[e.jsx("span",{style:{display:"flex",alignItems:"center",paddingLeft:"10px",color:T.textMuted,flexShrink:0},children:e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),e.jsx("input",{ref:Je,id:$,type:"text",value:He,placeholder:bt,disabled:j,"aria-invalid":S,"aria-haspopup":"dialog","aria-expanded":Te,readOnly:c==="range"||c==="multiple",onChange:K=>Qe(K.target.value),onFocus:()=>{j||Me(!0)},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:T.text,cursor:c!=="single"?"pointer":"text",fontFamily:"inherit",minWidth:0}}),yt&&!j&&e.jsx("button",{type:"button","aria-label":"Clear selection",onClick:lt,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",background:"transparent",cursor:"pointer",color:T.textMuted,flexShrink:0,borderRadius:"4px",marginRight:"4px"},children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("button",{type:"button","aria-label":Te?"Close calendar":"Open calendar",tabIndex:-1,disabled:j,onClick:()=>{j||Me(K=>!K)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"34px",height:"36px",border:"none",background:"transparent",cursor:j?"not-allowed":"pointer",color:T.textMuted,flexShrink:0},children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:Te?"rotate(180deg)":"rotate(0deg)",transition:F?"none":"transform 160ms ease"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),dt&&!S&&e.jsx("span",{style:{fontSize:"12px",color:T.textMuted},children:dt}),S&&ut&&e.jsx("span",{role:"alert",style:{fontSize:"12px",color:T.danger},children:ut}),Te&&typeof document<"u"&&Le.createPortal(us,document.body)]})}rn.displayName="TkxDatePicker";const go={sm:{track:4,thumb:14,fontSize:"0.75rem"},md:{track:6,thumb:18,fontSize:"0.875rem"},lg:{track:8,thumb:22,fontSize:"1rem"}};function it(t,r,n){return Math.min(Math.max(t,r),n)}function Wt(t,r,n){return Math.round((t-r)/n)*n+r}function Ge(t,r,n){return(t-r)/(n-r)*100}function zt({value:t,min:r,max:n,step:i,isDisabled:o,trackColor:l,thumbSize:c,ariaLabel:d,tooltipMode:u,formatValue:x,orientation:f,onChange:m,onChangeEnd:p}){const[h,y]=a.useState(!1),[k,b]=a.useState(!1),[g,w]=a.useState(!1),j=M=>{o||(M.key==="ArrowRight"||M.key==="ArrowUp"?(M.preventDefault(),m(it(Wt(t+i,r,i),r,n))):M.key==="ArrowLeft"||M.key==="ArrowDown"?(M.preventDefault(),m(it(Wt(t-i,r,i),r,n))):M.key==="Home"?(M.preventDefault(),m(r)):M.key==="End"&&(M.preventDefault(),m(n)))},S=f==="vertical",z=Ge(t,r,n),v=u==="always"||u==="hover"&&(g||k||h),N=S?{position:"absolute",bottom:`${z}%`,transform:"translateY(50%)",left:"50%",marginLeft:`-${c/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"}:{position:"absolute",left:`${z}%`,transform:"translateX(-50%)",top:"50%",marginTop:`-${c/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"},C=S?{position:"absolute",left:c+6,top:"50%",transform:"translateY(-50%)",backgroundColor:l,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"}:{position:"absolute",bottom:c+6,left:"50%",transform:"translateX(-50%)",backgroundColor:l,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"};return e.jsxs("div",{style:N,children:[v&&e.jsx("div",{style:C,children:x(t)}),e.jsx("div",{role:"slider",tabIndex:o?-1:0,"aria-label":d,"aria-valuemin":r,"aria-valuemax":n,"aria-valuenow":t,"aria-disabled":o,"aria-orientation":f,onKeyDown:j,onFocus:()=>y(!0),onBlur:()=>y(!1),onPointerEnter:()=>w(!0),onPointerLeave:()=>w(!1),onPointerDown:M=>{o||(b(!0),M.target.setPointerCapture(M.pointerId))},onPointerUp:()=>{b(!1),p==null||p()},style:{width:c,height:c,borderRadius:"50%",backgroundColor:o?"#888":l,border:"3px solid #fff",boxShadow:h?`0 0 0 3px ${l}44`:"0 1px 4px rgba(0,0,0,0.3)",outline:"none",display:"block",transition:"box-shadow 150ms ease"}})]})}function nn({value:t,defaultValue:r=0,onChange:n,rangeValue:i,onRangeChange:o,min:l=0,max:c=100,step:d=1,isRange:u=!1,label:x,showValue:f=!1,showTicks:m=!1,tickCount:p=5,isDisabled:h=!1,colorScheme:y="primary",size:k="md",marks:b,orientation:g="horizontal",showTooltip:w=!1,formatValue:j,onChangeEnd:S,onRangeChangeEnd:z,gradient:v=!1}){const N=B.useTheme(),C=a.useId(),M=s.useReducedMotion(),T=t!==void 0,[E,$]=a.useState(r),F=T?t:E,I=i!==void 0,[W,L]=a.useState([l,c]),Y=I?i:W,D=a.useRef(null),V=a.useRef(F);V.current=F;const R=a.useRef(Y);R.current=Y;const P={primary:N.primary,success:N.success,danger:N.danger,warning:N.warning}[y],A=go[k],O=g==="vertical",G=w===!0?"hover":w===!1?!1:w,ee=j??(re=>String(re)),oe=P+"66",ae=a.useCallback((re,le)=>{const J=D.current;if(!J)return l;const X=J.getBoundingClientRect();let ne;O?ne=it((X.bottom-(le??0))/X.height,0,1):ne=it((re-X.left)/X.width,0,1);const xe=ne*(c-l)+l;return it(Wt(xe,l,d),l,c)},[l,c,d,O]),fe=a.useCallback(re=>{if(h)return;const le=ae(re.clientX,re.clientY);if(!u)T||$(le),n==null||n(le);else{const[J,X]=Y,ne=Math.abs(le-J),xe=Math.abs(le-X),ke=ne<=xe?[le,X]:[J,le];I||L(ke),o==null||o(ke)}},[h,u,T,I,ae,n,o,Y]),de=re=>{T||$(re),n==null||n(re)},ge=re=>{const le=[it(re,l,Y[1]),Y[1]];I||L(le),o==null||o(le)},U=re=>{const le=[Y[0],it(re,Y[0],c)];I||L(le),o==null||o(le)},se=u?Ge(Y[0],l,c):0,he=Ge(u?Y[1]:F,l,c),we=m?Array.from({length:p},(re,le)=>l+le/(p-1)*(c-l)):[],ce=x?s.sanitizeString(x):void 0,me=M?"none":"background 150ms ease";return e.jsxs("div",{className:s.tkx("flex flex-col gap-2"),style:{opacity:h?.55:1,...O?{height:200,width:"auto",display:"inline-flex"}:{width:"100%"}},children:[(ce||f)&&e.jsxs("div",{className:s.tkx("flex items-center justify-between"),children:[ce&&e.jsx("label",{htmlFor:C,className:s.tkx("text-sm font-medium"),style:{color:N.text,fontSize:A.fontSize},children:ce}),f&&!u&&e.jsx("span",{className:s.tkx("text-sm tabular-nums"),style:{color:N.textMuted,fontSize:A.fontSize},children:ee(F)}),f&&u&&e.jsxs("span",{className:s.tkx("text-sm tabular-nums"),style:{color:N.textMuted,fontSize:A.fontSize},children:[ee(Y[0])," – ",ee(Y[1])]})]}),e.jsxs("div",{style:{position:"relative",...O?{paddingLeft:A.thumb/2,paddingRight:A.thumb/2,flex:1}:{paddingTop:A.thumb/2,paddingBottom:A.thumb/2}},children:[e.jsxs("div",{ref:D,onPointerDown:fe,style:{position:"relative",...O?{width:A.track,height:"100%"}:{height:A.track},borderRadius:9999,backgroundColor:N.border,cursor:h?"not-allowed":"pointer",userSelect:"none",touchAction:"none"},children:[e.jsx("div",{style:{position:"absolute",...O?{left:0,bottom:`${se}%`,height:`${he-se}%`,width:"100%"}:{top:0,left:`${se}%`,width:`${he-se}%`,height:"100%"},borderRadius:9999,...h?{backgroundColor:N.textMuted}:v?{background:O?`linear-gradient(to top, ${oe}, ${P})`:`linear-gradient(to right, ${oe}, ${P})`}:{backgroundColor:P},transition:me}}),we.map((re,le)=>e.jsx("div",{style:{position:"absolute",...O?{bottom:`${Ge(re,l,c)}%`,left:"50%",transform:"translate(-50%, 50%)",height:3,width:A.track+4}:{left:`${Ge(re,l,c)}%`,top:"50%",transform:"translate(-50%, -50%)",width:3,height:A.track+4},backgroundColor:N.surface,borderRadius:9999,pointerEvents:"none"}},le)),u?e.jsxs(e.Fragment,{children:[e.jsx(zt,{value:Y[0],min:l,max:Y[1],step:d,isDisabled:h,trackColor:P,trackHeight:A.track,thumbSize:A.thumb,ariaLabel:`${ce??"Range"} start`,tooltipMode:G,formatValue:ee,orientation:g,onChange:ge,onChangeEnd:z?()=>z(R.current):void 0}),e.jsx(zt,{value:Y[1],min:Y[0],max:c,step:d,isDisabled:h,trackColor:P,trackHeight:A.track,thumbSize:A.thumb,ariaLabel:`${ce??"Range"} end`,tooltipMode:G,formatValue:ee,orientation:g,onChange:U,onChangeEnd:z?()=>z(R.current):void 0})]}):e.jsx(zt,{value:F,min:l,max:c,step:d,isDisabled:h,trackColor:P,trackHeight:A.track,thumbSize:A.thumb,ariaLabel:ce??"Slider",tooltipMode:G,formatValue:ee,orientation:g,onChange:de,onChangeEnd:S?()=>S(V.current):void 0})]}),b&&b.length>0&&e.jsx("div",{style:{position:O?"absolute":"relative",...O?{left:"100%",top:0,bottom:0,marginLeft:8}:{marginTop:8}},children:b.map((re,le)=>e.jsx("div",{style:{position:"absolute",...O?{bottom:`${Ge(re.value,l,c)}%`,transform:"translateY(50%)",left:0}:{left:`${Ge(re.value,l,c)}%`,transform:"translateX(-50%)"},fontSize:"0.6875rem",color:N.textMuted,whiteSpace:"nowrap"},children:s.sanitizeString(re.label)},le))})]}),m&&!b&&!O&&e.jsx("div",{style:{position:"relative",height:"1rem"},children:we.map((re,le)=>e.jsx("span",{style:{position:"absolute",left:`${Ge(re,l,c)}%`,transform:"translateX(-50%)",fontSize:"0.6875rem",color:N.textMuted},children:ee(Math.round(re))},le))})]})}nn.displayName="TkxSlider";const bo={sm:{height:28,minWidth:28,fontSize:"0.75rem",px:8},md:{height:36,minWidth:36,fontSize:"0.875rem",px:10},lg:{height:44,minWidth:44,fontSize:"1rem",px:12}};function yo(t,r,n,i){if(r<=1)return[1];const o=(y,k)=>Array.from({length:Math.max(0,k-y+1)},(b,g)=>y+g),l=Math.max(t-n,1),c=Math.min(t+n,r);if(!i){const y=[];return l>1&&y.push("..."),y.push(...o(l,c)),c<r&&y.push("..."),y}const d=1,u=r,x=l>d+2,f=c<u-2,m=[];m.push(1),x?m.push("left-ellipsis"):m.push(...o(2,l-1)),m.push(...o(Math.max(l,2),Math.min(c,r-1))),f?m.push("right-ellipsis"):m.push(...o(c+1,r-1)),r>1&&m.push(r);const p=new Set,h=[];for(const y of m)typeof y=="number"?p.has(y)||(p.add(y),h.push(y)):h.push(y);return h}function sn({total:t,pageSize:r=10,page:n,defaultPage:i=1,onChange:o,siblingCount:l=1,showEdges:c=!0,showPageSize:d=!1,onPageSizeChange:u,pageSizeOptions:x=[10,25,50,100],size:f="md",variant:m="default"}){const p=B.useTheme(),h=a.useId(),y=n!==void 0,[k,b]=a.useState(i),g=y?n:k,[w,j]=a.useState(r),S=r,z=Math.max(1,Math.ceil(t/S)),v=I=>{const W=Math.min(Math.max(I,1),z);W!==g&&(y||b(W),o==null||o(W))},N=I=>{j(I),u==null||u(I),v(1)},C=yo(g,z,l,c),M=bo[f],T=Math.min((g-1)*S+1,t),E=Math.min(g*S,t),$=(I,W)=>{const L={height:M.height,minWidth:M.minWidth,paddingLeft:M.px,paddingRight:M.px,fontSize:M.fontSize,borderRadius:"8px",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:W?"not-allowed":"pointer",border:"none",outline:"none",fontFamily:"inherit",transition:"background 120ms ease, color 120ms ease",opacity:W?.4:1};return I?{...L,backgroundColor:p.primary,color:p.bg,fontWeight:600,boxShadow:`0 0 0 2px ${p.primary}44`}:m==="default"?{...L,backgroundColor:p.surface,color:p.text,border:`1px solid ${p.border}`}:m==="outline"?{...L,backgroundColor:"transparent",color:p.text,border:`1px solid ${p.border}`}:{...L,backgroundColor:"transparent",color:p.text}},F=({d:I})=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("polyline",{points:I})});return e.jsxs("nav",{"aria-label":"Pagination",className:s.tkx("flex flex-col gap-2"),children:[t>0&&e.jsx("p",{className:s.tkx("text-sm"),style:{color:p.textMuted,fontSize:M.fontSize},children:s.sanitizeString(`Showing ${T}–${E} of ${t} items`)}),e.jsxs("div",{className:s.tkx("flex items-center gap-1 flex-wrap"),children:[c&&e.jsxs("button",{type:"button","aria-label":"First page",disabled:g===1,onClick:()=>v(1),style:$(!1,g===1),children:[e.jsx(F,{d:"15 18 9 12 15 6"}),e.jsx(F,{d:"20 18 14 12 20 6"})]}),e.jsx("button",{type:"button","aria-label":"Previous page",disabled:g===1,onClick:()=>v(g-1),style:$(!1,g===1),children:e.jsx(F,{d:"15 18 9 12 15 6"})}),C.map((I,W)=>{if(typeof I=="string")return e.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:M.minWidth,height:M.height,fontSize:M.fontSize,color:p.textMuted,userSelect:"none"},children:"…"},`${I}-${W}`);const Y=I,D=Y===g;return e.jsx("button",{type:"button","aria-label":`Page ${Y}`,"aria-current":D?"page":void 0,onClick:()=>v(Y),style:$(D,!1),children:Y},Y)}),e.jsx("button",{type:"button","aria-label":"Next page",disabled:g===z,onClick:()=>v(g+1),style:$(!1,g===z),children:e.jsx(F,{d:"9 18 15 12 9 6"})}),c&&e.jsxs("button",{type:"button","aria-label":"Last page",disabled:g===z,onClick:()=>v(z),style:$(!1,g===z),children:[e.jsx(F,{d:"4 18 10 12 4 6"}),e.jsx(F,{d:"14 18 20 12 14 6"})]}),d&&e.jsxs("div",{className:s.tkx("flex items-center gap-2 ml-2"),children:[e.jsx("label",{htmlFor:h,className:s.tkx("text-sm"),style:{color:p.textMuted,fontSize:M.fontSize,whiteSpace:"nowrap"},children:"Rows per page"}),e.jsx("select",{id:h,value:w,onChange:I=>N(Number(I.target.value)),style:{height:M.height,paddingLeft:M.px,paddingRight:M.px,fontSize:M.fontSize,borderRadius:"8px",border:`1px solid ${p.border}`,backgroundColor:p.surface,color:p.text,cursor:"pointer",outline:"none",fontFamily:"inherit"},children:x.map(I=>e.jsx("option",{value:I,children:I},I))})]})]})]})}sn.displayName="TkxPagination";const ko={"1/1":"100%","4/3":"75%","16/9":"56.25%","3/2":"66.666%","9/16":"177.777%"},vo={none:"0",sm:"4px",md:"8px",lg:"16px",full:"9999px"};function wo({color:t,size:r}){return e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("path",{d:"M21 15l-5-5L5 21"})]})}function jo({src:t,alt:r,fallback:n,placeholder:i="skeleton",fit:o="cover",ratio:l="auto",radius:c="none",caption:d,lazy:u=!0,preview:x=!1,className:f,style:m,...p}){const h=B.useTheme(),y=s.useReducedMotion(),[k,b]=a.useState(!1),[g,w]=a.useState(!1),[j,S]=a.useState(!1),z=a.useRef(null),v=s.sanitizeString(t),N=r?s.sanitizeString(r):"",C=d?s.sanitizeString(d):"",M=vo[c];a.useEffect(()=>{var O;(O=z.current)!=null&&O.complete&&b(!0)},[]);const T=a.useCallback(()=>b(!0),[]),E=a.useCallback(()=>w(!0),[]),$=a.useCallback(()=>{x&&!g&&S(!0)},[x,g]),F=a.useCallback(()=>S(!1),[]);a.useEffect(()=>{if(!j)return;const O=G=>{G.key==="Escape"&&F()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[j,F]);const I=i==="skeleton"&&!k&&!g,W=I&&!y?{animation:"tkx-shimmer 1.5s ease-in-out infinite"}:{},L=g?null:e.jsx("img",{ref:z,src:v,alt:N||void 0,role:N?void 0:"img","aria-label":N?void 0:"Image",loading:u?"lazy":void 0,onLoad:T,onError:E,onClick:x?$:void 0,className:s.cx(s.tkx("block w-full h-full"),x&&!g?s.tkx("cursor-pointer"):""),style:{objectFit:o,borderRadius:M,opacity:k?1:0,transition:y?"none":"opacity 200ms ease",position:l==="auto"?void 0:"absolute",inset:l==="auto"?void 0:0},...p}),Y=g?n?e.jsx(e.Fragment,{children:n}):e.jsxs("div",{role:"img","aria-label":N||"Image failed to load",className:s.tkx("flex flex-col items-center justify-center gap-2 w-full h-full"),style:{backgroundColor:h.surfaceAlt,borderRadius:M,color:h.textMuted,minHeight:"80px"},children:[e.jsx(wo,{color:h.textMuted,size:32}),e.jsx("span",{className:s.tkx("text-xs"),style:{color:h.textMuted},children:"Failed to load"})]}):null,D=I?e.jsx("div",{"aria-hidden":"true",style:{position:l==="auto"?void 0:"absolute",inset:l==="auto"?void 0:0,width:"100%",height:l==="auto"?"100%":void 0,minHeight:l==="auto"?"80px":void 0,borderRadius:M,backgroundColor:h.surfaceAlt,...W}}):null,V=l==="auto"?e.jsxs("div",{className:s.tkx("relative w-full"),style:{borderRadius:M},children:[D,L,Y]}):e.jsxs("div",{className:s.tkx("relative w-full overflow-hidden"),style:{paddingBottom:ko[l],borderRadius:M},children:[D,L,Y]}),R=C?e.jsxs("figure",{className:s.tkx("m-0 p-0 flex flex-col gap-2"),style:{borderRadius:M},children:[V,e.jsx("figcaption",{className:s.tkx("text-sm text-center"),style:{color:h.textMuted},children:C})]}):V,P=e.jsx("div",{className:s.cx(s.tkx("inline-block w-full"),f),style:m,children:R}),A=j&&typeof document<"u"?Le.createPortal(e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":N||"Image preview",className:s.tkx("fixed inset-0 z-[9500] flex items-center justify-center p-4"),onClick:F,children:[e.jsx("div",{"aria-hidden":"true",className:s.tkx("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.85)",backdropFilter:"blur(6px)"}}),e.jsx("img",{src:v,alt:N||"Full-size preview",onClick:O=>O.stopPropagation(),className:s.tkx("relative z-10 max-w-full max-h-full"),style:{objectFit:"contain",borderRadius:"8px",boxShadow:"0 25px 60px rgba(0,0,0,0.5)"}}),e.jsx("button",{"aria-label":"Close preview",onClick:F,className:s.tkx("absolute top-4 right-4 z-10 flex items-center justify-center","bg-transparent border-none cursor-pointer rounded-full p-2"),style:{color:"#fff",backgroundColor:"rgba(255,255,255,0.15)"},children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),document.body):null;return e.jsxs(e.Fragment,{children:[P,A]})}function or(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function So({mimeType:t,color:r}){return t.startsWith("image/")?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("path",{d:"M21 15l-5-5L5 21"})]}):t==="application/pdf"?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"9",y1:"13",x2:"15",y2:"13"}),e.jsx("line",{x1:"9",y1:"17",x2:"11",y2:"17"})]}):e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}let Co=0;function To(){return`tkx-file-${++Co}`}function Mo({accept:t,multiple:r=!1,maxSize:n,maxFiles:i,onChange:o,onError:l,label:c="Upload files",hint:d,isDisabled:u=!1,preview:x=!0,dragDrop:f=!0,variant:m="dropzone"}){const p=B.useTheme(),h=s.useReducedMotion(),y=a.useId(),k=a.useRef(null),[b,g]=a.useState(!1),[w,j]=a.useState([]);a.useEffect(()=>()=>{w.forEach(D=>{D.objectUrl&&URL.revokeObjectURL(D.objectUrl)})},[]);const S=a.useCallback(D=>{let V=0;const R=setInterval(()=>{V+=Math.floor(Math.random()*20)+10,V>=100&&(V=100,clearInterval(R)),j(P=>P.map(A=>A.id===D?{...A,progress:V}:A))},100)},[]),z=a.useCallback(D=>{if(n&&D.size>n)return`"${s.sanitizeString(D.name)}" exceeds max size of ${or(n)}`;if(t&&!t.split(",").map(P=>P.trim()).some(P=>P.startsWith(".")?D.name.toLowerCase().endsWith(P.toLowerCase()):P.endsWith("/*")?D.type.startsWith(P.slice(0,-1)):D.type===P))return`"${s.sanitizeString(D.name)}" is not an accepted file type`},[t,n]),v=a.useCallback(D=>{const V=i?i-w.length:1/0;if(V<=0){l==null||l(`Maximum of ${i} file${i===1?"":"s"} allowed`);return}const P=D.slice(0,V).map(A=>{const O=z(A),G=x&&A.type.startsWith("image/")&&!O?URL.createObjectURL(A):void 0;return{file:A,id:To(),objectUrl:G,progress:0,error:O}});j(A=>{const O=r?[...A,...P]:P,G=O.filter(ee=>!ee.error).map(ee=>ee.file);return o==null||o(G),O}),P.forEach(A=>{A.error&&(l==null||l(A.error))}),P.forEach(A=>{A.error||S(A.id)})},[w.length,i,r,o,l,x,S,z]),N=a.useCallback(D=>{const V=Array.from(D.target.files??[]);V.length&&v(V),D.target.value=""},[v]),C=a.useCallback(D=>{if(D.preventDefault(),g(!1),u)return;const V=Array.from(D.dataTransfer.files);V.length&&v(V)},[u,v]),M=a.useCallback(D=>{D.preventDefault(),u||g(!0)},[u]),T=a.useCallback(()=>g(!1),[]),E=a.useCallback(D=>{j(V=>{const R=V.find(A=>A.id===D);R!=null&&R.objectUrl&&URL.revokeObjectURL(R.objectUrl);const P=V.filter(A=>A.id!==D);return o==null||o(P.filter(A=>!A.error).map(A=>A.file)),P})},[o]),$=a.useCallback(()=>{var D;u||(D=k.current)==null||D.click()},[u]),F=b?p.primary:p.border,I=s.sanitizeString(c),W=d?s.sanitizeString(d):"",L=e.jsxs("div",{role:"button",tabIndex:u?-1:0,"aria-label":I,"aria-describedby":d?y:void 0,"aria-disabled":u,onClick:$,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),$())},onDrop:f?C:void 0,onDragOver:f?M:void 0,onDragLeave:f?T:void 0,className:s.tkx("flex flex-col items-center justify-center gap-3 w-full p-8 rounded-lg"),style:{border:`2px dashed ${F}`,backgroundColor:b?`${p.primary}10`:p.surface,cursor:u?"not-allowed":"pointer",opacity:u?.5:1,transition:h?"none":"border-color 150ms ease, background-color 150ms ease",outline:"none"},children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:b?p.primary:p.textMuted,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),e.jsxs("div",{className:s.tkx("text-center"),children:[e.jsx("p",{className:s.tkx("m-0 text-sm font-medium"),style:{color:p.text},children:b?"Drop files here":I}),W&&e.jsx("p",{id:y,className:s.tkx("m-0 text-xs mt-1"),style:{color:p.textMuted},children:W})]})]}),Y=e.jsxs("button",{type:"button",disabled:u,onClick:$,"aria-describedby":d?y:void 0,className:s.tkx("flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium font-sans border-none cursor-pointer"),style:{backgroundColor:p.primary,color:p.bg,opacity:u?.5:1,cursor:u?"not-allowed":"pointer"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),I,d&&e.jsx("span",{id:y,className:s.tkx("sr-only"),children:W})]});return e.jsxs("div",{className:s.tkx("flex flex-col gap-3 w-full font-sans"),children:[e.jsx("input",{ref:k,type:"file",accept:t,multiple:r,disabled:u,onChange:N,className:s.tkx("sr-only"),tabIndex:-1,"aria-hidden":"true"}),m==="dropzone"?L:Y,w.length>0&&e.jsx("ul",{role:"status","aria-live":"polite","aria-label":"Uploaded files",className:s.tkx("m-0 p-0 flex flex-col gap-2"),style:{listStyle:"none"},children:w.map(D=>e.jsxs("li",{className:s.tkx("flex flex-col gap-1 rounded-md p-3"),style:{backgroundColor:p.surfaceAlt,border:`1px solid ${D.error?p.danger:p.border}`},children:[e.jsxs("div",{className:s.tkx("flex items-center gap-3"),children:[D.objectUrl&&x?e.jsx("img",{src:D.objectUrl,alt:s.sanitizeString(D.file.name),className:s.tkx("rounded"),style:{width:40,height:40,objectFit:"cover",flexShrink:0}}):e.jsx("span",{style:{flexShrink:0},children:e.jsx(So,{mimeType:D.file.type,color:D.error?p.danger:p.textMuted})}),e.jsxs("div",{className:s.tkx("flex flex-col gap-0.5 flex-1 min-w-0"),children:[e.jsx("span",{className:s.tkx("text-sm font-medium truncate"),style:{color:D.error?p.danger:p.text},title:D.file.name,children:s.sanitizeString(D.file.name)}),e.jsxs("span",{className:s.tkx("text-xs"),style:{color:p.textMuted},children:[or(D.file.size),D.error&&` — ${D.error}`]})]}),e.jsx("button",{type:"button","aria-label":`Remove ${s.sanitizeString(D.file.name)}`,onClick:()=>E(D.id),className:s.tkx("flex items-center justify-center bg-transparent border-none cursor-pointer rounded p-1"),style:{color:p.textMuted,flexShrink:0},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!D.error&&D.progress<100&&e.jsx("div",{className:s.tkx("w-full overflow-hidden"),style:{height:"3px",borderRadius:"3px",backgroundColor:p.border},"aria-hidden":"true",children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",backgroundColor:p.primary,width:`${D.progress}%`,transition:h?"none":"width 100ms ease"}})})]},D.id))})]})}const $o={sm:16,md:24,lg:32,xl:40};function zo({size:t,filled:r,color:n,halfFilled:i,id:o}){const l=o?`hg-${o}`:void 0;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[i&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"50%",stopColor:n}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",fill:i&&l?`url(#${l})`:r?n:"none",stroke:n,strokeWidth:1.5,strokeLinejoin:"round"})]})}function Io({size:t,filled:r,color:n,halfFilled:i,id:o}){const l=o?`hg-${o}`:void 0;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[i&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"50%",stopColor:n}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",fill:i&&l?`url(#${l})`:r?n:"none",stroke:n,strokeWidth:1.5,strokeLinejoin:"round"})]})}function Eo({size:t,filled:r,color:n,halfFilled:i,id:o}){const l=o?`hg-${o}`:void 0;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[i&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"50%",stopColor:n}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:i&&l?`url(#${l})`:r?n:"none",stroke:n,strokeWidth:1.5})]})}function No({type:t,size:r,filled:n,color:i,halfFilled:o,uid:l}){const c={size:r,filled:n,color:i,halfFilled:o,id:l};return t==="heart"?e.jsx(Io,{...c}):t==="circle"?e.jsx(Eo,{...c}):e.jsx(zo,{...c})}function ir(t,r,n){return Math.min(n,Math.max(r,t))}function Ro(t,r){return r===1?Math.round(t):Math.round(t*2)/2}function ar(t,r,n){if(n===1)return r+1;const i=t.currentTarget.getBoundingClientRect(),o=i.left+i.width/2;return t.clientX<o?r+.5:r+1}function Lo({value:t,defaultValue:r=0,onChange:n,max:i=5,precision:o=1,size:l="md",isReadOnly:c=!1,isDisabled:d=!1,label:u,showValue:x=!1,colorScheme:f="warning",emptyIcon:m="star",filledIcon:p="star"}){const h=B.useTheme(),y=s.useReducedMotion(),k=a.useId(),b=t!==void 0,[g,w]=a.useState(r),[j,S]=a.useState(null),z=a.useRef(null),v=b?t??0:g,N=j??v,M={warning:h.warning,primary:h.primary,danger:h.danger}[f]??h.warning,T=$o[l],E=!c&&!d,$=a.useCallback(D=>{b||w(D),n==null||n(D)},[b,n]),F=a.useCallback((D,V)=>{E&&S(ar(D,V,o))},[E,o]),I=a.useCallback(()=>{E&&S(null)},[E]),W=a.useCallback((D,V)=>{if(!E)return;const R=ar(D,V,o);$(R===v?0:R)},[E,o,v,$]),L=a.useCallback(D=>{if(!E)return;const V=o;let R=v;if(D.key==="ArrowRight"||D.key==="ArrowUp")D.preventDefault(),R=ir(v+V,0,i);else if(D.key==="ArrowLeft"||D.key==="ArrowDown")D.preventDefault(),R=ir(v-V,0,i);else if(D.key==="Home")D.preventDefault(),R=0;else if(D.key==="End")D.preventDefault(),R=i;else return;R=Ro(R,o),$(R)},[E,v,i,o,$]),Y=u?s.sanitizeString(u):"Rating";return e.jsxs("div",{className:s.cx(s.tkx("inline-flex items-center gap-2 font-sans"),d?s.tkx("opacity-50"):""),children:[e.jsx("div",{ref:z,role:"radiogroup","aria-label":Y,"aria-disabled":d,"aria-readonly":c,tabIndex:E?0:-1,onKeyDown:L,onMouseLeave:I,className:s.tkx("flex items-center gap-0.5 outline-none"),style:{cursor:E?"pointer":"default"},children:Array.from({length:i},(D,V)=>{const R=V+1,P=V+.5,A=N>=R,O=!A&&o===.5&&N>=P,G=`${k}-${V}`;return e.jsx("span",{role:"radio","aria-checked":o===.5&&v===P||v===R,"aria-label":o===.5?`${P} star${P!==1?"s":""} / ${R} star${R!==1?"s":""}`:`${R} star${R!==1?"s":""}`,tabIndex:-1,onMouseMove:ee=>F(ee,V),onClick:ee=>W(ee,V),style:{display:"inline-flex",alignItems:"center",lineHeight:0,transition:y?"none":"transform 120ms ease",transform:j!==null&&N>=P&&E?"scale(1.15)":"scale(1)"},children:e.jsx(No,{type:A||O?p:m,size:T,filled:A,halfFilled:O,color:A||O?M:h.border,uid:O?G:void 0})},V)})}),x&&e.jsxs("span",{className:s.tkx("text-sm tabular-nums"),style:{color:h.textMuted},"aria-live":"polite","aria-atomic":"true",children:[v%1===0?v.toFixed(0):v.toFixed(1)," / ",i]})]})}let lr=!1;function Do(){if(lr||typeof document>"u")return;lr=!0;const t=document.createElement("style");t.textContent=`
|
|
20
|
+
`,document.head.appendChild(d)}},[]),typeof document>"u")return null;const c=s?[...n].reverse():n;return Le.createPortal(e.jsx("div",{"aria-label":"Notifications",className:x.tkx("fixed z-[9999] flex flex-col gap-2 pointer-events-none"),style:l,children:c.map(d=>e.jsx("div",{className:x.tkx("pointer-events-auto"),children:e.jsx(zs,{toast:d,position:t,onDismiss:Yt,reduced:o})},d.id))}),document.body)}const Ns={sm:{triggerPadding:"10px 12px",contentPadding:"0 12px 10px 12px",fontSize:"13px",subtitleSize:"11px",iconSize:14},md:{triggerPadding:"14px 16px",contentPadding:"0 16px 14px 16px",fontSize:"14px",subtitleSize:"12px",iconSize:16},lg:{triggerPadding:"18px 20px",contentPadding:"0 20px 18px 20px",fontSize:"16px",subtitleSize:"13px",iconSize:18}};function Qt({open:t,reduced:n,iconStyle:r,size:o,color:s}){const l=n?"none":"transform 240ms cubic-bezier(0.4, 0, 0.2, 1)";return r==="chevron"?e.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:s,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:t?"rotate(180deg)":"rotate(0deg)",transition:l,flexShrink:0},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}):r==="plus"?e.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:s,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:t?"rotate(45deg)":"rotate(0deg)",transition:l,flexShrink:0},children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):e.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:s,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:l,flexShrink:0},children:[e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),e.jsx("polyline",{points:"12 5 19 12 12 19"})]})}function Ls({isOpen:t,reduced:n,children:r,id:o,triggerId:s}){const l=i.useRef(null),a=i.useRef(null),c=i.useRef(t),d=i.useRef(!1);i.useEffect(()=>{const u=l.current;u&&(t?(u.style.height="auto",u.style.overflow="visible"):(u.style.height="0px",u.style.overflow="hidden"))},[]),i.useEffect(()=>{if(c.current===t)return;c.current=t;const u=l.current,h=a.current;if(!(!u||!h)){if(n){u.style.height=t?"auto":"0px",u.style.overflow=t?"visible":"hidden";return}if(d.current){const p=u.getBoundingClientRect().height;u.style.transition="none",u.style.height=`${p}px`,u.offsetHeight}d.current=!0,u.style.overflow="hidden",t?(u.style.height="0px",u.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{u.style.height=`${h.scrollHeight}px`})})):(u.style.height=`${h.scrollHeight}px`,u.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{u.style.height="0px"})}))}},[t,n]);const f=u=>{if(u.propertyName!=="height")return;d.current=!1;const h=l.current;h&&(t?(h.style.height="auto",h.style.overflow="visible"):h.style.overflow="hidden")};return e.jsx("div",{ref:l,id:o,role:"region","aria-labelledby":s,onTransitionEnd:f,style:{willChange:"height"},children:e.jsx("div",{ref:a,children:r})})}function ir({items:t,multiple:n=!1,defaultOpen:r,value:o,onChange:s,variant:l="default",size:a="md",iconPosition:c="right",iconStyle:d="chevron",flush:f=!1,className:u,style:h}){const p=_.useTheme(),m=Q.useReducedMotion(),y=i.useId(),k=o!==void 0,b=T=>T?Array.isArray(T)?new Set(T):new Set([T]):new Set,[g,M]=i.useState(()=>b(r)),j=k?b(o):g,w=i.useCallback((T,E)=>{if(E)return;let C;if(k){const z=b(o);C=new Set(z),C.has(T)?C.delete(T):(n||C.clear(),C.add(T))}else{M(z=>{C=new Set(z),C.has(T)?C.delete(T):(n||C.clear(),C.add(T));const R=[...C];return s==null||s(n?R:R[0]??""),C});return}const H=[...C];s==null||s(n?H:H[0]??"")},[n,s,k,o]),I=Ns[a],v=()=>{if(f)return{};switch(l){case"bordered":return{border:`1px solid ${p.border}`,borderRadius:"10px",overflow:"hidden"};case"separated":return{};case"ghost":case"flush":return{};default:return{}}},N=(T,E,C)=>{if(f)return{};switch(l){case"default":return{borderBottom:C?"none":`1px solid ${p.border}`};case"bordered":return{borderBottom:C?"none":`1px solid ${p.border}`};case"separated":return{border:`1px solid ${p.border}`,borderRadius:"10px",overflow:"hidden",boxShadow:"0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04)"};case"ghost":return{};default:return{}}},$=T=>l==="ghost"||l==="flush"?T?`${p.primary}10`:`${p.surfaceAlt}80`:T?`${p.primary}0d`:`${p.surfaceAlt}60`,S=l==="separated";return e.jsx("div",{className:x.tkx(u??""),style:{...v(),display:S?"flex":void 0,flexDirection:S?"column":void 0,gap:S?"8px":void 0,...h},children:t.map((T,E)=>{const C=j.has(T.id),H=E===t.length-1,z=`${y}-trigger-${T.id}`,R=`${y}-panel-${T.id}`;return e.jsxs("div",{className:T.className,style:N(E,C,H),children:[e.jsxs("button",{id:z,type:"button",role:"button","aria-expanded":C,"aria-controls":R,disabled:T.disabled,onClick:()=>w(T.id,T.disabled),style:{width:"100%",display:"flex",alignItems:T.subtitle?"flex-start":"center",gap:"8px",padding:I.triggerPadding,border:"none",background:"transparent",cursor:T.disabled?"not-allowed":"pointer",textAlign:"left",fontFamily:"inherit",fontSize:I.fontSize,fontWeight:500,color:T.disabled?p.textMuted:p.text,opacity:T.disabled?.5:1,transition:m?"none":"background-color 160ms ease",outline:"none"},onMouseEnter:B=>{T.disabled||(B.currentTarget.style.backgroundColor=$(C))},onMouseLeave:B=>{B.currentTarget.style.backgroundColor=C?`${p.primary}0d`:"transparent"},onFocus:B=>{T.disabled||(B.currentTarget.style.outline=`2px solid ${p.primary}`,B.currentTarget.style.outlineOffset="2px")},onBlur:B=>{B.currentTarget.style.outline="none"},children:[T.icon&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:p.primary,marginTop:T.subtitle?"1px":void 0},children:T.icon}),c==="left"&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:C?p.primary:p.textMuted,marginTop:T.subtitle?"1px":void 0},children:e.jsx(Qt,{open:C,reduced:m,iconStyle:d,size:I.iconSize,color:C?p.primary:p.textMuted})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{style:{display:"block",lineHeight:1.4},children:T.title}),T.subtitle&&e.jsx("span",{style:{display:"block",fontSize:I.subtitleSize,color:p.textMuted,fontWeight:400,marginTop:"2px",lineHeight:1.3},children:T.subtitle})]}),T.badge&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0},children:T.badge}),c==="right"&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:C?p.primary:p.textMuted,marginTop:T.subtitle?"1px":void 0},children:e.jsx(Qt,{open:C,reduced:m,iconStyle:d,size:I.iconSize,color:C?p.primary:p.textMuted})})]}),e.jsx(Ls,{isOpen:C,reduced:m,id:R,triggerId:z,children:e.jsx("div",{style:{padding:I.contentPadding,fontSize:I.fontSize,lineHeight:1.6,color:p.textMuted,fontFamily:"inherit"},children:T.content})})]},T.id)})})}ir.displayName="TkxAccordion";const Rs={sm:"280px",md:"380px",lg:"480px",xl:"600px",full:"100%"};let Ft=0;function As(){++Ft===1&&(document.body.style.overflow="hidden")}function Jt(){--Ft<=0&&(Ft=0,document.body.style.overflow="")}function Ds(t){switch(t){case"left":return"translateX(-100%)";case"right":return"translateX(100%)";case"top":return"translateY(-100%)";case"bottom":return"translateY(100%)"}}function Bs(t,n){const r=Rs[n],o=t==="left"||t==="right",s={position:"absolute"};return o?{...s,top:0,bottom:0,[t]:0,width:r,maxWidth:"100vw",height:"100%"}:{...s,left:0,right:0,[t]:0,height:r,maxHeight:"100vh",width:"100%"}}function en(){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Ws({isOpen:t,onClose:n,placement:r="right",size:o="md",title:s,children:l,footer:a,closeOnOverlayClick:c=!0,closeOnEsc:d=!0}){const f=_.useTheme(),u=Q.useReducedMotion(),h=i.useId(),p=Q.useFocusTrap(t);if(Q.useEscapeKey(n,d&&t),i.useEffect(()=>(t?As():Jt(),()=>{t&&Jt()}),[t]),typeof document>"u")return null;const m=Bs(r,o),y=Ds(r),k=u?"none":"transform 280ms cubic-bezier(0.4,0,0.2,1), opacity 280ms ease",b=typeof s=="string"?A.sanitizeString(s):s;return Le.createPortal(e.jsxs("div",{role:"presentation",className:x.tkx("fixed inset-0 z-[9000]"),style:{pointerEvents:t?"auto":"none",visibility:t?"visible":"hidden"},children:[e.jsx("div",{"aria-hidden":"true",onClick:c?n:void 0,className:x.tkx("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(3px)",opacity:t?1:0,transition:u?"none":"opacity 280ms ease",cursor:c?"pointer":"default"}}),e.jsxs("div",{ref:p,role:"dialog","aria-modal":"true","aria-labelledby":s?h:void 0,className:x.tkx("absolute flex flex-col font-sans"),style:{...m,backgroundColor:f.surface,borderLeft:r==="right"?`1px solid ${f.border}`:void 0,borderRight:r==="left"?`1px solid ${f.border}`:void 0,borderTop:r==="bottom"?`1px solid ${f.border}`:void 0,borderBottom:r==="top"?`1px solid ${f.border}`:void 0,boxShadow:`0 20px 60px ${f.bg}99`,transform:t?"translate(0,0)":y,opacity:t?1:0,transition:k,willChange:"transform"},children:[s!==void 0&&e.jsxs("div",{className:x.tkx("flex items-center justify-between px-5 py-4 shrink-0"),style:{borderBottom:`1px solid ${f.border}`},children:[e.jsx("h2",{id:h,className:x.tkx("m-0 text-base font-semibold leading-snug"),style:{color:f.text},children:b}),e.jsx("button",{onClick:n,"aria-label":"Close drawer",className:x.tkx("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:f.textMuted},children:e.jsx(en,{})})]}),s===void 0&&e.jsx("div",{className:x.tkx("flex justify-end px-3 pt-3 shrink-0"),children:e.jsx("button",{onClick:n,"aria-label":"Close drawer",className:x.tkx("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:f.textMuted},children:e.jsx(en,{})})}),e.jsx("div",{className:x.tkx("flex-1 overflow-y-auto px-5 py-4"),style:{color:f.text},children:l}),a&&e.jsx("div",{className:x.tkx("flex items-center justify-end gap-2 px-5 py-4 shrink-0"),style:{borderTop:`1px solid ${f.border}`},children:a})]})]}),document.body)}const Ps=["Su","Mo","Tu","We","Th","Fr","Sa"],tn=["January","February","March","April","May","June","July","August","September","October","November","December"],Fs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ye(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function Be(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function Hs(t,n,r){if(!n||!r)return!1;const o=Be(t).getTime(),s=Be(n).getTime(),l=Be(r).getTime(),a=Math.min(s,l),c=Math.max(s,l);return o>a&&o<c}function nn(t,n,r){return!!(n&&Ye(t,n)||r&&Ye(t,r))}function ot(t,n="en-US"){return t?t.toLocaleDateString(n,{month:"2-digit",day:"2-digit",year:"numeric"}):""}function Vs(t){const n=t.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(!n)return null;const[,r,o,s]=n.map(Number);if(r<1||r>12||o<1||o>31)return null;const l=new Date(s,r-1,o);return l.getMonth()!==r-1?null:l}function rn(t,n){return new Date(t,n+1,0).getDate()}function Os(t,n){const r=new Date(t,n,1).getDay(),o=rn(t,n),s=[],l=rn(t,n-1);for(let c=r-1;c>=0;c--)s.push(new Date(t,n-1,l-c));for(let c=1;c<=o;c++)s.push(new Date(t,n,c));let a=1;for(;s.length<42;)s.push(new Date(t,n+1,a++));return s}function It(t){return Math.floor(t/10)*10}function _s(){return[{label:"Today",getValue:()=>{const t=Be(new Date);return[t,t]}},{label:"Yesterday",getValue:()=>{const t=Be(new Date);return t.setDate(t.getDate()-1),[t,t]}},{label:"Last 7 days",getValue:()=>{const t=Be(new Date),n=new Date(t);return n.setDate(n.getDate()-6),[n,t]}},{label:"Last 30 days",getValue:()=>{const t=Be(new Date),n=new Date(t);return n.setDate(n.getDate()-29),[n,t]}},{label:"Last 90 days",getValue:()=>{const t=Be(new Date),n=new Date(t);return n.setDate(n.getDate()-89),[n,t]}},{label:"This week",getValue:()=>{const t=Be(new Date),n=new Date(t);n.setDate(n.getDate()-n.getDay());const r=new Date(n);return r.setDate(r.getDate()+6),[n,r]}},{label:"Last week",getValue:()=>{const t=Be(new Date),n=new Date(t);n.setDate(n.getDate()-n.getDay()-1);const r=new Date(n);return r.setDate(r.getDate()-6),[r,n]}},{label:"This month",getValue:()=>{const t=new Date;return[new Date(t.getFullYear(),t.getMonth(),1),new Date(t.getFullYear(),t.getMonth()+1,0)]}},{label:"Last month",getValue:()=>{const t=new Date;return[new Date(t.getFullYear(),t.getMonth()-1,1),new Date(t.getFullYear(),t.getMonth(),0)]}},{label:"This quarter",getValue:()=>{const t=new Date,n=Math.floor(t.getMonth()/3);return[new Date(t.getFullYear(),n*3,1),new Date(t.getFullYear(),n*3+3,0)]}},{label:"Last quarter",getValue:()=>{const t=new Date,n=Math.floor(t.getMonth()/3),r=n===0?3:n-1,o=n===0?t.getFullYear()-1:t.getFullYear();return[new Date(o,r*3,1),new Date(o,r*3+3,0)]}},{label:"This year",getValue:()=>{const t=new Date().getFullYear();return[new Date(t,0,1),new Date(t,11,31)]}},{label:"Last year",getValue:()=>{const t=new Date().getFullYear()-1;return[new Date(t,0,1),new Date(t,11,31)]}}]}function Ys(t,n){const r=t.getBoundingClientRect(),o=window.innerHeight,s=window.scrollY,l=window.scrollX,c=o-r.bottom<n+8&&r.top>n+8;return{top:c?s+r.top-n-4:s+r.bottom+4,left:l+r.left,flipUp:c}}function sn({values:t,selected:n,onSelect:r,label:o,theme:s,format:l}){const a=i.useRef([]),c=i.useRef(null);i.useEffect(()=>{const f=a.current[n];f&&c.current&&f.scrollIntoView({block:"nearest"})},[n]);const d=l??(f=>String(f).padStart(2,"0"));return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:s.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:o}),e.jsx("div",{ref:c,style:{height:"160px",overflowY:"auto",width:"52px",scrollbarWidth:"thin",border:`1px solid ${s.border}`,borderRadius:"8px",padding:"4px"},children:t.map(f=>{const u=f===n;return e.jsx("button",{ref:h=>{a.current[f]=h},type:"button",onClick:()=>r(f),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"32px",borderRadius:"6px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:u?600:400,backgroundColor:u?s.primary:"transparent",color:u?s.bg:s.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:d(f)},f)})})]})}function on({year:t,month:n,today:r,mode:o,selectedDate:s,selectedRange:l,multiDates:a,hoverDate:c,focusedDate:d,isDateDisabled:f,onSelectDate:u,onHoverDate:h,onSetFocused:p,theme:m,locale:y}){const k=Os(t,n);return e.jsxs("div",{children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:Ps.map(b=>e.jsx("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:m.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:b},b))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:k.map((b,g)=>{const M=b.getMonth()===n,j=Ye(b,r),w=b.getDay()===0||b.getDay()===6,I=f(b),v=o==="single"&&s!=null&&Ye(b,s),N=o==="multiple"&&a.some(P=>Ye(P,b)),$=o==="range"&&nn(b,l[0],null),S=o==="range"&&nn(b,null,l[1]),T=$||S,E=o==="range"&&l[0]&&!l[1]&&c?c:l[1],C=o==="range"&&Hs(b,l[0],E),H=o==="range"&&l[0]&&!l[1]&&c&&Ye(b,c),z=v||N||T,R=d!=null&&Ye(b,d);let B="transparent",V=M?w?`${m.text}cc`:m.text:`${m.textMuted}60`,D="none",O=400;z||H?(B=m.primary,V=m.bg,O=600):C&&(B=`${m.primary}18`),j&&!z&&(D=`2px solid ${m.primary}`,O=600),I&&(V=`${m.textMuted}50`),R&&!z&&(D=`2px solid ${m.secondary}`);const L=b.toLocaleDateString(y,{weekday:"long",year:"numeric",month:"long",day:"numeric"});return e.jsx("button",{type:"button","aria-label":L,"aria-pressed":z,"aria-disabled":I,disabled:I,onClick:()=>!I&&u(b),onMouseEnter:()=>h(b),onMouseLeave:()=>h(null),onFocus:()=>p(b),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:B,color:V,border:D,fontSize:"13px",fontWeight:O,cursor:I?"not-allowed":"pointer",opacity:I?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:I?"line-through":"none",transition:"background-color 80ms ease"},children:b.getDate()},g)})})]})}function lr({value:t,onChange:n,rangeValue:r,onRangeChange:o,multiValue:s,onMultiChange:l,mode:a="single",minDate:c,maxDate:d,disabledDates:f,locale:u="en-US",showTime:h=!1,timeValue:p,onTimeChange:m,showPresets:y=!1,customPresets:k,label:b,placeholder:g="MM/DD/YYYY",hint:M,isDisabled:j=!1,isInvalid:w=!1,errorMessage:I,numberOfMonths:v=1,id:N,className:$,style:S}){const T=_.useTheme(),E=i.useId(),C=N??E,H=Q.useReducedMotion(),z=Be(new Date),R=t!==void 0,[B,V]=i.useState(null),D=R?t??null:B,O=r!==void 0,[L,P]=i.useState([null,null]),W=O?r:L,K=s!==void 0,[ne,Z]=i.useState([]),ie=K?s:ne,[fe,pe]=i.useState("start"),te=a==="range"||a==="single"&&h,[ce,Y]=i.useState([null,null]),[se,le]=i.useState(null),ge=D??W[0]??z,[he,ye]=i.useState(ge.getFullYear()),[de,xe]=i.useState(ge.getMonth()),[oe,G]=i.useState("day"),[ue,ke]=i.useState({h:0,m:0}),ve=p??ue,[Me,$e]=i.useState(!1),[We,Te]=i.useState(()=>{if(a==="single")return ot(D,u);if(a==="range"){const[X,ee]=W;if(X&&ee)return`${ot(X,u)} – ${ot(ee,u)}`}return""}),[ze,Ke]=i.useState(null),[Ze,Pe]=i.useState(null),[Oe,Ge]=i.useState({top:0,left:0,flipUp:!1}),[,Ee]=i.useReducer(X=>X+1,0),qe=i.useRef(null),rt=i.useRef(null),Qe=i.useRef(null),Re=y?420:h?480:360;i.useEffect(()=>{if(a==="single")Te(ot(D,u));else if(a==="range"){const[X,ee]=W;Te(X&&ee?`${ot(X,u)} – ${ot(ee,u)}`:X?ot(X,u):"")}else a==="multiple"&&Te(ie.length>0?`${ie.length} date${ie.length!==1?"s":""} selected`:"")},[D,W,ie,a,u]);const Fe=i.useCallback(()=>{qe.current&&Ge(Ys(qe.current,Re))},[Re]);i.useEffect(()=>{if(Me)return Fe(),window.addEventListener("scroll",Fe,!0),window.addEventListener("resize",Fe),()=>{window.removeEventListener("scroll",Fe,!0),window.removeEventListener("resize",Fe)}},[Me,Fe]),i.useEffect(()=>{if(!Me)return;const X=ee=>{var me,Se;(me=qe.current)!=null&&me.contains(ee.target)||(Se=rt.current)!=null&&Se.contains(ee.target)||$e(!1)};return document.addEventListener("pointerdown",X),()=>document.removeEventListener("pointerdown",X)},[Me]),i.useEffect(()=>{if(!Me)return;const X=ee=>{var me;ee.key==="Escape"&&($e(!1),(me=Qe.current)==null||me.focus())};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[Me]);const Ae=i.useCallback(X=>c&&Be(X)<Be(c)||d&&Be(X)>Be(d)?!0:f?typeof f=="function"?f(X):f.some(ee=>Ye(ee,X)):!1,[c,d,f]),Je=i.useCallback(X=>{if(!Ae(X)){if(a==="single")te?le(X):(R||V(X),n==null||n(X),Te(ot(X,u)),$e(!1));else if(a==="range")if(fe==="start"){const ee=[X,null];Y(ee),O||P(ee),o==null||o(ee),pe("end")}else{const ee=ce[0]??W[0],me=ee&&X<ee?[X,ee]:[ee,X];Y(me),te?pe("start"):(O||P(me),o==null||o(me),pe("start"),$e(!1))}else if(a==="multiple"){const me=ie.some(Se=>Ye(Se,X))?ie.filter(Se=>!Ye(Se,X)):[...ie,X];K||Z(me),l==null||l(me)}Ee()}},[a,Ae,R,O,K,n,o,l,fe,ce,W,ie,te,u]),Ue=i.useCallback(()=>{if(a==="single"){const X=se??D;R||V(X),n==null||n(X)}else a==="range"&&(O||P(ce),o==null||o(ce));$e(!1),pe("start")},[a,se,ce,D,R,O,n,o]),lt=i.useCallback(()=>{le(null),Y([null,null]),pe("start"),$e(!1)},[]),q=()=>{de===0?(xe(11),ye(X=>X-1)):xe(X=>X-1),G("day")},F=()=>{de===11?(xe(0),ye(X=>X+1)):xe(X=>X+1),G("day")},J=()=>ye(X=>X-1),re=()=>ye(X=>X+1),ae=()=>ye(X=>X-10),Ce=()=>ye(X=>X+10),Ie=X=>{if(Te(X),a==="single"){const ee=Vs(X);ee&&!Ae(ee)&&(R||V(ee),n==null||n(ee),ye(ee.getFullYear()),xe(ee.getMonth()))}},we=X=>{if(X.stopPropagation(),a==="single")R||V(null),n==null||n(null),Te("");else if(a==="range"){const ee=[null,null];O||P(ee),o==null||o(ee),Y(ee),Te(""),pe("start")}else a==="multiple"&&(K||Z([]),l==null||l([]),Te(""))},_e=X=>{if(oe!=="day")return;const ee=ze??D??z;let me=null;if(X.key==="ArrowRight")me=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()+1);else if(X.key==="ArrowLeft")me=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()-1);else if(X.key==="ArrowDown")me=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()+7);else if(X.key==="ArrowUp")me=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()-7);else if(X.key==="Enter"&&ze){Je(ze);return}me&&(X.preventDefault(),Ke(me),(me.getMonth()!==de||me.getFullYear()!==he)&&(xe(me.getMonth()),ye(me.getFullYear())))},U=()=>{ye(z.getFullYear()),xe(z.getMonth()),G("day"),Je(z)},be=k??_s(),je=X=>{const[ee,me]=X.getValue(),Se=[ee,me];Y(Se),O||P(Se),o==null||o(Se),ye(ee.getFullYear()),xe(ee.getMonth()),pe("start"),te||$e(!1)},Ne=de===11?0:de+1,at=de===11?he+1:he,st=v>=2,pt=b?A.sanitizeString(b):void 0,ht=M?A.sanitizeString(M):void 0,mt=I?A.sanitizeString(I):void 0,wt=A.sanitizeString(g),jt=a==="single"&&D!=null||a==="range"&&(W[0]!=null||W[1]!=null)||a==="multiple"&&ie.length>0,et=a==="range"?te?ce:W:[null,null],Wr=w?T.danger:Me?T.primary:T.border,Pr=Array.from({length:24},(X,ee)=>ee),Fr=Array.from({length:60},(X,ee)=>ee),Hr=e.jsxs("div",{ref:rt,role:"dialog","aria-label":"Date picker","aria-modal":"false",onKeyDown:_e,style:{position:"absolute",top:Oe.top,left:Oe.left,zIndex:9999,backgroundColor:T.surface,border:`1px solid ${T.border}`,borderRadius:"14px",boxShadow:"0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",display:"flex",overflow:"hidden",minWidth:st?"580px":"300px",maxWidth:st&&y?"780px":st?"620px":y?"520px":"300px",opacity:Me?1:0,transform:Me?"translateY(0) scale(1)":Oe.flipUp?"translateY(4px) scale(0.98)":"translateY(-4px) scale(0.98)",transition:H?"none":"opacity 120ms ease, transform 120ms ease",fontFamily:"inherit"},children:[y&&a==="range"&&e.jsxs("div",{style:{width:"148px",flexShrink:0,borderRight:`1px solid ${T.border}`,padding:"8px 6px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"1px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:T.textMuted,textTransform:"uppercase",letterSpacing:"0.07em",padding:"4px 8px 8px"},children:"Quick select"}),be.map(X=>{const[ee,me]=X.getValue(),Se=et[0]&&et[1]&&Ye(et[0],ee)&&Ye(et[1],me);return e.jsx("button",{type:"button",onClick:()=>je(X),style:{width:"100%",textAlign:"left",padding:"7px 10px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",backgroundColor:Se?`${T.primary}20`:"transparent",color:Se?T.primary:T.text,fontWeight:Se?600:400,fontFamily:"inherit",transition:"background-color 80ms ease"},onMouseEnter:gt=>{Se||(gt.currentTarget.style.backgroundColor=`${T.surfaceAlt}`)},onMouseLeave:gt=>{Se||(gt.currentTarget.style.backgroundColor="transparent")},children:X.label},X.label)})]}),e.jsxs("div",{style:{flex:1,padding:"16px",display:"flex",flexDirection:"column",gap:"12px",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("button",{type:"button","aria-label":oe==="day"?"Previous month":oe==="month"?"Previous year":"Previous decade",onClick:()=>{oe==="day"?q():oe==="month"?J():ae()},style:{border:"none",background:"transparent",cursor:"pointer",color:T.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[oe==="day"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>G("month"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:T.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:tn[de]}),e.jsx("button",{type:"button",onClick:()=>G("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:T.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:he}),st&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:T.textMuted,fontSize:"14px"},children:"–"}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:600,color:T.text},children:[tn[Ne]," ",at]})]})]}),oe==="month"&&e.jsx("button",{type:"button",onClick:()=>G("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:T.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:he}),oe==="year"&&e.jsxs("span",{style:{fontSize:"14px",fontWeight:600,color:T.text},children:[It(he),"–",It(he)+9]})]}),e.jsx("button",{type:"button","aria-label":oe==="day"?"Next month":oe==="month"?"Next year":"Next decade",onClick:()=>{oe==="day"?F():oe==="month"?re():Ce()},style:{border:"none",background:"transparent",cursor:"pointer",color:T.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),oe==="day"&&e.jsxs("div",{style:{display:"flex",gap:"20px"},children:[e.jsx(on,{year:he,month:de,today:z,mode:a,selectedDate:D,selectedRange:et,multiDates:ie,hoverDate:Ze,focusedDate:ze,isDateDisabled:Ae,onSelectDate:Je,onHoverDate:Pe,onSetFocused:Ke,theme:T,locale:u}),st&&e.jsx(on,{year:at,month:Ne,today:z,mode:a,selectedDate:D,selectedRange:et,multiDates:ie,hoverDate:Ze,focusedDate:ze,isDateDisabled:Ae,onSelectDate:Je,onHoverDate:Pe,onSetFocused:Ke,theme:T,locale:u})]}),oe==="month"&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"6px"},children:Fs.map((X,ee)=>{const me=ee===de,Se=ee===z.getMonth()&&he===z.getFullYear();return e.jsx("button",{type:"button",onClick:()=>{xe(ee),G("day")},style:{padding:"10px",borderRadius:"8px",border:Se&&!me?`2px solid ${T.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:me?600:400,backgroundColor:me?T.primary:"transparent",color:me?T.bg:T.text,fontFamily:"inherit",transition:"background-color 80ms ease"},children:X},X)})}),oe==="year"&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"6px"},children:Array.from({length:12},(X,ee)=>{const me=It(he)-1+ee,Se=me===he,gt=me===z.getFullYear(),Ut=ee===0||ee===11;return e.jsx("button",{type:"button",onClick:()=>{ye(me),G("month")},style:{padding:"10px 6px",borderRadius:"8px",border:gt&&!Se?`2px solid ${T.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:Se?600:400,backgroundColor:Se?T.primary:"transparent",color:Se?T.bg:Ut?T.textMuted:T.text,fontFamily:"inherit",transition:"background-color 80ms ease",opacity:Ut?.5:1},children:me},me)})}),h&&oe==="day"&&e.jsxs("div",{style:{borderTop:`1px solid ${T.border}`,paddingTop:"12px",display:"flex",alignItems:"flex-start",gap:"8px",justifyContent:"center"},children:[e.jsx(sn,{values:Pr,selected:ve.h,onSelect:X=>{p||ke(ee=>({...ee,h:X})),m==null||m({...ve,h:X})},label:"Hour",theme:T}),e.jsx("div",{style:{display:"flex",alignItems:"center",height:"40px",marginTop:"28px",fontSize:"16px",fontWeight:700,color:T.textMuted},children:":"}),e.jsx(sn,{values:Fr,selected:ve.m,onSelect:X=>{p||ke(ee=>({...ee,m:X})),m==null||m({...ve,m:X})},label:"Min",theme:T})]}),a==="multiple"&&oe==="day"&&ie.length>0&&e.jsxs("div",{style:{borderTop:`1px solid ${T.border}`,paddingTop:"8px",fontSize:"12px",color:T.textMuted,textAlign:"center"},children:[ie.length," date",ie.length!==1?"s":""," selected"]}),e.jsxs("div",{style:{borderTop:`1px solid ${T.border}`,paddingTop:"10px",display:"flex",alignItems:"center",justifyContent:te?"space-between":"flex-start",gap:"8px"},children:[e.jsx("button",{type:"button",onClick:U,style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"13px",color:T.primary,fontWeight:500,padding:"6px 10px",borderRadius:"6px",fontFamily:"inherit"},children:"Today"}),te&&e.jsxs("div",{style:{display:"flex",gap:"6px"},children:[e.jsx("button",{type:"button",onClick:lt,style:{padding:"6px 14px",borderRadius:"7px",border:`1px solid ${T.border}`,cursor:"pointer",fontSize:"13px",fontWeight:500,backgroundColor:"transparent",color:T.text,fontFamily:"inherit"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:Ue,style:{padding:"6px 14px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:600,backgroundColor:T.primary,color:T.bg,fontFamily:"inherit"},children:"Apply"})]})]})]})]});return e.jsxs("div",{className:$,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...S},children:[pt&&e.jsx("label",{htmlFor:C,style:{fontSize:"13px",fontWeight:500,color:T.text,marginBottom:"2px"},children:pt}),e.jsxs("div",{ref:qe,style:{display:"flex",alignItems:"center",border:`1.5px solid ${Wr}`,borderRadius:"8px",backgroundColor:T.surface,overflow:"hidden",transition:H?"none":"border-color 120ms ease",opacity:j?.5:1},children:[e.jsx("span",{style:{display:"flex",alignItems:"center",paddingLeft:"10px",color:T.textMuted,flexShrink:0},children:e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),e.jsx("input",{ref:Qe,id:C,type:"text",value:We,placeholder:wt,disabled:j,"aria-invalid":w,"aria-haspopup":"dialog","aria-expanded":Me,readOnly:a==="range"||a==="multiple",onChange:X=>Ie(X.target.value),onFocus:()=>{j||$e(!0)},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:T.text,cursor:a!=="single"?"pointer":"text",fontFamily:"inherit",minWidth:0}}),jt&&!j&&e.jsx("button",{type:"button","aria-label":"Clear selection",onClick:we,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",background:"transparent",cursor:"pointer",color:T.textMuted,flexShrink:0,borderRadius:"4px",marginRight:"4px"},children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("button",{type:"button","aria-label":Me?"Close calendar":"Open calendar",tabIndex:-1,disabled:j,onClick:()=>{j||$e(X=>!X)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"34px",height:"36px",border:"none",background:"transparent",cursor:j?"not-allowed":"pointer",color:T.textMuted,flexShrink:0},children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:Me?"rotate(180deg)":"rotate(0deg)",transition:H?"none":"transform 160ms ease"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),ht&&!w&&e.jsx("span",{style:{fontSize:"12px",color:T.textMuted},children:ht}),w&&mt&&e.jsx("span",{role:"alert",style:{fontSize:"12px",color:T.danger},children:mt}),Me&&typeof document<"u"&&Le.createPortal(Hr,document.body)]})}lr.displayName="TkxDatePicker";const Ks={sm:{track:4,thumb:14,fontSize:"0.75rem"},md:{track:6,thumb:18,fontSize:"0.875rem"},lg:{track:8,thumb:22,fontSize:"1rem"}};function ut(t,n,r){return Math.min(Math.max(t,n),r)}function Ht(t,n,r){return Math.round((t-n)/r)*r+n}function tt(t,n,r){return(t-n)/(r-n)*100}function zt({value:t,min:n,max:r,step:o,isDisabled:s,trackColor:l,thumbSize:a,ariaLabel:c,tooltipMode:d,formatValue:f,orientation:u,onChange:h,onChangeEnd:p}){const[m,y]=i.useState(!1),[k,b]=i.useState(!1),[g,M]=i.useState(!1),j=S=>{s||(S.key==="ArrowRight"||S.key==="ArrowUp"?(S.preventDefault(),h(ut(Ht(t+o,n,o),n,r))):S.key==="ArrowLeft"||S.key==="ArrowDown"?(S.preventDefault(),h(ut(Ht(t-o,n,o),n,r))):S.key==="Home"?(S.preventDefault(),h(n)):S.key==="End"&&(S.preventDefault(),h(r)))},w=u==="vertical",I=tt(t,n,r),v=d==="always"||d==="hover"&&(g||k||m),N=w?{position:"absolute",bottom:`${I}%`,transform:"translateY(50%)",left:"50%",marginLeft:`-${a/2}px`,zIndex:2,cursor:s?"not-allowed":"grab"}:{position:"absolute",left:`${I}%`,transform:"translateX(-50%)",top:"50%",marginTop:`-${a/2}px`,zIndex:2,cursor:s?"not-allowed":"grab"},$=w?{position:"absolute",left:a+6,top:"50%",transform:"translateY(-50%)",backgroundColor:l,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"}:{position:"absolute",bottom:a+6,left:"50%",transform:"translateX(-50%)",backgroundColor:l,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"};return e.jsxs("div",{style:N,children:[v&&e.jsx("div",{style:$,children:f(t)}),e.jsx("div",{role:"slider",tabIndex:s?-1:0,"aria-label":c,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":t,"aria-disabled":s,"aria-orientation":u,onKeyDown:j,onFocus:()=>y(!0),onBlur:()=>y(!1),onPointerEnter:()=>M(!0),onPointerLeave:()=>M(!1),onPointerDown:S=>{s||(b(!0),S.target.setPointerCapture(S.pointerId))},onPointerUp:()=>{b(!1),p==null||p()},style:{width:a,height:a,borderRadius:"50%",backgroundColor:s?"#888":l,border:"3px solid #fff",boxShadow:m?`0 0 0 3px ${l}44`:"0 1px 4px rgba(0,0,0,0.3)",outline:"none",display:"block",transition:"box-shadow 150ms ease"}})]})}function ar({value:t,defaultValue:n=0,onChange:r,rangeValue:o,onRangeChange:s,min:l=0,max:a=100,step:c=1,isRange:d=!1,label:f,showValue:u=!1,showTicks:h=!1,tickCount:p=5,isDisabled:m=!1,colorScheme:y="primary",size:k="md",marks:b,orientation:g="horizontal",showTooltip:M=!1,formatValue:j,onChangeEnd:w,onRangeChangeEnd:I,gradient:v=!1}){const N=_.useTheme(),$=i.useId(),S=Q.useReducedMotion(),T=t!==void 0,[E,C]=i.useState(n),H=T?t:E,z=o!==void 0,[R,B]=i.useState([l,a]),V=z?o:R,D=i.useRef(null),O=i.useRef(H);O.current=H;const L=i.useRef(V);L.current=V;const P={primary:N.primary,success:N.success,danger:N.danger,warning:N.warning}[y],W=Ks[k],K=g==="vertical",ne=M===!0?"hover":M===!1?!1:M,Z=j??(de=>String(de)),ie=P+"66",fe=i.useCallback((de,xe)=>{const oe=D.current;if(!oe)return l;const G=oe.getBoundingClientRect();let ue;K?ue=ut((G.bottom-(xe??0))/G.height,0,1):ue=ut((de-G.left)/G.width,0,1);const ke=ue*(a-l)+l;return ut(Ht(ke,l,c),l,a)},[l,a,c,K]),pe=i.useCallback(de=>{if(m)return;const xe=fe(de.clientX,de.clientY);if(!d)T||C(xe),r==null||r(xe);else{const[oe,G]=V,ue=Math.abs(xe-oe),ke=Math.abs(xe-G),ve=ue<=ke?[xe,G]:[oe,xe];z||B(ve),s==null||s(ve)}},[m,d,T,z,fe,r,s,V]),te=de=>{T||C(de),r==null||r(de)},ce=de=>{const xe=[ut(de,l,V[1]),V[1]];z||B(xe),s==null||s(xe)},Y=de=>{const xe=[V[0],ut(de,V[0],a)];z||B(xe),s==null||s(xe)},se=d?tt(V[0],l,a):0,le=tt(d?V[1]:H,l,a),ge=h?Array.from({length:p},(de,xe)=>l+xe/(p-1)*(a-l)):[],he=f?A.sanitizeString(f):void 0,ye=S?"none":"background 150ms ease";return e.jsxs("div",{className:x.tkx("flex flex-col gap-2"),style:{opacity:m?.55:1,...K?{height:200,width:"auto",display:"inline-flex"}:{width:"100%"}},children:[(he||u)&&e.jsxs("div",{className:x.tkx("flex items-center justify-between"),children:[he&&e.jsx("label",{htmlFor:$,className:x.tkx("text-sm font-medium"),style:{color:N.text,fontSize:W.fontSize},children:he}),u&&!d&&e.jsx("span",{className:x.tkx("text-sm tabular-nums"),style:{color:N.textMuted,fontSize:W.fontSize},children:Z(H)}),u&&d&&e.jsxs("span",{className:x.tkx("text-sm tabular-nums"),style:{color:N.textMuted,fontSize:W.fontSize},children:[Z(V[0])," – ",Z(V[1])]})]}),e.jsxs("div",{style:{position:"relative",...K?{paddingLeft:W.thumb/2,paddingRight:W.thumb/2,flex:1}:{paddingTop:W.thumb/2,paddingBottom:W.thumb/2}},children:[e.jsxs("div",{ref:D,onPointerDown:pe,style:{position:"relative",...K?{width:W.track,height:"100%"}:{height:W.track},borderRadius:9999,backgroundColor:N.border,cursor:m?"not-allowed":"pointer",userSelect:"none",touchAction:"none"},children:[e.jsx("div",{style:{position:"absolute",...K?{left:0,bottom:`${se}%`,height:`${le-se}%`,width:"100%"}:{top:0,left:`${se}%`,width:`${le-se}%`,height:"100%"},borderRadius:9999,...m?{backgroundColor:N.textMuted}:v?{background:K?`linear-gradient(to top, ${ie}, ${P})`:`linear-gradient(to right, ${ie}, ${P})`}:{backgroundColor:P},transition:ye}}),ge.map((de,xe)=>e.jsx("div",{style:{position:"absolute",...K?{bottom:`${tt(de,l,a)}%`,left:"50%",transform:"translate(-50%, 50%)",height:3,width:W.track+4}:{left:`${tt(de,l,a)}%`,top:"50%",transform:"translate(-50%, -50%)",width:3,height:W.track+4},backgroundColor:N.surface,borderRadius:9999,pointerEvents:"none"}},xe)),d?e.jsxs(e.Fragment,{children:[e.jsx(zt,{value:V[0],min:l,max:V[1],step:c,isDisabled:m,trackColor:P,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:`${he??"Range"} start`,tooltipMode:ne,formatValue:Z,orientation:g,onChange:ce,onChangeEnd:I?()=>I(L.current):void 0}),e.jsx(zt,{value:V[1],min:V[0],max:a,step:c,isDisabled:m,trackColor:P,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:`${he??"Range"} end`,tooltipMode:ne,formatValue:Z,orientation:g,onChange:Y,onChangeEnd:I?()=>I(L.current):void 0})]}):e.jsx(zt,{value:H,min:l,max:a,step:c,isDisabled:m,trackColor:P,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:he??"Slider",tooltipMode:ne,formatValue:Z,orientation:g,onChange:te,onChangeEnd:w?()=>w(O.current):void 0})]}),b&&b.length>0&&e.jsx("div",{style:{position:K?"absolute":"relative",...K?{left:"100%",top:0,bottom:0,marginLeft:8}:{marginTop:8}},children:b.map((de,xe)=>e.jsx("div",{style:{position:"absolute",...K?{bottom:`${tt(de.value,l,a)}%`,transform:"translateY(50%)",left:0}:{left:`${tt(de.value,l,a)}%`,transform:"translateX(-50%)"},fontSize:"0.6875rem",color:N.textMuted,whiteSpace:"nowrap"},children:A.sanitizeString(de.label)},xe))})]}),h&&!b&&!K&&e.jsx("div",{style:{position:"relative",height:"1rem"},children:ge.map((de,xe)=>e.jsx("span",{style:{position:"absolute",left:`${tt(de,l,a)}%`,transform:"translateX(-50%)",fontSize:"0.6875rem",color:N.textMuted},children:Z(Math.round(de))},xe))})]})}ar.displayName="TkxSlider";const Us={sm:{height:28,minWidth:28,fontSize:"0.75rem",px:8},md:{height:36,minWidth:36,fontSize:"0.875rem",px:10},lg:{height:44,minWidth:44,fontSize:"1rem",px:12}};function Xs(t,n,r,o){if(n<=1)return[1];const s=(y,k)=>Array.from({length:Math.max(0,k-y+1)},(b,g)=>y+g),l=Math.max(t-r,1),a=Math.min(t+r,n);if(!o){const y=[];return l>1&&y.push("..."),y.push(...s(l,a)),a<n&&y.push("..."),y}const c=1,d=n,f=l>c+2,u=a<d-2,h=[];h.push(1),f?h.push("left-ellipsis"):h.push(...s(2,l-1)),h.push(...s(Math.max(l,2),Math.min(a,n-1))),u?h.push("right-ellipsis"):h.push(...s(a+1,n-1)),n>1&&h.push(n);const p=new Set,m=[];for(const y of h)typeof y=="number"?p.has(y)||(p.add(y),m.push(y)):m.push(y);return m}function cr({total:t,pageSize:n=10,page:r,defaultPage:o=1,onChange:s,siblingCount:l=1,showEdges:a=!0,showPageSize:c=!1,onPageSizeChange:d,pageSizeOptions:f=[10,25,50,100],size:u="md",variant:h="default"}){const p=_.useTheme(),m=i.useId(),y=r!==void 0,[k,b]=i.useState(o),g=y?r:k,[M,j]=i.useState(n),w=n,I=Math.max(1,Math.ceil(t/w)),v=z=>{const R=Math.min(Math.max(z,1),I);R!==g&&(y||b(R),s==null||s(R))},N=z=>{j(z),d==null||d(z),v(1)},$=Xs(g,I,l,a),S=Us[u],T=Math.min((g-1)*w+1,t),E=Math.min(g*w,t),C=(z,R)=>{const B={height:S.height,minWidth:S.minWidth,paddingLeft:S.px,paddingRight:S.px,fontSize:S.fontSize,borderRadius:"8px",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:R?"not-allowed":"pointer",border:"none",outline:"none",fontFamily:"inherit",transition:"background 120ms ease, color 120ms ease",opacity:R?.4:1};return z?{...B,backgroundColor:p.primary,color:p.bg,fontWeight:600,boxShadow:`0 0 0 2px ${p.primary}44`}:h==="default"?{...B,backgroundColor:p.surface,color:p.text,border:`1px solid ${p.border}`}:h==="outline"?{...B,backgroundColor:"transparent",color:p.text,border:`1px solid ${p.border}`}:{...B,backgroundColor:"transparent",color:p.text}},H=({d:z})=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("polyline",{points:z})});return e.jsxs("nav",{"aria-label":"Pagination",className:x.tkx("flex flex-col gap-2"),children:[t>0&&e.jsx("p",{className:x.tkx("text-sm"),style:{color:p.textMuted,fontSize:S.fontSize},children:A.sanitizeString(`Showing ${T}–${E} of ${t} items`)}),e.jsxs("div",{className:x.tkx("flex items-center gap-1 flex-wrap"),children:[a&&e.jsxs("button",{type:"button","aria-label":"First page",disabled:g===1,onClick:()=>v(1),style:C(!1,g===1),children:[e.jsx(H,{d:"15 18 9 12 15 6"}),e.jsx(H,{d:"20 18 14 12 20 6"})]}),e.jsx("button",{type:"button","aria-label":"Previous page",disabled:g===1,onClick:()=>v(g-1),style:C(!1,g===1),children:e.jsx(H,{d:"15 18 9 12 15 6"})}),$.map((z,R)=>{if(typeof z=="string")return e.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:S.minWidth,height:S.height,fontSize:S.fontSize,color:p.textMuted,userSelect:"none"},children:"…"},`${z}-${R}`);const V=z,D=V===g;return e.jsx("button",{type:"button","aria-label":`Page ${V}`,"aria-current":D?"page":void 0,onClick:()=>v(V),style:C(D,!1),children:V},V)}),e.jsx("button",{type:"button","aria-label":"Next page",disabled:g===I,onClick:()=>v(g+1),style:C(!1,g===I),children:e.jsx(H,{d:"9 18 15 12 9 6"})}),a&&e.jsxs("button",{type:"button","aria-label":"Last page",disabled:g===I,onClick:()=>v(I),style:C(!1,g===I),children:[e.jsx(H,{d:"4 18 10 12 4 6"}),e.jsx(H,{d:"14 18 20 12 14 6"})]}),c&&e.jsxs("div",{className:x.tkx("flex items-center gap-2 ml-2"),children:[e.jsx("label",{htmlFor:m,className:x.tkx("text-sm"),style:{color:p.textMuted,fontSize:S.fontSize,whiteSpace:"nowrap"},children:"Rows per page"}),e.jsx("select",{id:m,value:M,onChange:z=>N(Number(z.target.value)),style:{height:S.height,paddingLeft:S.px,paddingRight:S.px,fontSize:S.fontSize,borderRadius:"8px",border:`1px solid ${p.border}`,backgroundColor:p.surface,color:p.text,cursor:"pointer",outline:"none",fontFamily:"inherit"},children:f.map(z=>e.jsx("option",{value:z,children:z},z))})]})]})]})}cr.displayName="TkxPagination";const Zs={"1/1":"100%","4/3":"75%","16/9":"56.25%","3/2":"66.666%","9/16":"177.777%"},Gs={none:"0",sm:"4px",md:"8px",lg:"16px",full:"9999px"};function qs({color:t,size:n}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("path",{d:"M21 15l-5-5L5 21"})]})}function Qs({src:t,alt:n,fallback:r,placeholder:o="skeleton",fit:s="cover",ratio:l="auto",radius:a="none",caption:c,lazy:d=!0,preview:f=!1,className:u,style:h,...p}){const m=_.useTheme(),y=Q.useReducedMotion(),[k,b]=i.useState(!1),[g,M]=i.useState(!1),[j,w]=i.useState(!1),I=i.useRef(null),v=A.sanitizeString(t),N=n?A.sanitizeString(n):"",$=c?A.sanitizeString(c):"",S=Gs[a];i.useEffect(()=>{var K;(K=I.current)!=null&&K.complete&&b(!0)},[]);const T=i.useCallback(()=>b(!0),[]),E=i.useCallback(()=>M(!0),[]),C=i.useCallback(()=>{f&&!g&&w(!0)},[f,g]),H=i.useCallback(()=>w(!1),[]);i.useEffect(()=>{if(!j)return;const K=ne=>{ne.key==="Escape"&&H()};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[j,H]);const z=o==="skeleton"&&!k&&!g,R=z&&!y?{animation:"tkx-shimmer 1.5s ease-in-out infinite"}:{},B=g?null:e.jsx("img",{ref:I,src:v,alt:N||void 0,role:N?void 0:"img","aria-label":N?void 0:"Image",loading:d?"lazy":void 0,onLoad:T,onError:E,onClick:f?C:void 0,className:x.cx(x.tkx("block w-full h-full"),f&&!g?x.tkx("cursor-pointer"):""),style:{objectFit:s,borderRadius:S,opacity:k?1:0,transition:y?"none":"opacity 200ms ease",position:l==="auto"?void 0:"absolute",inset:l==="auto"?void 0:0},...p}),V=g?r?e.jsx(e.Fragment,{children:r}):e.jsxs("div",{role:"img","aria-label":N||"Image failed to load",className:x.tkx("flex flex-col items-center justify-center gap-2 w-full h-full"),style:{backgroundColor:m.surfaceAlt,borderRadius:S,color:m.textMuted,minHeight:"80px"},children:[e.jsx(qs,{color:m.textMuted,size:32}),e.jsx("span",{className:x.tkx("text-xs"),style:{color:m.textMuted},children:"Failed to load"})]}):null,D=z?e.jsx("div",{"aria-hidden":"true",style:{position:l==="auto"?void 0:"absolute",inset:l==="auto"?void 0:0,width:"100%",height:l==="auto"?"100%":void 0,minHeight:l==="auto"?"80px":void 0,borderRadius:S,backgroundColor:m.surfaceAlt,...R}}):null,O=l==="auto"?e.jsxs("div",{className:x.tkx("relative w-full"),style:{borderRadius:S},children:[D,B,V]}):e.jsxs("div",{className:x.tkx("relative w-full overflow-hidden"),style:{paddingBottom:Zs[l],borderRadius:S},children:[D,B,V]}),L=$?e.jsxs("figure",{className:x.tkx("m-0 p-0 flex flex-col gap-2"),style:{borderRadius:S},children:[O,e.jsx("figcaption",{className:x.tkx("text-sm text-center"),style:{color:m.textMuted},children:$})]}):O,P=e.jsx("div",{className:x.cx(x.tkx("inline-block w-full"),u),style:h,children:L}),W=j&&typeof document<"u"?Le.createPortal(e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":N||"Image preview",className:x.tkx("fixed inset-0 z-[9500] flex items-center justify-center p-4"),onClick:H,children:[e.jsx("div",{"aria-hidden":"true",className:x.tkx("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.85)",backdropFilter:"blur(6px)"}}),e.jsx("img",{src:v,alt:N||"Full-size preview",onClick:K=>K.stopPropagation(),className:x.tkx("relative z-10 max-w-full max-h-full"),style:{objectFit:"contain",borderRadius:"8px",boxShadow:"0 25px 60px rgba(0,0,0,0.5)"}}),e.jsx("button",{"aria-label":"Close preview",onClick:H,className:x.tkx("absolute top-4 right-4 z-10 flex items-center justify-center","bg-transparent border-none cursor-pointer rounded-full p-2"),style:{color:"#fff",backgroundColor:"rgba(255,255,255,0.15)"},children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),document.body):null;return e.jsxs(e.Fragment,{children:[P,W]})}function ln(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Js({mimeType:t,color:n}){return t.startsWith("image/")?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("path",{d:"M21 15l-5-5L5 21"})]}):t==="application/pdf"?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"9",y1:"13",x2:"15",y2:"13"}),e.jsx("line",{x1:"9",y1:"17",x2:"11",y2:"17"})]}):e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}let eo=0;function to(){return`tkx-file-${++eo}`}function no({accept:t,multiple:n=!1,maxSize:r,maxFiles:o,onChange:s,onError:l,label:a="Upload files",hint:c,isDisabled:d=!1,preview:f=!0,dragDrop:u=!0,variant:h="dropzone"}){const p=_.useTheme(),m=Q.useReducedMotion(),y=i.useId(),k=i.useRef(null),[b,g]=i.useState(!1),[M,j]=i.useState([]);i.useEffect(()=>()=>{M.forEach(D=>{D.objectUrl&&URL.revokeObjectURL(D.objectUrl)})},[]);const w=i.useCallback(D=>{let O=0;const L=setInterval(()=>{O+=Math.floor(Math.random()*20)+10,O>=100&&(O=100,clearInterval(L)),j(P=>P.map(W=>W.id===D?{...W,progress:O}:W))},100)},[]),I=i.useCallback(D=>{if(r&&D.size>r)return`"${A.sanitizeString(D.name)}" exceeds max size of ${ln(r)}`;if(t&&!t.split(",").map(P=>P.trim()).some(P=>P.startsWith(".")?D.name.toLowerCase().endsWith(P.toLowerCase()):P.endsWith("/*")?D.type.startsWith(P.slice(0,-1)):D.type===P))return`"${A.sanitizeString(D.name)}" is not an accepted file type`},[t,r]),v=i.useCallback(D=>{const O=o?o-M.length:1/0;if(O<=0){l==null||l(`Maximum of ${o} file${o===1?"":"s"} allowed`);return}const P=D.slice(0,O).map(W=>{const K=I(W),ne=f&&W.type.startsWith("image/")&&!K?URL.createObjectURL(W):void 0;return{file:W,id:to(),objectUrl:ne,progress:0,error:K}});j(W=>{const K=n?[...W,...P]:P,ne=K.filter(Z=>!Z.error).map(Z=>Z.file);return s==null||s(ne),K}),P.forEach(W=>{W.error&&(l==null||l(W.error))}),P.forEach(W=>{W.error||w(W.id)})},[M.length,o,n,s,l,f,w,I]),N=i.useCallback(D=>{const O=Array.from(D.target.files??[]);O.length&&v(O),D.target.value=""},[v]),$=i.useCallback(D=>{if(D.preventDefault(),g(!1),d)return;const O=Array.from(D.dataTransfer.files);O.length&&v(O)},[d,v]),S=i.useCallback(D=>{D.preventDefault(),d||g(!0)},[d]),T=i.useCallback(()=>g(!1),[]),E=i.useCallback(D=>{j(O=>{const L=O.find(W=>W.id===D);L!=null&&L.objectUrl&&URL.revokeObjectURL(L.objectUrl);const P=O.filter(W=>W.id!==D);return s==null||s(P.filter(W=>!W.error).map(W=>W.file)),P})},[s]),C=i.useCallback(()=>{var D;d||(D=k.current)==null||D.click()},[d]),H=b?p.primary:p.border,z=A.sanitizeString(a),R=c?A.sanitizeString(c):"",B=e.jsxs("div",{role:"button",tabIndex:d?-1:0,"aria-label":z,"aria-describedby":c?y:void 0,"aria-disabled":d,onClick:C,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),C())},onDrop:u?$:void 0,onDragOver:u?S:void 0,onDragLeave:u?T:void 0,className:x.tkx("flex flex-col items-center justify-center gap-3 w-full p-8 rounded-lg"),style:{border:`2px dashed ${H}`,backgroundColor:b?`${p.primary}10`:p.surface,cursor:d?"not-allowed":"pointer",opacity:d?.5:1,transition:m?"none":"border-color 150ms ease, background-color 150ms ease",outline:"none"},children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:b?p.primary:p.textMuted,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),e.jsxs("div",{className:x.tkx("text-center"),children:[e.jsx("p",{className:x.tkx("m-0 text-sm font-medium"),style:{color:p.text},children:b?"Drop files here":z}),R&&e.jsx("p",{id:y,className:x.tkx("m-0 text-xs mt-1"),style:{color:p.textMuted},children:R})]})]}),V=e.jsxs("button",{type:"button",disabled:d,onClick:C,"aria-describedby":c?y:void 0,className:x.tkx("flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium font-sans border-none cursor-pointer"),style:{backgroundColor:p.primary,color:p.bg,opacity:d?.5:1,cursor:d?"not-allowed":"pointer"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),z,c&&e.jsx("span",{id:y,className:x.tkx("sr-only"),children:R})]});return e.jsxs("div",{className:x.tkx("flex flex-col gap-3 w-full font-sans"),children:[e.jsx("input",{ref:k,type:"file",accept:t,multiple:n,disabled:d,onChange:N,className:x.tkx("sr-only"),tabIndex:-1,"aria-hidden":"true"}),h==="dropzone"?B:V,M.length>0&&e.jsx("ul",{role:"status","aria-live":"polite","aria-label":"Uploaded files",className:x.tkx("m-0 p-0 flex flex-col gap-2"),style:{listStyle:"none"},children:M.map(D=>e.jsxs("li",{className:x.tkx("flex flex-col gap-1 rounded-md p-3"),style:{backgroundColor:p.surfaceAlt,border:`1px solid ${D.error?p.danger:p.border}`},children:[e.jsxs("div",{className:x.tkx("flex items-center gap-3"),children:[D.objectUrl&&f?e.jsx("img",{src:D.objectUrl,alt:A.sanitizeString(D.file.name),className:x.tkx("rounded"),style:{width:40,height:40,objectFit:"cover",flexShrink:0}}):e.jsx("span",{style:{flexShrink:0},children:e.jsx(Js,{mimeType:D.file.type,color:D.error?p.danger:p.textMuted})}),e.jsxs("div",{className:x.tkx("flex flex-col gap-0.5 flex-1 min-w-0"),children:[e.jsx("span",{className:x.tkx("text-sm font-medium truncate"),style:{color:D.error?p.danger:p.text},title:D.file.name,children:A.sanitizeString(D.file.name)}),e.jsxs("span",{className:x.tkx("text-xs"),style:{color:p.textMuted},children:[ln(D.file.size),D.error&&` — ${D.error}`]})]}),e.jsx("button",{type:"button","aria-label":`Remove ${A.sanitizeString(D.file.name)}`,onClick:()=>E(D.id),className:x.tkx("flex items-center justify-center bg-transparent border-none cursor-pointer rounded p-1"),style:{color:p.textMuted,flexShrink:0},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!D.error&&D.progress<100&&e.jsx("div",{className:x.tkx("w-full overflow-hidden"),style:{height:"3px",borderRadius:"3px",backgroundColor:p.border},"aria-hidden":"true",children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",backgroundColor:p.primary,width:`${D.progress}%`,transition:m?"none":"width 100ms ease"}})})]},D.id))})]})}const ro={sm:16,md:24,lg:32,xl:40};function so({size:t,filled:n,color:r,halfFilled:o,id:s}){const l=s?`hg-${s}`:void 0;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[o&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"50%",stopColor:r}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",fill:o&&l?`url(#${l})`:n?r:"none",stroke:r,strokeWidth:1.5,strokeLinejoin:"round"})]})}function oo({size:t,filled:n,color:r,halfFilled:o,id:s}){const l=s?`hg-${s}`:void 0;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[o&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"50%",stopColor:r}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",fill:o&&l?`url(#${l})`:n?r:"none",stroke:r,strokeWidth:1.5,strokeLinejoin:"round"})]})}function io({size:t,filled:n,color:r,halfFilled:o,id:s}){const l=s?`hg-${s}`:void 0;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[o&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"50%",stopColor:r}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:o&&l?`url(#${l})`:n?r:"none",stroke:r,strokeWidth:1.5})]})}function lo({type:t,size:n,filled:r,color:o,halfFilled:s,uid:l}){const a={size:n,filled:r,color:o,halfFilled:s,id:l};return t==="heart"?e.jsx(oo,{...a}):t==="circle"?e.jsx(io,{...a}):e.jsx(so,{...a})}function an(t,n,r){return Math.min(r,Math.max(n,t))}function ao(t,n){return n===1?Math.round(t):Math.round(t*2)/2}function cn(t,n,r){if(r===1)return n+1;const o=t.currentTarget.getBoundingClientRect(),s=o.left+o.width/2;return t.clientX<s?n+.5:n+1}function co({value:t,defaultValue:n=0,onChange:r,max:o=5,precision:s=1,size:l="md",isReadOnly:a=!1,isDisabled:c=!1,label:d,showValue:f=!1,colorScheme:u="warning",emptyIcon:h="star",filledIcon:p="star"}){const m=_.useTheme(),y=Q.useReducedMotion(),k=i.useId(),b=t!==void 0,[g,M]=i.useState(n),[j,w]=i.useState(null),I=i.useRef(null),v=b?t??0:g,N=j??v,S={warning:m.warning,primary:m.primary,danger:m.danger}[u]??m.warning,T=ro[l],E=!a&&!c,C=i.useCallback(D=>{b||M(D),r==null||r(D)},[b,r]),H=i.useCallback((D,O)=>{E&&w(cn(D,O,s))},[E,s]),z=i.useCallback(()=>{E&&w(null)},[E]),R=i.useCallback((D,O)=>{if(!E)return;const L=cn(D,O,s);C(L===v?0:L)},[E,s,v,C]),B=i.useCallback(D=>{if(!E)return;const O=s;let L=v;if(D.key==="ArrowRight"||D.key==="ArrowUp")D.preventDefault(),L=an(v+O,0,o);else if(D.key==="ArrowLeft"||D.key==="ArrowDown")D.preventDefault(),L=an(v-O,0,o);else if(D.key==="Home")D.preventDefault(),L=0;else if(D.key==="End")D.preventDefault(),L=o;else return;L=ao(L,s),C(L)},[E,v,o,s,C]),V=d?A.sanitizeString(d):"Rating";return e.jsxs("div",{className:x.cx(x.tkx("inline-flex items-center gap-2 font-sans"),c?x.tkx("opacity-50"):""),children:[e.jsx("div",{ref:I,role:"radiogroup","aria-label":V,"aria-disabled":c,"aria-readonly":a,tabIndex:E?0:-1,onKeyDown:B,onMouseLeave:z,className:x.tkx("flex items-center gap-0.5 outline-none"),style:{cursor:E?"pointer":"default"},children:Array.from({length:o},(D,O)=>{const L=O+1,P=O+.5,W=N>=L,K=!W&&s===.5&&N>=P,ne=`${k}-${O}`;return e.jsx("span",{role:"radio","aria-checked":s===.5&&v===P||v===L,"aria-label":s===.5?`${P} star${P!==1?"s":""} / ${L} star${L!==1?"s":""}`:`${L} star${L!==1?"s":""}`,tabIndex:-1,onMouseMove:Z=>H(Z,O),onClick:Z=>R(Z,O),style:{display:"inline-flex",alignItems:"center",lineHeight:0,transition:y?"none":"transform 120ms ease",transform:j!==null&&N>=P&&E?"scale(1.15)":"scale(1)"},children:e.jsx(lo,{type:W||K?p:h,size:T,filled:W,halfFilled:K,color:W||K?S:m.border,uid:K?ne:void 0})},O)})}),f&&e.jsxs("span",{className:x.tkx("text-sm tabular-nums"),style:{color:m.textMuted},"aria-live":"polite","aria-atomic":"true",children:[v%1===0?v.toFixed(0):v.toFixed(1)," / ",o]})]})}let dn=!1;function uo(){if(dn||typeof document>"u")return;dn=!0;const t=document.createElement("style");t.textContent=`
|
|
21
21
|
@keyframes tkx-blink { 0%,100% { opacity:1 } 50% { opacity:0 } }
|
|
22
22
|
@keyframes tkx-bounce { 0%,100% { transform:translateY(0) } 50% { transform:translateY(-5px) } }
|
|
23
23
|
.tkx-cursor::after { content:'▋'; display:inline-block; animation:tkx-blink 1s step-start infinite; margin-left:1px; }
|
|
24
24
|
.tkx-dot1 { animation:tkx-bounce 1s ease-in-out infinite; }
|
|
25
25
|
.tkx-dot2 { animation:tkx-bounce 1s ease-in-out 0.2s infinite; }
|
|
26
26
|
.tkx-dot3 { animation:tkx-bounce 1s ease-in-out 0.4s infinite; }
|
|
27
|
-
`,document.head.appendChild(t)}function
|
|
27
|
+
`,document.head.appendChild(t)}function fo(){return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"14",cy:"14",r:"14",fill:"currentColor",fillOpacity:"0.15"}),e.jsx("circle",{cx:"14",cy:"11",r:"4",fill:"currentColor"}),e.jsx("path",{d:"M6 24c0-4.418 3.582-8 8-8s8 3.582 8 8",fill:"currentColor"})]})}function xo(){return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"14",cy:"14",r:"14",fill:"currentColor",fillOpacity:"0.15"}),e.jsx("path",{d:"M14 5l2.2 6.5H23l-5.6 4 2.2 6.5L14 18l-5.6 4 2.2-6.5L5 11.5h6.8z",fill:"currentColor"})]})}function dr(){const t=_.useTheme();return e.jsxs("div",{className:x.tkx("flex items-center gap-1.5 px-4 py-3 rounded-2xl w-fit"),style:{backgroundColor:t.surface,border:`1px solid ${t.border}`},"aria-label":"Assistant is thinking",children:[e.jsx("span",{className:"tkx-dot1 inline-block w-2 h-2 rounded-full",style:{backgroundColor:t.textMuted}}),e.jsx("span",{className:"tkx-dot2 inline-block w-2 h-2 rounded-full",style:{backgroundColor:t.textMuted}}),e.jsx("span",{className:"tkx-dot3 inline-block w-2 h-2 rounded-full",style:{backgroundColor:t.textMuted}})]})}function ur({message:t,showTimestamp:n,avatarUser:r,avatarAssistant:o}){const s=_.useTheme(),l=Q.useReducedMotion(),{role:a,content:c,timestamp:d,isStreaming:f,error:u}=t,h=A.sanitizeString(c),p=d?new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}).format(d):null;if(a==="system")return e.jsx("div",{role:"listitem",className:x.tkx("flex justify-center my-2"),children:e.jsx("p",{className:x.tkx("text-xs italic px-3 py-1 rounded-full"),style:{color:s.textMuted,backgroundColor:s.surfaceAlt},children:h})});const m=a==="user",y=m?r??e.jsx(fo,{}):o??e.jsx(xo,{}),k=m?{backgroundColor:s.primary,color:s.bg}:{backgroundColor:s.surface,color:s.text,border:`1px solid ${u?s.danger:s.border}`};return u&&(k.borderColor=s.danger,k.borderWidth="2px"),e.jsxs("div",{role:"listitem",className:x.tkx("flex gap-2 mb-4",m?"flex-row-reverse":"flex-row"),children:[e.jsx("div",{className:x.tkx("shrink-0 w-8 h-8 rounded-full flex items-center justify-center overflow-hidden"),style:{color:m?s.primary:s.secondary},children:y}),e.jsxs("div",{className:x.tkx("flex flex-col gap-1 max-w-[75%]",m?"items-end":"items-start"),children:[e.jsxs("div",{className:x.cx(x.tkx("px-4 py-2.5 rounded-2xl text-sm leading-relaxed break-words whitespace-pre-wrap"),f&&!l?"tkx-cursor":""),style:k,children:[h,u&&e.jsx("span",{"aria-label":"Error",style:{marginLeft:6,color:s.danger},children:"⚠"})]}),n&&p&&e.jsx("span",{className:x.tkx("text-[10px]"),style:{color:s.textMuted},children:p})]})]})}function po({messages:t,onSend:n,isLoading:r=!1,placeholder:o="Type a message…",maxLength:s,showTimestamps:l=!1,avatarUser:a,avatarAssistant:c,height:d=480,inputPosition:f="bottom"}){const u=_.useTheme(),h=Q.useReducedMotion(),[p,m]=i.useState(""),y=i.useRef(null),k=i.useRef(null);i.useEffect(()=>{uo()},[]),i.useEffect(()=>{const N=y.current;N&&N.scrollTo({top:N.scrollHeight,behavior:h?"auto":"smooth"})},[t,r,h]);const b=i.useCallback(()=>{const N=p.trim();!N||!n||(n(N),m(""),k.current&&(k.current.style.height="auto"))},[p,n]),g=i.useCallback(N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),b())},[b]),M=i.useCallback(N=>{const $=s?N.target.value.slice(0,s):N.target.value;m($);const S=k.current;if(S){S.style.height="auto";const E=24*4+24;S.style.height=`${Math.min(S.scrollHeight,E)}px`}},[s]),j=p.trim().length>0&&!r,w=typeof d=="number"?`${d}px`:d,I=f==="floating",v=e.jsxs("div",{className:x.tkx("flex flex-col gap-1 p-3"),style:I?{position:"absolute",bottom:12,left:12,right:12,borderRadius:16,backgroundColor:u.surface,border:`1px solid ${u.border}`,boxShadow:"0 4px 24px rgba(0,0,0,0.18)"}:{borderTop:`1px solid ${u.border}`,backgroundColor:u.surface},children:[e.jsxs("div",{className:x.tkx("flex items-end gap-2"),children:[e.jsx("textarea",{ref:k,rows:1,value:p,onChange:M,onKeyDown:g,placeholder:A.sanitizeString(o),"aria-label":"Message input","aria-multiline":"true",disabled:r,className:x.tkx("flex-1 resize-none text-sm leading-6 bg-transparent outline-none py-1"),style:{color:u.text,caretColor:u.primary,minHeight:32,maxHeight:120}}),e.jsx("button",{onClick:b,disabled:!j,"aria-label":"Send message",className:x.tkx("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center",!h&&"transition-opacity duration-150",j?"cursor-pointer opacity-100":"opacity-40 cursor-not-allowed"),style:{backgroundColor:u.primary,color:u.bg},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2 14L14 8 2 2v4.5l8 1.5-8 1.5V14z",fill:"currentColor"})})})]}),s&&e.jsxs("div",{className:x.tkx("text-right text-[10px]"),style:{color:u.textMuted},children:[p.length,"/",s]})]});return e.jsxs("div",{className:x.tkx("flex flex-col overflow-hidden rounded-2xl"),style:{height:w,backgroundColor:u.bg,border:`1px solid ${u.border}`,position:"relative"},children:[e.jsx("div",{ref:y,role:"log","aria-live":"polite","aria-label":"Chat messages",className:x.tkx("flex-1 overflow-y-auto p-4"),style:{paddingBottom:I?80:void 0},children:e.jsxs("div",{role:"list",children:[t.map(N=>e.jsx(ur,{message:N,showTimestamp:l,avatarUser:a,avatarAssistant:c},N.id)),r&&e.jsxs("div",{role:"listitem",className:x.tkx("flex gap-2 mb-4"),children:[e.jsx("div",{className:x.tkx("w-8 h-8 shrink-0")}),e.jsx(dr,{})]})]})}),v]})}const ho={sm:"text-[11px]",md:"text-xs",lg:"text-sm"},mo={sm:"px-2 py-0.5",md:"px-2.5 py-1",lg:"px-3 py-1.5"},go={sm:"gap-1",md:"gap-1.5",lg:"gap-2"},bo={sm:12,md:14,lg:16};function yo(t,n){const r=_.useTheme(),s={default:r.textMuted,primary:r.primary,secondary:r.secondary,success:r.success,danger:r.danger,warning:r.warning,info:r.info}[t];return n==="solid"?{bg:s,color:r.bg,border:"transparent"}:n==="subtle"?{bg:`${s}22`,color:s,border:"transparent"}:{bg:"transparent",color:s,border:s}}function fr({variant:t="subtle",size:n="md",colorScheme:r="default",onRemove:o,leftIcon:s,isDisabled:l=!1,clickable:a=!1,children:c,className:d,style:f,onClick:u,...h}){_.useTheme();const p=Q.useReducedMotion(),m=yo(r,t),y=typeof c=="string"?A.sanitizeString(c):c,k=bo[n],b=x.tkx("inline-flex items-center font-medium rounded-full select-none",ho[n],mo[n],go[n],l?"opacity-50 cursor-not-allowed":a?"cursor-pointer":"cursor-default",a&&!p&&"transition-opacity duration-150");return e.jsxs("span",{role:a?"button":void 0,tabIndex:a&&!l?0:void 0,"aria-disabled":l||void 0,className:x.cx(b,d),style:{backgroundColor:m.bg,color:m.color,border:`1px solid ${m.border==="transparent"?"transparent":m.border}`,...f},onClick:l?void 0:u,onKeyDown:a&&!l&&u?g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),u(g))}:void 0,...h,children:[s&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("shrink-0 flex items-center"),children:s}),e.jsx("span",{children:y}),o&&!l&&e.jsx("button",{type:"button","aria-label":`Remove ${typeof c=="string"?c:"tag"}`,onClick:g=>{g.stopPropagation(),o()},className:x.tkx("shrink-0 flex items-center justify-center rounded-full cursor-pointer"),style:{width:k+4,height:k+4,color:m.color,backgroundColor:"transparent",border:"none",padding:0},tabIndex:0,children:e.jsx("svg",{width:k,height:k,viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2 2l8 8M10 2L2 10",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})})]})}function ko({value:t,defaultValue:n=[],onChange:r,placeholder:o="Add tag…",maxTags:s,allowDuplicates:l=!1,validate:a,colorScheme:c="primary",size:d="md",label:f,hint:u,isDisabled:h=!1}){const p=_.useTheme(),m=Q.useReducedMotion(),[y,k]=i.useState(n),[b,g]=i.useState(""),[M,j]=i.useState(null),w=i.useRef(null),I=t!==void 0,v=I?t:y,N=i.useCallback(z=>{I||k(z),r==null||r(z)},[I,r]),$=i.useCallback(z=>{const R=z.trim();if(R){if(s!==void 0&&v.length>=s){j(`Maximum ${s} tags allowed`);return}if(!l&&v.includes(R)){j("Duplicate tags are not allowed");return}if(a){const B=a(R);if(B===!1){j("Invalid tag");return}if(typeof B=="string"){j(B);return}}j(null),N([...v,R]),g("")}},[v,s,l,a,N]),S=i.useCallback(z=>{const R=v.filter((B,V)=>V!==z);N(R),j(null)},[v,N]),T=i.useCallback(z=>{z.key==="Enter"||z.key===","?(z.preventDefault(),$(b)):z.key==="Backspace"&&b===""&&v.length>0&&S(v.length-1)},[b,v,$,S]),E=i.useCallback(z=>{const R=z.target.value;R.endsWith(",")?$(R.slice(0,-1)):(g(R),M&&j(null))},[$,M]),C=d==="sm"?"6px 8px":d==="lg"?"10px 12px":"8px 10px",H=d==="sm"?11:d==="lg"?14:12;return e.jsxs("div",{className:x.tkx("flex flex-col gap-1.5"),children:[f&&e.jsx("label",{className:x.tkx("text-sm font-medium"),style:{color:p.text},onClick:()=>{var z;return(z=w.current)==null?void 0:z.focus()},children:A.sanitizeString(f)}),e.jsxs("div",{className:x.tkx("flex flex-wrap items-center gap-1.5 rounded-lg cursor-text",!m&&"transition-colors duration-150"),style:{padding:C,backgroundColor:p.surface,border:`1.5px solid ${M?p.danger:p.border}`,opacity:h?.55:1,minHeight:d==="sm"?36:d==="lg"?48:40},onClick:()=>{var z;return!h&&((z=w.current)==null?void 0:z.focus())},children:[v.map((z,R)=>e.jsx(fr,{size:d,variant:"subtle",colorScheme:c,onRemove:h?void 0:()=>S(R),isDisabled:h,children:z},`${z}-${R}`)),(!s||v.length<s)&&!h&&e.jsx("input",{ref:w,type:"text",value:b,onChange:E,onKeyDown:T,placeholder:v.length===0?A.sanitizeString(o):"",disabled:h,className:x.tkx("flex-1 bg-transparent outline-none min-w-[80px]"),style:{fontSize:H,color:p.text,caretColor:p.primary},"aria-label":f??"Tag input"})]}),M&&e.jsx("p",{className:x.tkx("text-xs"),style:{color:p.danger},role:"alert",children:M}),u&&!M&&e.jsx("p",{className:x.tkx("text-xs"),style:{color:p.textMuted},children:A.sanitizeString(u)})]})}let un=!1;function vo(){if(un||typeof document>"u")return;un=!0;const t=document.createElement("style");t.textContent=`
|
|
28
28
|
@keyframes tkx-pulse-dot { 0%,100% { box-shadow:0 0 0 0 currentColor; opacity:1; } 70% { box-shadow:0 0 0 8px transparent; opacity:0.7; } }
|
|
29
29
|
@keyframes tkx-draw-line { from { transform:scaleY(0); transform-origin:top center; } to { transform:scaleY(1); } }
|
|
30
30
|
@keyframes tkx-draw-line-h { from { transform:scaleX(0); transform-origin:left center; } to { transform:scaleX(1); } }
|
|
31
31
|
.tkx-pulse-dot { animation: tkx-pulse-dot 1.5s ease-in-out infinite; }
|
|
32
32
|
.tkx-draw-v { animation: tkx-draw-line 0.6s ease forwards; }
|
|
33
33
|
.tkx-draw-h { animation: tkx-draw-line-h 0.6s ease forwards; }
|
|
34
|
-
`,document.head.appendChild(t)}function
|
|
34
|
+
`,document.head.appendChild(t)}function wo(t="pending"){const n=_.useTheme();return{completed:n.success,active:n.primary,pending:n.border,error:n.danger}[t]}function Et({status:t="pending",icon:n,size:r=28}){const o=_.useTheme(),s=Q.useReducedMotion(),l=wo(t),a=t==="active";return e.jsx("div",{className:x.cx(x.tkx("relative flex items-center justify-center rounded-full shrink-0 z-10"),a&&!s?"tkx-pulse-dot":""),style:{width:r,height:r,backgroundColor:t==="pending"?o.surface:l,border:`2px solid ${l}`,color:t==="pending"?l:o.bg},"aria-hidden":"true",children:n?e.jsx("span",{style:{fontSize:r*.45,lineHeight:1},children:n}):e.jsx("span",{style:{width:r*.35,height:r*.35,borderRadius:"50%",backgroundColor:t==="pending"?l:o.bg,display:"block"}})})}function fn({style:t,color:n,animate:r}){return _.useTheme(),e.jsx("div",{className:x.cx(x.tkx("w-0.5 flex-1 min-h-[24px]"),r?"tkx-draw-v":""),style:{borderLeft:`2px ${t} ${n}`,backgroundColor:"transparent",alignSelf:"stretch",borderColor:n,marginLeft:1},"aria-hidden":"true"})}function xn({style:t,color:n,animate:r}){return e.jsx("div",{className:x.cx(x.tkx("h-0.5 flex-1 min-w-[24px]"),r?"tkx-draw-h":""),style:{borderTop:`2px ${t} ${n}`,borderColor:n},"aria-hidden":"true"})}function Nt({item:t,compact:n}){const r=_.useTheme(),o=t.timestamp?A.sanitizeString(t.timestamp):null;return e.jsxs("div",{className:x.tkx("flex flex-col gap-0.5",n?"pb-3":"pb-5"),children:[e.jsxs("div",{className:x.tkx("flex items-center gap-2 flex-wrap"),children:[e.jsx("span",{className:x.tkx("text-sm font-semibold leading-snug"),style:{color:r.text},children:typeof t.title=="string"?A.sanitizeString(t.title):t.title}),t.badge&&e.jsx("span",{children:t.badge}),o&&e.jsx("span",{className:x.tkx("text-[11px] ml-auto"),style:{color:r.textMuted},children:o})]}),t.description&&!n&&e.jsx("div",{className:x.tkx("text-xs leading-relaxed mt-0.5"),style:{color:r.textMuted},children:typeof t.description=="string"?A.sanitizeString(t.description):t.description})]})}function jo({items:t,variant:n="default",orientation:r="vertical",connectorStyle:o="solid"}){const s=_.useTheme(),l=Q.useReducedMotion(),a=i.useRef(!1);i.useEffect(()=>{vo(),a.current=!0},[]);const c=!l,d=n==="compact",f=n==="alternating"&&r==="vertical";return r==="horizontal"?e.jsx("div",{role:"list","aria-label":"Timeline",className:x.tkx("flex items-start w-full overflow-x-auto"),children:t.map((h,p)=>{const m=h.status??"pending",y=m==="completed"?s.success:s.border,k=p===t.length-1;return e.jsx("div",{role:"listitem",className:x.tkx("flex items-start flex-1 min-w-0"),children:e.jsxs("div",{className:x.tkx("flex flex-col items-center flex-1 min-w-0"),children:[e.jsxs("div",{className:x.tkx("flex items-center w-full"),children:[p>0&&e.jsx(xn,{style:o,color:y,animate:c}),e.jsx(Et,{status:m,icon:h.icon,size:24}),!k&&e.jsx(xn,{style:o,color:y,animate:c})]}),e.jsxs("div",{className:x.tkx("mt-2 px-1 text-center min-w-0 w-full"),children:[e.jsx("div",{className:x.tkx("text-xs font-semibold truncate"),style:{color:s.text},children:typeof h.title=="string"?A.sanitizeString(h.title):h.title}),h.timestamp&&e.jsx("div",{className:x.tkx("text-[10px] mt-0.5"),style:{color:s.textMuted},children:A.sanitizeString(h.timestamp)})]})]})},h.id)})}):e.jsx("div",{role:"list","aria-label":"Timeline",className:x.tkx("flex flex-col"),children:t.map((h,p)=>{const m=h.status??"pending",y=p===t.length-1,k=m==="completed"?s.success:s.border,b=f&&p%2===0;return f?e.jsxs("div",{role:"listitem",className:x.tkx("flex items-stretch gap-0"),children:[e.jsx("div",{className:x.tkx("flex-1 flex flex-col items-end pr-4",b?"":"invisible"),children:b&&e.jsx(Nt,{item:h,compact:d})}),e.jsxs("div",{className:x.tkx("flex flex-col items-center"),children:[e.jsx(Et,{status:m,icon:h.icon,size:28}),!y&&e.jsx(fn,{style:o,color:k,animate:c})]}),e.jsx("div",{className:x.tkx("flex-1 flex flex-col items-start pl-4",b?"invisible":""),children:!b&&e.jsx(Nt,{item:h,compact:d})})]},h.id):e.jsxs("div",{role:"listitem",className:x.tkx("flex gap-3 items-stretch"),children:[e.jsxs("div",{className:x.tkx("flex flex-col items-center"),children:[e.jsx(Et,{status:m,icon:h.icon,size:d?22:28}),!y&&e.jsx(fn,{style:o,color:k,animate:c})]}),e.jsx("div",{className:x.tkx("flex-1 min-w-0 pt-0.5"),children:e.jsx(Nt,{item:h,compact:d})})]},h.id)})})}function pn(t,n,r,o){const s=window.innerWidth,l=window.innerHeight,a=6;let c=0,d=0,f="top left";switch(n){case"bottom-start":c=t.bottom+a,d=t.left,f="top left",c+o>l&&t.top-a-o>0&&(c=t.top-a-o,f="bottom left"),d+r>s&&(d=Math.max(0,s-r-8));break;case"bottom-end":c=t.bottom+a,d=t.right-r,f="top right",c+o>l&&t.top-a-o>0&&(c=t.top-a-o,f="bottom right"),d<0&&(d=8);break;case"top-start":c=t.top-a-o,d=t.left,f="bottom left",c<0&&(c=t.bottom+a,f="top left"),d+r>s&&(d=Math.max(0,s-r-8));break;case"top-end":c=t.top-a-o,d=t.right-r,f="bottom right",c<0&&(c=t.bottom+a,f="top right"),d<0&&(d=8);break;case"right-start":c=t.top,d=t.right+a,f="top left",d+r>s&&(d=t.left-a-r,f="top right"),c+o>l&&(c=Math.max(8,l-o-8));break;case"left-start":c=t.top,d=t.left-a-r,f="top right",d<0&&(d=t.right+a,f="top left"),c+o>l&&(c=Math.max(8,l-o-8));break}return{top:c+window.scrollY,left:d+window.scrollX,transformOrigin:f}}function So(t,n,r){const o=window.innerWidth,s=window.innerHeight,l=4;let a=t.right+l,c="top left";a+n>o&&(a=t.left-l-n,c="top right");let d=t.top;return d+r>s&&(d=Math.max(8,s-r-8)),{top:d+window.scrollY,left:a+window.scrollX,transformOrigin:c}}const Mo=`
|
|
35
35
|
@keyframes tkxMenuIn {
|
|
36
36
|
from { opacity: 0; transform: scale(0.94); }
|
|
37
37
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
animation: tkxMenuInReduced 100ms ease forwards;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
`;function Zo(t,r){return{position:"absolute",top:r.top,left:r.left,zIndex:9999,minWidth:200,maxWidth:320,backgroundColor:t.surface,border:`1.5px solid ${t.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",padding:"4px 0",transformOrigin:r.transformOrigin,overflow:"hidden"}}function Go({color:t}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})}function Jo({color:t}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"5",fill:t}),e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:t,strokeWidth:"2"})]})}function Qo({color:t}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M9 18l6-6-6-6"})})}function ei(t){const r=[];let n=0;for(const i of t)if(i.type!=="separator")if(i.type==="radio-group")for(let o=0;o<i.options.length;o++)r.push({kind:"radio",item:i,optionIdx:o,idx:n++});else i.type==="check"?r.push({kind:"check",item:i,idx:n++}):i.type==="submenu"?r.push({kind:"submenu",item:i,idx:n++}):r.push({kind:"action",item:i,idx:n++});return r}function cn({items:t,pos:r,panelId:n,onClose:i,onCloseAll:o,isSubmenu:l=!1}){const c=B.useTheme(),[d,u]=a.useState(-1),[x,f]=a.useState(null),[m,p]=a.useState(null),h=a.useRef(null),[y,k]=a.useState(""),b=a.useRef(null),g=ei(t);a.useEffect(()=>{var C;(C=h.current)==null||C.focus()},[]),a.useEffect(()=>{var M;if(d<0)return;const C=(M=h.current)==null?void 0:M.querySelector(`[data-midx="${d}"]`);C==null||C.scrollIntoView({block:"nearest"})},[d]);const w=a.useCallback(C=>{var M,T,E,$,F,I;if(C.kind==="action"){if(C.item.disabled)return;(T=(M=C.item).onClick)==null||T.call(M),o()}else if(C.kind==="check"){if(C.item.disabled)return;($=(E=C.item).onChange)==null||$.call(E,!C.item.checked)}else if(C.kind==="radio"){if(C.item.disabled)return;(I=(F=C.item).onChange)==null||I.call(F,C.item.options[C.optionIdx].value)}else if(C.kind==="submenu"){if(C.item.disabled)return;f(C.item.id)}},[o]),j=C=>{var M;switch(C.key){case"ArrowDown":C.preventDefault(),u(T=>{const E=T+1;return E<g.length?E:0});break;case"ArrowUp":C.preventDefault(),u(T=>{const E=T-1;return E>=0?E:g.length-1});break;case"Home":C.preventDefault(),u(0);break;case"End":C.preventDefault(),u(g.length-1);break;case"Enter":case" ":C.preventDefault(),d>=0&&g[d]&&w(g[d]);break;case"Escape":C.preventDefault(),l?i():o();break;case"Tab":C.preventDefault(),o();break;case"ArrowRight":C.preventDefault(),d>=0&&((M=g[d])==null?void 0:M.kind)==="submenu"&&f(g[d].item.id);break;case"ArrowLeft":C.preventDefault(),l&&i();break;default:C.key.length===1&&!C.ctrlKey&&!C.metaKey&&S(C.key)}};function S(C){b.current&&clearTimeout(b.current);const M=y+C.toLowerCase();k(M);const T=g.findIndex(E=>(E.kind==="radio"?E.item.options[E.optionIdx].label:E.item.label).toLowerCase().startsWith(M));T>=0&&u(T),b.current=setTimeout(()=>k(""),800)}function z(C,M){const T=M.getBoundingClientRect();f(C.id);const E=Math.min(C.items.length*38+12,360);p(Xo(T,220,E))}function v(){f(null),p(null)}const N=()=>{let C=-1;return t.map(M=>{if(M.type==="separator")return e.jsx("div",{role:"separator",style:{margin:(M.label,"4px 0"),display:"flex",alignItems:"center",gap:8},children:M.label?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1,height:1,backgroundColor:c.border,marginLeft:14}}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:c.textMuted,fontFamily:"inherit",whiteSpace:"nowrap"},children:s.sanitizeString(M.label)}),e.jsx("div",{style:{flex:1,height:1,backgroundColor:c.border,marginRight:14}})]}):e.jsx("div",{style:{flex:1,height:1,backgroundColor:c.border,margin:"0 10px"}})},M.id);if(M.type==="radio-group")return e.jsxs("div",{role:"group","aria-label":M.label,children:[M.label&&e.jsx("div",{style:{padding:"6px 14px 2px",fontSize:"11px",fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:c.textMuted,fontFamily:"inherit"},"aria-hidden":"true",children:s.sanitizeString(M.label)}),M.options.map((L,Y)=>{C++;const D=C,V=D===d,R=L.value===M.value,P=!!M.disabled,A=kt(c,V,!1,P);return e.jsxs("div",{role:"menuitemradio","aria-checked":R,"aria-disabled":P||void 0,"data-midx":D,tabIndex:-1,style:A,onClick:()=>{var O;return!P&&((O=M.onChange)==null?void 0:O.call(M,L.value))},onMouseEnter:()=>!P&&u(D),children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:R?e.jsx(Jo,{color:c.primary}):e.jsx("span",{style:{width:14,height:14,borderRadius:"50%",border:`2px solid ${c.border}`,display:"inline-block"}})}),L.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:c.textMuted},children:L.icon}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.sanitizeString(L.label)})]},L.value)})]},M.id);if(M.type==="check"){C++;const L=C,Y=L===d,D=!!M.disabled,V=kt(c,Y,!1,D);return e.jsxs("div",{role:"menuitemcheckbox","aria-checked":M.checked,"aria-disabled":D||void 0,"data-midx":L,tabIndex:-1,style:V,onClick:()=>{var R;return!D&&((R=M.onChange)==null?void 0:R.call(M,!M.checked))},onMouseEnter:()=>!D&&u(L),children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:M.checked?e.jsx(Go,{color:c.primary}):e.jsx("span",{style:{width:14,height:14,display:"inline-block"}})}),M.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:c.textMuted},children:M.icon}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.sanitizeString(M.label)})]},M.id)}if(M.type==="submenu"){C++;const L=C,Y=L===d,D=!!M.disabled,V=x===M.id,R=kt(c,Y||V,!1,D);return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{role:"menuitem","aria-haspopup":"menu","aria-expanded":V,"aria-disabled":D||void 0,"data-midx":L,tabIndex:-1,style:R,onMouseEnter:P=>{D||(u(L),z(M,P.currentTarget))},onMouseLeave:()=>{},onClick:()=>{D||f(V?null:M.id)},children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:M.icon?e.jsx("span",{style:{display:"flex",color:c.textMuted},children:M.icon}):e.jsx("span",{style:{width:14}})}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.sanitizeString(M.label)}),e.jsx(Qo,{color:c.textMuted})]}),V&&m&&Le.createPortal(e.jsx(cn,{items:M.items,pos:m,panelId:`${n}-sub-${M.id}`,onClose:v,onCloseAll:o,isSubmenu:!0}),document.body)]},M.id)}const T=M;C++;const E=C,$=E===d,F=!!T.disabled,I=!!T.danger,W=kt(c,$,I,F);return e.jsxs("div",{role:"menuitem","aria-disabled":F||void 0,"data-midx":E,tabIndex:-1,style:W,onClick:()=>{var L;F||((L=T.onClick)==null||L.call(T),o())},onMouseEnter:()=>{F||(u(E),v())},children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:T.icon?e.jsx("span",{style:{display:"flex",color:I?c.danger:c.textMuted},children:T.icon}):e.jsx("span",{style:{width:14}})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.sanitizeString(T.label)}),T.description&&e.jsx("span",{style:{display:"block",fontSize:"12px",color:c.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.sanitizeString(T.description)})]}),T.shortcut&&e.jsx("span",{style:{fontSize:"12px",color:c.textMuted,fontFamily:"inherit",flexShrink:0,marginLeft:16,opacity:.8},children:s.sanitizeString(T.shortcut)})]},T.id)})};return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:qo}),e.jsx("div",{ref:h,id:n,role:"menu",tabIndex:-1,className:"tkx-menu-panel",onKeyDown:j,style:{...Zo(c,r),maxHeight:400,overflowY:"auto"},children:N()})]})}function kt(t,r,n,i){const o=n?t.danger:t.text;return{display:"flex",alignItems:"center",gap:8,padding:"7px 14px",fontSize:"14px",fontFamily:"inherit",cursor:i?"not-allowed":"pointer",userSelect:"none",color:i?t.textMuted:r&&n?t.danger:o,backgroundColor:r?n?`${t.danger}18`:`${t.primary}18`:"transparent",transition:"background-color 80ms",opacity:i?.5:1,outline:"none"}}function dn({trigger:t,items:r,placement:n="bottom-start",isDisabled:i=!1,onOpen:o,onClose:l,className:c,style:d}){const x=`tkx-menu-${a.useId().replace(/:/g,"")}`,[f,m]=a.useState(!1),[p,h]=a.useState(null),y=a.useRef(null),k=a.useCallback(()=>{if(i)return;const w=y.current;if(!w)return;const j=w.getBoundingClientRect(),S=Math.min(r.length*38+12,360);h(fr(j,n,220,S)),m(!0),o==null||o()},[i,r.length,o,n]),b=a.useCallback(()=>{var w,j,S;m(!1),l==null||l(),(S=(j=(w=y.current)==null?void 0:w.firstElementChild)==null?void 0:j.focus)==null||S.call(j)},[l]);a.useEffect(()=>{if(!f)return;const w=j=>{var v;const S=j.target;if((v=y.current)!=null&&v.contains(S))return;const z=document.querySelectorAll(".tkx-menu-panel");for(const N of z)if(N.contains(S))return;b()};return document.addEventListener("pointerdown",w),()=>document.removeEventListener("pointerdown",w)},[f,b]),a.useEffect(()=>{if(!f)return;const w=()=>{const j=y.current;if(!j)return;const S=j.getBoundingClientRect(),z=Math.min(r.length*38+12,360);h(fr(S,n,220,z))};return window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[f,r.length,n]);const g=w=>{(w.key==="Enter"||w.key===" "||w.key==="ArrowDown")&&(w.preventDefault(),f||k()),w.key==="Escape"&&f&&(w.preventDefault(),b())};return e.jsxs("span",{ref:y,className:c,style:{display:"inline-flex",...d},children:[e.jsx("span",{role:"button",tabIndex:i?-1:0,"aria-haspopup":"menu","aria-expanded":f,"aria-controls":f?x:void 0,"aria-disabled":i||void 0,onClick:()=>f?b():k(),onKeyDown:g,style:{display:"inline-flex",cursor:i?"not-allowed":"pointer",opacity:i?.55:1,outline:"none"},children:t}),f&&p&&Le.createPortal(e.jsx(cn,{items:r,pos:p,panelId:x,onClose:b,onCloseAll:b}),document.body)]})}dn.displayName="TkxMenu";const ti={sm:120,md:180,lg:240,xl:320};function vt(t){const r=new Date;if(t)try{const c=new Intl.DateTimeFormat("en-US",{timeZone:t,hour:"numeric",minute:"numeric",second:"numeric",hour12:!1,weekday:"long",month:"long",day:"2-digit",year:"numeric"}).formatToParts(r),d=b=>{var g;return((g=c.find(w=>w.type===b))==null?void 0:g.value)??"0"};let u=parseInt(d("hour"),10);u===24&&(u=0);const x=parseInt(d("minute"),10),f=parseInt(d("second"),10),m=d("weekday"),p=d("month"),h=d("day"),y=d("year"),k=`${m}, ${p} ${h}, ${y}`;return{hours:u,minutes:x,seconds:f,milliseconds:r.getMilliseconds(),dateString:k}}catch{}const n=r.getHours(),i=r.getMinutes(),o=r.getSeconds(),l=r.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"2-digit",year:"numeric"});return{hours:n,minutes:i,seconds:o,milliseconds:r.getMilliseconds(),dateString:l}}function ri({time:t,size:r,analogStyle:n,showSeconds:i,reducedMotion:o,primary:l,danger:c,text:d,textMuted:u,border:x,surface:f,bg:m}){const p=r/2,h=r/2,y=r/2-4,{hours:k,minutes:b,seconds:g,milliseconds:w}=t,S=(g+(o?0:w)/1e3)/60*360,z=b/60*360+g/60*6,v=k%12/12*360+b/60*30,N=(I,W)=>{const L=(I-90)*Math.PI/180;return{x:p+Math.cos(L)*W,y:h+Math.sin(L)*W}},C=o?"none":"transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44)";if(n==="modern"){const I=(P,A)=>{const G=-90+P*360,ee={x:p+Math.cos(-90*Math.PI/180)*A,y:h+Math.sin(-90*Math.PI/180)*A},oe={x:p+Math.cos(G*Math.PI/180)*A,y:h+Math.sin(G*Math.PI/180)*A},ae=P>.5?1:0;return`M ${ee.x} ${ee.y} A ${A} ${A} 0 ${ae} 1 ${oe.x} ${oe.y}`},W=k%12/12+b/60/12,L=b/60+g/3600,Y=(g+(o?0:w/1e3))/60,D=y-2,V=y-10,R=y-18;return e.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,"aria-hidden":"true",children:[e.jsx("circle",{cx:p,cy:h,r:D,fill:"none",stroke:x,strokeWidth:4}),e.jsx("circle",{cx:p,cy:h,r:V,fill:"none",stroke:x,strokeWidth:4}),i&&e.jsx("circle",{cx:p,cy:h,r:R,fill:"none",stroke:x,strokeWidth:3}),e.jsx("path",{d:I(W,D),fill:"none",stroke:l,strokeWidth:4,strokeLinecap:"round"}),e.jsx("path",{d:I(L,V),fill:"none",stroke:d,strokeWidth:4,strokeLinecap:"round"}),i&&e.jsx("path",{d:I(Y,R),fill:"none",stroke:c,strokeWidth:3,strokeLinecap:"round"}),e.jsx("circle",{cx:p,cy:h,r:4,fill:l}),e.jsxs("text",{x:p,y:h+20,textAnchor:"middle",fontSize:r*.12,fill:u,fontFamily:"monospace",style:{fontVariantNumeric:"tabular-nums"},children:[String(k).padStart(2,"0"),":",String(b).padStart(2,"0")]})]})}const M=N(v,y*.5),T=N(z,y*.75),E=N(S,y*.85),$=N(S+180,y*.2),F=[];if(n==="classic"){for(let W=0;W<60;W++){const L=W/60*360,Y=W%5===0,D=(L-90)*Math.PI/180,V=Y?y-10:y-6,R=p+Math.cos(D)*y,P=h+Math.sin(D)*y,A=p+Math.cos(D)*V,O=h+Math.sin(D)*V;F.push(e.jsx("line",{x1:R,y1:P,x2:A,y2:O,stroke:Y?d:u,strokeWidth:Y?2:1,strokeLinecap:"round"},W))}const I=[{n:12,angle:0},{n:3,angle:90},{n:6,angle:180},{n:9,angle:270}];for(const{n:W,angle:L}of I){const Y=(L-90)*Math.PI/180,D=y-20;F.push(e.jsx("text",{x:p+Math.cos(Y)*D,y:h+Math.sin(Y)*D,textAnchor:"middle",dominantBaseline:"central",fontSize:r*.09,fill:d,fontFamily:"system-ui, sans-serif",fontWeight:"600",children:W},`n${W}`))}}else for(let I=0;I<12;I++){const L=(I/12*360-90)*Math.PI/180,Y=y-8;F.push(e.jsx("circle",{cx:p+Math.cos(L)*Y,cy:h+Math.sin(L)*Y,r:I%3===0?3:2,fill:I%3===0?d:u},I))}return e.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,"aria-hidden":"true",style:{display:"block"},children:[e.jsx("circle",{cx:p,cy:h,r:y,fill:f,stroke:x,strokeWidth:2}),F,e.jsx("line",{x1:p,y1:h,x2:M.x,y2:M.y,stroke:l,strokeWidth:n==="minimal"?3:4,strokeLinecap:"round",style:{transformOrigin:`${p}px ${h}px`,transition:C}}),e.jsx("line",{x1:p,y1:h,x2:T.x,y2:T.y,stroke:d,strokeWidth:n==="minimal"?2:3,strokeLinecap:"round",style:{transformOrigin:`${p}px ${h}px`,transition:C}}),i&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:$.x,y1:$.y,x2:E.x,y2:E.y,stroke:c,strokeWidth:1.5,strokeLinecap:"round",style:{transformOrigin:`${p}px ${h}px`,transition:"none"}}),e.jsx("circle",{cx:p,cy:h,r:3,fill:c})]}),e.jsx("circle",{cx:p,cy:h,r:n==="minimal"?3:5,fill:l})]})}function xr({time:t,format:r,showSeconds:n,showDate:i,label:o,size:l,primary:c,text:d,textMuted:u,colonVisible:x}){const{hours:f,minutes:m,seconds:p,dateString:h}=t;let y=f,k="";r==="12h"&&(k=f>=12?"PM":"AM",y=f%12||12);const b=l*.2,g={opacity:x?1:0,transition:"opacity 0.1s",display:"inline-block",minWidth:"0.5ch",textAlign:"center"};return e.jsxs("div",{style:{textAlign:"center",fontFamily:"'Courier New', Courier, monospace",fontVariantNumeric:"tabular-nums",lineHeight:1.1},children:[e.jsxs("div",{style:{fontSize:b,color:c,fontWeight:700,letterSpacing:"0.05em",display:"flex",alignItems:"center",justifyContent:"center",gap:0},children:[e.jsx("span",{children:String(y).padStart(2,"0")}),e.jsx("span",{style:g,children:":"}),e.jsx("span",{children:String(m).padStart(2,"0")}),n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:g,children:":"}),e.jsx("span",{children:String(p).padStart(2,"0")})]}),r==="12h"&&e.jsx("span",{style:{fontSize:b*.45,color:u,marginLeft:"0.4ch",alignSelf:"flex-end",marginBottom:b*.05},children:k})]}),i&&e.jsx("div",{style:{fontSize:l*.072,color:u,marginTop:l*.025,letterSpacing:"0.03em"},children:h}),o&&e.jsx("div",{style:{fontSize:l*.065,color:u,marginTop:l*.015,textTransform:"uppercase",letterSpacing:"0.08em"},children:s.sanitizeString(o)})]})}function un({variant:t="both",size:r="md",showSeconds:n=!0,showDate:i=!1,format:o="24h",timezone:l,timezone2:c,label:d,analogStyle:u="classic",className:x,style:f}){const m=B.useTheme(),p=s.useReducedMotion(),[h,y]=a.useState(()=>vt(l)),[k,b]=a.useState(()=>c?vt(c):null),[g,w]=a.useState(!0),[j,S]=a.useState(!1),z=a.useRef(null);a.useEffect(()=>{S(!0)},[]),a.useEffect(()=>{const T=()=>{y(vt(l)),c&&b(vt(c))};T();const E=setInterval(T,1e3);return()=>clearInterval(E)},[l,c]),a.useEffect(()=>(z.current=setInterval(()=>{w(T=>!T)},500),()=>{z.current&&clearInterval(z.current)}),[]);const v=ti[r],N=t==="analog"||t==="both",C=t==="digital"||t==="both",M={display:"inline-flex",flexDirection:"column",alignItems:"center",gap:t==="both"?`${v*.06}px`:0,opacity:j?1:0,transition:p?"none":"opacity 0.4s ease",...f};return e.jsxs("div",{className:x,style:M,role:"timer","aria-live":"off",children:[N&&e.jsx(ri,{time:h,size:v,analogStyle:u,showSeconds:n,reducedMotion:p,primary:m.primary,danger:m.danger,text:m.text,textMuted:m.textMuted,border:m.border,surface:m.surface,bg:m.bg}),C&&e.jsx(xr,{time:h,format:o,showSeconds:n,showDate:i,label:d,size:v,primary:m.primary,text:m.text,textMuted:m.textMuted,colonVisible:g}),k&&c&&e.jsx("div",{style:{marginTop:v*.04,padding:`${v*.03}px ${v*.06}px`,borderTop:`1px solid ${m.border}`,textAlign:"center"},children:e.jsx(xr,{time:k,format:o,showSeconds:!1,showDate:!1,label:c,size:v*.7,primary:m.secondary,text:m.text,textMuted:m.textMuted,colonVisible:g})})]})}un.displayName="TkxClock";function Nt(t){if(!isFinite(t)||isNaN(t))return"0:00";const r=Math.floor(t/3600),n=Math.floor(t%3600/60),i=Math.floor(t%60);return r>0?`${r}:${String(n).padStart(2,"0")}:${String(i).padStart(2,"0")}`:`${n}:${String(i).padStart(2,"0")}`}function Ue({path:t,size:r=20,color:n="currentColor",title:i}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:n,"aria-hidden":i?void 0:"true",role:i?"img":void 0,"aria-label":i,style:{display:"block",flexShrink:0},children:e.jsx("path",{d:t})})}const Re={play:"M8 5v14l11-7z",pause:"M6 19h4V5H6v14zm8-14v14h4V5h-4z",volumeUp:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z",volumeMute:"M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z",volumeDown:"M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z",fullscreen:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",fullscreenExit:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z",pip:"M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z",download:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",closedCaption:"M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z",replay10:"M11.99 5V1l-5 5 5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z",forward10:"M18 13c0 3.31-2.69 6-6 6s-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8V1l-5 5 5 5V7c3.31 0 6 2.69 6 6z",errorOutline:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",refresh:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"};function st({onClick:t,title:r,children:n,active:i,primary:o}){const[l,c]=a.useState(!1);return e.jsx("button",{type:"button",onClick:t,title:r,"aria-label":r,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{background:"none",border:"none",padding:"6px",cursor:"pointer",color:i||l?o:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",flexShrink:0,transition:"color 0.15s ease"},children:n})}function fn({src:t,poster:r,title:n,width:i="100%",height:o,autoPlay:l=!1,loop:c=!1,muted:d=!1,controls:u=!0,showTitle:x=!0,allowFullscreen:f=!0,allowPiP:m=!0,allowDownload:p=!1,chapters:h=[],subtitles:y=[],startTime:k,onPlay:b,onPause:g,onEnded:w,onTimeUpdate:j,className:S,style:z}){const v=B.useTheme(),N=s.useReducedMotion(),C=a.useRef(null),M=a.useRef(null),T=a.useRef(null),E=a.useRef(null),[$,F]=a.useState(!1),[I,W]=a.useState(0),[L,Y]=a.useState(0),[D,V]=a.useState(0),[R,P]=a.useState(1),[A,O]=a.useState(d),[G,ee]=a.useState(!1),[oe,ae]=a.useState(!0),[fe,de]=a.useState(!1),[ge,U]=a.useState(1),[se,he]=a.useState(!1),[we,ce]=a.useState(-1),[me,re]=a.useState(null),[le,J]=a.useState(0),[X,ne]=a.useState(null),[xe,ke]=a.useState(!1),[Te,Me]=a.useState(!1),[He,$e]=a.useState(null),[ze,Ke]=a.useState(!1);a.useEffect(()=>{const _=C.current;if(!_)return;k!==void 0&&(_.currentTime=k);const pe=()=>{W(_.currentTime),_.buffered.length>0&&V(_.buffered.end(_.buffered.length-1))},je=()=>Y(_.duration),Ne=()=>F(!0),nt=()=>{F(!1),de(!0)},et=()=>{F(!1),de(!0),w==null||w()},ct=()=>ke(!0),dt=()=>ke(!1),ut=()=>Me(!0),bt=()=>Me(!1),yt=()=>{const Ze=_.error;$e(Ze?`Error ${Ze.code}: ${Ze.message||"Failed to load video"}`:"Failed to load video"),Me(!1)};return _.addEventListener("timeupdate",pe),_.addEventListener("durationchange",je),_.addEventListener("play",Ne),_.addEventListener("pause",nt),_.addEventListener("ended",et),_.addEventListener("enterpictureinpicture",ct),_.addEventListener("leavepictureinpicture",dt),_.addEventListener("waiting",ut),_.addEventListener("canplay",bt),_.addEventListener("error",yt),()=>{_.removeEventListener("timeupdate",pe),_.removeEventListener("durationchange",je),_.removeEventListener("play",Ne),_.removeEventListener("pause",nt),_.removeEventListener("ended",et),_.removeEventListener("enterpictureinpicture",ct),_.removeEventListener("leavepictureinpicture",dt),_.removeEventListener("waiting",ut),_.removeEventListener("canplay",bt),_.removeEventListener("error",yt)}},[w,k]),a.useEffect(()=>{C.current&&($?b==null||b():g==null||g())},[$,b,g]),a.useEffect(()=>{j==null||j(I,L)},[I,L,j]),a.useEffect(()=>{const _=C.current;if(!_)return;const pe=_.textTracks;for(let je=0;je<pe.length;je++)pe[je].mode=je===we?"showing":"disabled"},[we]),a.useEffect(()=>{const _=()=>ee(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",_),()=>document.removeEventListener("fullscreenchange",_)},[]),a.useEffect(()=>{const _=M.current;if(!_)return;const pe=je=>{const Ne=C.current;if(Ne&&je.target.tagName!=="INPUT")switch(je.key){case" ":case"k":je.preventDefault(),De();break;case"f":case"F":f&&Oe();break;case"m":case"M":Pe();break;case"ArrowRight":je.preventDefault(),Ne.currentTime=Math.min(Ne.currentTime+10,Ne.duration);break;case"ArrowLeft":je.preventDefault(),Ne.currentTime=Math.max(Ne.currentTime-10,0);break;case"ArrowUp":je.preventDefault(),P(Math.min(R+.1,1)),C.current&&(C.current.volume=Math.min(R+.1,1));break;case"ArrowDown":je.preventDefault(),P(Math.max(R-.1,0)),C.current&&(C.current.volume=Math.max(R-.1,0));break}};return _.addEventListener("keydown",pe),()=>_.removeEventListener("keydown",pe)},[R,f]);const Xe=a.useCallback(()=>{ae(!0),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{$&&ae(!1)},3e3)},[$]);a.useEffect(()=>(Xe(),()=>{E.current&&clearTimeout(E.current)}),[$,Xe]);const De=a.useCallback(()=>{const _=C.current;_&&(_.paused?(_.play().catch(()=>{}),ne("play"),de(!1)):(_.pause(),ne("pause")),setTimeout(()=>ne(null),600))},[]),Pe=a.useCallback(()=>{const _=C.current;if(!_)return;const pe=!A;O(pe),_.muted=pe},[A]),Oe=a.useCallback(()=>{const _=M.current;_&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):_.requestFullscreen().catch(()=>{}))},[]),Ie=a.useCallback(async()=>{const _=C.current;if(_)try{document.pictureInPictureElement?await document.exitPictureInPicture():await _.requestPictureInPicture()}catch{}},[]),qe=a.useCallback(()=>{y.length!==0&&(ce(_=>(_+1)%(y.length+1)-1),ce(_=>{const pe=_+1;return pe>=y.length?-1:pe}))},[y.length]),_e=a.useCallback(()=>{const _=C.current;_&&(_.currentTime=Math.min(_.currentTime+10,_.duration||0))},[]),Je=a.useCallback(()=>{const _=C.current;_&&(_.currentTime=Math.max(_.currentTime-10,0))},[]),q=a.useCallback(()=>{const _=C.current;_&&($e(null),_.load())},[]),te=a.useCallback(()=>{f&&Oe()},[f,Oe]),ve=a.useCallback(_=>{const pe=C.current,je=T.current;if(!pe||!je||!L)return;const Ne=je.getBoundingClientRect(),nt=Math.max(0,Math.min(1,(_.clientX-Ne.left)/Ne.width));pe.currentTime=nt*L},[L]),Se=a.useCallback(_=>{const pe=T.current;if(!pe||!L)return;const je=pe.getBoundingClientRect(),Ne=Math.max(0,Math.min(1,(_.clientX-je.left)/je.width));re(Ne*L),J(_.clientX-je.left)},[L]),ye=a.useCallback(_=>{const pe=parseFloat(_.target.value);P(pe),C.current&&(C.current.volume=pe,C.current.muted=pe===0,O(pe===0))},[]),Be=a.useCallback(_=>{U(_),C.current&&(C.current.playbackRate=_),he(!1)},[]),Ee=h.length>0?[...h].reverse().find(_=>I>=_.time):null,H=_=>[...h].reverse().find(pe=>_>=pe.time)??null,Q=Array.isArray(t)?t:[{src:t,type:"video/mp4"}],ie=Array.isArray(t)?t[0].src:t,be=oe||fe||!$,Ye=N?"none":"opacity 0.25s ease",Qe=A||R===0?Re.volumeMute:R<.5?Re.volumeDown:Re.volumeUp,lt=L>0?I/L*100:0,Mt=L>0?D/L*100:0;return e.jsxs("div",{ref:M,className:S,tabIndex:0,onMouseMove:Xe,onMouseLeave:()=>{$&&ae(!1)},style:{position:"relative",width:i,height:o??"auto",background:"#000",borderRadius:"8px",overflow:"hidden",outline:"none",userSelect:"none",...z},children:[e.jsxs("video",{ref:C,style:{width:"100%",height:"100%",display:"block",objectFit:"contain"},poster:r,autoPlay:l,loop:c,muted:d,playsInline:!0,onClick:De,onDoubleClick:te,children:[Q.map((_,pe)=>e.jsx("source",{src:_.src,type:_.type},pe)),y.map((_,pe)=>e.jsx("track",{kind:"subtitles",label:s.sanitizeString(_.label),srcLang:_.lang,src:_.src,default:_.default},pe))]}),x&&n&&e.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,background:"linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%)",padding:"16px 16px 32px",opacity:be?1:0,transition:Ye,pointerEvents:"none"},children:[e.jsx("span",{style:{color:"#fff",fontSize:"0.95rem",fontWeight:600,textShadow:"0 1px 3px rgba(0,0,0,0.7)"},children:s.sanitizeString(n)}),Ee&&e.jsxs("span",{style:{color:"rgba(255,255,255,0.65)",fontSize:"0.8rem",marginLeft:8},children:["— ",s.sanitizeString(Ee.label)]})]}),X&&e.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(0,0,0,0.45)",borderRadius:"50%",width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",animation:N?"none":"tkxvp-flash 0.6s ease forwards",pointerEvents:"none"},children:e.jsx(Ue,{path:X==="play"?Re.play:Re.pause,size:32,color:"#fff"})}),Te&&!He&&e.jsx("div",{"aria-label":"Loading",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:10},children:e.jsx("div",{style:{width:48,height:48,border:"4px solid rgba(255,255,255,0.25)",borderTopColor:v.primary,borderRadius:"50%",animation:N?"none":"tkxvp-spin 0.8s linear infinite"}})}),He&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.8)",zIndex:20,gap:12},children:[e.jsx(Ue,{path:Re.errorOutline,size:48,color:"#ef4444"}),e.jsx("span",{style:{color:"#fff",fontSize:"0.9rem",maxWidth:"80%",textAlign:"center"},children:He}),e.jsxs("button",{type:"button",onClick:q,style:{display:"flex",alignItems:"center",gap:6,background:v.primary,color:"#fff",border:"none",borderRadius:6,padding:"8px 18px",fontSize:"0.85rem",fontWeight:600,cursor:"pointer",marginTop:4},children:[e.jsx(Ue,{path:Re.refresh,size:18,color:"#fff"}),"Retry"]})]}),u&&e.jsxs("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 70%, transparent 100%)",padding:"32px 12px 8px",opacity:be?1:0,transition:Ye},onMouseEnter:()=>de(!0),onMouseLeave:()=>de(!1),children:[e.jsxs("div",{ref:T,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(L),"aria-valuenow":Math.floor(I),tabIndex:0,onClick:ve,onMouseMove:Se,style:{position:"relative",height:4,borderRadius:2,background:"rgba(255,255,255,0.25)",cursor:"pointer",marginBottom:8,transition:"height 0.15s ease"},onMouseEnter:_=>{_.currentTarget.style.height="8px"},onMouseLeave:_=>{_.currentTarget.style.height="4px",re(null)},children:[e.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${Mt}%`,background:"rgba(255,255,255,0.3)",borderRadius:2,pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${lt}%`,background:v.primary,borderRadius:2,pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",top:"50%",left:`${lt}%`,transform:"translate(-50%, -50%)",width:12,height:12,borderRadius:"50%",background:v.primary,pointerEvents:"none"}}),h.map((_,pe)=>{const je=L>0?_.time/L*100:0;return e.jsx("div",{title:s.sanitizeString(_.label),style:{position:"absolute",top:"50%",left:`${je}%`,transform:"translate(-50%, -50%)",width:8,height:8,borderRadius:"50%",background:"#fff",border:`2px solid ${v.primary}`,zIndex:2,cursor:"pointer",pointerEvents:"auto"}},pe)}),me!==null&&e.jsxs("div",{style:{position:"absolute",bottom:12,left:le,transform:"translateX(-50%)",background:"rgba(0,0,0,0.8)",color:"#fff",fontSize:"0.72rem",padding:"2px 6px",borderRadius:4,whiteSpace:"nowrap",pointerEvents:"none"},children:[Nt(me),H(me)&&e.jsx("span",{style:{display:"block",fontSize:"0.65rem",color:"rgba(255,255,255,0.7)"},children:s.sanitizeString(H(me).label)})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(st,{onClick:De,title:$?"Pause":"Play",primary:v.primary,children:e.jsx(Ue,{path:$?Re.pause:Re.play,size:22})}),e.jsx(st,{onClick:Je,title:"Skip back 10 seconds",primary:v.primary,children:e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(Ue,{path:Re.replay10,size:22}),e.jsx("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),e.jsx(st,{onClick:_e,title:"Skip forward 10 seconds",primary:v.primary,children:e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(Ue,{path:Re.forward10,size:22}),e.jsx("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",position:"relative"},onMouseEnter:()=>Ke(!0),onMouseLeave:()=>Ke(!1),children:[e.jsx(st,{onClick:Pe,title:A?"Unmute":"Mute",primary:v.primary,children:e.jsx(Ue,{path:Qe,size:20})}),e.jsx("div",{style:{overflow:"hidden",width:ze?64:0,opacity:ze?1:0,transition:N?"none":"width 0.2s ease, opacity 0.2s ease",display:"flex",alignItems:"center"},children:e.jsx("input",{type:"range",min:0,max:1,step:.05,value:A?0:R,onChange:ye,"aria-label":"Volume",style:{width:64,accentColor:v.primary,cursor:"pointer",height:4}})})]}),e.jsxs("span",{style:{color:"#fff",fontSize:"0.78rem",fontFamily:"monospace",fontVariantNumeric:"tabular-nums",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:[Nt(I)," / ",Nt(L)]}),e.jsx("div",{style:{flex:1}}),y.length>0&&e.jsx(st,{onClick:qe,title:"Subtitles",primary:v.primary,active:we>=0,children:e.jsx(Ue,{path:Re.closedCaption,size:20})}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[e.jsxs("button",{type:"button",onClick:()=>he(_=>!_),title:"Playback speed",style:{background:"none",border:"none",cursor:"pointer",color:"#fff",fontSize:"0.75rem",fontWeight:600,padding:"6px 8px",letterSpacing:"0.02em",position:"relative"},children:[ge,"×"]}),ge!==1&&e.jsxs("span",{style:{position:"absolute",top:0,right:0,background:v.primary,color:"#fff",fontSize:"0.55rem",fontWeight:700,borderRadius:6,padding:"1px 4px",lineHeight:1.2,pointerEvents:"none"},children:[ge,"x"]}),se&&e.jsx("div",{style:{position:"absolute",bottom:"100%",right:0,background:"rgba(20,20,20,0.97)",border:`1px solid ${v.border}`,borderRadius:6,overflow:"hidden",zIndex:100,minWidth:80},children:[.5,.75,1,1.25,1.5,2].map(_=>e.jsxs("button",{type:"button",onClick:()=>Be(_),style:{display:"block",width:"100%",padding:"6px 14px",background:_===ge?v.primary+"30":"none",border:"none",color:_===ge?v.primary:"#fff",fontSize:"0.8rem",cursor:"pointer",textAlign:"left"},children:[_,"×"]},_))})]}),m&&typeof document<"u"&&"pictureInPictureEnabled"in document&&e.jsx(st,{onClick:Ie,title:"Picture-in-Picture",primary:v.primary,active:xe,children:e.jsx(Ue,{path:Re.pip,size:20})}),p&&e.jsx("a",{href:ie,download:!0,title:"Download",style:{color:"#fff",display:"flex",alignItems:"center",padding:"6px"},children:e.jsx(Ue,{path:Re.download,size:20})}),f&&e.jsx(st,{onClick:Oe,title:G?"Exit fullscreen":"Fullscreen",primary:v.primary,children:e.jsx(Ue,{path:G?Re.fullscreenExit:Re.fullscreen,size:20})})]})]}),e.jsx("style",{children:`
|
|
53
|
+
`;function To(t,n){return{position:"absolute",top:n.top,left:n.left,zIndex:9999,minWidth:200,maxWidth:320,backgroundColor:t.surface,border:`1.5px solid ${t.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",padding:"4px 0",transformOrigin:n.transformOrigin,overflow:"hidden"}}function Co({color:t}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})}function $o({color:t}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"5",fill:t}),e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:t,strokeWidth:"2"})]})}function Io({color:t}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M9 18l6-6-6-6"})})}function zo(t){const n=[];let r=0;for(const o of t)if(o.type!=="separator")if(o.type==="radio-group")for(let s=0;s<o.options.length;s++)n.push({kind:"radio",item:o,optionIdx:s,idx:r++});else o.type==="check"?n.push({kind:"check",item:o,idx:r++}):o.type==="submenu"?n.push({kind:"submenu",item:o,idx:r++}):n.push({kind:"action",item:o,idx:r++});return n}function xr({items:t,pos:n,panelId:r,onClose:o,onCloseAll:s,isSubmenu:l=!1}){const a=_.useTheme(),[c,d]=i.useState(-1),[f,u]=i.useState(null),[h,p]=i.useState(null),m=i.useRef(null),[y,k]=i.useState(""),b=i.useRef(null),g=zo(t);i.useEffect(()=>{var $;($=m.current)==null||$.focus()},[]),i.useEffect(()=>{var S;if(c<0)return;const $=(S=m.current)==null?void 0:S.querySelector(`[data-midx="${c}"]`);$==null||$.scrollIntoView({block:"nearest"})},[c]);const M=i.useCallback($=>{var S,T,E,C,H,z;if($.kind==="action"){if($.item.disabled)return;(T=(S=$.item).onClick)==null||T.call(S),s()}else if($.kind==="check"){if($.item.disabled)return;(C=(E=$.item).onChange)==null||C.call(E,!$.item.checked)}else if($.kind==="radio"){if($.item.disabled)return;(z=(H=$.item).onChange)==null||z.call(H,$.item.options[$.optionIdx].value)}else if($.kind==="submenu"){if($.item.disabled)return;u($.item.id)}},[s]),j=$=>{var S;switch($.key){case"ArrowDown":$.preventDefault(),d(T=>{const E=T+1;return E<g.length?E:0});break;case"ArrowUp":$.preventDefault(),d(T=>{const E=T-1;return E>=0?E:g.length-1});break;case"Home":$.preventDefault(),d(0);break;case"End":$.preventDefault(),d(g.length-1);break;case"Enter":case" ":$.preventDefault(),c>=0&&g[c]&&M(g[c]);break;case"Escape":$.preventDefault(),l?o():s();break;case"Tab":$.preventDefault(),s();break;case"ArrowRight":$.preventDefault(),c>=0&&((S=g[c])==null?void 0:S.kind)==="submenu"&&u(g[c].item.id);break;case"ArrowLeft":$.preventDefault(),l&&o();break;default:$.key.length===1&&!$.ctrlKey&&!$.metaKey&&w($.key)}};function w($){b.current&&clearTimeout(b.current);const S=y+$.toLowerCase();k(S);const T=g.findIndex(E=>(E.kind==="radio"?E.item.options[E.optionIdx].label:E.item.label).toLowerCase().startsWith(S));T>=0&&d(T),b.current=setTimeout(()=>k(""),800)}function I($,S){const T=S.getBoundingClientRect();u($.id);const E=Math.min($.items.length*38+12,360);p(So(T,220,E))}function v(){u(null),p(null)}const N=()=>{let $=-1;return t.map(S=>{if(S.type==="separator")return e.jsx("div",{role:"separator",style:{margin:(S.label,"4px 0"),display:"flex",alignItems:"center",gap:8},children:S.label?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1,height:1,backgroundColor:a.border,marginLeft:14}}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:a.textMuted,fontFamily:"inherit",whiteSpace:"nowrap"},children:A.sanitizeString(S.label)}),e.jsx("div",{style:{flex:1,height:1,backgroundColor:a.border,marginRight:14}})]}):e.jsx("div",{style:{flex:1,height:1,backgroundColor:a.border,margin:"0 10px"}})},S.id);if(S.type==="radio-group")return e.jsxs("div",{role:"group","aria-label":S.label,children:[S.label&&e.jsx("div",{style:{padding:"6px 14px 2px",fontSize:"11px",fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:a.textMuted,fontFamily:"inherit"},"aria-hidden":"true",children:A.sanitizeString(S.label)}),S.options.map((B,V)=>{$++;const D=$,O=D===c,L=B.value===S.value,P=!!S.disabled,W=St(a,O,!1,P);return e.jsxs("div",{role:"menuitemradio","aria-checked":L,"aria-disabled":P||void 0,"data-midx":D,tabIndex:-1,style:W,onClick:()=>{var K;return!P&&((K=S.onChange)==null?void 0:K.call(S,B.value))},onMouseEnter:()=>!P&&d(D),children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:L?e.jsx($o,{color:a.primary}):e.jsx("span",{style:{width:14,height:14,borderRadius:"50%",border:`2px solid ${a.border}`,display:"inline-block"}})}),B.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:a.textMuted},children:B.icon}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(B.label)})]},B.value)})]},S.id);if(S.type==="check"){$++;const B=$,V=B===c,D=!!S.disabled,O=St(a,V,!1,D);return e.jsxs("div",{role:"menuitemcheckbox","aria-checked":S.checked,"aria-disabled":D||void 0,"data-midx":B,tabIndex:-1,style:O,onClick:()=>{var L;return!D&&((L=S.onChange)==null?void 0:L.call(S,!S.checked))},onMouseEnter:()=>!D&&d(B),children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:S.checked?e.jsx(Co,{color:a.primary}):e.jsx("span",{style:{width:14,height:14,display:"inline-block"}})}),S.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:a.textMuted},children:S.icon}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(S.label)})]},S.id)}if(S.type==="submenu"){$++;const B=$,V=B===c,D=!!S.disabled,O=f===S.id,L=St(a,V||O,!1,D);return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{role:"menuitem","aria-haspopup":"menu","aria-expanded":O,"aria-disabled":D||void 0,"data-midx":B,tabIndex:-1,style:L,onMouseEnter:P=>{D||(d(B),I(S,P.currentTarget))},onMouseLeave:()=>{},onClick:()=>{D||u(O?null:S.id)},children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:S.icon?e.jsx("span",{style:{display:"flex",color:a.textMuted},children:S.icon}):e.jsx("span",{style:{width:14}})}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(S.label)}),e.jsx(Io,{color:a.textMuted})]}),O&&h&&Le.createPortal(e.jsx(xr,{items:S.items,pos:h,panelId:`${r}-sub-${S.id}`,onClose:v,onCloseAll:s,isSubmenu:!0}),document.body)]},S.id)}const T=S;$++;const E=$,C=E===c,H=!!T.disabled,z=!!T.danger,R=St(a,C,z,H);return e.jsxs("div",{role:"menuitem","aria-disabled":H||void 0,"data-midx":E,tabIndex:-1,style:R,onClick:()=>{var B;H||((B=T.onClick)==null||B.call(T),s())},onMouseEnter:()=>{H||(d(E),v())},children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:T.icon?e.jsx("span",{style:{display:"flex",color:z?a.danger:a.textMuted},children:T.icon}):e.jsx("span",{style:{width:14}})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(T.label)}),T.description&&e.jsx("span",{style:{display:"block",fontSize:"12px",color:a.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(T.description)})]}),T.shortcut&&e.jsx("span",{style:{fontSize:"12px",color:a.textMuted,fontFamily:"inherit",flexShrink:0,marginLeft:16,opacity:.8},children:A.sanitizeString(T.shortcut)})]},T.id)})};return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:Mo}),e.jsx("div",{ref:m,id:r,role:"menu",tabIndex:-1,className:"tkx-menu-panel",onKeyDown:j,style:{...To(a,n),maxHeight:400,overflowY:"auto"},children:N()})]})}function St(t,n,r,o){const s=r?t.danger:t.text;return{display:"flex",alignItems:"center",gap:8,padding:"7px 14px",fontSize:"14px",fontFamily:"inherit",cursor:o?"not-allowed":"pointer",userSelect:"none",color:o?t.textMuted:n&&r?t.danger:s,backgroundColor:n?r?`${t.danger}18`:`${t.primary}18`:"transparent",transition:"background-color 80ms",opacity:o?.5:1,outline:"none"}}function pr({trigger:t,items:n,placement:r="bottom-start",isDisabled:o=!1,onOpen:s,onClose:l,className:a,style:c}){const f=`tkx-menu-${i.useId().replace(/:/g,"")}`,[u,h]=i.useState(!1),[p,m]=i.useState(null),y=i.useRef(null),k=i.useCallback(()=>{if(o)return;const M=y.current;if(!M)return;const j=M.getBoundingClientRect(),w=Math.min(n.length*38+12,360);m(pn(j,r,220,w)),h(!0),s==null||s()},[o,n.length,s,r]),b=i.useCallback(()=>{var M,j,w;h(!1),l==null||l(),(w=(j=(M=y.current)==null?void 0:M.firstElementChild)==null?void 0:j.focus)==null||w.call(j)},[l]);i.useEffect(()=>{if(!u)return;const M=j=>{var v;const w=j.target;if((v=y.current)!=null&&v.contains(w))return;const I=document.querySelectorAll(".tkx-menu-panel");for(const N of I)if(N.contains(w))return;b()};return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[u,b]),i.useEffect(()=>{if(!u)return;const M=()=>{const j=y.current;if(!j)return;const w=j.getBoundingClientRect(),I=Math.min(n.length*38+12,360);m(pn(w,r,220,I))};return window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[u,n.length,r]);const g=M=>{(M.key==="Enter"||M.key===" "||M.key==="ArrowDown")&&(M.preventDefault(),u||k()),M.key==="Escape"&&u&&(M.preventDefault(),b())};return e.jsxs("span",{ref:y,className:a,style:{display:"inline-flex",...c},children:[e.jsx("span",{role:"button",tabIndex:o?-1:0,"aria-haspopup":"menu","aria-expanded":u,"aria-controls":u?f:void 0,"aria-disabled":o||void 0,onClick:()=>u?b():k(),onKeyDown:g,style:{display:"inline-flex",cursor:o?"not-allowed":"pointer",opacity:o?.55:1,outline:"none"},children:t}),u&&p&&Le.createPortal(e.jsx(xr,{items:n,pos:p,panelId:f,onClose:b,onCloseAll:b}),document.body)]})}pr.displayName="TkxMenu";const Eo={sm:120,md:180,lg:240,xl:320};function Mt(t){const n=new Date;if(t)try{const a=new Intl.DateTimeFormat("en-US",{timeZone:t,hour:"numeric",minute:"numeric",second:"numeric",hour12:!1,weekday:"long",month:"long",day:"2-digit",year:"numeric"}).formatToParts(n),c=b=>{var g;return((g=a.find(M=>M.type===b))==null?void 0:g.value)??"0"};let d=parseInt(c("hour"),10);d===24&&(d=0);const f=parseInt(c("minute"),10),u=parseInt(c("second"),10),h=c("weekday"),p=c("month"),m=c("day"),y=c("year"),k=`${h}, ${p} ${m}, ${y}`;return{hours:d,minutes:f,seconds:u,milliseconds:n.getMilliseconds(),dateString:k}}catch{}const r=n.getHours(),o=n.getMinutes(),s=n.getSeconds(),l=n.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"2-digit",year:"numeric"});return{hours:r,minutes:o,seconds:s,milliseconds:n.getMilliseconds(),dateString:l}}function No({time:t,size:n,analogStyle:r,showSeconds:o,reducedMotion:s,primary:l,danger:a,text:c,textMuted:d,border:f,surface:u,bg:h}){const p=n/2,m=n/2,y=n/2-4,{hours:k,minutes:b,seconds:g,milliseconds:M}=t,w=(g+(s?0:M)/1e3)/60*360,I=b/60*360+g/60*6,v=k%12/12*360+b/60*30,N=(z,R)=>{const B=(z-90)*Math.PI/180;return{x:p+Math.cos(B)*R,y:m+Math.sin(B)*R}},$=s?"none":"transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44)";if(r==="modern"){const z=(P,W)=>{const ne=-90+P*360,Z={x:p+Math.cos(-90*Math.PI/180)*W,y:m+Math.sin(-90*Math.PI/180)*W},ie={x:p+Math.cos(ne*Math.PI/180)*W,y:m+Math.sin(ne*Math.PI/180)*W},fe=P>.5?1:0;return`M ${Z.x} ${Z.y} A ${W} ${W} 0 ${fe} 1 ${ie.x} ${ie.y}`},R=k%12/12+b/60/12,B=b/60+g/3600,V=(g+(s?0:M/1e3))/60,D=y-2,O=y-10,L=y-18;return e.jsxs("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,"aria-hidden":"true",children:[e.jsx("circle",{cx:p,cy:m,r:D,fill:"none",stroke:f,strokeWidth:4}),e.jsx("circle",{cx:p,cy:m,r:O,fill:"none",stroke:f,strokeWidth:4}),o&&e.jsx("circle",{cx:p,cy:m,r:L,fill:"none",stroke:f,strokeWidth:3}),e.jsx("path",{d:z(R,D),fill:"none",stroke:l,strokeWidth:4,strokeLinecap:"round"}),e.jsx("path",{d:z(B,O),fill:"none",stroke:c,strokeWidth:4,strokeLinecap:"round"}),o&&e.jsx("path",{d:z(V,L),fill:"none",stroke:a,strokeWidth:3,strokeLinecap:"round"}),e.jsx("circle",{cx:p,cy:m,r:4,fill:l}),e.jsxs("text",{x:p,y:m+20,textAnchor:"middle",fontSize:n*.12,fill:d,fontFamily:"monospace",style:{fontVariantNumeric:"tabular-nums"},children:[String(k).padStart(2,"0"),":",String(b).padStart(2,"0")]})]})}const S=N(v,y*.5),T=N(I,y*.75),E=N(w,y*.85),C=N(w+180,y*.2),H=[];if(r==="classic"){for(let R=0;R<60;R++){const B=R/60*360,V=R%5===0,D=(B-90)*Math.PI/180,O=V?y-10:y-6,L=p+Math.cos(D)*y,P=m+Math.sin(D)*y,W=p+Math.cos(D)*O,K=m+Math.sin(D)*O;H.push(e.jsx("line",{x1:L,y1:P,x2:W,y2:K,stroke:V?c:d,strokeWidth:V?2:1,strokeLinecap:"round"},R))}const z=[{n:12,angle:0},{n:3,angle:90},{n:6,angle:180},{n:9,angle:270}];for(const{n:R,angle:B}of z){const V=(B-90)*Math.PI/180,D=y-20;H.push(e.jsx("text",{x:p+Math.cos(V)*D,y:m+Math.sin(V)*D,textAnchor:"middle",dominantBaseline:"central",fontSize:n*.09,fill:c,fontFamily:"system-ui, sans-serif",fontWeight:"600",children:R},`n${R}`))}}else for(let z=0;z<12;z++){const B=(z/12*360-90)*Math.PI/180,V=y-8;H.push(e.jsx("circle",{cx:p+Math.cos(B)*V,cy:m+Math.sin(B)*V,r:z%3===0?3:2,fill:z%3===0?c:d},z))}return e.jsxs("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,"aria-hidden":"true",style:{display:"block"},children:[e.jsx("circle",{cx:p,cy:m,r:y,fill:u,stroke:f,strokeWidth:2}),H,e.jsx("line",{x1:p,y1:m,x2:S.x,y2:S.y,stroke:l,strokeWidth:r==="minimal"?3:4,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:$}}),e.jsx("line",{x1:p,y1:m,x2:T.x,y2:T.y,stroke:c,strokeWidth:r==="minimal"?2:3,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:$}}),o&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:C.x,y1:C.y,x2:E.x,y2:E.y,stroke:a,strokeWidth:1.5,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:"none"}}),e.jsx("circle",{cx:p,cy:m,r:3,fill:a})]}),e.jsx("circle",{cx:p,cy:m,r:r==="minimal"?3:5,fill:l})]})}function hn({time:t,format:n,showSeconds:r,showDate:o,label:s,size:l,primary:a,text:c,textMuted:d,colonVisible:f}){const{hours:u,minutes:h,seconds:p,dateString:m}=t;let y=u,k="";n==="12h"&&(k=u>=12?"PM":"AM",y=u%12||12);const b=l*.2,g={opacity:f?1:0,transition:"opacity 0.1s",display:"inline-block",minWidth:"0.5ch",textAlign:"center"};return e.jsxs("div",{style:{textAlign:"center",fontFamily:"'Courier New', Courier, monospace",fontVariantNumeric:"tabular-nums",lineHeight:1.1},children:[e.jsxs("div",{style:{fontSize:b,color:a,fontWeight:700,letterSpacing:"0.05em",display:"flex",alignItems:"center",justifyContent:"center",gap:0},children:[e.jsx("span",{children:String(y).padStart(2,"0")}),e.jsx("span",{style:g,children:":"}),e.jsx("span",{children:String(h).padStart(2,"0")}),r&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:g,children:":"}),e.jsx("span",{children:String(p).padStart(2,"0")})]}),n==="12h"&&e.jsx("span",{style:{fontSize:b*.45,color:d,marginLeft:"0.4ch",alignSelf:"flex-end",marginBottom:b*.05},children:k})]}),o&&e.jsx("div",{style:{fontSize:l*.072,color:d,marginTop:l*.025,letterSpacing:"0.03em"},children:m}),s&&e.jsx("div",{style:{fontSize:l*.065,color:d,marginTop:l*.015,textTransform:"uppercase",letterSpacing:"0.08em"},children:A.sanitizeString(s)})]})}function hr({variant:t="both",size:n="md",showSeconds:r=!0,showDate:o=!1,format:s="24h",timezone:l,timezone2:a,label:c,analogStyle:d="classic",className:f,style:u}){const h=_.useTheme(),p=Q.useReducedMotion(),[m,y]=i.useState(()=>Mt(l)),[k,b]=i.useState(()=>a?Mt(a):null),[g,M]=i.useState(!0),[j,w]=i.useState(!1),I=i.useRef(null);i.useEffect(()=>{w(!0)},[]),i.useEffect(()=>{const T=()=>{y(Mt(l)),a&&b(Mt(a))};T();const E=setInterval(T,1e3);return()=>clearInterval(E)},[l,a]),i.useEffect(()=>(I.current=setInterval(()=>{M(T=>!T)},500),()=>{I.current&&clearInterval(I.current)}),[]);const v=Eo[n],N=t==="analog"||t==="both",$=t==="digital"||t==="both",S={display:"inline-flex",flexDirection:"column",alignItems:"center",gap:t==="both"?`${v*.06}px`:0,opacity:j?1:0,transition:p?"none":"opacity 0.4s ease",...u};return e.jsxs("div",{className:f,style:S,role:"timer","aria-live":"off",children:[N&&e.jsx(No,{time:m,size:v,analogStyle:d,showSeconds:r,reducedMotion:p,primary:h.primary,danger:h.danger,text:h.text,textMuted:h.textMuted,border:h.border,surface:h.surface,bg:h.bg}),$&&e.jsx(hn,{time:m,format:s,showSeconds:r,showDate:o,label:c,size:v,primary:h.primary,text:h.text,textMuted:h.textMuted,colonVisible:g}),k&&a&&e.jsx("div",{style:{marginTop:v*.04,padding:`${v*.03}px ${v*.06}px`,borderTop:`1px solid ${h.border}`,textAlign:"center"},children:e.jsx(hn,{time:k,format:s,showSeconds:!1,showDate:!1,label:a,size:v*.7,primary:h.secondary,text:h.text,textMuted:h.textMuted,colonVisible:g})})]})}hr.displayName="TkxClock";function Lt(t){if(!isFinite(t)||isNaN(t))return"0:00";const n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=Math.floor(t%60);return n>0?`${n}:${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`:`${r}:${String(o).padStart(2,"0")}`}function Xe({path:t,size:n=20,color:r="currentColor",title:o}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:r,"aria-hidden":o?void 0:"true",role:o?"img":void 0,"aria-label":o,style:{display:"block",flexShrink:0},children:e.jsx("path",{d:t})})}const De={play:"M8 5v14l11-7z",pause:"M6 19h4V5H6v14zm8-14v14h4V5h-4z",volumeUp:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z",volumeMute:"M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z",volumeDown:"M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z",fullscreen:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",fullscreenExit:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z",pip:"M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z",download:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",closedCaption:"M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z",replay10:"M11.99 5V1l-5 5 5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z",forward10:"M18 13c0 3.31-2.69 6-6 6s-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8V1l-5 5 5 5V7c3.31 0 6 2.69 6 6z",errorOutline:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",refresh:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"};function ct({onClick:t,title:n,children:r,active:o,primary:s}){const[l,a]=i.useState(!1);return e.jsx("button",{type:"button",onClick:t,title:n,"aria-label":n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{background:"none",border:"none",padding:"6px",cursor:"pointer",color:o||l?s:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",flexShrink:0,transition:"color 0.15s ease"},children:r})}function mr({src:t,poster:n,title:r,width:o="100%",height:s,autoPlay:l=!1,loop:a=!1,muted:c=!1,controls:d=!0,showTitle:f=!0,allowFullscreen:u=!0,allowPiP:h=!0,allowDownload:p=!1,chapters:m=[],subtitles:y=[],startTime:k,onPlay:b,onPause:g,onEnded:M,onTimeUpdate:j,className:w,style:I}){const v=_.useTheme(),N=Q.useReducedMotion(),$=i.useRef(null),S=i.useRef(null),T=i.useRef(null),E=i.useRef(null),[C,H]=i.useState(!1),[z,R]=i.useState(0),[B,V]=i.useState(0),[D,O]=i.useState(0),[L,P]=i.useState(1),[W,K]=i.useState(c),[ne,Z]=i.useState(!1),[ie,fe]=i.useState(!0),[pe,te]=i.useState(!1),[ce,Y]=i.useState(1),[se,le]=i.useState(!1),[ge,he]=i.useState(-1),[ye,de]=i.useState(null),[xe,oe]=i.useState(0),[G,ue]=i.useState(null),[ke,ve]=i.useState(!1),[Me,$e]=i.useState(!1),[We,Te]=i.useState(null),[ze,Ke]=i.useState(!1);i.useEffect(()=>{const U=$.current;if(!U)return;k!==void 0&&(U.currentTime=k);const be=()=>{R(U.currentTime),U.buffered.length>0&&O(U.buffered.end(U.buffered.length-1))},je=()=>V(U.duration),Ne=()=>H(!0),at=()=>{H(!1),te(!0)},st=()=>{H(!1),te(!0),M==null||M()},pt=()=>ve(!0),ht=()=>ve(!1),mt=()=>$e(!0),wt=()=>$e(!1),jt=()=>{const et=U.error;Te(et?`Error ${et.code}: ${et.message||"Failed to load video"}`:"Failed to load video"),$e(!1)};return U.addEventListener("timeupdate",be),U.addEventListener("durationchange",je),U.addEventListener("play",Ne),U.addEventListener("pause",at),U.addEventListener("ended",st),U.addEventListener("enterpictureinpicture",pt),U.addEventListener("leavepictureinpicture",ht),U.addEventListener("waiting",mt),U.addEventListener("canplay",wt),U.addEventListener("error",jt),()=>{U.removeEventListener("timeupdate",be),U.removeEventListener("durationchange",je),U.removeEventListener("play",Ne),U.removeEventListener("pause",at),U.removeEventListener("ended",st),U.removeEventListener("enterpictureinpicture",pt),U.removeEventListener("leavepictureinpicture",ht),U.removeEventListener("waiting",mt),U.removeEventListener("canplay",wt),U.removeEventListener("error",jt)}},[M,k]),i.useEffect(()=>{$.current&&(C?b==null||b():g==null||g())},[C,b,g]),i.useEffect(()=>{j==null||j(z,B)},[z,B,j]),i.useEffect(()=>{const U=$.current;if(!U)return;const be=U.textTracks;for(let je=0;je<be.length;je++)be[je].mode=je===ge?"showing":"disabled"},[ge]),i.useEffect(()=>{const U=()=>Z(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",U),()=>document.removeEventListener("fullscreenchange",U)},[]),i.useEffect(()=>{const U=S.current;if(!U)return;const be=je=>{const Ne=$.current;if(Ne&&je.target.tagName!=="INPUT")switch(je.key){case" ":case"k":je.preventDefault(),Pe();break;case"f":case"F":u&&Ge();break;case"m":case"M":Oe();break;case"ArrowRight":je.preventDefault(),Ne.currentTime=Math.min(Ne.currentTime+10,Ne.duration);break;case"ArrowLeft":je.preventDefault(),Ne.currentTime=Math.max(Ne.currentTime-10,0);break;case"ArrowUp":je.preventDefault(),P(Math.min(L+.1,1)),$.current&&($.current.volume=Math.min(L+.1,1));break;case"ArrowDown":je.preventDefault(),P(Math.max(L-.1,0)),$.current&&($.current.volume=Math.max(L-.1,0));break}};return U.addEventListener("keydown",be),()=>U.removeEventListener("keydown",be)},[L,u]);const Ze=i.useCallback(()=>{fe(!0),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{C&&fe(!1)},3e3)},[C]);i.useEffect(()=>(Ze(),()=>{E.current&&clearTimeout(E.current)}),[C,Ze]);const Pe=i.useCallback(()=>{const U=$.current;U&&(U.paused?(U.play().catch(()=>{}),ue("play"),te(!1)):(U.pause(),ue("pause")),setTimeout(()=>ue(null),600))},[]),Oe=i.useCallback(()=>{const U=$.current;if(!U)return;const be=!W;K(be),U.muted=be},[W]),Ge=i.useCallback(()=>{const U=S.current;U&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):U.requestFullscreen().catch(()=>{}))},[]),Ee=i.useCallback(async()=>{const U=$.current;if(U)try{document.pictureInPictureElement?await document.exitPictureInPicture():await U.requestPictureInPicture()}catch{}},[]),qe=i.useCallback(()=>{y.length!==0&&(he(U=>(U+1)%(y.length+1)-1),he(U=>{const be=U+1;return be>=y.length?-1:be}))},[y.length]),rt=i.useCallback(()=>{const U=$.current;U&&(U.currentTime=Math.min(U.currentTime+10,U.duration||0))},[]),Qe=i.useCallback(()=>{const U=$.current;U&&(U.currentTime=Math.max(U.currentTime-10,0))},[]),Re=i.useCallback(()=>{const U=$.current;U&&(Te(null),U.load())},[]),Fe=i.useCallback(()=>{u&&Ge()},[u,Ge]),Ae=i.useCallback(U=>{const be=$.current,je=T.current;if(!be||!je||!B)return;const Ne=je.getBoundingClientRect(),at=Math.max(0,Math.min(1,(U.clientX-Ne.left)/Ne.width));be.currentTime=at*B},[B]),Je=i.useCallback(U=>{const be=T.current;if(!be||!B)return;const je=be.getBoundingClientRect(),Ne=Math.max(0,Math.min(1,(U.clientX-je.left)/je.width));de(Ne*B),oe(U.clientX-je.left)},[B]),Ue=i.useCallback(U=>{const be=parseFloat(U.target.value);P(be),$.current&&($.current.volume=be,$.current.muted=be===0,K(be===0))},[]),lt=i.useCallback(U=>{Y(U),$.current&&($.current.playbackRate=U),le(!1)},[]),q=m.length>0?[...m].reverse().find(U=>z>=U.time):null,F=U=>[...m].reverse().find(be=>U>=be.time)??null,J=Array.isArray(t)?t:[{src:t,type:"video/mp4"}],re=Array.isArray(t)?t[0].src:t,ae=ie||pe||!C,Ce=N?"none":"opacity 0.25s ease",Ie=W||L===0?De.volumeMute:L<.5?De.volumeDown:De.volumeUp,we=B>0?z/B*100:0,_e=B>0?D/B*100:0;return e.jsxs("div",{ref:S,className:w,tabIndex:0,onMouseMove:Ze,onMouseLeave:()=>{C&&fe(!1)},style:{position:"relative",width:o,height:s??"auto",background:"#000",borderRadius:"8px",overflow:"hidden",outline:"none",userSelect:"none",...I},children:[e.jsxs("video",{ref:$,style:{width:"100%",height:"100%",display:"block",objectFit:"contain"},poster:n,autoPlay:l,loop:a,muted:c,playsInline:!0,onClick:Pe,onDoubleClick:Fe,children:[J.map((U,be)=>e.jsx("source",{src:U.src,type:U.type},be)),y.map((U,be)=>e.jsx("track",{kind:"subtitles",label:A.sanitizeString(U.label),srcLang:U.lang,src:U.src,default:U.default},be))]}),f&&r&&e.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,background:"linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%)",padding:"16px 16px 32px",opacity:ae?1:0,transition:Ce,pointerEvents:"none"},children:[e.jsx("span",{style:{color:"#fff",fontSize:"0.95rem",fontWeight:600,textShadow:"0 1px 3px rgba(0,0,0,0.7)"},children:A.sanitizeString(r)}),q&&e.jsxs("span",{style:{color:"rgba(255,255,255,0.65)",fontSize:"0.8rem",marginLeft:8},children:["— ",A.sanitizeString(q.label)]})]}),G&&e.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(0,0,0,0.45)",borderRadius:"50%",width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",animation:N?"none":"tkxvp-flash 0.6s ease forwards",pointerEvents:"none"},children:e.jsx(Xe,{path:G==="play"?De.play:De.pause,size:32,color:"#fff"})}),Me&&!We&&e.jsx("div",{"aria-label":"Loading",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:10},children:e.jsx("div",{style:{width:48,height:48,border:"4px solid rgba(255,255,255,0.25)",borderTopColor:v.primary,borderRadius:"50%",animation:N?"none":"tkxvp-spin 0.8s linear infinite"}})}),We&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.8)",zIndex:20,gap:12},children:[e.jsx(Xe,{path:De.errorOutline,size:48,color:"#ef4444"}),e.jsx("span",{style:{color:"#fff",fontSize:"0.9rem",maxWidth:"80%",textAlign:"center"},children:We}),e.jsxs("button",{type:"button",onClick:Re,style:{display:"flex",alignItems:"center",gap:6,background:v.primary,color:"#fff",border:"none",borderRadius:6,padding:"8px 18px",fontSize:"0.85rem",fontWeight:600,cursor:"pointer",marginTop:4},children:[e.jsx(Xe,{path:De.refresh,size:18,color:"#fff"}),"Retry"]})]}),d&&e.jsxs("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 70%, transparent 100%)",padding:"32px 12px 8px",opacity:ae?1:0,transition:Ce},onMouseEnter:()=>te(!0),onMouseLeave:()=>te(!1),children:[e.jsxs("div",{ref:T,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(B),"aria-valuenow":Math.floor(z),tabIndex:0,onClick:Ae,onMouseMove:Je,style:{position:"relative",height:4,borderRadius:2,background:"rgba(255,255,255,0.25)",cursor:"pointer",marginBottom:8,transition:"height 0.15s ease"},onMouseEnter:U=>{U.currentTarget.style.height="8px"},onMouseLeave:U=>{U.currentTarget.style.height="4px",de(null)},children:[e.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${_e}%`,background:"rgba(255,255,255,0.3)",borderRadius:2,pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${we}%`,background:v.primary,borderRadius:2,pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",top:"50%",left:`${we}%`,transform:"translate(-50%, -50%)",width:12,height:12,borderRadius:"50%",background:v.primary,pointerEvents:"none"}}),m.map((U,be)=>{const je=B>0?U.time/B*100:0;return e.jsx("div",{title:A.sanitizeString(U.label),style:{position:"absolute",top:"50%",left:`${je}%`,transform:"translate(-50%, -50%)",width:8,height:8,borderRadius:"50%",background:"#fff",border:`2px solid ${v.primary}`,zIndex:2,cursor:"pointer",pointerEvents:"auto"}},be)}),ye!==null&&e.jsxs("div",{style:{position:"absolute",bottom:12,left:xe,transform:"translateX(-50%)",background:"rgba(0,0,0,0.8)",color:"#fff",fontSize:"0.72rem",padding:"2px 6px",borderRadius:4,whiteSpace:"nowrap",pointerEvents:"none"},children:[Lt(ye),F(ye)&&e.jsx("span",{style:{display:"block",fontSize:"0.65rem",color:"rgba(255,255,255,0.7)"},children:A.sanitizeString(F(ye).label)})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(ct,{onClick:Pe,title:C?"Pause":"Play",primary:v.primary,children:e.jsx(Xe,{path:C?De.pause:De.play,size:22})}),e.jsx(ct,{onClick:Qe,title:"Skip back 10 seconds",primary:v.primary,children:e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(Xe,{path:De.replay10,size:22}),e.jsx("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),e.jsx(ct,{onClick:rt,title:"Skip forward 10 seconds",primary:v.primary,children:e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(Xe,{path:De.forward10,size:22}),e.jsx("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",position:"relative"},onMouseEnter:()=>Ke(!0),onMouseLeave:()=>Ke(!1),children:[e.jsx(ct,{onClick:Oe,title:W?"Unmute":"Mute",primary:v.primary,children:e.jsx(Xe,{path:Ie,size:20})}),e.jsx("div",{style:{overflow:"hidden",width:ze?64:0,opacity:ze?1:0,transition:N?"none":"width 0.2s ease, opacity 0.2s ease",display:"flex",alignItems:"center"},children:e.jsx("input",{type:"range",min:0,max:1,step:.05,value:W?0:L,onChange:Ue,"aria-label":"Volume",style:{width:64,accentColor:v.primary,cursor:"pointer",height:4}})})]}),e.jsxs("span",{style:{color:"#fff",fontSize:"0.78rem",fontFamily:"monospace",fontVariantNumeric:"tabular-nums",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:[Lt(z)," / ",Lt(B)]}),e.jsx("div",{style:{flex:1}}),y.length>0&&e.jsx(ct,{onClick:qe,title:"Subtitles",primary:v.primary,active:ge>=0,children:e.jsx(Xe,{path:De.closedCaption,size:20})}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[e.jsxs("button",{type:"button",onClick:()=>le(U=>!U),title:"Playback speed",style:{background:"none",border:"none",cursor:"pointer",color:"#fff",fontSize:"0.75rem",fontWeight:600,padding:"6px 8px",letterSpacing:"0.02em",position:"relative"},children:[ce,"×"]}),ce!==1&&e.jsxs("span",{style:{position:"absolute",top:0,right:0,background:v.primary,color:"#fff",fontSize:"0.55rem",fontWeight:700,borderRadius:6,padding:"1px 4px",lineHeight:1.2,pointerEvents:"none"},children:[ce,"x"]}),se&&e.jsx("div",{style:{position:"absolute",bottom:"100%",right:0,background:"rgba(20,20,20,0.97)",border:`1px solid ${v.border}`,borderRadius:6,overflow:"hidden",zIndex:100,minWidth:80},children:[.5,.75,1,1.25,1.5,2].map(U=>e.jsxs("button",{type:"button",onClick:()=>lt(U),style:{display:"block",width:"100%",padding:"6px 14px",background:U===ce?v.primary+"30":"none",border:"none",color:U===ce?v.primary:"#fff",fontSize:"0.8rem",cursor:"pointer",textAlign:"left"},children:[U,"×"]},U))})]}),h&&typeof document<"u"&&"pictureInPictureEnabled"in document&&e.jsx(ct,{onClick:Ee,title:"Picture-in-Picture",primary:v.primary,active:ke,children:e.jsx(Xe,{path:De.pip,size:20})}),p&&e.jsx("a",{href:re,download:!0,title:"Download",style:{color:"#fff",display:"flex",alignItems:"center",padding:"6px"},children:e.jsx(Xe,{path:De.download,size:20})}),u&&e.jsx(ct,{onClick:Ge,title:ne?"Exit fullscreen":"Fullscreen",primary:v.primary,children:e.jsx(Xe,{path:ne?De.fullscreenExit:De.fullscreen,size:20})})]})]}),e.jsx("style",{children:`
|
|
54
54
|
@keyframes tkxvp-flash {
|
|
55
55
|
0% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
|
|
56
56
|
100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); }
|
|
@@ -59,33 +59,33 @@
|
|
|
59
59
|
0% { transform: rotate(0deg); }
|
|
60
60
|
100% { transform: rotate(360deg); }
|
|
61
61
|
}
|
|
62
|
-
`})]})}
|
|
62
|
+
`})]})}mr.displayName="TkxVideoPlayer";const Lo={sm:{circle:24,fontSize:"0.75rem",titleSize:"0.8rem",descSize:"0.7rem",connectorWidth:2},md:{circle:32,fontSize:"0.875rem",titleSize:"0.9rem",descSize:"0.775rem",connectorWidth:2},lg:{circle:40,fontSize:"1rem",titleSize:"1rem",descSize:"0.85rem",connectorWidth:3}};function Ro({size:t}){const n=t*.55;return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"})})}function Ao({size:t}){const n=t*.55;return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})})}function Do({status:t,index:n,showStepNumbers:r,icon:o,circleSize:s,fontSize:l,primary:a,danger:c,success:d,text:f,textMuted:u,border:h,surface:p,variant:m,reducedMotion:y,clickable:k}){const b=t==="completed",g=t==="active",M=t==="error",j=t==="pending";let w=p,I=h,v=u,N=2;b?(w=m==="filled"?d:p,I=d,v=m==="filled"?"#fff":d):g?(w=m==="outlined"?p:a,I=a,v=m==="outlined"?a:"#fff",N=2):M?(w=m==="filled"?c:p,I=c,v=m==="filled"?"#fff":c):j&&(w=p,I=h,v=u);const $=g&&!y?{boxShadow:`0 0 0 4px ${a}30`,animation:"tkxstepper-pulse 2s ease-in-out infinite"}:{},S=k?{cursor:"pointer",transition:"transform 0.15s ease, box-shadow 0.15s ease"}:{};let T;return o&&!b&&!M?T=e.jsx("span",{style:{fontSize:l,lineHeight:1},children:o}):b?T=e.jsx(Ro,{size:s}):M?T=e.jsx(Ao,{size:s}):r?T=e.jsx("span",{style:{fontSize:l,fontWeight:600,lineHeight:1},children:n+1}):T=e.jsx("span",{style:{fontSize:s*.22,lineHeight:1,background:v,borderRadius:"50%",width:s*.22,height:s*.22,display:"block"}}),e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
|
|
63
63
|
@keyframes tkxstepper-pulse {
|
|
64
|
-
0%, 100% { box-shadow: 0 0 0 0 ${
|
|
65
|
-
50% { box-shadow: 0 0 0 6px ${
|
|
64
|
+
0%, 100% { box-shadow: 0 0 0 0 ${a}50; }
|
|
65
|
+
50% { box-shadow: 0 0 0 6px ${a}20; }
|
|
66
66
|
}
|
|
67
|
-
`}),e.jsx("div",{style:{width:o,height:o,minWidth:o,borderRadius:"50%",border:`${N}px solid ${z}`,backgroundColor:S,color:v,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:y?"none":"background-color 0.2s, border-color 0.2s",...C,...M},children:T})]})}function pr({completed:t,orientation:r,connectorStyle:n,connectorWidth:i,primary:o,border:l,reducedMotion:c}){const d=t?o:l;return r==="horizontal"?e.jsx("div",{"aria-hidden":"true",style:{flex:1,height:i,background:n==="solid"?d:"none",backgroundImage:n!=="solid"?`repeating-linear-gradient(90deg, ${d} 0, ${d} 6px, transparent 6px, transparent ${n==="dashed"?12:9}px)`:"none",borderRadius:1,transition:c?"none":"background 0.3s ease",alignSelf:"center",marginLeft:4,marginRight:4}}):e.jsx("div",{"aria-hidden":"true",style:{width:i,flex:1,minHeight:20,background:n==="solid"?d:"none",backgroundImage:n!=="solid"?`repeating-linear-gradient(180deg, ${d} 0, ${d} 6px, transparent 6px, transparent ${n==="dashed"?12:9}px)`:"none",borderRadius:1,transition:c?"none":"background 0.3s ease",alignSelf:"stretch",marginTop:4,marginBottom:4,marginLeft:"auto",marginRight:"auto"}})}function xn({steps:t,activeStep:r=0,orientation:n="horizontal",variant:i="default",size:o="md",clickable:l=!1,onStepClick:c,showStepNumbers:d=!0,alternateLabel:u=!1,connector:x="solid",className:f,style:m}){const p=B.useTheme(),h=s.useReducedMotion(),y=ni[o],k=(g,w)=>g.status?g.status:w<r?"completed":w===r?"active":"pending",b=n==="horizontal";return e.jsx("div",{className:f,role:"list","aria-label":"Steps",style:{display:"flex",flexDirection:b?"row":"column",alignItems:b?u?"flex-start":"center":"stretch",width:"100%",gap:0,...m},children:t.map((g,w)=>{const j=k(g,w),S=w===t.length-1,z=j==="completed"||w<r,v=w%2===0,N=()=>{l&&(c==null||c(w))},C=e.jsx(ii,{status:j,index:w,showStepNumbers:d,icon:g.icon,circleSize:y.circle,fontSize:y.fontSize,primary:p.primary,danger:p.danger,success:p.success,text:p.text,textMuted:p.textMuted,border:p.border,surface:p.surface,variant:i,reducedMotion:h,clickable:l}),M=e.jsxs("div",{style:{textAlign:b&&!u?"center":"left",maxWidth:b?120:void 0},children:[e.jsxs("div",{style:{fontSize:y.titleSize,fontWeight:j==="active"?600:500,color:j==="pending"?p.textMuted:j==="error"?p.danger:p.text,lineHeight:1.3,transition:h?"none":"color 0.2s"},children:[s.sanitizeString(g.title),g.optional&&e.jsx("span",{style:{fontSize:y.descSize,color:p.textMuted,fontWeight:400,marginLeft:4},children:"(optional)"})]}),g.description&&e.jsx("div",{style:{fontSize:y.descSize,color:p.textMuted,marginTop:2,lineHeight:1.4},children:s.sanitizeString(g.description)}),g.error&&j==="error"&&e.jsx("div",{style:{fontSize:y.descSize,color:p.danger,marginTop:2},children:s.sanitizeString(g.error)})]});return b?e.jsxs("div",{role:"listitem",style:{display:"flex",flex:S?0:1,alignItems:"center",minWidth:0},children:[e.jsxs("div",{onClick:N,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,cursor:l?"pointer":"default",flexShrink:0},"aria-current":j==="active"?"step":void 0,children:[u&&!v&&e.jsx("div",{style:{minHeight:y.circle*1.5+6,display:"flex",alignItems:"flex-end",paddingBottom:6},children:M}),C,!u&&M,u&&v&&e.jsx("div",{style:{marginTop:6},children:M})]}),!S&&e.jsx(pr,{completed:z,orientation:"horizontal",connectorStyle:x,connectorWidth:y.connectorWidth,primary:p.primary,border:p.border,reducedMotion:h})]},g.id):e.jsxs("div",{role:"listitem",style:{display:"flex",flexDirection:"row",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginRight:14,flexShrink:0},children:[e.jsx("div",{onClick:N,style:{cursor:l?"pointer":"default"},"aria-current":j==="active"?"step":void 0,children:C}),!S&&e.jsx(pr,{completed:z,orientation:"vertical",connectorStyle:x,connectorWidth:y.connectorWidth,primary:p.primary,border:p.border,reducedMotion:h})]}),e.jsx("div",{style:{paddingTop:(y.circle-parseFloat(y.titleSize)*16)/2,paddingBottom:S?0:16,flex:1,minWidth:0},children:M})]},g.id)})})}xn.displayName="TkxStepper";function pn(t){let r=0,n=0,i=0;const o=t.replace("#","");o.length===3?(r=parseInt(o[0]+o[0],16),n=parseInt(o[1]+o[1],16),i=parseInt(o[2]+o[2],16)):o.length>=6&&(r=parseInt(o.slice(0,2),16),n=parseInt(o.slice(2,4),16),i=parseInt(o.slice(4,6),16)),r/=255,n/=255,i/=255;const l=Math.max(r,n,i),c=Math.min(r,n,i);let d=0,u=0;const x=(l+c)/2;if(l!==c){const f=l-c;switch(u=x>.5?f/(2-l-c):f/(l+c),l){case r:d=((n-i)/f+(n<i?6:0))/6;break;case n:d=((i-r)/f+2)/6;break;case i:d=((r-n)/f+4)/6;break}}return[Math.round(d*360),Math.round(u*100),Math.round(x*100)]}function Ht(t,r,n){r/=100,n/=100;const i=r*Math.min(n,1-n),o=l=>{const c=(l+t/30)%12,d=n-i*Math.max(Math.min(c-3,9-c,1),-1);return Math.round(255*d).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}function St(t){const r=t.replace("#",""),n=parseInt(r.slice(0,2),16),i=parseInt(r.slice(2,4),16),o=parseInt(r.slice(4,6),16);return[isNaN(n)?0:n,isNaN(i)?0:i,isNaN(o)?0:o]}function Rt(t,r,n){return`#${t.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}function ot(t){return/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)}function Lt(t,r,n){if(n==="hex")return r<1?`${t}${Math.round(r*255).toString(16).padStart(2,"0")}`:t;const[i,o,l]=St(t);if(n==="rgb")return r<1?`rgba(${i}, ${o}, ${l}, ${r.toFixed(2)})`:`rgb(${i}, ${o}, ${l})`;const[c,d,u]=pn(t);return n==="hsl"?r<1?`hsla(${c}, ${d}%, ${u}%, ${r.toFixed(2)})`:`hsl(${c}, ${d}%, ${u}%)`:t}const ai=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#ffffff","#94a3b8","#475569","#0f172a"];function li({hue:t,sat:r,bright:n,onChange:i}){const o=a.useRef(null),l=a.useRef(!1),c=a.useCallback(x=>{const f=o.current;if(!f)return;const m=f.getBoundingClientRect(),p=Math.max(0,Math.min(1,(x.clientX-m.left)/m.width)),h=Math.max(0,Math.min(1,(x.clientY-m.top)/m.height));i(Math.round(p*100),Math.round((1-h)*100))},[i]);a.useEffect(()=>{const x=m=>{l.current&&c(m)},f=()=>{l.current=!1};return document.addEventListener("mousemove",x),document.addEventListener("mouseup",f),()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",f)}},[c]);const d=`${r}%`,u=`${100-n}%`;return e.jsxs("div",{ref:o,style:{position:"relative",width:"100%",height:"160px",borderRadius:"6px",cursor:"crosshair",background:`hsl(${t}, 100%, 50%)`,flexShrink:0},onMouseDown:x=>{l.current=!0,c(x)},children:[e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to right, #ffffff, transparent)"}}),e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to bottom, transparent, #000000)"}}),e.jsx("div",{style:{position:"absolute",left:d,top:u,transform:"translate(-50%, -50%)",width:"14px",height:"14px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.4)",pointerEvents:"none",backgroundColor:Ht(t,r,n/2+25)}})]})}function ci({hue:t,onChange:r}){const n=a.useRef(null),i=a.useRef(!1),o=a.useCallback(l=>{const c=n.current;if(!c)return;const d=c.getBoundingClientRect(),u=Math.max(0,Math.min(1,(l.clientX-d.left)/d.width));r(Math.round(u*360))},[r]);return a.useEffect(()=>{const l=d=>{i.current&&o(d)},c=()=>{i.current=!1};return document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c)}},[o]),e.jsx("div",{ref:n,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:"linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)"},onMouseDown:l=>{i.current=!0,o(l)},children:e.jsx("div",{style:{position:"absolute",left:`${t/360*100}%`,top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`hsl(${t}, 100%, 50%)`,pointerEvents:"none"}})})}function di({alpha:t,hex:r,onChange:n}){const i=a.useRef(null),o=a.useRef(!1),l=a.useCallback(x=>{const f=i.current;if(!f)return;const m=f.getBoundingClientRect(),p=Math.max(0,Math.min(1,(x.clientX-m.left)/m.width));n(Math.round(p*100)/100)},[n]);a.useEffect(()=>{const x=m=>{o.current&&l(m)},f=()=>{o.current=!1};return document.addEventListener("mousemove",x),document.addEventListener("mouseup",f),()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",f)}},[l]);const[c,d,u]=St(r);return e.jsxs("div",{style:{position:"relative"},children:[e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"6px",backgroundImage:"repeating-conic-gradient(#ccc 0% 25%, white 0% 50%)",backgroundSize:"8px 8px"}}),e.jsx("div",{ref:i,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:`linear-gradient(to right, rgba(${c},${d},${u},0), rgba(${c},${d},${u},1))`},onMouseDown:x=>{o.current=!0,l(x)},children:e.jsx("div",{style:{position:"absolute",left:`${t*100}%`,top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`rgba(${c},${d},${u},${t})`,pointerEvents:"none"}})})]})}function ui({value:t,defaultValue:r="#3b82f6",onChange:n,format:i="hex",showAlpha:o=!1,presets:l=ai,disabled:c=!1,size:d="md",placeholder:u,label:x,style:f}){const m=B.useTheme(),p=a.useRef(null),h=a.useRef(null),[y,k]=a.useState(!1),b=t!==void 0,[g,w]=a.useState(b&&t||r),j=b?t||r:g,[S,z]=a.useState(1),[v,N]=a.useState(j),[C,M]=a.useState({top:0,left:0}),[T,E,$]=pn(ot(j)?j:r),F=a.useCallback((U,se=S)=>{ot(U)&&(N(U),b||w(U),n==null||n(Lt(U,se,i),i))},[S,b,i,n]);a.useEffect(()=>{b&&t&&ot(t)&&N(t)},[b,t]);const I=()=>{if(c)return;const U=p.current;if(!U)return;const se=U.getBoundingClientRect(),we=window.innerHeight-se.bottom>320?se.bottom+6:se.top-326;M({top:we+window.scrollY,left:se.left+window.scrollX}),k(!0)};a.useEffect(()=>{if(!y)return;const U=se=>{h.current&&!h.current.contains(se.target)&&p.current&&!p.current.contains(se.target)&&k(!1)};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[y]),a.useEffect(()=>{if(!y)return;const U=se=>{se.key==="Escape"&&k(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[y]);const W=(U,se)=>{const he=se/100,we=U/100,ce=he*(1-we/2),me=ce===0||ce===1?0:(he-ce)/Math.min(ce,1-ce),re=Ht(T,Math.round(me*100),Math.round(ce*100));F(re)},L=U=>{const se=Ht(U,E,$);F(se)},Y=U=>{z(U),n==null||n(Lt(j,U,i),i)},D=U=>{const se=U.target.value;N(se),ot(se)&&F(se)},V=(U,se)=>{const he=Math.max(0,Math.min(255,parseInt(se)||0)),[we,ce,me]=St(j),re=U==="r"?Rt(he,ce,me):U==="g"?Rt(we,he,me):Rt(we,ce,he);F(re)},P={sm:28,md:34,lg:40}[d],[A,O,G]=St(ot(j)?j:r),ee={display:"inline-flex",alignItems:"center",gap:"8px",height:`${P}px`,padding:"4px 10px 4px 6px",borderRadius:"8px",border:`1px solid ${m.border}`,backgroundColor:m.surface,cursor:c?"not-allowed":"pointer",opacity:c?.5:1,color:m.text,fontSize:"13px",fontFamily:"inherit",transition:"border-color 0.15s",...f},oe={width:`${P-8}px`,height:`${P-8}px`,borderRadius:"4px",backgroundColor:`rgba(${A},${O},${G},${S})`,border:`1px solid ${m.border}`,flexShrink:0},ae={position:"absolute",top:C.top,left:C.left,zIndex:9999,width:"260px",backgroundColor:m.surface,border:`1px solid ${m.border}`,borderRadius:"12px",padding:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.24)",display:"flex",flexDirection:"column",gap:"12px"},fe={width:"100%",padding:"6px 10px",borderRadius:"6px",border:`1px solid ${m.border}`,backgroundColor:m.bg,color:m.text,fontSize:"12px",fontFamily:"monospace",outline:"none"},de={flex:1,padding:"5px 6px",borderRadius:"6px",border:`1px solid ${m.border}`,backgroundColor:m.bg,color:m.text,fontSize:"11px",textAlign:"center",fontFamily:"monospace",outline:"none"},ge=U=>({width:"20px",height:"20px",borderRadius:"50%",backgroundColor:U,border:U.toLowerCase()===j.toLowerCase()?`2px solid ${m.primary}`:`1px solid ${m.border}`,cursor:"pointer",flexShrink:0,transition:"transform 0.1s"});return e.jsxs(e.Fragment,{children:[x&&e.jsx("label",{style:{display:"block",fontSize:"13px",color:m.text,marginBottom:"6px",fontWeight:500},children:x}),e.jsxs("button",{ref:p,type:"button",style:ee,onClick:I,disabled:c,"aria-label":`Color picker, current color ${j}`,"aria-haspopup":"dialog","aria-expanded":y,children:[e.jsx("div",{style:oe}),e.jsx("span",{style:{fontFamily:"monospace",fontSize:"12px",color:m.textMuted},children:u??Lt(ot(j)?j:r,S,i)})]}),y&&Le.createPortal(e.jsxs("div",{ref:h,style:ae,role:"dialog","aria-label":"Color picker",children:[e.jsx(li,{hue:T,sat:E,bright:$,onChange:W}),e.jsx(ci,{hue:T,onChange:L}),o&&e.jsx(di,{alpha:S,hex:ot(j)?j:r,onChange:Y}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"6px",flexShrink:0,backgroundColor:`rgba(${A},${O},${G},${S})`,border:`1px solid ${m.border}`}}),e.jsx("input",{style:fe,value:v,onChange:D,maxLength:7,spellCheck:!1,"aria-label":"Hex color value"})]}),e.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[["r","g","b"].map(U=>{const se=U==="r"?A:U==="g"?O:G;return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[e.jsx("input",{style:de,type:"number",min:0,max:255,value:se,onChange:he=>V(U,he.target.value),"aria-label":`${U.toUpperCase()} channel`}),e.jsx("span",{style:{fontSize:"10px",color:m.textMuted,textTransform:"uppercase"},children:U})]},U)}),o&&e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[e.jsx("input",{style:de,type:"number",min:0,max:100,value:Math.round(S*100),onChange:U=>Y(Math.max(0,Math.min(1,parseInt(U.target.value)/100||0))),"aria-label":"Alpha channel"}),e.jsx("span",{style:{fontSize:"10px",color:m.textMuted},children:"A%"})]})]}),l.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"11px",color:m.textMuted,marginBottom:"6px",fontWeight:500},children:"Presets"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:l.map(U=>e.jsx("button",{type:"button",style:ge(U),onClick:()=>F(U),"aria-label":`Select color ${U}`,onMouseEnter:se=>{se.currentTarget.style.transform="scale(1.15)"},onMouseLeave:se=>{se.currentTarget.style.transform="scale(1)"}},U))})]})]}),document.body)]})}const fi={sm:{height:"32px",fontSize:"0.8125rem",px:"8px",btnW:"28px",iconSz:14},md:{height:"40px",fontSize:"0.875rem",px:"12px",btnW:"34px",iconSz:16},lg:{height:"48px",fontSize:"1rem",px:"14px",btnW:"40px",iconSz:18}};function hr(t,r,n){let i=t;return r!==void 0&&(i=Math.max(i,r)),n!==void 0&&(i=Math.min(i,n)),i}function Dt(t,r){if(r===void 0)return t;const n=Math.pow(10,r);return Math.round(t*n)/n}function xi(t,r,n,i,o){const l=i??"en-US";return r==="currency"?new Intl.NumberFormat(l,{style:"currency",currency:n??"USD",minimumFractionDigits:o??2,maximumFractionDigits:o??2}).format(t):r==="percent"?new Intl.NumberFormat(l,{style:"percent",minimumFractionDigits:o??0,maximumFractionDigits:o??0}).format(t/100):r==="decimal"||o!==void 0?new Intl.NumberFormat(l,{minimumFractionDigits:o??0,maximumFractionDigits:o??20}).format(t):String(t)}function mr({direction:t,isDisabled:r,btnW:n,height:i,primaryColor:o,borderColor:l,textMuted:c,iconSz:d,onStep:u}){const x=a.useRef(null),f=a.useRef(null),m=t==="inc"?1:-1,p=a.useCallback(()=>{u(m),x.current=setTimeout(()=>{f.current=setInterval(()=>u(m),60)},400)},[m,u]),h=a.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=null),f.current&&(clearInterval(f.current),f.current=null)},[]);a.useEffect(()=>()=>h(),[h]);const y=t==="inc";return e.jsx("button",{type:"button","aria-label":y?"Increment":"Decrement",disabled:r,onMouseDown:p,onMouseUp:h,onMouseLeave:h,onTouchStart:k=>{k.preventDefault(),p()},onTouchEnd:h,style:{width:n,height:i,minWidth:n,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",borderRight:y?void 0:`1px solid ${l}`,borderLeft:y?`1px solid ${l}`:void 0,cursor:r?"not-allowed":"pointer",color:r?c:o,transition:"color 120ms ease, background 120ms ease",outline:"none"},onFocus:k=>{r||(k.currentTarget.style.background=`${o}12`)},onBlur:k=>{k.currentTarget.style.background="transparent"},children:y?e.jsxs("svg",{width:d,height:d,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):e.jsx("svg",{width:d,height:d,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})}function hn({value:t,defaultValue:r=0,onChange:n,min:i,max:o,step:l=1,precision:c,prefix:d,suffix:u,format:x,currency:f,locale:m,clampOnBlur:p=!0,allowMouseWheel:h=!1,size:y="md",label:k,hint:b,isDisabled:g=!1,isReadOnly:w=!1,isInvalid:j=!1,errorMessage:S,id:z,className:v,style:N}){const C=B.useTheme(),M=a.useId(),T=z??M,E=`${T}-hint`,$=`${T}-error`,F=t!==void 0,[I,W]=a.useState(r),L=F?t:I,[Y,D]=a.useState(!1),[V,R]=a.useState(""),P=fi[y],A=j||!!S,O=A?C.danger:Y?C.primary:C.border,G=[b&&E,A&&$].filter(Boolean).join(" ")||void 0,ee=k?s.sanitizeString(k):void 0,oe=b?s.sanitizeString(b):void 0,ae=S?s.sanitizeString(S):void 0,fe=d?s.sanitizeString(d):void 0,de=u?s.sanitizeString(u):void 0,ge=a.useCallback(J=>{const X=Dt(J,c);F||W(X),n==null||n(X)},[F,n,c]),U=a.useCallback(J=>{if(g||w)return;const X=hr(Dt(L+J*l,c),i,o);ge(X)},[g,w,L,l,c,i,o,ge]),se=()=>{D(!0),R(String(L))},he=()=>{D(!1);const J=parseFloat(V);if(isNaN(J)){n==null||n(null),R(String(L));return}let X=Dt(J,c);p&&(X=hr(X,i,o)),ge(X)},we=J=>{R(J.target.value)},ce=J=>{J.key==="ArrowUp"&&(J.preventDefault(),U(1)),J.key==="ArrowDown"&&(J.preventDefault(),U(-1))},me=J=>{!h||!Y||(J.preventDefault(),U(J.deltaY<0?1:-1))},re=Y?V:xi(L,x,f,m,c),le=(fe||de)&&!Y;return e.jsxs("div",{className:s.cx(s.tkx("flex flex-col gap-1 w-full"),v),style:N,children:[ee&&e.jsx("label",{htmlFor:T,className:s.tkx("text-sm font-medium font-sans"),style:{color:C.text},children:ee}),e.jsxs("div",{className:s.tkx("flex items-stretch overflow-hidden rounded-lg transition-colors duration-150"),style:{border:`1.5px solid ${O}`,backgroundColor:g?C.surfaceAlt:C.surface,opacity:g?.65:1,height:P.height},children:[e.jsx(mr,{direction:"dec",isDisabled:g||w,btnW:P.btnW,height:P.height,primaryColor:C.primary,borderColor:C.border,textMuted:C.textMuted,iconSz:P.iconSz,onStep:U}),e.jsxs("div",{className:s.tkx("relative flex-1 flex items-center overflow-hidden"),children:[le&&fe&&e.jsx("span",{style:{position:"absolute",left:P.px,fontSize:P.fontSize,color:C.textMuted,pointerEvents:"none",userSelect:"none"},children:fe}),e.jsx("input",{id:T,type:"text",inputMode:"decimal",value:Y?V:re,readOnly:w,disabled:g,"aria-invalid":A,"aria-describedby":G,"aria-valuemin":i,"aria-valuemax":o,"aria-valuenow":L,style:{width:"100%",height:"100%",border:"none",background:"transparent",outline:"none",textAlign:"center",fontSize:P.fontSize,fontFamily:"inherit",color:C.text,paddingLeft:le&&fe?`calc(${P.px} + 1.2em)`:P.px,paddingRight:le&&de?`calc(${P.px} + 1.2em)`:P.px,cursor:g?"not-allowed":w?"default":"text"},onFocus:se,onBlur:he,onChange:we,onKeyDown:ce,onWheel:me}),le&&de&&e.jsx("span",{style:{position:"absolute",right:P.px,fontSize:P.fontSize,color:C.textMuted,pointerEvents:"none",userSelect:"none"},children:de})]}),e.jsx(mr,{direction:"inc",isDisabled:g||w,btnW:P.btnW,height:P.height,primaryColor:C.primary,borderColor:C.border,textMuted:C.textMuted,iconSz:P.iconSz,onStep:U})]}),oe&&!ae&&e.jsx("span",{id:E,className:s.tkx("text-xs"),style:{color:C.textMuted},children:oe}),ae&&e.jsxs("span",{id:$,role:"alert",className:s.tkx("text-xs flex items-center gap-1"),style:{color:C.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),ae]})]})}hn.displayName="TkxNumberInput";const pi={sm:{box:"36px",fontSize:"1rem",gap:"6px"},md:{box:"44px",fontSize:"1.25rem",gap:"8px"},lg:{box:"52px",fontSize:"1.5rem",gap:"10px"}},hi={number:/^\d$/,alphanumeric:/^[a-zA-Z0-9]$/,alpha:/^[a-zA-Z]$/};function gr(t,r){return hi[r].test(t)?t.toUpperCase():""}function mn({length:t=6,value:r,onChange:n,onComplete:i,type:o="number",mask:l=!1,autoFocus:c=!1,isDisabled:d=!1,isInvalid:u=!1,errorMessage:x,hint:f,size:m="md",separator:p,separatorPosition:h,className:y,style:k}){const b=B.useTheme(),g=a.useId(),w=`${g}-hint`,j=`${g}-error`,S=r!==void 0,z=A=>{const O=A.split("").slice(0,t);for(;O.length<t;)O.push("");return O},[v,N]=a.useState(()=>z(S?r:"")),C=S?z(r):v,M=a.useRef([]),T=pi[m],E=u||!!x,$=C.every(A=>A!==""),F=f?s.sanitizeString(f):void 0,I=x?s.sanitizeString(x):void 0,W=A=>E?b.danger:$?b.success:b.border;a.useEffect(()=>{var A;c&&((A=M.current[0])==null||A.focus())},[]);const L=a.useCallback(A=>{S||N(A);const O=A.join("");n==null||n(O),A.every(G=>G!=="")&&(i==null||i(O))},[S,n,i]),Y=A=>{var G;const O=Math.max(0,Math.min(t-1,A));(G=M.current[O])==null||G.focus()},D=A=>O=>{if(!d){if(O.key==="Backspace"){if(O.preventDefault(),C[A]!==""){const G=[...C];G[A]="",L(G)}else if(A>0){const G=[...C];G[A-1]="",L(G),Y(A-1)}return}if(O.key==="Delete"){O.preventDefault();const G=[...C];G[A]="",L(G);return}if(O.key==="ArrowLeft"){O.preventDefault(),Y(A-1);return}if(O.key==="ArrowRight"){O.preventDefault(),Y(A+1);return}if(O.key==="Home"){O.preventDefault(),Y(0);return}if(O.key==="End"){O.preventDefault(),Y(t-1);return}}},V=A=>O=>{if(d)return;const ee=O.target.value.slice(-1);if(!ee)return;const oe=gr(ee,o);if(!oe)return;const ae=[...C];ae[A]=oe,L(ae),A<t-1&&Y(A+1)},R=A=>O=>{if(O.preventDefault(),d)return;const ee=O.clipboardData.getData("text").split("").map(fe=>gr(fe,o)).filter(Boolean);if(!ee.length)return;const oe=[...C];let ae=A;for(const fe of ee){if(ae>=t)break;oe[ae]=fe,ae++}L(oe),Y(Math.min(ae,t-1))},P=[F&&w,E&&j].filter(Boolean).join(" ")||void 0;return e.jsxs("div",{className:s.cx(s.tkx("flex flex-col gap-2 w-fit"),y),style:k,children:[e.jsx("div",{role:"group","aria-label":"One-time password","aria-describedby":P,className:s.tkx("flex items-center"),style:{gap:T.gap},children:Array.from({length:t},(A,O)=>{const G=W();return typeof document<"u"&&(document.activeElement,M.current[O]),e.jsxs("div",{className:s.tkx("flex items-center"),style:{gap:T.gap},children:[p&&h===O&&O!==0&&e.jsx("span",{"aria-hidden":"true",style:{color:b.textMuted,userSelect:"none",flexShrink:0},children:p}),e.jsx("input",{ref:ee=>{M.current[O]=ee},type:l?"password":"text",inputMode:o==="number"?"numeric":"text",maxLength:1,value:C[O],disabled:d,"aria-label":`Digit ${O+1} of ${t}`,autoComplete:"one-time-code",spellCheck:!1,onChange:V(O),onKeyDown:D(O),onPaste:R(O),onFocus:ee=>ee.target.select(),style:{width:T.box,height:T.box,textAlign:"center",fontSize:T.fontSize,fontFamily:"monospace",fontWeight:600,border:`1.5px solid ${G}`,borderRadius:"8px",backgroundColor:d?b.surfaceAlt:b.surface,color:b.text,outline:"none",boxShadow:"none",cursor:d?"not-allowed":"text",transition:"border-color 150ms ease, box-shadow 150ms ease",opacity:d?.6:1},onFocusCapture:ee=>{d||(ee.currentTarget.style.borderColor=E?b.danger:b.primary,ee.currentTarget.style.boxShadow=`0 0 0 3px ${E?b.danger:b.primary}33`)},onBlurCapture:ee=>{ee.currentTarget.style.borderColor=W(),ee.currentTarget.style.boxShadow="none"}})]},O)})}),F&&!I&&e.jsx("span",{id:w,className:s.tkx("text-xs"),style:{color:b.textMuted},children:F}),I&&e.jsxs("span",{id:j,role:"alert",className:s.tkx("text-xs flex items-center gap-1"),style:{color:b.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),I]})]})}mn.displayName="TkxOTP";function mi(t,r){a.useEffect(()=>{if(!r)return;const n=i=>{i.key==="Escape"&&t()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t,r])}function gi(t){const r=a.useRef(null);return a.useEffect(()=>{if(!t||!r.current)return;const n=r.current,i=n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),o=i[0],l=i[i.length-1],c=d=>{d.key==="Tab"&&(d.shiftKey?document.activeElement===o&&(d.preventDefault(),l==null||l.focus()):document.activeElement===l&&(d.preventDefault(),o==null||o.focus()))};return n.addEventListener("keydown",c),()=>n.removeEventListener("keydown",c)},[t]),r}function bi(){const[t,r]=a.useState(!1),n=a.useCallback(()=>r(!0),[]),i=a.useCallback(()=>r(!1),[]),o=a.useCallback(()=>r(l=>!l),[]);return{isOpen:t,open:n,close:i,toggle:o}}function At(t,r){if(!t)return{matched:!0,ranges:[],score:0};const n=t.toLowerCase(),i=r.toLowerCase(),o=i.indexOf(n);if(o!==-1)return{matched:!0,ranges:[[o,o+n.length-1]],score:o===0?100:80};const l=[];let c=0,d=-1,u=-1;for(let x=0;x<i.length&&c<n.length;x++)i[x]===n[c]&&((u===-1||x!==u+1)&&(d!==-1&&l.push([d,u]),d=x),u=x,c++);return d!==-1&&u!==-1&&l.push([d,u]),c<n.length?{matched:!1,ranges:[],score:0}:{matched:!0,ranges:l,score:40}}function yi(t,r){if(!t.trim())return r.filter(i=>!i.disabled).map(i=>({item:i,score:0,labelRanges:[]}));const n=[];for(const i of r){if(i.disabled)continue;const o=At(t,i.label),l=i.description?At(t,i.description):{matched:!1,score:0},c=(i.keywords??[]).some(d=>At(t,d).matched);o.matched?n.push({item:i,score:o.score+20,labelRanges:o.ranges}):l.matched?n.push({item:i,score:l.score,labelRanges:[]}):c&&n.push({item:i,score:20,labelRanges:[]})}return n.sort((i,o)=>o.score-i.score)}function ki({text:t,ranges:r,color:n}){if(!r.length)return e.jsx(e.Fragment,{children:t});const i=[];let o=0;for(const[l,c]of r)o<l&&i.push(e.jsx("span",{children:t.slice(o,l)},`t-${o}`)),i.push(e.jsx("span",{style:{color:n,fontWeight:700},children:t.slice(l,c+1)},`h-${l}`)),o=c+1;return o<t.length&&i.push(e.jsx("span",{children:t.slice(o)},"t-end")),e.jsx(e.Fragment,{children:i})}function vi({surface:t,border:r}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:8,overflow:"hidden"},children:[e.jsx("div",{style:{width:24,height:24,borderRadius:6,background:`linear-gradient(90deg, ${r} 25%, ${t} 50%, ${r} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite",flexShrink:0}}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:5},children:[e.jsx("div",{style:{height:13,borderRadius:4,width:"60%",background:`linear-gradient(90deg, ${r} 25%, ${t} 50%, ${r} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite"}}),e.jsx("div",{style:{height:10,borderRadius:4,width:"40%",background:`linear-gradient(90deg, ${r} 25%, ${t} 50%, ${r} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out 0.2s infinite"}})]})]})}function gn({items:t,isOpen:r=!1,onClose:n,placeholder:i="Type a command or search…",emptyMessage:o,maxItems:l=8,onItemSelect:c,className:d,style:u}){const x=B.useTheme(),[f,m]=a.useState(""),[p,h]=a.useState(0),[y,k]=a.useState(!1),b=a.useRef(null),g=a.useRef(null),w=a.useId(),j=gi(r),S=yi(f,t).slice(0,l),z=[];for(const $ of S){const F=$.item.group,I=z.find(W=>W.group===F);I?I.items.push($):z.push({group:F,items:[$]})}const v=z.flatMap($=>$.items);mi(()=>{n==null||n()},r),a.useEffect(()=>{r&&(m(""),h(0),setTimeout(()=>{var $;return($=b.current)==null?void 0:$.focus()},30))},[r]),a.useEffect(()=>{p>=v.length&&h(Math.max(0,v.length-1))},[v.length,p]);const N=a.useCallback($=>{const F=g.current;if(!F)return;const I=F.querySelectorAll("[data-command-item]")[$];I==null||I.scrollIntoView({block:"nearest"})},[]),C=$=>{if($.key==="ArrowDown"){$.preventDefault();const F=Math.min(v.length-1,p+1);h(F),N(F)}else if($.key==="ArrowUp"){$.preventDefault();const F=Math.max(0,p-1);h(F),N(F)}else if($.key==="Enter"){$.preventDefault();const F=v[p];F&&M(F.item)}},M=$=>{var F;$.disabled||((F=$.onSelect)==null||F.call($),c==null||c($),n==null||n())};if(!r||typeof document>"u")return null;const T=s.sanitizeString(i),E=o?s.sanitizeString(o):`No results for "${s.sanitizeString(f)}"`;if(typeof document<"u"&&!document.getElementById("tkx-shimmer-style")){const $=document.createElement("style");$.id="tkx-shimmer-style",$.textContent="@keyframes tkx-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }",document.head.appendChild($)}return Le.createPortal(e.jsxs("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:1e4,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",paddingLeft:16,paddingRight:16},children:[e.jsx("div",{"aria-hidden":"true",onClick:n,style:{position:"absolute",inset:0,backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",animation:"tkx-fade-in 120ms ease"}}),e.jsxs("div",{ref:j,role:"dialog","aria-modal":"true","aria-label":"Command palette",id:w,className:s.cx(d),style:{position:"relative",zIndex:1,width:"100%",maxWidth:560,backgroundColor:x.surface,border:`1px solid ${x.border}`,borderRadius:16,boxShadow:`0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px ${x.border}`,overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"70vh",...u},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px",borderBottom:`1px solid ${x.border}`},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:x.textMuted,strokeWidth:2,"aria-hidden":"true",style:{flexShrink:0},children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:b,type:"text",role:"combobox","aria-expanded":!0,"aria-autocomplete":"list","aria-controls":`${w}-list`,"aria-activedescendant":v[p]?`${w}-item-${v[p].item.id}`:void 0,value:f,onChange:$=>{m($.target.value),h(0)},onKeyDown:C,placeholder:T,style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:16,fontFamily:"inherit",color:x.text}}),f&&e.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>{var $;m(""),h(0),($=b.current)==null||$.focus()},style:{border:"none",background:"transparent",cursor:"pointer",color:x.textMuted,display:"flex",alignItems:"center",padding:0},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("div",{id:`${w}-list`,ref:g,role:"listbox","aria-label":"Command results",style:{overflowY:"auto",flex:1,padding:"6px 8px"},children:y?Array.from({length:4},($,F)=>e.jsx(vi,{surface:x.surface,border:x.border},F)):v.length===0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:"32px 16px",color:x.textMuted},children:[e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]}),e.jsx("span",{style:{fontSize:"0.875rem"},children:E})]}):z.map(({group:$,items:F},I)=>{const W=z.slice(0,I).reduce((L,Y)=>L+Y.items.length,0);return e.jsxs("div",{children:[$&&e.jsx("div",{role:"presentation",style:{fontSize:"0.6875rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:x.textMuted,padding:"10px 12px 4px"},children:s.sanitizeString($)}),F.map((L,Y)=>{const D=W+Y,V=D===p,R=L.item;return e.jsxs("div",{id:`${w}-item-${R.id}`,role:"option","aria-selected":V,"aria-disabled":R.disabled,"data-command-item":!0,onClick:()=>M(R),onMouseEnter:()=>h(D),style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderRadius:8,cursor:R.disabled?"not-allowed":"pointer",opacity:R.disabled?.45:1,backgroundColor:V?`${x.primary}18`:"transparent",borderLeft:V?`2px solid ${x.primary}`:"2px solid transparent",transition:"background 80ms ease",userSelect:"none"},children:[R.icon&&e.jsx("span",{style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",color:V?x.primary:x.textMuted},children:R.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:"0.875rem",fontWeight:500,color:x.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.jsx(ki,{text:R.label,ranges:L.labelRanges,color:x.primary})}),R.description&&e.jsx("div",{style:{fontSize:"0.75rem",color:x.textMuted,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.sanitizeString(R.description)})]}),R.shortcut&&e.jsx("span",{style:{flexShrink:0,fontSize:"0.6875rem",fontWeight:500,color:x.textMuted,backgroundColor:x.surfaceAlt,border:`1px solid ${x.border}`,borderRadius:6,padding:"2px 6px",fontFamily:"monospace",letterSpacing:"0.04em"},children:s.sanitizeString(R.shortcut)})]},R.id)})]},$??"__default__")})}),v.length>0&&e.jsxs("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 16px",borderTop:`1px solid ${x.border}`,fontSize:"0.6875rem",color:x.textMuted},children:[e.jsxs("span",{children:[e.jsx("kbd",{style:{fontFamily:"monospace"},children:"↑↓"})," navigate"]}),e.jsxs("span",{children:[e.jsx("kbd",{style:{fontFamily:"monospace"},children:"↵"})," select"]}),e.jsxs("span",{children:[e.jsx("kbd",{style:{fontFamily:"monospace"},children:"Esc"})," close"]})]})]})]}),document.body)}gn.displayName="TkxCommand";function wt({direction:t,onClick:r,isDisabled:n,primaryColor:i,position:o,orientation:l}){const c=l==="vertical",d=t==="prev",u=o==="inside"?{position:"absolute",zIndex:3,...c?{[d?"top":"bottom"]:10,left:"50%",transform:"translateX(-50%)"}:{[d?"left":"right"]:10,top:"50%",transform:"translateY(-50%)"}}:{flexShrink:0,position:"relative"};return e.jsx("button",{type:"button","aria-label":d?"Previous slide":"Next slide",disabled:n,onClick:r,style:{...u,width:36,height:36,borderRadius:"50%",border:"none",backgroundColor:"rgba(0,0,0,0.45)",backdropFilter:"blur(4px)",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:n?"not-allowed":"pointer",opacity:n?.35:1,transition:"background 150ms ease, opacity 150ms ease",outline:"none"},onFocus:x=>{x.currentTarget.style.boxShadow=`0 0 0 3px ${i}55`},onBlur:x=>{x.currentTarget.style.boxShadow="none"},onMouseEnter:x=>{n||(x.currentTarget.style.backgroundColor="rgba(0,0,0,0.65)")},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="rgba(0,0,0,0.45)"},children:c?d?e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"18 15 12 9 6 15"})}):e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}):d?e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}):e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})})}function bn({slides:t,autoPlay:r=!1,autoPlayInterval:n=4e3,pauseOnHover:i=!0,loop:o=!0,showArrows:l=!0,showDots:c=!0,showThumbnails:d=!1,orientation:u="horizontal",slidesToShow:x=1,gap:f=0,transitionDuration:m=400,swipeable:p=!0,initialIndex:h=0,onChange:y,arrowPosition:k="inside",height:b=320,className:g,style:w}){const j=B.useTheme(),S=s.useReducedMotion(),z=a.useId(),v=t.length,[N,C]=a.useState(h),[M,T]=a.useState(o?h+1:h),[E,$]=a.useState(!1),[F,I]=a.useState(!1),W=a.useRef(null),L=a.useRef(null),Y=a.useRef(null),D=a.useRef(0),V=a.useRef(!1),R=u==="vertical",P=S?0:m,A=o&&v>1?[t[v-1],...t,t[0]]:t,O=A.length,G=100/x,ee=(X,ne=0)=>{const xe=ne!==0?` - ${ne}px`:"";return R?`translateY(calc(-${X*G}%${xe}))`:`translateX(calc(-${X*G}%${xe}))`},oe=a.useCallback((X,ne=!1)=>{const xe=o?(X%v+v)%v:Math.max(0,Math.min(v-1,X)),ke=o?xe+1:xe;ne&&W.current?(W.current.style.transition="none",T(ke),C(xe),W.current.offsetHeight,W.current.style.transition=""):($(!0),T(ke),C(xe)),y==null||y(xe)},[v,o,y]),ae=a.useCallback(()=>oe(N-1),[N,oe]),fe=a.useCallback(()=>oe(N+1),[N,oe]),de=a.useCallback(()=>{$(!1),!(!o||v<=1)&&(M===0?oe(v-1,!0):M===O-1&&oe(0,!0))},[o,v,M,O,oe]);a.useEffect(()=>{if(!(!r||F||v<=1))return L.current=setInterval(fe,n),()=>{L.current&&clearInterval(L.current)}},[r,F,n,fe,v]),a.useEffect(()=>{const X=ne=>{const xe=document.activeElement,ke=document.getElementById(z);ke!=null&&ke.contains(xe)&&(ne.key===(R?"ArrowUp":"ArrowLeft")&&(ne.preventDefault(),ae()),ne.key===(R?"ArrowDown":"ArrowRight")&&(ne.preventDefault(),fe()))};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[z,R,ae,fe]);const ge=X=>"touches"in X?R?X.touches[0].clientY:X.touches[0].clientX:R?X.clientY:X.clientX,U=X=>{p&&(Y.current=ge(X),D.current=0,V.current=!0)},se=X=>{if(!V.current||Y.current===null)return;const ne=ge(X)-Y.current;D.current=ne,W.current&&(W.current.style.transition="none",W.current.style.transform=ee(M,-ne))},he=()=>{if(!V.current)return;V.current=!1;const X=D.current,ne=50;W.current&&(W.current.style.transition="",W.current.style.transform=""),X<-ne?fe():X>ne?ae():W.current&&(W.current.style.transform=ee(M)),Y.current=null,D.current=0},we=typeof b=="number"?`${b}px`:b,ce={display:"flex",flexDirection:R?"column":"row",width:R?"100%":`${O/x*100}%`,height:R?`${O/x*100}%`:"100%",transform:ee(M),transition:E||!S?`transform ${P}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none",willChange:"transform",gap:f>0?f:void 0},me={flexShrink:0,width:R?"100%":`${G/(O/x)}%`,height:R?`${G/(O/x)}%`:"100%",overflow:"hidden",position:"relative"},re=o||N>0,le=o||N<v-1,J=k==="outside";return e.jsxs("div",{id:z,className:s.cx(s.tkx("flex flex-col gap-2"),g),style:w,"aria-roledescription":"carousel","aria-label":"Content carousel",children:[e.jsxs("div",{className:s.tkx("flex items-center gap-2"),style:{gap:J&&l?8:0},children:[l&&J&&e.jsx(wt,{direction:"prev",onClick:ae,isDisabled:!re,primaryColor:j.primary,position:"outside",orientation:u}),e.jsxs("div",{style:{position:"relative",flex:1,overflow:"hidden",height:we,borderRadius:12,cursor:p?V.current?"grabbing":"grab":"default",userSelect:"none"},onMouseEnter:()=>i&&I(!0),onMouseLeave:()=>{I(!1),he()},onTouchStart:U,onTouchMove:se,onTouchEnd:he,onMouseDown:U,onMouseMove:se,onMouseUp:he,"aria-live":"polite","aria-atomic":"false",children:[l&&!J&&e.jsxs(e.Fragment,{children:[e.jsx(wt,{direction:"prev",onClick:ae,isDisabled:!re,primaryColor:j.primary,position:"inside",orientation:u}),e.jsx(wt,{direction:"next",onClick:fe,isDisabled:!le,primaryColor:j.primary,position:"inside",orientation:u})]}),e.jsx("div",{ref:W,style:ce,onTransitionEnd:de,children:A.map((X,ne)=>e.jsx("div",{style:me,role:"group","aria-roledescription":"slide","aria-label":`Slide ${(ne-(o?1:0)+v)%v+1} of ${v}`,"aria-hidden":(ne-(o?1:0)+v)%v!==N,children:X.content},`${X.id}-${ne}`))}),c&&!d&&e.jsx("div",{"aria-label":"Slide indicators",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:6,zIndex:2},children:t.map((X,ne)=>e.jsx("button",{type:"button","aria-label":`Go to slide ${ne+1}`,"aria-current":ne===N?"true":void 0,onClick:()=>oe(ne),style:{width:ne===N?20:8,height:8,borderRadius:9999,border:"none",backgroundColor:ne===N?j.primary:"rgba(255,255,255,0.5)",cursor:"pointer",padding:0,transition:"width 250ms ease, background 250ms ease",outline:"none"},onFocus:xe=>{xe.currentTarget.style.boxShadow=`0 0 0 3px ${j.primary}66`},onBlur:xe=>{xe.currentTarget.style.boxShadow="none"}},X.id))})]}),l&&J&&e.jsx(wt,{direction:"next",onClick:fe,isDisabled:!le,primaryColor:j.primary,position:"outside",orientation:u})]}),d&&e.jsx("div",{role:"tablist","aria-label":"Slide thumbnails",style:{display:"flex",gap:6,overflowX:"auto",paddingBottom:4,scrollbarWidth:"thin"},children:t.map((X,ne)=>e.jsxs("button",{type:"button",role:"tab","aria-selected":ne===N,"aria-label":`Thumbnail for slide ${ne+1}`,onClick:()=>oe(ne),style:{flexShrink:0,width:60,height:42,border:`2px solid ${ne===N?j.primary:j.border}`,borderRadius:6,overflow:"hidden",cursor:"pointer",padding:0,background:j.surfaceAlt,transition:"border-color 150ms ease",outline:"none",position:"relative"},onFocus:xe=>{xe.currentTarget.style.boxShadow=`0 0 0 3px ${j.primary}55`},onBlur:xe=>{xe.currentTarget.style.boxShadow="none"},children:[X.thumbnail?e.jsx("img",{src:X.thumbnail,alt:"","aria-hidden":"true",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.625rem",color:j.textMuted,fontWeight:600},children:ne+1}),ne===N&&e.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:`${j.primary}22`}})]},X.id))})]})}bn.displayName="TkxCarousel";function wi({color:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M6 3l5 5-5 5",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ji({onClick:t,bgColor:r,hoverColor:n,textColor:i}){const o=l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t())};return e.jsx("button",{type:"button",onClick:t,onKeyDown:o,"aria-label":"Show hidden breadcrumb items",className:s.tkx("inline-flex items-center justify-center rounded px-1.5 py-0.5","text-sm font-medium cursor-pointer border-none outline-none","focus-visible:ring-2 focus-visible:ring-offset-1"),style:{backgroundColor:r,color:i,transition:"background-color 150ms ease"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=n},onMouseLeave:l=>{l.currentTarget.style.backgroundColor=r},children:"…"})}function Si({items:t,separator:r,maxItems:n,onNavigate:i,className:o,style:l}){const c=B.useTheme(),d=s.useReducedMotion(),u=n!==void 0&&n>1&&t.length>n,f=a.useCallback(()=>{if(!u||!n)return t.map((N,C)=>({item:N,originalIndex:C}));const j=Math.ceil((n-1)/2),S=n-1-j,z=t.slice(0,j).map((N,C)=>({item:N,originalIndex:C})),v=t.slice(t.length-S).map((N,C)=>({item:N,originalIndex:t.length-S+C}));return z.concat(v)},[t,n,u])(),m=u&&n?Math.ceil((n-1)/2):-1,p=(j,S)=>{i==null||i(j,S)},h=(j,S,z)=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),p(S,z))},y=d?{}:{transition:"color 150ms ease, background-color 150ms ease"},k=j=>e.jsx("li",{role:"presentation","aria-hidden":"true",className:s.tkx("flex items-center mx-1.5"),children:r??e.jsx(wi,{color:c.textMuted})},j),b=(j,S,z)=>{const v=s.sanitizeString(j.label);if(z)return e.jsx("li",{children:e.jsxs("span",{"aria-current":"page",className:s.tkx("inline-flex items-center gap-1.5 text-sm font-medium"),style:{color:c.text},children:[j.icon&&e.jsx("span",{"aria-hidden":"true",className:s.tkx("flex-shrink-0"),children:j.icon}),v]})},`item-${S}`);const N=!!j.href,C={color:c.textMuted,textDecoration:"none",...y},M={onMouseEnter:E=>{E.currentTarget.style.color=c.primary},onMouseLeave:E=>{E.currentTarget.style.color=c.textMuted}},T=e.jsxs(e.Fragment,{children:[j.icon&&e.jsx("span",{"aria-hidden":"true",className:s.tkx("flex-shrink-0"),children:j.icon}),v]});return N?e.jsx("li",{children:e.jsx("a",{href:j.href,onClick:E=>{i&&(E.preventDefault(),p(j,S))},className:s.tkx("inline-flex items-center gap-1.5 text-sm rounded","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:{...C,focusRingColor:c.primary},...M,children:T})},`item-${S}`):e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>p(j,S),onKeyDown:E=>h(E,j,S),className:s.tkx("inline-flex items-center gap-1.5 text-sm rounded","border-none bg-transparent cursor-pointer p-0","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:C,...M,children:T})},`item-${S}`)},g=[];let w=!1;for(let j=0;j<f.length;j++){const{item:S,originalIndex:z}=f[j],v=z===t.length-1;u&&!w&&j===m&&(g.length>0&&g.push(k("sep-ellipsis-before")),g.push(e.jsx("li",{role:"presentation",children:e.jsx(ji,{onClick:()=>{},bgColor:c.surfaceAlt,hoverColor:c.surface,textColor:c.textMuted})},"ellipsis")),w=!0),g.length>0&&g[g.length-1]!==null&&g.push(k(`sep-${z}`)),g.push(b(S,z,v))}return e.jsx("nav",{"aria-label":"Breadcrumb",className:s.tkx("font-sans",o??""),style:{...l},children:e.jsx("ol",{role:"list",className:s.tkx("flex items-center flex-wrap list-none m-0 p-0"),children:g})})}const Fe=8,rt=8;function Ci(t,r,n){const i=r.getBoundingClientRect(),o=window.scrollX,l=window.scrollY,c=window.innerWidth,d=window.innerHeight;let u=0,x=0,f=n;const m={top:t.top-i.height-rt-Fe>0,bottom:t.bottom+i.height+rt+Fe<d,left:t.left-i.width-rt-Fe>0,right:t.right+i.width+rt+Fe<c};if(!m[n]){const h={top:"bottom",bottom:"top",left:"right",right:"left"};m[h[n]]&&(f=h[n])}switch(f){case"top":u=t.top+l-i.height-rt-Fe,x=t.left+o+t.width/2-i.width/2;break;case"bottom":u=t.bottom+l+rt+Fe,x=t.left+o+t.width/2-i.width/2;break;case"left":u=t.top+l+t.height/2-i.height/2,x=t.left+o-i.width-rt-Fe;break;case"right":u=t.top+l+t.height/2-i.height/2,x=t.right+o+rt+Fe;break}x=Math.max(8,Math.min(x,c+o-i.width-8)),u=Math.max(8,Math.min(u,d+l-i.height-8));const p={position:"absolute",width:0,height:0,borderStyle:"solid",borderWidth:Fe};switch(f){case"top":Object.assign(p,{bottom:-Fe*2,left:"50%",transform:"translateX(-50%)",borderColor:"var(--tkx-popover-bg) transparent transparent transparent"});break;case"bottom":Object.assign(p,{top:-Fe*2,left:"50%",transform:"translateX(-50%)",borderColor:"transparent transparent var(--tkx-popover-bg) transparent"});break;case"left":Object.assign(p,{right:-Fe*2,top:"50%",transform:"translateY(-50%)",borderColor:"transparent transparent transparent var(--tkx-popover-bg)"});break;case"right":Object.assign(p,{left:-Fe*2,top:"50%",transform:"translateY(-50%)",borderColor:"transparent var(--tkx-popover-bg) transparent transparent"});break}return{top:u,left:x,arrowStyle:p,resolvedPlacement:f}}function Ti({trigger:t,content:r,placement:n="bottom",isOpen:i,onOpenChange:o,closeOnClickOutside:l=!0,className:c,style:d}){const u=B.useTheme(),x=s.useReducedMotion(),f=a.useId(),m=i!==void 0,[p,h]=a.useState(!1),y=m?i:p,k=a.useRef(null),b=a.useRef(null);a.useRef(null);const[g,w]=a.useState(null),j=a.useCallback(C=>{m||h(C),o==null||o(C)},[m,o]),S=a.useCallback(()=>j(!1),[j]),z=a.useCallback(()=>j(!y),[j,y]);s.useEscapeKey(S,y),a.useEffect(()=>{if(!y||!l)return;const C=M=>{var E,$;const T=M.target;(E=k.current)!=null&&E.contains(T)||($=b.current)!=null&&$.contains(T)||S()};return document.addEventListener("pointerdown",C),()=>document.removeEventListener("pointerdown",C)},[y,l,S]),a.useEffect(()=>{if(!y||!k.current)return;const C=()=>{if(!k.current||!b.current)return;const M=k.current.getBoundingClientRect();w(Ci(M,b.current,n))};return requestAnimationFrame(C),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[y,n]);const v=x?{opacity:1}:{animation:"tkxPopoverFadeIn 150ms ease forwards",opacity:0},N=y&&typeof document<"u"?Le.createPortal(e.jsxs("div",{ref:b,id:f,role:"dialog","aria-modal":"false",className:s.tkx("absolute z-[9100] rounded-lg font-sans",c??""),style:{"--tkx-popover-bg":u.surface,top:(g==null?void 0:g.top)??-9999,left:(g==null?void 0:g.left)??-9999,backgroundColor:u.surface,border:`1px solid ${u.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",minWidth:200,maxWidth:420,padding:"12px 16px",color:u.text,...v,...d},children:[g&&e.jsx("span",{style:g.arrowStyle,"aria-hidden":"true"}),r]}),document.body):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:k,className:s.tkx("inline-flex"),onClick:z,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),z())},"aria-expanded":y,"aria-haspopup":"dialog","aria-controls":y?f:void 0,children:t}),N,y&&!x&&e.jsx("style",{children:`
|
|
67
|
+
`}),e.jsx("div",{style:{width:s,height:s,minWidth:s,borderRadius:"50%",border:`${N}px solid ${I}`,backgroundColor:w,color:v,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:y?"none":"background-color 0.2s, border-color 0.2s",...$,...S},children:T})]})}function mn({completed:t,orientation:n,connectorStyle:r,connectorWidth:o,primary:s,border:l,reducedMotion:a}){const c=t?s:l;return n==="horizontal"?e.jsx("div",{"aria-hidden":"true",style:{flex:1,height:o,background:r==="solid"?c:"none",backgroundImage:r!=="solid"?`repeating-linear-gradient(90deg, ${c} 0, ${c} 6px, transparent 6px, transparent ${r==="dashed"?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background 0.3s ease",alignSelf:"center",marginLeft:4,marginRight:4}}):e.jsx("div",{"aria-hidden":"true",style:{width:o,flex:1,minHeight:20,background:r==="solid"?c:"none",backgroundImage:r!=="solid"?`repeating-linear-gradient(180deg, ${c} 0, ${c} 6px, transparent 6px, transparent ${r==="dashed"?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background 0.3s ease",alignSelf:"stretch",marginTop:4,marginBottom:4,marginLeft:"auto",marginRight:"auto"}})}function gr({steps:t,activeStep:n=0,orientation:r="horizontal",variant:o="default",size:s="md",clickable:l=!1,onStepClick:a,showStepNumbers:c=!0,alternateLabel:d=!1,connector:f="solid",className:u,style:h}){const p=_.useTheme(),m=Q.useReducedMotion(),y=Lo[s],k=(g,M)=>g.status?g.status:M<n?"completed":M===n?"active":"pending",b=r==="horizontal";return e.jsx("div",{className:u,role:"list","aria-label":"Steps",style:{display:"flex",flexDirection:b?"row":"column",alignItems:b?d?"flex-start":"center":"stretch",width:"100%",gap:0,...h},children:t.map((g,M)=>{const j=k(g,M),w=M===t.length-1,I=j==="completed"||M<n,v=M%2===0,N=()=>{l&&(a==null||a(M))},$=e.jsx(Do,{status:j,index:M,showStepNumbers:c,icon:g.icon,circleSize:y.circle,fontSize:y.fontSize,primary:p.primary,danger:p.danger,success:p.success,text:p.text,textMuted:p.textMuted,border:p.border,surface:p.surface,variant:o,reducedMotion:m,clickable:l}),S=e.jsxs("div",{style:{textAlign:b&&!d?"center":"left",maxWidth:b?120:void 0},children:[e.jsxs("div",{style:{fontSize:y.titleSize,fontWeight:j==="active"?600:500,color:j==="pending"?p.textMuted:j==="error"?p.danger:p.text,lineHeight:1.3,transition:m?"none":"color 0.2s"},children:[A.sanitizeString(g.title),g.optional&&e.jsx("span",{style:{fontSize:y.descSize,color:p.textMuted,fontWeight:400,marginLeft:4},children:"(optional)"})]}),g.description&&e.jsx("div",{style:{fontSize:y.descSize,color:p.textMuted,marginTop:2,lineHeight:1.4},children:A.sanitizeString(g.description)}),g.error&&j==="error"&&e.jsx("div",{style:{fontSize:y.descSize,color:p.danger,marginTop:2},children:A.sanitizeString(g.error)})]});return b?e.jsxs("div",{role:"listitem",style:{display:"flex",flex:w?0:1,alignItems:"center",minWidth:0},children:[e.jsxs("div",{onClick:N,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,cursor:l?"pointer":"default",flexShrink:0},"aria-current":j==="active"?"step":void 0,children:[d&&!v&&e.jsx("div",{style:{minHeight:y.circle*1.5+6,display:"flex",alignItems:"flex-end",paddingBottom:6},children:S}),$,!d&&S,d&&v&&e.jsx("div",{style:{marginTop:6},children:S})]}),!w&&e.jsx(mn,{completed:I,orientation:"horizontal",connectorStyle:f,connectorWidth:y.connectorWidth,primary:p.primary,border:p.border,reducedMotion:m})]},g.id):e.jsxs("div",{role:"listitem",style:{display:"flex",flexDirection:"row",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginRight:14,flexShrink:0},children:[e.jsx("div",{onClick:N,style:{cursor:l?"pointer":"default"},"aria-current":j==="active"?"step":void 0,children:$}),!w&&e.jsx(mn,{completed:I,orientation:"vertical",connectorStyle:f,connectorWidth:y.connectorWidth,primary:p.primary,border:p.border,reducedMotion:m})]}),e.jsx("div",{style:{paddingTop:(y.circle-parseFloat(y.titleSize)*16)/2,paddingBottom:w?0:16,flex:1,minWidth:0},children:S})]},g.id)})})}gr.displayName="TkxStepper";function br(t){let n=0,r=0,o=0;const s=t.replace("#","");s.length===3?(n=parseInt(s[0]+s[0],16),r=parseInt(s[1]+s[1],16),o=parseInt(s[2]+s[2],16)):s.length>=6&&(n=parseInt(s.slice(0,2),16),r=parseInt(s.slice(2,4),16),o=parseInt(s.slice(4,6),16)),n/=255,r/=255,o/=255;const l=Math.max(n,r,o),a=Math.min(n,r,o);let c=0,d=0;const f=(l+a)/2;if(l!==a){const u=l-a;switch(d=f>.5?u/(2-l-a):u/(l+a),l){case n:c=((r-o)/u+(r<o?6:0))/6;break;case r:c=((o-n)/u+2)/6;break;case o:c=((n-r)/u+4)/6;break}}return[Math.round(c*360),Math.round(d*100),Math.round(f*100)]}function Vt(t,n,r){n/=100,r/=100;const o=n*Math.min(r,1-r),s=l=>{const a=(l+t/30)%12,c=r-o*Math.max(Math.min(a-3,9-a,1),-1);return Math.round(255*c).toString(16).padStart(2,"0")};return`#${s(0)}${s(8)}${s(4)}`}function $t(t){const n=t.replace("#",""),r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),s=parseInt(n.slice(4,6),16);return[isNaN(r)?0:r,isNaN(o)?0:o,isNaN(s)?0:s]}function Rt(t,n,r){return`#${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function dt(t){return/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)}function At(t,n,r){if(r==="hex")return n<1?`${t}${Math.round(n*255).toString(16).padStart(2,"0")}`:t;const[o,s,l]=$t(t);if(r==="rgb")return n<1?`rgba(${o}, ${s}, ${l}, ${n.toFixed(2)})`:`rgb(${o}, ${s}, ${l})`;const[a,c,d]=br(t);return r==="hsl"?n<1?`hsla(${a}, ${c}%, ${d}%, ${n.toFixed(2)})`:`hsl(${a}, ${c}%, ${d}%)`:t}const Bo=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#ffffff","#94a3b8","#475569","#0f172a"];function Wo({hue:t,sat:n,bright:r,onChange:o}){const s=i.useRef(null),l=i.useRef(!1),a=i.useCallback(f=>{const u=s.current;if(!u)return;const h=u.getBoundingClientRect(),p=Math.max(0,Math.min(1,(f.clientX-h.left)/h.width)),m=Math.max(0,Math.min(1,(f.clientY-h.top)/h.height));o(Math.round(p*100),Math.round((1-m)*100))},[o]);i.useEffect(()=>{const f=h=>{l.current&&a(h)},u=()=>{l.current=!1};return document.addEventListener("mousemove",f),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",u)}},[a]);const c=`${n}%`,d=`${100-r}%`;return e.jsxs("div",{ref:s,style:{position:"relative",width:"100%",height:"160px",borderRadius:"6px",cursor:"crosshair",background:`hsl(${t}, 100%, 50%)`,flexShrink:0},onMouseDown:f=>{l.current=!0,a(f)},children:[e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to right, #ffffff, transparent)"}}),e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to bottom, transparent, #000000)"}}),e.jsx("div",{style:{position:"absolute",left:c,top:d,transform:"translate(-50%, -50%)",width:"14px",height:"14px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.4)",pointerEvents:"none",backgroundColor:Vt(t,n,r/2+25)}})]})}function Po({hue:t,onChange:n}){const r=i.useRef(null),o=i.useRef(!1),s=i.useCallback(l=>{const a=r.current;if(!a)return;const c=a.getBoundingClientRect(),d=Math.max(0,Math.min(1,(l.clientX-c.left)/c.width));n(Math.round(d*360))},[n]);return i.useEffect(()=>{const l=c=>{o.current&&s(c)},a=()=>{o.current=!1};return document.addEventListener("mousemove",l),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}},[s]),e.jsx("div",{ref:r,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:"linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)"},onMouseDown:l=>{o.current=!0,s(l)},children:e.jsx("div",{style:{position:"absolute",left:`${t/360*100}%`,top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`hsl(${t}, 100%, 50%)`,pointerEvents:"none"}})})}function Fo({alpha:t,hex:n,onChange:r}){const o=i.useRef(null),s=i.useRef(!1),l=i.useCallback(f=>{const u=o.current;if(!u)return;const h=u.getBoundingClientRect(),p=Math.max(0,Math.min(1,(f.clientX-h.left)/h.width));r(Math.round(p*100)/100)},[r]);i.useEffect(()=>{const f=h=>{s.current&&l(h)},u=()=>{s.current=!1};return document.addEventListener("mousemove",f),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",u)}},[l]);const[a,c,d]=$t(n);return e.jsxs("div",{style:{position:"relative"},children:[e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"6px",backgroundImage:"repeating-conic-gradient(#ccc 0% 25%, white 0% 50%)",backgroundSize:"8px 8px"}}),e.jsx("div",{ref:o,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:`linear-gradient(to right, rgba(${a},${c},${d},0), rgba(${a},${c},${d},1))`},onMouseDown:f=>{s.current=!0,l(f)},children:e.jsx("div",{style:{position:"absolute",left:`${t*100}%`,top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`rgba(${a},${c},${d},${t})`,pointerEvents:"none"}})})]})}function Ho({value:t,defaultValue:n="#3b82f6",onChange:r,format:o="hex",showAlpha:s=!1,presets:l=Bo,disabled:a=!1,size:c="md",placeholder:d,label:f,style:u}){const h=_.useTheme(),p=i.useRef(null),m=i.useRef(null),[y,k]=i.useState(!1),b=t!==void 0,[g,M]=i.useState(b&&t||n),j=b?t||n:g,[w,I]=i.useState(1),[v,N]=i.useState(j),[$,S]=i.useState({top:0,left:0}),[T,E,C]=br(dt(j)?j:n),H=i.useCallback((Y,se=w)=>{dt(Y)&&(N(Y),b||M(Y),r==null||r(At(Y,se,o),o))},[w,b,o,r]);i.useEffect(()=>{b&&t&&dt(t)&&N(t)},[b,t]);const z=()=>{if(a)return;const Y=p.current;if(!Y)return;const se=Y.getBoundingClientRect(),ge=window.innerHeight-se.bottom>320?se.bottom+6:se.top-326;S({top:ge+window.scrollY,left:se.left+window.scrollX}),k(!0)};i.useEffect(()=>{if(!y)return;const Y=se=>{m.current&&!m.current.contains(se.target)&&p.current&&!p.current.contains(se.target)&&k(!1)};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[y]),i.useEffect(()=>{if(!y)return;const Y=se=>{se.key==="Escape"&&k(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[y]);const R=(Y,se)=>{const le=se/100,ge=Y/100,he=le*(1-ge/2),ye=he===0||he===1?0:(le-he)/Math.min(he,1-he),de=Vt(T,Math.round(ye*100),Math.round(he*100));H(de)},B=Y=>{const se=Vt(Y,E,C);H(se)},V=Y=>{I(Y),r==null||r(At(j,Y,o),o)},D=Y=>{const se=Y.target.value;N(se),dt(se)&&H(se)},O=(Y,se)=>{const le=Math.max(0,Math.min(255,parseInt(se)||0)),[ge,he,ye]=$t(j),de=Y==="r"?Rt(le,he,ye):Y==="g"?Rt(ge,le,ye):Rt(ge,he,le);H(de)},P={sm:28,md:34,lg:40}[c],[W,K,ne]=$t(dt(j)?j:n),Z={display:"inline-flex",alignItems:"center",gap:"8px",height:`${P}px`,padding:"4px 10px 4px 6px",borderRadius:"8px",border:`1px solid ${h.border}`,backgroundColor:h.surface,cursor:a?"not-allowed":"pointer",opacity:a?.5:1,color:h.text,fontSize:"13px",fontFamily:"inherit",transition:"border-color 0.15s",...u},ie={width:`${P-8}px`,height:`${P-8}px`,borderRadius:"4px",backgroundColor:`rgba(${W},${K},${ne},${w})`,border:`1px solid ${h.border}`,flexShrink:0},fe={position:"absolute",top:$.top,left:$.left,zIndex:9999,width:"260px",backgroundColor:h.surface,border:`1px solid ${h.border}`,borderRadius:"12px",padding:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.24)",display:"flex",flexDirection:"column",gap:"12px"},pe={width:"100%",padding:"6px 10px",borderRadius:"6px",border:`1px solid ${h.border}`,backgroundColor:h.bg,color:h.text,fontSize:"12px",fontFamily:"monospace",outline:"none"},te={flex:1,padding:"5px 6px",borderRadius:"6px",border:`1px solid ${h.border}`,backgroundColor:h.bg,color:h.text,fontSize:"11px",textAlign:"center",fontFamily:"monospace",outline:"none"},ce=Y=>({width:"20px",height:"20px",borderRadius:"50%",backgroundColor:Y,border:Y.toLowerCase()===j.toLowerCase()?`2px solid ${h.primary}`:`1px solid ${h.border}`,cursor:"pointer",flexShrink:0,transition:"transform 0.1s"});return e.jsxs(e.Fragment,{children:[f&&e.jsx("label",{style:{display:"block",fontSize:"13px",color:h.text,marginBottom:"6px",fontWeight:500},children:f}),e.jsxs("button",{ref:p,type:"button",style:Z,onClick:z,disabled:a,"aria-label":`Color picker, current color ${j}`,"aria-haspopup":"dialog","aria-expanded":y,children:[e.jsx("div",{style:ie}),e.jsx("span",{style:{fontFamily:"monospace",fontSize:"12px",color:h.textMuted},children:d??At(dt(j)?j:n,w,o)})]}),y&&Le.createPortal(e.jsxs("div",{ref:m,style:fe,role:"dialog","aria-label":"Color picker",children:[e.jsx(Wo,{hue:T,sat:E,bright:C,onChange:R}),e.jsx(Po,{hue:T,onChange:B}),s&&e.jsx(Fo,{alpha:w,hex:dt(j)?j:n,onChange:V}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"6px",flexShrink:0,backgroundColor:`rgba(${W},${K},${ne},${w})`,border:`1px solid ${h.border}`}}),e.jsx("input",{style:pe,value:v,onChange:D,maxLength:7,spellCheck:!1,"aria-label":"Hex color value"})]}),e.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[["r","g","b"].map(Y=>{const se=Y==="r"?W:Y==="g"?K:ne;return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[e.jsx("input",{style:te,type:"number",min:0,max:255,value:se,onChange:le=>O(Y,le.target.value),"aria-label":`${Y.toUpperCase()} channel`}),e.jsx("span",{style:{fontSize:"10px",color:h.textMuted,textTransform:"uppercase"},children:Y})]},Y)}),s&&e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[e.jsx("input",{style:te,type:"number",min:0,max:100,value:Math.round(w*100),onChange:Y=>V(Math.max(0,Math.min(1,parseInt(Y.target.value)/100||0))),"aria-label":"Alpha channel"}),e.jsx("span",{style:{fontSize:"10px",color:h.textMuted},children:"A%"})]})]}),l.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"11px",color:h.textMuted,marginBottom:"6px",fontWeight:500},children:"Presets"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:l.map(Y=>e.jsx("button",{type:"button",style:ce(Y),onClick:()=>H(Y),"aria-label":`Select color ${Y}`,onMouseEnter:se=>{se.currentTarget.style.transform="scale(1.15)"},onMouseLeave:se=>{se.currentTarget.style.transform="scale(1)"}},Y))})]})]}),document.body)]})}const Vo={sm:{height:"32px",fontSize:"0.8125rem",px:"8px",btnW:"28px",iconSz:14},md:{height:"40px",fontSize:"0.875rem",px:"12px",btnW:"34px",iconSz:16},lg:{height:"48px",fontSize:"1rem",px:"14px",btnW:"40px",iconSz:18}};function gn(t,n,r){let o=t;return n!==void 0&&(o=Math.max(o,n)),r!==void 0&&(o=Math.min(o,r)),o}function Dt(t,n){if(n===void 0)return t;const r=Math.pow(10,n);return Math.round(t*r)/r}function Oo(t,n,r,o,s){const l=o??"en-US";return n==="currency"?new Intl.NumberFormat(l,{style:"currency",currency:r??"USD",minimumFractionDigits:s??2,maximumFractionDigits:s??2}).format(t):n==="percent"?new Intl.NumberFormat(l,{style:"percent",minimumFractionDigits:s??0,maximumFractionDigits:s??0}).format(t/100):n==="decimal"||s!==void 0?new Intl.NumberFormat(l,{minimumFractionDigits:s??0,maximumFractionDigits:s??20}).format(t):String(t)}function bn({direction:t,isDisabled:n,btnW:r,height:o,primaryColor:s,borderColor:l,textMuted:a,iconSz:c,onStep:d}){const f=i.useRef(null),u=i.useRef(null),h=t==="inc"?1:-1,p=i.useCallback(()=>{d(h),f.current=setTimeout(()=>{u.current=setInterval(()=>d(h),60)},400)},[h,d]),m=i.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null),u.current&&(clearInterval(u.current),u.current=null)},[]);i.useEffect(()=>()=>m(),[m]);const y=t==="inc";return e.jsx("button",{type:"button","aria-label":y?"Increment":"Decrement",disabled:n,onMouseDown:p,onMouseUp:m,onMouseLeave:m,onTouchStart:k=>{k.preventDefault(),p()},onTouchEnd:m,style:{width:r,height:o,minWidth:r,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",borderRight:y?void 0:`1px solid ${l}`,borderLeft:y?`1px solid ${l}`:void 0,cursor:n?"not-allowed":"pointer",color:n?a:s,transition:"color 120ms ease, background 120ms ease",outline:"none"},onFocus:k=>{n||(k.currentTarget.style.background=`${s}12`)},onBlur:k=>{k.currentTarget.style.background="transparent"},children:y?e.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):e.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})}function yr({value:t,defaultValue:n=0,onChange:r,min:o,max:s,step:l=1,precision:a,prefix:c,suffix:d,format:f,currency:u,locale:h,clampOnBlur:p=!0,allowMouseWheel:m=!1,size:y="md",label:k,hint:b,isDisabled:g=!1,isReadOnly:M=!1,isInvalid:j=!1,errorMessage:w,id:I,className:v,style:N}){const $=_.useTheme(),S=i.useId(),T=I??S,E=`${T}-hint`,C=`${T}-error`,H=t!==void 0,[z,R]=i.useState(n),B=H?t:z,[V,D]=i.useState(!1),[O,L]=i.useState(""),P=Vo[y],W=j||!!w,K=W?$.danger:V?$.primary:$.border,ne=[b&&E,W&&C].filter(Boolean).join(" ")||void 0,Z=k?A.sanitizeString(k):void 0,ie=b?A.sanitizeString(b):void 0,fe=w?A.sanitizeString(w):void 0,pe=c?A.sanitizeString(c):void 0,te=d?A.sanitizeString(d):void 0,ce=i.useCallback(oe=>{const G=Dt(oe,a);H||R(G),r==null||r(G)},[H,r,a]),Y=i.useCallback(oe=>{if(g||M)return;const G=gn(Dt(B+oe*l,a),o,s);ce(G)},[g,M,B,l,a,o,s,ce]),se=()=>{D(!0),L(String(B))},le=()=>{D(!1);const oe=parseFloat(O);if(isNaN(oe)){r==null||r(null),L(String(B));return}let G=Dt(oe,a);p&&(G=gn(G,o,s)),ce(G)},ge=oe=>{L(oe.target.value)},he=oe=>{oe.key==="ArrowUp"&&(oe.preventDefault(),Y(1)),oe.key==="ArrowDown"&&(oe.preventDefault(),Y(-1))},ye=oe=>{!m||!V||(oe.preventDefault(),Y(oe.deltaY<0?1:-1))},de=V?O:Oo(B,f,u,h,a),xe=(pe||te)&&!V;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),v),style:N,children:[Z&&e.jsx("label",{htmlFor:T,className:x.tkx("text-sm font-medium font-sans"),style:{color:$.text},children:Z}),e.jsxs("div",{className:x.tkx("flex items-stretch overflow-hidden rounded-lg transition-colors duration-150"),style:{border:`1.5px solid ${K}`,backgroundColor:g?$.surfaceAlt:$.surface,opacity:g?.65:1,height:P.height},children:[e.jsx(bn,{direction:"dec",isDisabled:g||M,btnW:P.btnW,height:P.height,primaryColor:$.primary,borderColor:$.border,textMuted:$.textMuted,iconSz:P.iconSz,onStep:Y}),e.jsxs("div",{className:x.tkx("relative flex-1 flex items-center overflow-hidden"),children:[xe&&pe&&e.jsx("span",{style:{position:"absolute",left:P.px,fontSize:P.fontSize,color:$.textMuted,pointerEvents:"none",userSelect:"none"},children:pe}),e.jsx("input",{id:T,type:"text",inputMode:"decimal",value:V?O:de,readOnly:M,disabled:g,"aria-invalid":W,"aria-describedby":ne,"aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":B,style:{width:"100%",height:"100%",border:"none",background:"transparent",outline:"none",textAlign:"center",fontSize:P.fontSize,fontFamily:"inherit",color:$.text,paddingLeft:xe&&pe?`calc(${P.px} + 1.2em)`:P.px,paddingRight:xe&&te?`calc(${P.px} + 1.2em)`:P.px,cursor:g?"not-allowed":M?"default":"text"},onFocus:se,onBlur:le,onChange:ge,onKeyDown:he,onWheel:ye}),xe&&te&&e.jsx("span",{style:{position:"absolute",right:P.px,fontSize:P.fontSize,color:$.textMuted,pointerEvents:"none",userSelect:"none"},children:te})]}),e.jsx(bn,{direction:"inc",isDisabled:g||M,btnW:P.btnW,height:P.height,primaryColor:$.primary,borderColor:$.border,textMuted:$.textMuted,iconSz:P.iconSz,onStep:Y})]}),ie&&!fe&&e.jsx("span",{id:E,className:x.tkx("text-xs"),style:{color:$.textMuted},children:ie}),fe&&e.jsxs("span",{id:C,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:$.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),fe]})]})}yr.displayName="TkxNumberInput";const _o={sm:{box:"36px",fontSize:"1rem",gap:"6px"},md:{box:"44px",fontSize:"1.25rem",gap:"8px"},lg:{box:"52px",fontSize:"1.5rem",gap:"10px"}},Yo={number:/^\d$/,alphanumeric:/^[a-zA-Z0-9]$/,alpha:/^[a-zA-Z]$/};function yn(t,n){return Yo[n].test(t)?t.toUpperCase():""}function kr({length:t=6,value:n,onChange:r,onComplete:o,type:s="number",mask:l=!1,autoFocus:a=!1,isDisabled:c=!1,isInvalid:d=!1,errorMessage:f,hint:u,size:h="md",separator:p,separatorPosition:m,className:y,style:k}){const b=_.useTheme(),g=i.useId(),M=`${g}-hint`,j=`${g}-error`,w=n!==void 0,I=W=>{const K=W.split("").slice(0,t);for(;K.length<t;)K.push("");return K},[v,N]=i.useState(()=>I(w?n:"")),$=w?I(n):v,S=i.useRef([]),T=_o[h],E=d||!!f,C=$.every(W=>W!==""),H=u?A.sanitizeString(u):void 0,z=f?A.sanitizeString(f):void 0,R=W=>E?b.danger:C?b.success:b.border;i.useEffect(()=>{var W;a&&((W=S.current[0])==null||W.focus())},[]);const B=i.useCallback(W=>{w||N(W);const K=W.join("");r==null||r(K),W.every(ne=>ne!=="")&&(o==null||o(K))},[w,r,o]),V=W=>{var ne;const K=Math.max(0,Math.min(t-1,W));(ne=S.current[K])==null||ne.focus()},D=W=>K=>{if(!c){if(K.key==="Backspace"){if(K.preventDefault(),$[W]!==""){const ne=[...$];ne[W]="",B(ne)}else if(W>0){const ne=[...$];ne[W-1]="",B(ne),V(W-1)}return}if(K.key==="Delete"){K.preventDefault();const ne=[...$];ne[W]="",B(ne);return}if(K.key==="ArrowLeft"){K.preventDefault(),V(W-1);return}if(K.key==="ArrowRight"){K.preventDefault(),V(W+1);return}if(K.key==="Home"){K.preventDefault(),V(0);return}if(K.key==="End"){K.preventDefault(),V(t-1);return}}},O=W=>K=>{if(c)return;const Z=K.target.value.slice(-1);if(!Z)return;const ie=yn(Z,s);if(!ie)return;const fe=[...$];fe[W]=ie,B(fe),W<t-1&&V(W+1)},L=W=>K=>{if(K.preventDefault(),c)return;const Z=K.clipboardData.getData("text").split("").map(pe=>yn(pe,s)).filter(Boolean);if(!Z.length)return;const ie=[...$];let fe=W;for(const pe of Z){if(fe>=t)break;ie[fe]=pe,fe++}B(ie),V(Math.min(fe,t-1))},P=[H&&M,E&&j].filter(Boolean).join(" ")||void 0;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-2 w-fit"),y),style:k,children:[e.jsx("div",{role:"group","aria-label":"One-time password","aria-describedby":P,className:x.tkx("flex items-center"),style:{gap:T.gap},children:Array.from({length:t},(W,K)=>{const ne=R();return typeof document<"u"&&(document.activeElement,S.current[K]),e.jsxs("div",{className:x.tkx("flex items-center"),style:{gap:T.gap},children:[p&&m===K&&K!==0&&e.jsx("span",{"aria-hidden":"true",style:{color:b.textMuted,userSelect:"none",flexShrink:0},children:p}),e.jsx("input",{ref:Z=>{S.current[K]=Z},type:l?"password":"text",inputMode:s==="number"?"numeric":"text",maxLength:1,value:$[K],disabled:c,"aria-label":`Digit ${K+1} of ${t}`,autoComplete:"one-time-code",spellCheck:!1,onChange:O(K),onKeyDown:D(K),onPaste:L(K),onFocus:Z=>Z.target.select(),style:{width:T.box,height:T.box,textAlign:"center",fontSize:T.fontSize,fontFamily:"monospace",fontWeight:600,border:`1.5px solid ${ne}`,borderRadius:"8px",backgroundColor:c?b.surfaceAlt:b.surface,color:b.text,outline:"none",boxShadow:"none",cursor:c?"not-allowed":"text",transition:"border-color 150ms ease, box-shadow 150ms ease",opacity:c?.6:1},onFocusCapture:Z=>{c||(Z.currentTarget.style.borderColor=E?b.danger:b.primary,Z.currentTarget.style.boxShadow=`0 0 0 3px ${E?b.danger:b.primary}33`)},onBlurCapture:Z=>{Z.currentTarget.style.borderColor=R(),Z.currentTarget.style.boxShadow="none"}})]},K)})}),H&&!z&&e.jsx("span",{id:M,className:x.tkx("text-xs"),style:{color:b.textMuted},children:H}),z&&e.jsxs("span",{id:j,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:b.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),z]})]})}kr.displayName="TkxOTP";function Ko(t,n){i.useEffect(()=>{if(!n)return;const r=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,n])}function Uo(t){const n=i.useRef(null);return i.useEffect(()=>{if(!t||!n.current)return;const r=n.current,o=r.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),s=o[0],l=o[o.length-1],a=c=>{c.key==="Tab"&&(c.shiftKey?document.activeElement===s&&(c.preventDefault(),l==null||l.focus()):document.activeElement===l&&(c.preventDefault(),s==null||s.focus()))};return r.addEventListener("keydown",a),()=>r.removeEventListener("keydown",a)},[t]),n}function Xo(){const[t,n]=i.useState(!1),r=i.useCallback(()=>n(!0),[]),o=i.useCallback(()=>n(!1),[]),s=i.useCallback(()=>n(l=>!l),[]);return{isOpen:t,open:r,close:o,toggle:s}}function Bt(t,n){if(!t)return{matched:!0,ranges:[],score:0};const r=t.toLowerCase(),o=n.toLowerCase(),s=o.indexOf(r);if(s!==-1)return{matched:!0,ranges:[[s,s+r.length-1]],score:s===0?100:80};const l=[];let a=0,c=-1,d=-1;for(let f=0;f<o.length&&a<r.length;f++)o[f]===r[a]&&((d===-1||f!==d+1)&&(c!==-1&&l.push([c,d]),c=f),d=f,a++);return c!==-1&&d!==-1&&l.push([c,d]),a<r.length?{matched:!1,ranges:[],score:0}:{matched:!0,ranges:l,score:40}}function Zo(t,n){if(!t.trim())return n.filter(o=>!o.disabled).map(o=>({item:o,score:0,labelRanges:[]}));const r=[];for(const o of n){if(o.disabled)continue;const s=Bt(t,o.label),l=o.description?Bt(t,o.description):{matched:!1,score:0},a=(o.keywords??[]).some(c=>Bt(t,c).matched);s.matched?r.push({item:o,score:s.score+20,labelRanges:s.ranges}):l.matched?r.push({item:o,score:l.score,labelRanges:[]}):a&&r.push({item:o,score:20,labelRanges:[]})}return r.sort((o,s)=>s.score-o.score)}function Go({text:t,ranges:n,color:r}){if(!n.length)return e.jsx(e.Fragment,{children:t});const o=[];let s=0;for(const[l,a]of n)s<l&&o.push(e.jsx("span",{children:t.slice(s,l)},`t-${s}`)),o.push(e.jsx("span",{style:{color:r,fontWeight:700},children:t.slice(l,a+1)},`h-${l}`)),s=a+1;return s<t.length&&o.push(e.jsx("span",{children:t.slice(s)},"t-end")),e.jsx(e.Fragment,{children:o})}function qo({surface:t,border:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:8,overflow:"hidden"},children:[e.jsx("div",{style:{width:24,height:24,borderRadius:6,background:`linear-gradient(90deg, ${n} 25%, ${t} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite",flexShrink:0}}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:5},children:[e.jsx("div",{style:{height:13,borderRadius:4,width:"60%",background:`linear-gradient(90deg, ${n} 25%, ${t} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite"}}),e.jsx("div",{style:{height:10,borderRadius:4,width:"40%",background:`linear-gradient(90deg, ${n} 25%, ${t} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out 0.2s infinite"}})]})]})}function vr({items:t,isOpen:n=!1,onClose:r,placeholder:o="Type a command or search…",emptyMessage:s,maxItems:l=8,onItemSelect:a,className:c,style:d}){const f=_.useTheme(),[u,h]=i.useState(""),[p,m]=i.useState(0),[y,k]=i.useState(!1),b=i.useRef(null),g=i.useRef(null),M=i.useId(),j=Uo(n),w=Zo(u,t).slice(0,l),I=[];for(const C of w){const H=C.item.group,z=I.find(R=>R.group===H);z?z.items.push(C):I.push({group:H,items:[C]})}const v=I.flatMap(C=>C.items);Ko(()=>{r==null||r()},n),i.useEffect(()=>{n&&(h(""),m(0),setTimeout(()=>{var C;return(C=b.current)==null?void 0:C.focus()},30))},[n]),i.useEffect(()=>{p>=v.length&&m(Math.max(0,v.length-1))},[v.length,p]);const N=i.useCallback(C=>{const H=g.current;if(!H)return;const z=H.querySelectorAll("[data-command-item]")[C];z==null||z.scrollIntoView({block:"nearest"})},[]),$=C=>{if(C.key==="ArrowDown"){C.preventDefault();const H=Math.min(v.length-1,p+1);m(H),N(H)}else if(C.key==="ArrowUp"){C.preventDefault();const H=Math.max(0,p-1);m(H),N(H)}else if(C.key==="Enter"){C.preventDefault();const H=v[p];H&&S(H.item)}},S=C=>{var H;C.disabled||((H=C.onSelect)==null||H.call(C),a==null||a(C),r==null||r())};if(!n||typeof document>"u")return null;const T=A.sanitizeString(o),E=s?A.sanitizeString(s):`No results for "${A.sanitizeString(u)}"`;if(typeof document<"u"&&!document.getElementById("tkx-shimmer-style")){const C=document.createElement("style");C.id="tkx-shimmer-style",C.textContent="@keyframes tkx-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }",document.head.appendChild(C)}return Le.createPortal(e.jsxs("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:1e4,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",paddingLeft:16,paddingRight:16},children:[e.jsx("div",{"aria-hidden":"true",onClick:r,style:{position:"absolute",inset:0,backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",animation:"tkx-fade-in 120ms ease"}}),e.jsxs("div",{ref:j,role:"dialog","aria-modal":"true","aria-label":"Command palette",id:M,className:x.cx(c),style:{position:"relative",zIndex:1,width:"100%",maxWidth:560,backgroundColor:f.surface,border:`1px solid ${f.border}`,borderRadius:16,boxShadow:`0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px ${f.border}`,overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"70vh",...d},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px",borderBottom:`1px solid ${f.border}`},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:f.textMuted,strokeWidth:2,"aria-hidden":"true",style:{flexShrink:0},children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:b,type:"text",role:"combobox","aria-expanded":!0,"aria-autocomplete":"list","aria-controls":`${M}-list`,"aria-activedescendant":v[p]?`${M}-item-${v[p].item.id}`:void 0,value:u,onChange:C=>{h(C.target.value),m(0)},onKeyDown:$,placeholder:T,style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:16,fontFamily:"inherit",color:f.text}}),u&&e.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>{var C;h(""),m(0),(C=b.current)==null||C.focus()},style:{border:"none",background:"transparent",cursor:"pointer",color:f.textMuted,display:"flex",alignItems:"center",padding:0},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("div",{id:`${M}-list`,ref:g,role:"listbox","aria-label":"Command results",style:{overflowY:"auto",flex:1,padding:"6px 8px"},children:y?Array.from({length:4},(C,H)=>e.jsx(qo,{surface:f.surface,border:f.border},H)):v.length===0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:"32px 16px",color:f.textMuted},children:[e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]}),e.jsx("span",{style:{fontSize:"0.875rem"},children:E})]}):I.map(({group:C,items:H},z)=>{const R=I.slice(0,z).reduce((B,V)=>B+V.items.length,0);return e.jsxs("div",{children:[C&&e.jsx("div",{role:"presentation",style:{fontSize:"0.6875rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:f.textMuted,padding:"10px 12px 4px"},children:A.sanitizeString(C)}),H.map((B,V)=>{const D=R+V,O=D===p,L=B.item;return e.jsxs("div",{id:`${M}-item-${L.id}`,role:"option","aria-selected":O,"aria-disabled":L.disabled,"data-command-item":!0,onClick:()=>S(L),onMouseEnter:()=>m(D),style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderRadius:8,cursor:L.disabled?"not-allowed":"pointer",opacity:L.disabled?.45:1,backgroundColor:O?`${f.primary}18`:"transparent",borderLeft:O?`2px solid ${f.primary}`:"2px solid transparent",transition:"background 80ms ease",userSelect:"none"},children:[L.icon&&e.jsx("span",{style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",color:O?f.primary:f.textMuted},children:L.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:"0.875rem",fontWeight:500,color:f.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.jsx(Go,{text:L.label,ranges:B.labelRanges,color:f.primary})}),L.description&&e.jsx("div",{style:{fontSize:"0.75rem",color:f.textMuted,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:A.sanitizeString(L.description)})]}),L.shortcut&&e.jsx("span",{style:{flexShrink:0,fontSize:"0.6875rem",fontWeight:500,color:f.textMuted,backgroundColor:f.surfaceAlt,border:`1px solid ${f.border}`,borderRadius:6,padding:"2px 6px",fontFamily:"monospace",letterSpacing:"0.04em"},children:A.sanitizeString(L.shortcut)})]},L.id)})]},C??"__default__")})}),v.length>0&&e.jsxs("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 16px",borderTop:`1px solid ${f.border}`,fontSize:"0.6875rem",color:f.textMuted},children:[e.jsxs("span",{children:[e.jsx("kbd",{style:{fontFamily:"monospace"},children:"↑↓"})," navigate"]}),e.jsxs("span",{children:[e.jsx("kbd",{style:{fontFamily:"monospace"},children:"↵"})," select"]}),e.jsxs("span",{children:[e.jsx("kbd",{style:{fontFamily:"monospace"},children:"Esc"})," close"]})]})]})]}),document.body)}vr.displayName="TkxCommand";function Tt({direction:t,onClick:n,isDisabled:r,primaryColor:o,position:s,orientation:l}){const a=l==="vertical",c=t==="prev",d=s==="inside"?{position:"absolute",zIndex:3,...a?{[c?"top":"bottom"]:10,left:"50%",transform:"translateX(-50%)"}:{[c?"left":"right"]:10,top:"50%",transform:"translateY(-50%)"}}:{flexShrink:0,position:"relative"};return e.jsx("button",{type:"button","aria-label":c?"Previous slide":"Next slide",disabled:r,onClick:n,style:{...d,width:36,height:36,borderRadius:"50%",border:"none",backgroundColor:"rgba(0,0,0,0.45)",backdropFilter:"blur(4px)",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:r?"not-allowed":"pointer",opacity:r?.35:1,transition:"background 150ms ease, opacity 150ms ease",outline:"none"},onFocus:f=>{f.currentTarget.style.boxShadow=`0 0 0 3px ${o}55`},onBlur:f=>{f.currentTarget.style.boxShadow="none"},onMouseEnter:f=>{r||(f.currentTarget.style.backgroundColor="rgba(0,0,0,0.65)")},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="rgba(0,0,0,0.45)"},children:a?c?e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"18 15 12 9 6 15"})}):e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}):c?e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}):e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})})}function wr({slides:t,autoPlay:n=!1,autoPlayInterval:r=4e3,pauseOnHover:o=!0,loop:s=!0,showArrows:l=!0,showDots:a=!0,showThumbnails:c=!1,orientation:d="horizontal",slidesToShow:f=1,gap:u=0,transitionDuration:h=400,swipeable:p=!0,initialIndex:m=0,onChange:y,arrowPosition:k="inside",height:b=320,className:g,style:M}){const j=_.useTheme(),w=Q.useReducedMotion(),I=i.useId(),v=t.length,[N,$]=i.useState(m),[S,T]=i.useState(s?m+1:m),[E,C]=i.useState(!1),[H,z]=i.useState(!1),R=i.useRef(null),B=i.useRef(null),V=i.useRef(null),D=i.useRef(0),O=i.useRef(!1),L=d==="vertical",P=w?0:h,W=s&&v>1?[t[v-1],...t,t[0]]:t,K=W.length,ne=100/f,Z=(G,ue=0)=>{const ke=ue!==0?` - ${ue}px`:"";return L?`translateY(calc(-${G*ne}%${ke}))`:`translateX(calc(-${G*ne}%${ke}))`},ie=i.useCallback((G,ue=!1)=>{const ke=s?(G%v+v)%v:Math.max(0,Math.min(v-1,G)),ve=s?ke+1:ke;ue&&R.current?(R.current.style.transition="none",T(ve),$(ke),R.current.offsetHeight,R.current.style.transition=""):(C(!0),T(ve),$(ke)),y==null||y(ke)},[v,s,y]),fe=i.useCallback(()=>ie(N-1),[N,ie]),pe=i.useCallback(()=>ie(N+1),[N,ie]),te=i.useCallback(()=>{C(!1),!(!s||v<=1)&&(S===0?ie(v-1,!0):S===K-1&&ie(0,!0))},[s,v,S,K,ie]);i.useEffect(()=>{if(!(!n||H||v<=1))return B.current=setInterval(pe,r),()=>{B.current&&clearInterval(B.current)}},[n,H,r,pe,v]),i.useEffect(()=>{const G=ue=>{const ke=document.activeElement,ve=document.getElementById(I);ve!=null&&ve.contains(ke)&&(ue.key===(L?"ArrowUp":"ArrowLeft")&&(ue.preventDefault(),fe()),ue.key===(L?"ArrowDown":"ArrowRight")&&(ue.preventDefault(),pe()))};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[I,L,fe,pe]);const ce=G=>"touches"in G?L?G.touches[0].clientY:G.touches[0].clientX:L?G.clientY:G.clientX,Y=G=>{p&&(V.current=ce(G),D.current=0,O.current=!0)},se=G=>{if(!O.current||V.current===null)return;const ue=ce(G)-V.current;D.current=ue,R.current&&(R.current.style.transition="none",R.current.style.transform=Z(S,-ue))},le=()=>{if(!O.current)return;O.current=!1;const G=D.current,ue=50;R.current&&(R.current.style.transition="",R.current.style.transform=""),G<-ue?pe():G>ue?fe():R.current&&(R.current.style.transform=Z(S)),V.current=null,D.current=0},ge=typeof b=="number"?`${b}px`:b,he={display:"flex",flexDirection:L?"column":"row",width:L?"100%":`${K/f*100}%`,height:L?`${K/f*100}%`:"100%",transform:Z(S),transition:E||!w?`transform ${P}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none",willChange:"transform",gap:u>0?u:void 0},ye={flexShrink:0,width:L?"100%":`${ne/(K/f)}%`,height:L?`${ne/(K/f)}%`:"100%",overflow:"hidden",position:"relative"},de=s||N>0,xe=s||N<v-1,oe=k==="outside";return e.jsxs("div",{id:I,className:x.cx(x.tkx("flex flex-col gap-2"),g),style:M,"aria-roledescription":"carousel","aria-label":"Content carousel",children:[e.jsxs("div",{className:x.tkx("flex items-center gap-2"),style:{gap:oe&&l?8:0},children:[l&&oe&&e.jsx(Tt,{direction:"prev",onClick:fe,isDisabled:!de,primaryColor:j.primary,position:"outside",orientation:d}),e.jsxs("div",{style:{position:"relative",flex:1,overflow:"hidden",height:ge,borderRadius:12,cursor:p?O.current?"grabbing":"grab":"default",userSelect:"none"},onMouseEnter:()=>o&&z(!0),onMouseLeave:()=>{z(!1),le()},onTouchStart:Y,onTouchMove:se,onTouchEnd:le,onMouseDown:Y,onMouseMove:se,onMouseUp:le,"aria-live":"polite","aria-atomic":"false",children:[l&&!oe&&e.jsxs(e.Fragment,{children:[e.jsx(Tt,{direction:"prev",onClick:fe,isDisabled:!de,primaryColor:j.primary,position:"inside",orientation:d}),e.jsx(Tt,{direction:"next",onClick:pe,isDisabled:!xe,primaryColor:j.primary,position:"inside",orientation:d})]}),e.jsx("div",{ref:R,style:he,onTransitionEnd:te,children:W.map((G,ue)=>e.jsx("div",{style:ye,role:"group","aria-roledescription":"slide","aria-label":`Slide ${(ue-(s?1:0)+v)%v+1} of ${v}`,"aria-hidden":(ue-(s?1:0)+v)%v!==N,children:G.content},`${G.id}-${ue}`))}),a&&!c&&e.jsx("div",{"aria-label":"Slide indicators",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:6,zIndex:2},children:t.map((G,ue)=>e.jsx("button",{type:"button","aria-label":`Go to slide ${ue+1}`,"aria-current":ue===N?"true":void 0,onClick:()=>ie(ue),style:{width:ue===N?20:8,height:8,borderRadius:9999,border:"none",backgroundColor:ue===N?j.primary:"rgba(255,255,255,0.5)",cursor:"pointer",padding:0,transition:"width 250ms ease, background 250ms ease",outline:"none"},onFocus:ke=>{ke.currentTarget.style.boxShadow=`0 0 0 3px ${j.primary}66`},onBlur:ke=>{ke.currentTarget.style.boxShadow="none"}},G.id))})]}),l&&oe&&e.jsx(Tt,{direction:"next",onClick:pe,isDisabled:!xe,primaryColor:j.primary,position:"outside",orientation:d})]}),c&&e.jsx("div",{role:"tablist","aria-label":"Slide thumbnails",style:{display:"flex",gap:6,overflowX:"auto",paddingBottom:4,scrollbarWidth:"thin"},children:t.map((G,ue)=>e.jsxs("button",{type:"button",role:"tab","aria-selected":ue===N,"aria-label":`Thumbnail for slide ${ue+1}`,onClick:()=>ie(ue),style:{flexShrink:0,width:60,height:42,border:`2px solid ${ue===N?j.primary:j.border}`,borderRadius:6,overflow:"hidden",cursor:"pointer",padding:0,background:j.surfaceAlt,transition:"border-color 150ms ease",outline:"none",position:"relative"},onFocus:ke=>{ke.currentTarget.style.boxShadow=`0 0 0 3px ${j.primary}55`},onBlur:ke=>{ke.currentTarget.style.boxShadow="none"},children:[G.thumbnail?e.jsx("img",{src:G.thumbnail,alt:"","aria-hidden":"true",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.625rem",color:j.textMuted,fontWeight:600},children:ue+1}),ue===N&&e.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:`${j.primary}22`}})]},G.id))})]})}wr.displayName="TkxCarousel";function Qo({color:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M6 3l5 5-5 5",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Jo({onClick:t,bgColor:n,hoverColor:r,textColor:o}){const s=l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t())};return e.jsx("button",{type:"button",onClick:t,onKeyDown:s,"aria-label":"Show hidden breadcrumb items",className:x.tkx("inline-flex items-center justify-center rounded px-1.5 py-0.5","text-sm font-medium cursor-pointer border-none outline-none","focus-visible:ring-2 focus-visible:ring-offset-1"),style:{backgroundColor:n,color:o,transition:"background-color 150ms ease"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=r},onMouseLeave:l=>{l.currentTarget.style.backgroundColor=n},children:"…"})}function ei({items:t,separator:n,maxItems:r,onNavigate:o,className:s,style:l}){const a=_.useTheme(),c=Q.useReducedMotion(),d=r!==void 0&&r>1&&t.length>r,u=i.useCallback(()=>{if(!d||!r)return t.map((N,$)=>({item:N,originalIndex:$}));const j=Math.ceil((r-1)/2),w=r-1-j,I=t.slice(0,j).map((N,$)=>({item:N,originalIndex:$})),v=t.slice(t.length-w).map((N,$)=>({item:N,originalIndex:t.length-w+$}));return I.concat(v)},[t,r,d])(),h=d&&r?Math.ceil((r-1)/2):-1,p=(j,w)=>{o==null||o(j,w)},m=(j,w,I)=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),p(w,I))},y=c?{}:{transition:"color 150ms ease, background-color 150ms ease"},k=j=>e.jsx("li",{role:"presentation","aria-hidden":"true",className:x.tkx("flex items-center mx-1.5"),children:n??e.jsx(Qo,{color:a.textMuted})},j),b=(j,w,I)=>{const v=A.sanitizeString(j.label);if(I)return e.jsx("li",{children:e.jsxs("span",{"aria-current":"page",className:x.tkx("inline-flex items-center gap-1.5 text-sm font-medium"),style:{color:a.text},children:[j.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:j.icon}),v]})},`item-${w}`);const N=!!j.href,$={color:a.textMuted,textDecoration:"none",...y},S={onMouseEnter:E=>{E.currentTarget.style.color=a.primary},onMouseLeave:E=>{E.currentTarget.style.color=a.textMuted}},T=e.jsxs(e.Fragment,{children:[j.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:j.icon}),v]});return N?e.jsx("li",{children:e.jsx("a",{href:j.href,onClick:E=>{o&&(E.preventDefault(),p(j,w))},className:x.tkx("inline-flex items-center gap-1.5 text-sm rounded","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:{...$,focusRingColor:a.primary},...S,children:T})},`item-${w}`):e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>p(j,w),onKeyDown:E=>m(E,j,w),className:x.tkx("inline-flex items-center gap-1.5 text-sm rounded","border-none bg-transparent cursor-pointer p-0","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:$,...S,children:T})},`item-${w}`)},g=[];let M=!1;for(let j=0;j<u.length;j++){const{item:w,originalIndex:I}=u[j],v=I===t.length-1;d&&!M&&j===h&&(g.length>0&&g.push(k("sep-ellipsis-before")),g.push(e.jsx("li",{role:"presentation",children:e.jsx(Jo,{onClick:()=>{},bgColor:a.surfaceAlt,hoverColor:a.surface,textColor:a.textMuted})},"ellipsis")),M=!0),g.length>0&&g[g.length-1]!==null&&g.push(k(`sep-${I}`)),g.push(b(w,I,v))}return e.jsx("nav",{"aria-label":"Breadcrumb",className:x.tkx("font-sans",s??""),style:{...l},children:e.jsx("ol",{role:"list",className:x.tkx("flex items-center flex-wrap list-none m-0 p-0"),children:g})})}const He=8,it=8;function ti(t,n,r){const o=n.getBoundingClientRect(),s=window.scrollX,l=window.scrollY,a=window.innerWidth,c=window.innerHeight;let d=0,f=0,u=r;const h={top:t.top-o.height-it-He>0,bottom:t.bottom+o.height+it+He<c,left:t.left-o.width-it-He>0,right:t.right+o.width+it+He<a};if(!h[r]){const m={top:"bottom",bottom:"top",left:"right",right:"left"};h[m[r]]&&(u=m[r])}switch(u){case"top":d=t.top+l-o.height-it-He,f=t.left+s+t.width/2-o.width/2;break;case"bottom":d=t.bottom+l+it+He,f=t.left+s+t.width/2-o.width/2;break;case"left":d=t.top+l+t.height/2-o.height/2,f=t.left+s-o.width-it-He;break;case"right":d=t.top+l+t.height/2-o.height/2,f=t.right+s+it+He;break}f=Math.max(8,Math.min(f,a+s-o.width-8)),d=Math.max(8,Math.min(d,c+l-o.height-8));const p={position:"absolute",width:0,height:0,borderStyle:"solid",borderWidth:He};switch(u){case"top":Object.assign(p,{bottom:-He*2,left:"50%",transform:"translateX(-50%)",borderColor:"var(--tkx-popover-bg) transparent transparent transparent"});break;case"bottom":Object.assign(p,{top:-He*2,left:"50%",transform:"translateX(-50%)",borderColor:"transparent transparent var(--tkx-popover-bg) transparent"});break;case"left":Object.assign(p,{right:-He*2,top:"50%",transform:"translateY(-50%)",borderColor:"transparent transparent transparent var(--tkx-popover-bg)"});break;case"right":Object.assign(p,{left:-He*2,top:"50%",transform:"translateY(-50%)",borderColor:"transparent var(--tkx-popover-bg) transparent transparent"});break}return{top:d,left:f,arrowStyle:p,resolvedPlacement:u}}function ni({trigger:t,content:n,placement:r="bottom",isOpen:o,onOpenChange:s,closeOnClickOutside:l=!0,className:a,style:c}){const d=_.useTheme(),f=Q.useReducedMotion(),u=i.useId(),h=o!==void 0,[p,m]=i.useState(!1),y=h?o:p,k=i.useRef(null),b=i.useRef(null);i.useRef(null);const[g,M]=i.useState(null),j=i.useCallback($=>{h||m($),s==null||s($)},[h,s]),w=i.useCallback(()=>j(!1),[j]),I=i.useCallback(()=>j(!y),[j,y]);Q.useEscapeKey(w,y),i.useEffect(()=>{if(!y||!l)return;const $=S=>{var E,C;const T=S.target;(E=k.current)!=null&&E.contains(T)||(C=b.current)!=null&&C.contains(T)||w()};return document.addEventListener("pointerdown",$),()=>document.removeEventListener("pointerdown",$)},[y,l,w]),i.useEffect(()=>{if(!y||!k.current)return;const $=()=>{if(!k.current||!b.current)return;const S=k.current.getBoundingClientRect();M(ti(S,b.current,r))};return requestAnimationFrame($),window.addEventListener("scroll",$,!0),window.addEventListener("resize",$),()=>{window.removeEventListener("scroll",$,!0),window.removeEventListener("resize",$)}},[y,r]);const v=f?{opacity:1}:{animation:"tkxPopoverFadeIn 150ms ease forwards",opacity:0},N=y&&typeof document<"u"?Le.createPortal(e.jsxs("div",{ref:b,id:u,role:"dialog","aria-modal":"false",className:x.tkx("absolute z-[9100] rounded-lg font-sans",a??""),style:{"--tkx-popover-bg":d.surface,top:(g==null?void 0:g.top)??-9999,left:(g==null?void 0:g.left)??-9999,backgroundColor:d.surface,border:`1px solid ${d.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",minWidth:200,maxWidth:420,padding:"12px 16px",color:d.text,...v,...c},children:[g&&e.jsx("span",{style:g.arrowStyle,"aria-hidden":"true"}),n]}),document.body):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:k,className:x.tkx("inline-flex"),onClick:I,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),I())},"aria-expanded":y,"aria-haspopup":"dialog","aria-controls":y?u:void 0,children:t}),N,y&&!f&&e.jsx("style",{children:`
|
|
68
68
|
@keyframes tkxPopoverFadeIn {
|
|
69
69
|
from { opacity: 0; transform: translateY(4px); }
|
|
70
70
|
to { opacity: 1; transform: translateY(0); }
|
|
71
71
|
}
|
|
72
|
-
`})]})}function
|
|
72
|
+
`})]})}function ri(t,n){if(!n)return!0;const r=n.toLowerCase(),o=t.label.toLowerCase();let s=0;for(let l=0;l<o.length&&s<r.length;l++)o[l]===r[s]&&s++;return s===r.length}function si(t,n){const r=t.getBoundingClientRect(),o=4,s=window.innerHeight-r.bottom,l=r.top,a=s>=n+o||s>=l?"below":"above";return{top:a==="below"?r.bottom+window.scrollY+o:r.top+window.scrollY-n-o,left:r.left+window.scrollX,width:r.width,placement:a}}function kn({color:t}){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{animation:"spin 0.8s linear infinite",flexShrink:0},children:[e.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"2",opacity:"0.3"}),e.jsx("path",{d:"M14 8a6 6 0 00-6-6",stroke:t,strokeWidth:"2",strokeLinecap:"round"})]})}const vn=280;function oi({options:t,value:n,onChange:r,onInputChange:o,placeholder:s="",label:l,isLoading:a=!1,emptyMessage:c="No results found",filterFn:d,freeSolo:f=!1,className:u,style:h}){const p=_.useTheme(),m=Q.useReducedMotion(),y=i.useId(),k=i.useId(),b=i.useRef(null),g=i.useRef(null),[M,j]=i.useState(""),[w,I]=i.useState(!1),[v,N]=i.useState(-1),[$,S]=i.useState(null);i.useEffect(()=>{if(n!==void 0){const L=t.find(P=>P.value===n);j(L?L.label:n)}},[n,t]);const T=d??ri,E=i.useMemo(()=>w?t.filter(L=>T(L,M)):[],[t,M,w,T]),C=A.sanitizeString(l),H=A.sanitizeString(c);i.useEffect(()=>{if(!w||!g.current)return;const L=()=>{g.current&&S(si(g.current,vn))};return L(),window.addEventListener("scroll",L,!0),window.addEventListener("resize",L),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",L)}},[w]),i.useEffect(()=>{if(!w)return;const L=P=>{var ne;const W=P.target;if((ne=g.current)!=null&&ne.contains(W))return;const K=document.getElementById(k);K!=null&&K.contains(W)||I(!1)};return document.addEventListener("pointerdown",L),()=>document.removeEventListener("pointerdown",L)},[w,k]),Q.useEscapeKey(()=>I(!1),w);const z=i.useCallback(L=>{var P;L.disabled||(j(L.label),r==null||r(L.value),I(!1),N(-1),(P=b.current)==null||P.focus())},[r]),R=L=>{const P=L.target.value;j(P),o==null||o(P),w||I(!0),N(-1),f&&(r==null||r(P))},B=L=>{if(!w&&(L.key==="ArrowDown"||L.key==="ArrowUp")){I(!0);return}switch(L.key){case"ArrowDown":{L.preventDefault(),N(P=>{let W=P+1;for(;W<E.length&&E[W].disabled;)W++;return W<E.length?W:P});break}case"ArrowUp":{L.preventDefault(),N(P=>{let W=P-1;for(;W>=0&&E[W].disabled;)W--;return W>=0?W:P});break}case"Enter":{L.preventDefault(),v>=0&&v<E.length?z(E[v]):f&&M&&(r==null||r(M),I(!1));break}case"Escape":{I(!1),N(-1);break}}};i.useEffect(()=>{var P;if(v<0)return;const L=`${k}-opt-${v}`;(P=document.getElementById(L))==null||P.scrollIntoView({block:"nearest"})},[v,k]);const V=v>=0?`${k}-opt-${v}`:void 0,D=m?{}:{animation:"tkxAutoFadeIn 120ms ease forwards"},O=w&&typeof document<"u"&&$?Le.createPortal(e.jsx("ul",{id:k,role:"listbox","aria-label":C,className:x.tkx("absolute z-[9200] list-none m-0 p-1 rounded-lg overflow-y-auto font-sans"),style:{top:$.top,left:$.left,width:$.width,maxHeight:vn,backgroundColor:p.surface,border:`1px solid ${p.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",...D},children:a?e.jsxs("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:x.tkx("flex items-center gap-2 px-3 py-2 text-sm"),style:{color:p.textMuted},children:[e.jsx(kn,{color:p.primary}),"Loading..."]}):E.length===0?e.jsx("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:x.tkx("px-3 py-2 text-sm text-center"),style:{color:p.textMuted},children:H}):E.map((L,P)=>{const W=P===v,K=A.sanitizeString(L.label),ne=L.description?A.sanitizeString(L.description):null;return e.jsxs("li",{id:`${k}-opt-${P}`,role:"option","aria-selected":L.value===n,"aria-disabled":L.disabled||void 0,className:x.tkx("flex items-center gap-2 px-3 py-2 text-sm rounded-md cursor-pointer",L.disabled?"opacity-50 cursor-not-allowed":""),style:{backgroundColor:W?p.surfaceAlt:"transparent",color:L.disabled?p.textMuted:p.text,transition:m?"none":"background-color 100ms ease"},onMouseEnter:()=>!L.disabled&&N(P),onMouseDown:Z=>{Z.preventDefault(),z(L)},children:[L.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:L.icon}),e.jsxs("span",{className:x.tkx("flex flex-col min-w-0"),children:[e.jsx("span",{className:x.tkx("truncate"),children:K}),ne&&e.jsx("span",{className:x.tkx("text-xs truncate"),style:{color:p.textMuted},children:ne})]}),L.value===n&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:x.tkx("ml-auto flex-shrink-0"),children:e.jsx("path",{d:"M3 8l3.5 3.5L13 5",stroke:p.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},L.value)})}),document.body):null;return e.jsxs("div",{ref:g,className:x.tkx("relative font-sans",u??""),style:h,children:[e.jsx("label",{htmlFor:y,className:x.tkx("block text-sm font-medium mb-1.5"),style:{color:p.text},children:C}),e.jsxs("div",{className:x.tkx("relative flex items-center"),style:{backgroundColor:p.surface,border:`1px solid ${w?p.primary:p.border}`,borderRadius:8,transition:m?"none":"border-color 150ms ease"},children:[e.jsx("input",{ref:b,id:y,type:"text",role:"combobox","aria-expanded":w,"aria-controls":k,"aria-activedescendant":V,"aria-autocomplete":"list","aria-label":C,value:M,placeholder:s,onChange:R,onFocus:()=>I(!0),onKeyDown:B,className:x.tkx("w-full bg-transparent border-none outline-none text-sm py-2.5 px-3","placeholder:opacity-50"),style:{color:p.text}}),a&&e.jsx("span",{className:x.tkx("pr-3"),children:e.jsx(kn,{color:p.primary})})]}),O,w&&!m&&e.jsx("style",{children:`
|
|
73
73
|
@keyframes tkxAutoFadeIn {
|
|
74
74
|
from { opacity: 0; transform: translateY(4px); }
|
|
75
75
|
to { opacity: 1; transform: translateY(0); }
|
|
76
76
|
}
|
|
77
|
-
`})]})}function Ii(t,r){const n=[];function i(o,l){var c;for(const d of o)n.push({node:d,depth:l}),(c=d.children)!=null&&c.length&&r.has(d.id)&&i(d.children,l+1)}return i(t,0),n}function Ei({expanded:t,color:r,reducedMotion:n}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:n?"none":"transform 150ms ease",flexShrink:0},children:e.jsx("path",{d:"M6 3l5 5-5 5",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ni({checked:t,color:r,borderColor:n}){return e.jsx("span",{role:"presentation","aria-hidden":"true",className:s.tkx("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${t?r:n}`,backgroundColor:t?r:"transparent",transition:"all 100ms ease"},children:t&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}const kr=24;function Ri({data:t,selected:r,onSelect:n,expanded:i,onExpand:o,multiSelect:l=!1,showCheckboxes:c=!1,showLines:d=!1,className:u,style:x}){const f=B.useTheme(),m=s.useReducedMotion();a.useId();const[p,h]=a.useState([]),[y,k]=a.useState([]),b=new Set(r??p),g=new Set(i??y),w=a.useCallback(E=>{i===void 0&&k(E),o==null||o(E)},[i,o]),j=a.useCallback(E=>{r===void 0&&h(E),n==null||n(E)},[r,n]),S=a.useCallback(E=>{const $=Array.from(g);g.has(E)?w($.filter(F=>F!==E)):w([...$,E])},[g,w]),z=a.useCallback(E=>{if(l){const $=Array.from(b);b.has(E)?j($.filter(F=>F!==E)):j([...$,E])}else j(b.has(E)?[]:[E])},[l,b,j]),v=Ii(t,g),N=a.useRef(0),C=a.useRef(new Map),M=E=>{var $;N.current=E,($=C.current.get(E))==null||$.focus()},T=(E,$)=>{var L;const F=v[$];if(!F)return;const{node:I}=F,W=(((L=I.children)==null?void 0:L.length)??0)>0;switch(E.key){case"ArrowDown":{E.preventDefault(),$<v.length-1&&M($+1);break}case"ArrowUp":{E.preventDefault(),$>0&&M($-1);break}case"ArrowRight":{E.preventDefault(),W&&!g.has(I.id)?S(I.id):W&&g.has(I.id)&&$<v.length-1&&M($+1);break}case"ArrowLeft":{if(E.preventDefault(),W&&g.has(I.id))S(I.id);else for(let Y=$-1;Y>=0;Y--)if(v[Y].depth<F.depth){M(Y);break}break}case"Enter":case" ":{E.preventDefault(),I.disabled||z(I.id);break}case"Home":{E.preventDefault(),M(0);break}case"End":{E.preventDefault(),M(v.length-1);break}}};return e.jsx("ul",{role:"tree","aria-label":"Tree view","aria-multiselectable":l||void 0,className:s.tkx("list-none m-0 p-0 font-sans select-none",u??""),style:{color:f.text,...x},children:v.map(({node:E,depth:$},F)=>{var D;const I=(((D=E.children)==null?void 0:D.length)??0)>0,W=g.has(E.id),L=b.has(E.id),Y=s.sanitizeString(E.label);return e.jsxs("li",{role:"treeitem","aria-selected":L,"aria-expanded":I?W:void 0,"aria-disabled":E.disabled||void 0,"aria-level":$+1,"aria-setsize":v.filter(V=>V.depth===$).length,tabIndex:F===0?0:-1,ref:V=>{V?C.current.set(F,V):C.current.delete(F)},onKeyDown:V=>T(V,F),onClick:()=>{E.disabled||(I&&S(E.id),z(E.id))},className:s.tkx("relative flex items-center gap-1.5 py-1 px-2 rounded-md cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",E.disabled?"opacity-50 cursor-not-allowed":""),style:{paddingLeft:$*kr+8,backgroundColor:L?`${f.primary}18`:"transparent",transition:m?"none":"background-color 100ms ease",minHeight:32},onMouseEnter:V=>{!L&&!E.disabled&&(V.currentTarget.style.backgroundColor=f.surfaceAlt)},onMouseLeave:V=>{V.currentTarget.style.backgroundColor=L?`${f.primary}18`:"transparent"},children:[d&&$>0&&e.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:($-1)*kr+16,top:0,bottom:0,width:1,backgroundColor:f.border}}),I?e.jsx("span",{role:"presentation",onClick:V=>{V.stopPropagation(),S(E.id)},className:s.tkx("inline-flex items-center justify-center cursor-pointer"),style:{width:20,height:20},children:e.jsx(Ei,{expanded:W,color:f.textMuted,reducedMotion:m})}):e.jsx("span",{style:{width:20,height:20},"aria-hidden":"true"}),c&&e.jsx(Ni,{checked:L,color:f.primary,borderColor:f.border}),E.icon&&e.jsx("span",{"aria-hidden":"true",className:s.tkx("flex-shrink-0"),children:E.icon}),e.jsx("span",{className:s.tkx("text-sm truncate"),style:{color:E.disabled?f.textMuted:f.text},children:Y})]},E.id)})})}const Li={sm:{buttonPx:6,buttonPy:4,fontSize:12,iconSize:14,gap:2,separatorSize:16},md:{buttonPx:8,buttonPy:6,fontSize:13,iconSize:16,gap:4,separatorSize:20},lg:{buttonPx:12,buttonPy:8,fontSize:14,iconSize:18,gap:6,separatorSize:24}};function Di({items:t,orientation:r="horizontal",size:n="md",variant:i="default",ariaLabel:o="Toolbar",className:l,style:c}){const d=B.useTheme(),u=s.useReducedMotion(),x=Li[n],f=r==="horizontal",m=a.useRef(new Map),p=t.filter(g=>g.type!=="separator"&&!g.disabled).map(g=>g.id),h=a.useCallback(g=>{var w;(w=m.current.get(g))==null||w.focus()},[]),y=a.useCallback((g,w)=>{const j=p.indexOf(w);if(j<0)return;const S=f?"ArrowRight":"ArrowDown",z=f?"ArrowLeft":"ArrowUp";switch(g.key){case S:{g.preventDefault();const v=j+1<p.length?j+1:0;h(p[v]);break}case z:{g.preventDefault();const v=j-1>=0?j-1:p.length-1;h(p[v]);break}case"Home":{g.preventDefault(),h(p[0]);break}case"End":{g.preventDefault(),h(p[p.length-1]);break}}},[p,h,f]),k=()=>{switch(i){case"outlined":return{backgroundColor:"transparent",border:`1px solid ${d.border}`};case"filled":return{backgroundColor:d.surfaceAlt,border:"none"};default:return{backgroundColor:d.surface,border:`1px solid ${d.border}`}}},b=g=>{g.type;const w=g.active;return{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,padding:`${x.buttonPy}px ${x.buttonPx}px`,fontSize:x.fontSize,borderRadius:6,border:"none",cursor:g.disabled?"not-allowed":"pointer",backgroundColor:w?`${d.primary}20`:"transparent",color:w?d.primary:g.disabled?d.textMuted:d.text,opacity:g.disabled?.5:1,outline:"none",transition:u?"none":"all 100ms ease",whiteSpace:"nowrap",lineHeight:1}};return e.jsx("div",{role:"toolbar","aria-label":o,"aria-orientation":r,className:s.tkx("inline-flex items-center rounded-lg font-sans",f?"flex-row":"flex-col",l??""),style:{...k(),padding:x.gap,gap:x.gap,...c},children:t.map((g,w)=>{if(g.type==="separator")return e.jsx("div",{role:"separator","aria-orientation":f?"vertical":"horizontal",className:s.tkx("flex-shrink-0"),style:{...f?{width:1,height:x.separatorSize,marginLeft:2,marginRight:2}:{height:1,width:x.separatorSize,marginTop:2,marginBottom:2},backgroundColor:d.border}},g.id);const j=s.sanitizeString(g.label),S=!g.disabled,z=p[0]===g.id;return e.jsxs("button",{ref:v=>{v?m.current.set(g.id,v):m.current.delete(g.id)},type:"button",role:(g.type==="toggle",void 0),"aria-pressed":g.type==="toggle"?g.active:void 0,"aria-label":j,"aria-disabled":g.disabled||void 0,tabIndex:S&&z?0:-1,disabled:g.disabled,onClick:()=>{var v;g.disabled||(v=g.onClick)==null||v.call(g)},onKeyDown:v=>{var N;y(v,g.id),(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),g.disabled||(N=g.onClick)==null||N.call(g))},className:s.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:b(g),onMouseEnter:v=>{!g.disabled&&!g.active&&(v.currentTarget.style.backgroundColor=d.surfaceAlt)},onMouseLeave:v=>{g.disabled||(v.currentTarget.style.backgroundColor=g.active?`${d.primary}20`:"transparent")},children:[g.icon&&e.jsx("span",{"aria-hidden":"true",style:{width:x.iconSize,height:x.iconSize,display:"flex",alignItems:"center",justifyContent:"center"},children:g.icon}),!g.icon&&j]},g.id)})})}function Ai({color:t}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:t,strokeWidth:"1.5"}),e.jsx("path",{d:"M9.5 9.5L13 13",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"})]})}function vr({checked:t,primaryColor:r,borderColor:n}){return e.jsx("span",{"aria-hidden":"true",className:s.tkx("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${t?r:n}`,backgroundColor:t?r:"transparent",transition:"all 100ms ease"},children:t&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Pi({color:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 8h10M9 4l4 4-4 4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Bi({color:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M13 8H3M7 4l-4 4 4 4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function wr({title:t,items:r,selected:n,onToggle:i,onToggleAll:o,search:l,onSearchChange:c,searchable:d,height:u,listId:x}){const f=B.useTheme(),m=s.useReducedMotion(),p=s.sanitizeString(t),h=a.useMemo(()=>{if(!l)return r;const g=l.toLowerCase();return r.filter(w=>w.label.toLowerCase().includes(g))},[r,l]),y=h.filter(g=>!g.disabled),k=y.length>0&&y.every(g=>n.has(g.value));y.some(g=>n.has(g.value));const b=(g,w)=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),i(w))};return e.jsxs("div",{className:s.tkx("flex flex-col rounded-lg overflow-hidden flex-1 min-w-0"),style:{border:`1px solid ${f.border}`,backgroundColor:f.surface},children:[e.jsxs("div",{className:s.tkx("flex items-center gap-2 px-3 py-2 border-b"),style:{borderColor:f.border,backgroundColor:f.surfaceAlt},children:[e.jsx("button",{type:"button","aria-label":k?`Deselect all ${p}`:`Select all ${p}`,onClick:o,className:s.tkx("border-none bg-transparent cursor-pointer p-0 outline-none focus-visible:ring-2"),children:e.jsx(vr,{checked:k,primaryColor:f.primary,borderColor:f.border})}),e.jsx("span",{className:s.tkx("text-sm font-medium flex-1 truncate"),style:{color:f.text},children:p}),e.jsxs("span",{className:s.tkx("text-xs"),style:{color:f.textMuted},children:[n.size,"/",r.length]})]}),d&&e.jsxs("div",{className:s.tkx("flex items-center gap-1.5 px-3 py-1.5 border-b"),style:{borderColor:f.border},children:[e.jsx(Ai,{color:f.textMuted}),e.jsx("input",{type:"text","aria-label":`Search ${p}`,value:l,onChange:g=>c(g.target.value),placeholder:"Search...",className:s.tkx("flex-1 bg-transparent border-none outline-none text-xs"),style:{color:f.text}})]}),e.jsx("ul",{id:x,role:"listbox","aria-label":p,"aria-multiselectable":"true",className:s.tkx("list-none m-0 p-1 overflow-y-auto"),style:{height:u,minHeight:100},children:h.length===0?e.jsx("li",{className:s.tkx("text-xs text-center py-4"),style:{color:f.textMuted},"aria-disabled":"true",children:"No items"}):h.map(g=>{const w=n.has(g.value),j=s.sanitizeString(g.label);return e.jsxs("li",{role:"option","aria-selected":w,"aria-disabled":g.disabled||void 0,tabIndex:0,onClick:()=>!g.disabled&&i(g.value),onKeyDown:S=>!g.disabled&&b(S,g.value),className:s.tkx("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",g.disabled?"opacity-50 cursor-not-allowed":""),style:{color:g.disabled?f.textMuted:f.text,backgroundColor:w?`${f.primary}10`:"transparent",transition:m?"none":"background-color 100ms ease"},onMouseEnter:S=>{!g.disabled&&!w&&(S.currentTarget.style.backgroundColor=f.surfaceAlt)},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=w?`${f.primary}10`:"transparent"},children:[e.jsx(vr,{checked:w,primaryColor:f.primary,borderColor:f.border}),e.jsx("span",{className:s.tkx("truncate"),children:j})]},g.value)})})]})}function Fi({sourceItems:t,targetItems:r,onTransfer:n,sourceTitle:i="Available",targetTitle:o="Selected",searchable:l=!1,height:c=300,className:d,style:u}){const x=B.useTheme(),f=s.useReducedMotion(),m=a.useId(),p=a.useId(),[h,y]=a.useState(new Set),[k,b]=a.useState(new Set),[g,w]=a.useState(""),[j,S]=a.useState(""),z=a.useCallback($=>{y(F=>{const I=new Set(F);return I.has($)?I.delete($):I.add($),I})},[]),v=a.useCallback($=>{b(F=>{const I=new Set(F);return I.has($)?I.delete($):I.add($),I})},[]),N=a.useCallback(()=>{const $=t.filter(I=>!I.disabled).map(I=>I.value),F=$.every(I=>h.has(I));y(F?new Set:new Set($))},[t,h]),C=a.useCallback(()=>{const $=r.filter(I=>!I.disabled).map(I=>I.value),F=$.every(I=>k.has(I));b(F?new Set:new Set($))},[r,k]),M=a.useCallback(()=>{if(h.size===0)return;const $=t.filter(W=>h.has(W.value)&&!W.disabled),F=t.filter(W=>!h.has(W.value)||W.disabled),I=[...r,...$];n(F,I),y(new Set)},[t,r,h,n]),T=a.useCallback(()=>{if(k.size===0)return;const $=r.filter(W=>k.has(W.value)&&!W.disabled),F=r.filter(W=>!k.has(W.value)||W.disabled),I=[...t,...$];n(I,F),b(new Set)},[t,r,k,n]),E=$=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:8,border:`1px solid ${x.border}`,backgroundColor:$?x.surface:x.surfaceAlt,cursor:$?"not-allowed":"pointer",opacity:$?.5:1,transition:f?"none":"all 100ms ease",outline:"none"});return e.jsxs("div",{className:s.tkx("flex gap-3 font-sans","flex-col sm:flex-row",d??""),style:{color:x.text,...u},children:[e.jsx(wr,{title:i,items:t,selected:h,onToggle:z,onToggleAll:N,search:g,onSearchChange:w,searchable:l,height:c,listId:m}),e.jsxs("div",{className:s.tkx("flex items-center justify-center gap-2","flex-row sm:flex-col"),style:{padding:"8px 0"},children:[e.jsx("button",{type:"button","aria-label":"Move selected items to target list",disabled:h.size===0,onClick:M,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),M())},className:s.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:E(h.size===0),onMouseEnter:$=>{h.size>0&&($.currentTarget.style.backgroundColor=x.primary,$.currentTarget.style.borderColor=x.primary)},onMouseLeave:$=>{$.currentTarget.style.backgroundColor=h.size===0?x.surface:x.surfaceAlt,$.currentTarget.style.borderColor=x.border},children:e.jsx(Pi,{color:x.text})}),e.jsx("button",{type:"button","aria-label":"Move selected items to source list",disabled:k.size===0,onClick:T,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),T())},className:s.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:E(k.size===0),onMouseEnter:$=>{k.size>0&&($.currentTarget.style.backgroundColor=x.primary,$.currentTarget.style.borderColor=x.primary)},onMouseLeave:$=>{$.currentTarget.style.backgroundColor=k.size===0?x.surface:x.surfaceAlt,$.currentTarget.style.borderColor=x.border},children:e.jsx(Bi,{color:x.text})})]}),e.jsx(wr,{title:o,items:r,selected:k,onToggle:v,onToggleAll:C,search:j,onSearchChange:S,searchable:l,height:c,listId:p})]})}function Wi({color:t,rotated:r,reducedMotion:n}){return e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{transform:r?"rotate(45deg)":"rotate(0deg)",transition:n?"none":"transform 200ms ease"},children:e.jsx("path",{d:"M12 5v14M5 12h14",stroke:t,strokeWidth:"2.5",strokeLinecap:"round"})})}const Hi={"bottom-right":{bottom:24,right:24},"bottom-left":{bottom:24,left:24},"top-right":{top:24,right:24},"top-left":{top:24,left:24}};function Vi(t,r,n){const i=(r+1)*n;switch(t){case"up":return{bottom:i,left:"50%",transform:"translateX(-50%)"};case"down":return{top:i,left:"50%",transform:"translateX(-50%)"};case"left":return{right:i,top:"50%",transform:"translateY(-50%)"};case"right":return{left:i,top:"50%",transform:"translateY(-50%)"}}}function Oi(t){switch(t){case"up":case"down":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:10};case"left":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:10};case"right":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:10}}}const jr=56,Sr=48,_i=64;function Yi({actions:t,icon:r,direction:n="up",position:i="bottom-right",className:o,style:l}){const c=B.useTheme(),d=s.useReducedMotion(),u=a.useId(),[x,f]=a.useState(!1),[m,p]=a.useState(-1),h=a.useRef(null),y=a.useRef(new Map),k=a.useCallback(()=>{f(S=>!S),p(-1)},[]),b=a.useCallback(()=>{f(!1),p(-1)},[]);s.useEscapeKey(b,x),a.useEffect(()=>{if(!x)return;const S=z=>{var v;(v=h.current)!=null&&v.contains(z.target)||b()};return document.addEventListener("pointerdown",S),()=>document.removeEventListener("pointerdown",S)},[x,b]),a.useEffect(()=>{var S;m>=0&&((S=y.current.get(m))==null||S.focus())},[m]);const g=S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),k()),x&&((S.key==="ArrowUp"||S.key==="ArrowLeft")&&(S.preventDefault(),p(0)),(S.key==="ArrowDown"||S.key==="ArrowRight")&&(S.preventDefault(),p(0)))},w=(S,z)=>{var v,N;switch(S.key){case"ArrowUp":case"ArrowLeft":{S.preventDefault(),p(z>0?z-1:t.length-1);break}case"ArrowDown":case"ArrowRight":{S.preventDefault(),p(z<t.length-1?z+1:0);break}case"Enter":case" ":{S.preventDefault(),(N=(v=t[z]).onClick)==null||N.call(v),b();break}case"Escape":{b();break}case"Home":{S.preventDefault(),p(0);break}case"End":{S.preventDefault(),p(t.length-1);break}}},j=S=>d?"0ms":`${S*40}ms`;return e.jsxs(e.Fragment,{children:[x&&typeof document<"u"&&Le.createPortal(e.jsx("div",{"aria-hidden":"true",onClick:b,style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.3)",zIndex:9e3,transition:d?"none":"opacity 200ms ease"}}),document.body),e.jsxs("div",{ref:h,className:s.tkx("fixed z-[9100] font-sans",o??""),style:{...Hi[i],...l},children:[x&&t.map((S,z)=>{const v=s.sanitizeString(S.label),N=Vi(n,z,_i),C=Oi(n);return e.jsx("div",{className:s.tkx("absolute"),style:{...N,opacity:d?1:0,animation:d?"none":"tkxSpeedDialIn 180ms ease forwards",animationDelay:j(z)},children:e.jsxs("div",{className:s.tkx("relative inline-flex"),children:[e.jsx("span",{className:s.tkx("absolute z-10 whitespace-nowrap text-xs py-1 px-2 rounded-md pointer-events-none"),style:{...C,backgroundColor:c.surfaceAlt,color:c.text,border:`1px solid ${c.border}`,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},role:"tooltip",children:v}),e.jsx("button",{ref:M=>{M?y.current.set(z,M):y.current.delete(z)},type:"button","aria-label":v,tabIndex:x?0:-1,onClick:()=>{var M;(M=S.onClick)==null||M.call(S),b()},onKeyDown:M=>w(M,z),className:s.tkx("inline-flex items-center justify-center rounded-full border-none cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-2","shadow-lg"),style:{width:Sr,height:Sr,backgroundColor:c.surface,color:c.text,border:`1px solid ${c.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",transition:d?"none":"all 150ms ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=c.surfaceAlt,M.currentTarget.style.transform="scale(1.1)"},onMouseLeave:M=>{M.currentTarget.style.backgroundColor=c.surface,M.currentTarget.style.transform="scale(1)"},children:S.icon})]})},S.id)}),e.jsx("button",{type:"button","aria-label":x?"Close actions menu":"Open actions menu","aria-expanded":x,"aria-controls":u,"aria-haspopup":"true",onClick:k,onKeyDown:g,className:s.tkx("inline-flex items-center justify-center rounded-full border-none cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-2"),style:{width:jr,height:jr,backgroundColor:c.primary,color:c.bg,boxShadow:`0 6px 20px ${c.primary}40`,transition:d?"none":"all 200ms ease",position:"relative",zIndex:1},onMouseEnter:S=>{S.currentTarget.style.boxShadow=`0 8px 28px ${c.primary}60`,d||(S.currentTarget.style.transform="scale(1.05)")},onMouseLeave:S=>{S.currentTarget.style.boxShadow=`0 6px 20px ${c.primary}40`,S.currentTarget.style.transform="scale(1)"},children:r??e.jsx(Wi,{color:c.bg,rotated:x,reducedMotion:d})}),e.jsx("div",{id:u,role:"menu","aria-label":"Speed dial actions",style:{display:"none"},children:t.map(S=>e.jsx("div",{role:"menuitem",children:s.sanitizeString(S.label)},S.id))})]}),x&&!d&&e.jsx("style",{children:`
|
|
77
|
+
`})]})}function ii(t,n){const r=[];function o(s,l){var a;for(const c of s)r.push({node:c,depth:l}),(a=c.children)!=null&&a.length&&n.has(c.id)&&o(c.children,l+1)}return o(t,0),r}function li({expanded:t,color:n,reducedMotion:r}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:r?"none":"transform 150ms ease",flexShrink:0},children:e.jsx("path",{d:"M6 3l5 5-5 5",stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ai({checked:t,color:n,borderColor:r}){return e.jsx("span",{role:"presentation","aria-hidden":"true",className:x.tkx("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${t?n:r}`,backgroundColor:t?n:"transparent",transition:"all 100ms ease"},children:t&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}const wn=24;function ci({data:t,selected:n,onSelect:r,expanded:o,onExpand:s,multiSelect:l=!1,showCheckboxes:a=!1,showLines:c=!1,className:d,style:f}){const u=_.useTheme(),h=Q.useReducedMotion();i.useId();const[p,m]=i.useState([]),[y,k]=i.useState([]),b=new Set(n??p),g=new Set(o??y),M=i.useCallback(E=>{o===void 0&&k(E),s==null||s(E)},[o,s]),j=i.useCallback(E=>{n===void 0&&m(E),r==null||r(E)},[n,r]),w=i.useCallback(E=>{const C=Array.from(g);g.has(E)?M(C.filter(H=>H!==E)):M([...C,E])},[g,M]),I=i.useCallback(E=>{if(l){const C=Array.from(b);b.has(E)?j(C.filter(H=>H!==E)):j([...C,E])}else j(b.has(E)?[]:[E])},[l,b,j]),v=ii(t,g),N=i.useRef(0),$=i.useRef(new Map),S=E=>{var C;N.current=E,(C=$.current.get(E))==null||C.focus()},T=(E,C)=>{var B;const H=v[C];if(!H)return;const{node:z}=H,R=(((B=z.children)==null?void 0:B.length)??0)>0;switch(E.key){case"ArrowDown":{E.preventDefault(),C<v.length-1&&S(C+1);break}case"ArrowUp":{E.preventDefault(),C>0&&S(C-1);break}case"ArrowRight":{E.preventDefault(),R&&!g.has(z.id)?w(z.id):R&&g.has(z.id)&&C<v.length-1&&S(C+1);break}case"ArrowLeft":{if(E.preventDefault(),R&&g.has(z.id))w(z.id);else for(let V=C-1;V>=0;V--)if(v[V].depth<H.depth){S(V);break}break}case"Enter":case" ":{E.preventDefault(),z.disabled||I(z.id);break}case"Home":{E.preventDefault(),S(0);break}case"End":{E.preventDefault(),S(v.length-1);break}}};return e.jsx("ul",{role:"tree","aria-label":"Tree view","aria-multiselectable":l||void 0,className:x.tkx("list-none m-0 p-0 font-sans select-none",d??""),style:{color:u.text,...f},children:v.map(({node:E,depth:C},H)=>{var D;const z=(((D=E.children)==null?void 0:D.length)??0)>0,R=g.has(E.id),B=b.has(E.id),V=A.sanitizeString(E.label);return e.jsxs("li",{role:"treeitem","aria-selected":B,"aria-expanded":z?R:void 0,"aria-disabled":E.disabled||void 0,"aria-level":C+1,"aria-setsize":v.filter(O=>O.depth===C).length,tabIndex:H===0?0:-1,ref:O=>{O?$.current.set(H,O):$.current.delete(H)},onKeyDown:O=>T(O,H),onClick:()=>{E.disabled||(z&&w(E.id),I(E.id))},className:x.tkx("relative flex items-center gap-1.5 py-1 px-2 rounded-md cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",E.disabled?"opacity-50 cursor-not-allowed":""),style:{paddingLeft:C*wn+8,backgroundColor:B?`${u.primary}18`:"transparent",transition:h?"none":"background-color 100ms ease",minHeight:32},onMouseEnter:O=>{!B&&!E.disabled&&(O.currentTarget.style.backgroundColor=u.surfaceAlt)},onMouseLeave:O=>{O.currentTarget.style.backgroundColor=B?`${u.primary}18`:"transparent"},children:[c&&C>0&&e.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:(C-1)*wn+16,top:0,bottom:0,width:1,backgroundColor:u.border}}),z?e.jsx("span",{role:"presentation",onClick:O=>{O.stopPropagation(),w(E.id)},className:x.tkx("inline-flex items-center justify-center cursor-pointer"),style:{width:20,height:20},children:e.jsx(li,{expanded:R,color:u.textMuted,reducedMotion:h})}):e.jsx("span",{style:{width:20,height:20},"aria-hidden":"true"}),a&&e.jsx(ai,{checked:B,color:u.primary,borderColor:u.border}),E.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:E.icon}),e.jsx("span",{className:x.tkx("text-sm truncate"),style:{color:E.disabled?u.textMuted:u.text},children:V})]},E.id)})})}const di={sm:{buttonPx:6,buttonPy:4,fontSize:12,iconSize:14,gap:2,separatorSize:16},md:{buttonPx:8,buttonPy:6,fontSize:13,iconSize:16,gap:4,separatorSize:20},lg:{buttonPx:12,buttonPy:8,fontSize:14,iconSize:18,gap:6,separatorSize:24}};function ui({items:t,orientation:n="horizontal",size:r="md",variant:o="default",ariaLabel:s="Toolbar",className:l,style:a}){const c=_.useTheme(),d=Q.useReducedMotion(),f=di[r],u=n==="horizontal",h=i.useRef(new Map),p=t.filter(g=>g.type!=="separator"&&!g.disabled).map(g=>g.id),m=i.useCallback(g=>{var M;(M=h.current.get(g))==null||M.focus()},[]),y=i.useCallback((g,M)=>{const j=p.indexOf(M);if(j<0)return;const w=u?"ArrowRight":"ArrowDown",I=u?"ArrowLeft":"ArrowUp";switch(g.key){case w:{g.preventDefault();const v=j+1<p.length?j+1:0;m(p[v]);break}case I:{g.preventDefault();const v=j-1>=0?j-1:p.length-1;m(p[v]);break}case"Home":{g.preventDefault(),m(p[0]);break}case"End":{g.preventDefault(),m(p[p.length-1]);break}}},[p,m,u]),k=()=>{switch(o){case"outlined":return{backgroundColor:"transparent",border:`1px solid ${c.border}`};case"filled":return{backgroundColor:c.surfaceAlt,border:"none"};default:return{backgroundColor:c.surface,border:`1px solid ${c.border}`}}},b=g=>{g.type;const M=g.active;return{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,padding:`${f.buttonPy}px ${f.buttonPx}px`,fontSize:f.fontSize,borderRadius:6,border:"none",cursor:g.disabled?"not-allowed":"pointer",backgroundColor:M?`${c.primary}20`:"transparent",color:M?c.primary:g.disabled?c.textMuted:c.text,opacity:g.disabled?.5:1,outline:"none",transition:d?"none":"all 100ms ease",whiteSpace:"nowrap",lineHeight:1}};return e.jsx("div",{role:"toolbar","aria-label":s,"aria-orientation":n,className:x.tkx("inline-flex items-center rounded-lg font-sans",u?"flex-row":"flex-col",l??""),style:{...k(),padding:f.gap,gap:f.gap,...a},children:t.map((g,M)=>{if(g.type==="separator")return e.jsx("div",{role:"separator","aria-orientation":u?"vertical":"horizontal",className:x.tkx("flex-shrink-0"),style:{...u?{width:1,height:f.separatorSize,marginLeft:2,marginRight:2}:{height:1,width:f.separatorSize,marginTop:2,marginBottom:2},backgroundColor:c.border}},g.id);const j=A.sanitizeString(g.label),w=!g.disabled,I=p[0]===g.id;return e.jsxs("button",{ref:v=>{v?h.current.set(g.id,v):h.current.delete(g.id)},type:"button",role:(g.type==="toggle",void 0),"aria-pressed":g.type==="toggle"?g.active:void 0,"aria-label":j,"aria-disabled":g.disabled||void 0,tabIndex:w&&I?0:-1,disabled:g.disabled,onClick:()=>{var v;g.disabled||(v=g.onClick)==null||v.call(g)},onKeyDown:v=>{var N;y(v,g.id),(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),g.disabled||(N=g.onClick)==null||N.call(g))},className:x.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:b(g),onMouseEnter:v=>{!g.disabled&&!g.active&&(v.currentTarget.style.backgroundColor=c.surfaceAlt)},onMouseLeave:v=>{g.disabled||(v.currentTarget.style.backgroundColor=g.active?`${c.primary}20`:"transparent")},children:[g.icon&&e.jsx("span",{"aria-hidden":"true",style:{width:f.iconSize,height:f.iconSize,display:"flex",alignItems:"center",justifyContent:"center"},children:g.icon}),!g.icon&&j]},g.id)})})}function fi({color:t}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:t,strokeWidth:"1.5"}),e.jsx("path",{d:"M9.5 9.5L13 13",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"})]})}function jn({checked:t,primaryColor:n,borderColor:r}){return e.jsx("span",{"aria-hidden":"true",className:x.tkx("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${t?n:r}`,backgroundColor:t?n:"transparent",transition:"all 100ms ease"},children:t&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function xi({color:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 8h10M9 4l4 4-4 4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function pi({color:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M13 8H3M7 4l-4 4 4 4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Sn({title:t,items:n,selected:r,onToggle:o,onToggleAll:s,search:l,onSearchChange:a,searchable:c,height:d,listId:f}){const u=_.useTheme(),h=Q.useReducedMotion(),p=A.sanitizeString(t),m=i.useMemo(()=>{if(!l)return n;const g=l.toLowerCase();return n.filter(M=>M.label.toLowerCase().includes(g))},[n,l]),y=m.filter(g=>!g.disabled),k=y.length>0&&y.every(g=>r.has(g.value));y.some(g=>r.has(g.value));const b=(g,M)=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),o(M))};return e.jsxs("div",{className:x.tkx("flex flex-col rounded-lg overflow-hidden flex-1 min-w-0"),style:{border:`1px solid ${u.border}`,backgroundColor:u.surface},children:[e.jsxs("div",{className:x.tkx("flex items-center gap-2 px-3 py-2 border-b"),style:{borderColor:u.border,backgroundColor:u.surfaceAlt},children:[e.jsx("button",{type:"button","aria-label":k?`Deselect all ${p}`:`Select all ${p}`,onClick:s,className:x.tkx("border-none bg-transparent cursor-pointer p-0 outline-none focus-visible:ring-2"),children:e.jsx(jn,{checked:k,primaryColor:u.primary,borderColor:u.border})}),e.jsx("span",{className:x.tkx("text-sm font-medium flex-1 truncate"),style:{color:u.text},children:p}),e.jsxs("span",{className:x.tkx("text-xs"),style:{color:u.textMuted},children:[r.size,"/",n.length]})]}),c&&e.jsxs("div",{className:x.tkx("flex items-center gap-1.5 px-3 py-1.5 border-b"),style:{borderColor:u.border},children:[e.jsx(fi,{color:u.textMuted}),e.jsx("input",{type:"text","aria-label":`Search ${p}`,value:l,onChange:g=>a(g.target.value),placeholder:"Search...",className:x.tkx("flex-1 bg-transparent border-none outline-none text-xs"),style:{color:u.text}})]}),e.jsx("ul",{id:f,role:"listbox","aria-label":p,"aria-multiselectable":"true",className:x.tkx("list-none m-0 p-1 overflow-y-auto"),style:{height:d,minHeight:100},children:m.length===0?e.jsx("li",{className:x.tkx("text-xs text-center py-4"),style:{color:u.textMuted},"aria-disabled":"true",children:"No items"}):m.map(g=>{const M=r.has(g.value),j=A.sanitizeString(g.label);return e.jsxs("li",{role:"option","aria-selected":M,"aria-disabled":g.disabled||void 0,tabIndex:0,onClick:()=>!g.disabled&&o(g.value),onKeyDown:w=>!g.disabled&&b(w,g.value),className:x.tkx("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",g.disabled?"opacity-50 cursor-not-allowed":""),style:{color:g.disabled?u.textMuted:u.text,backgroundColor:M?`${u.primary}10`:"transparent",transition:h?"none":"background-color 100ms ease"},onMouseEnter:w=>{!g.disabled&&!M&&(w.currentTarget.style.backgroundColor=u.surfaceAlt)},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=M?`${u.primary}10`:"transparent"},children:[e.jsx(jn,{checked:M,primaryColor:u.primary,borderColor:u.border}),e.jsx("span",{className:x.tkx("truncate"),children:j})]},g.value)})})]})}function hi({sourceItems:t,targetItems:n,onTransfer:r,sourceTitle:o="Available",targetTitle:s="Selected",searchable:l=!1,height:a=300,className:c,style:d}){const f=_.useTheme(),u=Q.useReducedMotion(),h=i.useId(),p=i.useId(),[m,y]=i.useState(new Set),[k,b]=i.useState(new Set),[g,M]=i.useState(""),[j,w]=i.useState(""),I=i.useCallback(C=>{y(H=>{const z=new Set(H);return z.has(C)?z.delete(C):z.add(C),z})},[]),v=i.useCallback(C=>{b(H=>{const z=new Set(H);return z.has(C)?z.delete(C):z.add(C),z})},[]),N=i.useCallback(()=>{const C=t.filter(z=>!z.disabled).map(z=>z.value),H=C.every(z=>m.has(z));y(H?new Set:new Set(C))},[t,m]),$=i.useCallback(()=>{const C=n.filter(z=>!z.disabled).map(z=>z.value),H=C.every(z=>k.has(z));b(H?new Set:new Set(C))},[n,k]),S=i.useCallback(()=>{if(m.size===0)return;const C=t.filter(R=>m.has(R.value)&&!R.disabled),H=t.filter(R=>!m.has(R.value)||R.disabled),z=[...n,...C];r(H,z),y(new Set)},[t,n,m,r]),T=i.useCallback(()=>{if(k.size===0)return;const C=n.filter(R=>k.has(R.value)&&!R.disabled),H=n.filter(R=>!k.has(R.value)||R.disabled),z=[...t,...C];r(z,H),b(new Set)},[t,n,k,r]),E=C=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:8,border:`1px solid ${f.border}`,backgroundColor:C?f.surface:f.surfaceAlt,cursor:C?"not-allowed":"pointer",opacity:C?.5:1,transition:u?"none":"all 100ms ease",outline:"none"});return e.jsxs("div",{className:x.tkx("flex gap-3 font-sans","flex-col sm:flex-row",c??""),style:{color:f.text,...d},children:[e.jsx(Sn,{title:o,items:t,selected:m,onToggle:I,onToggleAll:N,search:g,onSearchChange:M,searchable:l,height:a,listId:h}),e.jsxs("div",{className:x.tkx("flex items-center justify-center gap-2","flex-row sm:flex-col"),style:{padding:"8px 0"},children:[e.jsx("button",{type:"button","aria-label":"Move selected items to target list",disabled:m.size===0,onClick:S,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),S())},className:x.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:E(m.size===0),onMouseEnter:C=>{m.size>0&&(C.currentTarget.style.backgroundColor=f.primary,C.currentTarget.style.borderColor=f.primary)},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=m.size===0?f.surface:f.surfaceAlt,C.currentTarget.style.borderColor=f.border},children:e.jsx(xi,{color:f.text})}),e.jsx("button",{type:"button","aria-label":"Move selected items to source list",disabled:k.size===0,onClick:T,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),T())},className:x.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:E(k.size===0),onMouseEnter:C=>{k.size>0&&(C.currentTarget.style.backgroundColor=f.primary,C.currentTarget.style.borderColor=f.primary)},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=k.size===0?f.surface:f.surfaceAlt,C.currentTarget.style.borderColor=f.border},children:e.jsx(pi,{color:f.text})})]}),e.jsx(Sn,{title:s,items:n,selected:k,onToggle:v,onToggleAll:$,search:j,onSearchChange:w,searchable:l,height:a,listId:p})]})}function mi({color:t,rotated:n,reducedMotion:r}){return e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{transform:n?"rotate(45deg)":"rotate(0deg)",transition:r?"none":"transform 200ms ease"},children:e.jsx("path",{d:"M12 5v14M5 12h14",stroke:t,strokeWidth:"2.5",strokeLinecap:"round"})})}const gi={"bottom-right":{bottom:24,right:24},"bottom-left":{bottom:24,left:24},"top-right":{top:24,right:24},"top-left":{top:24,left:24}};function bi(t,n,r){const o=(n+1)*r;switch(t){case"up":return{bottom:o,left:"50%",transform:"translateX(-50%)"};case"down":return{top:o,left:"50%",transform:"translateX(-50%)"};case"left":return{right:o,top:"50%",transform:"translateY(-50%)"};case"right":return{left:o,top:"50%",transform:"translateY(-50%)"}}}function yi(t){switch(t){case"up":case"down":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:10};case"left":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:10};case"right":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:10}}}const Mn=56,Tn=48,ki=64;function vi({actions:t,icon:n,direction:r="up",position:o="bottom-right",className:s,style:l}){const a=_.useTheme(),c=Q.useReducedMotion(),d=i.useId(),[f,u]=i.useState(!1),[h,p]=i.useState(-1),m=i.useRef(null),y=i.useRef(new Map),k=i.useCallback(()=>{u(w=>!w),p(-1)},[]),b=i.useCallback(()=>{u(!1),p(-1)},[]);Q.useEscapeKey(b,f),i.useEffect(()=>{if(!f)return;const w=I=>{var v;(v=m.current)!=null&&v.contains(I.target)||b()};return document.addEventListener("pointerdown",w),()=>document.removeEventListener("pointerdown",w)},[f,b]),i.useEffect(()=>{var w;h>=0&&((w=y.current.get(h))==null||w.focus())},[h]);const g=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),k()),f&&((w.key==="ArrowUp"||w.key==="ArrowLeft")&&(w.preventDefault(),p(0)),(w.key==="ArrowDown"||w.key==="ArrowRight")&&(w.preventDefault(),p(0)))},M=(w,I)=>{var v,N;switch(w.key){case"ArrowUp":case"ArrowLeft":{w.preventDefault(),p(I>0?I-1:t.length-1);break}case"ArrowDown":case"ArrowRight":{w.preventDefault(),p(I<t.length-1?I+1:0);break}case"Enter":case" ":{w.preventDefault(),(N=(v=t[I]).onClick)==null||N.call(v),b();break}case"Escape":{b();break}case"Home":{w.preventDefault(),p(0);break}case"End":{w.preventDefault(),p(t.length-1);break}}},j=w=>c?"0ms":`${w*40}ms`;return e.jsxs(e.Fragment,{children:[f&&typeof document<"u"&&Le.createPortal(e.jsx("div",{"aria-hidden":"true",onClick:b,style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.3)",zIndex:9e3,transition:c?"none":"opacity 200ms ease"}}),document.body),e.jsxs("div",{ref:m,className:x.tkx("fixed z-[9100] font-sans",s??""),style:{...gi[o],...l},children:[f&&t.map((w,I)=>{const v=A.sanitizeString(w.label),N=bi(r,I,ki),$=yi(r);return e.jsx("div",{className:x.tkx("absolute"),style:{...N,opacity:c?1:0,animation:c?"none":"tkxSpeedDialIn 180ms ease forwards",animationDelay:j(I)},children:e.jsxs("div",{className:x.tkx("relative inline-flex"),children:[e.jsx("span",{className:x.tkx("absolute z-10 whitespace-nowrap text-xs py-1 px-2 rounded-md pointer-events-none"),style:{...$,backgroundColor:a.surfaceAlt,color:a.text,border:`1px solid ${a.border}`,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},role:"tooltip",children:v}),e.jsx("button",{ref:S=>{S?y.current.set(I,S):y.current.delete(I)},type:"button","aria-label":v,tabIndex:f?0:-1,onClick:()=>{var S;(S=w.onClick)==null||S.call(w),b()},onKeyDown:S=>M(S,I),className:x.tkx("inline-flex items-center justify-center rounded-full border-none cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-2","shadow-lg"),style:{width:Tn,height:Tn,backgroundColor:a.surface,color:a.text,border:`1px solid ${a.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",transition:c?"none":"all 150ms ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=a.surfaceAlt,S.currentTarget.style.transform="scale(1.1)"},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=a.surface,S.currentTarget.style.transform="scale(1)"},children:w.icon})]})},w.id)}),e.jsx("button",{type:"button","aria-label":f?"Close actions menu":"Open actions menu","aria-expanded":f,"aria-controls":d,"aria-haspopup":"true",onClick:k,onKeyDown:g,className:x.tkx("inline-flex items-center justify-center rounded-full border-none cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-2"),style:{width:Mn,height:Mn,backgroundColor:a.primary,color:a.bg,boxShadow:`0 6px 20px ${a.primary}40`,transition:c?"none":"all 200ms ease",position:"relative",zIndex:1},onMouseEnter:w=>{w.currentTarget.style.boxShadow=`0 8px 28px ${a.primary}60`,c||(w.currentTarget.style.transform="scale(1.05)")},onMouseLeave:w=>{w.currentTarget.style.boxShadow=`0 6px 20px ${a.primary}40`,w.currentTarget.style.transform="scale(1)"},children:n??e.jsx(mi,{color:a.bg,rotated:f,reducedMotion:c})}),e.jsx("div",{id:d,role:"menu","aria-label":"Speed dial actions",style:{display:"none"},children:t.map(w=>e.jsx("div",{role:"menuitem",children:A.sanitizeString(w.label)},w.id))})]}),f&&!c&&e.jsx("style",{children:`
|
|
78
78
|
@keyframes tkxSpeedDialIn {
|
|
79
79
|
from { opacity: 0; transform: translateX(-50%) scale(0.5); }
|
|
80
80
|
to { opacity: 1; transform: translateX(-50%) scale(1); }
|
|
81
81
|
}
|
|
82
|
-
`})]})}const
|
|
82
|
+
`})]})}const Cn=768,wi=56;function ji({open:t}){return e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round","aria-hidden":"true",children:t?e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})}function Si(){const[t,n]=i.useState(()=>typeof window>"u"?!1:window.innerWidth<Cn);return i.useEffect(()=>{if(typeof window>"u")return;const r=()=>n(window.innerWidth<Cn);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),t}function Mi({title:t,logo:n,actions:r,navigation:o,position:s="sticky",variant:l="default",color:a="surface"}){const c=_.useTheme(),d=Q.useReducedMotion(),f=Si(),[u,h]=i.useState(!1),p=i.useRef(null),m=i.useId();Q.useEscapeKey(()=>h(!1),u),i.useEffect(()=>{!f&&u&&h(!1)},[f,u]),i.useEffect(()=>{if(!u)return;const I=v=>{p.current&&!p.current.contains(v.target)&&h(!1)};return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[u]);const y=i.useCallback(()=>{h(I=>!I)},[]),k=a==="primary"?c.primary:c.surface,b=a==="primary"?c.bg:c.text,g={default:{backgroundColor:k,borderBottom:`1px solid ${c.border}`},transparent:{backgroundColor:"transparent",borderBottom:"none"},elevated:{backgroundColor:k,boxShadow:`0 2px 8px ${c.bg}66`,borderBottom:"none"}},M={fixed:{position:"fixed",top:0,left:0,right:0,zIndex:1100},sticky:{position:"sticky",top:0,zIndex:1100},static:{position:"static"}},j=typeof t=="string"?A.sanitizeString(t):t,w=d?"none":"max-height 300ms cubic-bezier(0.4,0,0.2,1), opacity 300ms ease";return e.jsxs("header",{role:"banner",className:x.tkx("font-sans w-full"),style:{...M[s],...g[l],color:b,height:wi},children:[e.jsxs("div",{ref:p,className:x.tkx("flex items-center h-full px-4"),style:{maxWidth:1440,margin:"0 auto"},children:[n&&e.jsx("div",{className:x.tkx("flex items-center shrink-0 mr-3"),"aria-hidden":"true",children:n}),j&&e.jsx("div",{className:x.tkx("text-base font-semibold shrink-0 mr-4 leading-snug"),style:{color:b},children:j}),!f&&o&&e.jsx("nav",{id:m,"aria-label":"Main navigation",className:x.tkx("flex items-center flex-1 gap-1"),children:o}),f&&e.jsx("div",{className:x.tkx("flex-1")}),r&&e.jsx("div",{className:x.tkx("flex items-center gap-2 ml-auto shrink-0"),children:r}),f&&o&&e.jsx("button",{onClick:y,"aria-expanded":u,"aria-controls":m,"aria-label":u?"Close navigation menu":"Open navigation menu",className:x.tkx("bg-transparent border-none cursor-pointer p-2 ml-2 rounded flex items-center justify-center","focus-visible:focus-ring"),style:{color:b},children:e.jsx(ji,{open:u})})]}),f&&o&&e.jsx("nav",{id:m,"aria-label":"Main navigation",style:{maxHeight:u?400:0,opacity:u?1:0,overflow:"hidden",transition:w,backgroundColor:c.surface,borderBottom:u?`1px solid ${c.border}`:"none"},children:e.jsx("div",{className:x.tkx("flex flex-col gap-1 px-4 py-3"),role:"menu",children:o})})]})}const Ti=5,Ci=56;let $n=!1;function $i(){if($n||typeof document>"u")return;$n=!0;const t=document.createElement("style");t.id="tkx-bottom-nav-kf",t.textContent=`
|
|
83
83
|
@keyframes tkx-bottom-nav-pulse {
|
|
84
84
|
0% { transform: scale(1); }
|
|
85
85
|
50% { transform: scale(1.15); }
|
|
86
86
|
100% { transform: scale(1); }
|
|
87
87
|
}
|
|
88
|
-
`,document.head.appendChild(t)}function
|
|
88
|
+
`,document.head.appendChild(t)}function Ii({items:t,activeId:n,onChange:r,showLabels:o=!0}){const s=_.useTheme(),l=Q.useReducedMotion(),a=i.useRef(null);i.useEffect(()=>{$i()},[]);const c=t.slice(0,Ti),d=i.useCallback(h=>{r==null||r(h)},[r]),f=i.useCallback(h=>{const p=a.current;if(!p)return;const m=Array.from(p.querySelectorAll('[role="tab"]')),y=m.findIndex(b=>b===document.activeElement);if(y===-1)return;let k=y;h.key==="ArrowRight"||h.key==="ArrowDown"?(h.preventDefault(),k=(y+1)%m.length):h.key==="ArrowLeft"||h.key==="ArrowUp"?(h.preventDefault(),k=(y-1+m.length)%m.length):h.key==="Home"?(h.preventDefault(),k=0):h.key==="End"&&(h.preventDefault(),k=m.length-1),k!==y&&(m[k].focus(),d(c[k].id))},[d,c]),u=l?"none":"color 200ms ease, transform 150ms ease";return e.jsx("nav",{ref:a,role:"navigation","aria-label":"Bottom navigation",className:x.tkx("fixed bottom-0 left-0 right-0 z-[1000] font-sans"),style:{height:Ci,backgroundColor:s.surface,borderTop:`1px solid ${s.border}`,boxShadow:`0 -2px 12px ${s.bg}44`},children:e.jsx("div",{role:"tablist","aria-label":"Navigation tabs",className:x.tkx("flex items-center justify-around h-full"),onKeyDown:f,children:c.map(h=>{const p=h.id===n,m=A.sanitizeString(h.label),y=p?s.primary:s.textMuted;return e.jsxs("button",{role:"tab","aria-selected":p,"aria-label":m,tabIndex:p?0:-1,onClick:()=>d(h.id),className:x.tkx("flex flex-col items-center justify-center gap-0.5","bg-transparent border-none cursor-pointer p-1","flex-1 h-full relative","focus-visible:focus-ring"),style:{color:y,transition:u,outline:"none"},children:[p&&e.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:"25%",right:"25%",height:3,borderRadius:"0 0 3px 3px",backgroundColor:s.primary,transition:l?"none":"width 200ms ease"}}),e.jsxs("div",{className:x.tkx("relative flex items-center justify-center"),style:{animation:p&&!l?"tkx-bottom-nav-pulse 300ms ease-out":"none"},children:[h.icon,h.badge!==void 0&&h.badge>0&&e.jsx("span",{"aria-label":`${h.badge} notifications`,className:x.tkx("absolute flex items-center justify-center","text-[10px] font-bold leading-none rounded-full"),style:{top:-4,right:-8,minWidth:16,height:16,padding:"0 4px",backgroundColor:s.danger,color:s.bg},children:h.badge>99?"99+":h.badge})]}),o&&e.jsx("span",{className:x.tkx("text-[10px] leading-tight mt-0.5"),style:{fontWeight:p?600:400,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m})]},h.id)})})})}const zi=5e3;let In=!1;function Ei(){if(In||typeof document>"u")return;In=!0;const t=document.createElement("style");t.id="tkx-snackbar-kf",t.textContent=`
|
|
89
89
|
@keyframes tkx-snackbar-slide-up {
|
|
90
90
|
from { opacity: 0; transform: translateY(24px); }
|
|
91
91
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -98,22 +98,27 @@
|
|
|
98
98
|
from { opacity: 1; }
|
|
99
99
|
to { opacity: 0; transform: translateY(8px); }
|
|
100
100
|
}
|
|
101
|
-
`,document.head.appendChild(t)}const
|
|
102
|
-
`)?`"${
|
|
103
|
-
`),
|
|
101
|
+
`,document.head.appendChild(t)}const Ni={success:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),error:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),warning:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),info:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})})},Li={"bottom-left":{bottom:24,left:24},"bottom-center":{bottom:24,left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:24,right:24},"top-center":{top:24,left:"50%",transform:"translateX(-50%)"}};function Ri({message:t,isOpen:n,onClose:r,action:o,variant:s="default",position:l="bottom-center",autoHideDuration:a=zi,icon:c}){const d=_.useTheme(),f=Q.useReducedMotion(),u=i.useId(),h=i.useRef(null),[p,m]=i.useState(!1),[y,k]=i.useState(!1);i.useEffect(()=>{Ei()},[]),i.useEffect(()=>{if(n)k(!1),m(!0);else if(p)if(f)m(!1);else{k(!0);const S=setTimeout(()=>{m(!1),k(!1)},250);return()=>clearTimeout(S)}},[n,f,p]),i.useEffect(()=>{if(!(!n||a<=0||!r))return h.current=setTimeout(()=>{r()},a),()=>{h.current&&clearTimeout(h.current)}},[n,a,r]);const b=i.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),g=i.useCallback(()=>{n&&a>0&&r&&(h.current=setTimeout(()=>r(),a))},[n,a,r]),j={default:d.textMuted,success:d.success,error:d.danger,warning:d.warning,info:d.info}[s],w=A.sanitizeString(t);if(!p||typeof document>"u")return null;const v=l==="top-center"?"tkx-snackbar-slide-down":"tkx-snackbar-slide-up";let N={};f||(y?N={animation:"tkx-snackbar-fade-out 250ms ease forwards"}:N={animation:`${v} 250ms cubic-bezier(0.16,1,0.3,1) both`});const $=c??Ni[s]??null;return Le.createPortal(e.jsx("div",{role:s==="error"?"alert":"status","aria-live":s==="error"?"assertive":"polite","aria-atomic":"true","aria-labelledby":u,className:x.tkx("fixed z-[9500] font-sans"),style:{...Li[l],...N,pointerEvents:"auto"},onMouseEnter:b,onMouseLeave:g,children:e.jsxs("div",{className:x.tkx("flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg","min-w-[280px] max-w-[480px]"),style:{backgroundColor:d.surface,border:`1px solid ${j}44`,boxShadow:`0 8px 24px ${d.bg}aa`,color:d.text},children:[$&&e.jsx("span",{className:x.tkx("shrink-0 flex items-center"),style:{color:j},children:$}),e.jsx("span",{id:u,className:x.tkx("flex-1 text-sm leading-snug"),children:w}),o&&e.jsx("button",{onClick:()=>{o.onClick(),r==null||r()},className:x.tkx("bg-transparent border-none cursor-pointer p-0 ml-2","text-sm font-semibold shrink-0","focus-visible:focus-ring"),style:{color:d.primary},children:A.sanitizeString(o.label)}),r&&e.jsx("button",{"aria-label":"Dismiss snackbar",onClick:r,className:x.tkx("bg-transparent border-none cursor-pointer rounded p-[2px] ml-1","shrink-0 flex items-center justify-center","focus-visible:focus-ring"),style:{color:d.textMuted},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),document.body)}function Ai({direction:t}){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:x.tkx("shrink-0 ml-1"),children:t==="asc"?e.jsx("path",{d:"M7 14l5-5 5 5H7z"}):t==="desc"?e.jsx("path",{d:"M7 10l5 5 5-5H7z"}):e.jsx("path",{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.35"})})}function zn({checked:t,indeterminate:n}){const r=_.useTheme();return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"1",width:"14",height:"14",rx:"2",fill:t||n?r.primary:"transparent",stroke:t||n?r.primary:r.border,strokeWidth:"1.5"}),n&&e.jsx("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:r.bg,strokeWidth:"2"}),t&&!n&&e.jsx("path",{d:"M4.5 8L7 10.5L11.5 5.5",fill:"none",stroke:r.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function En(t,n){return typeof n=="function"?n(t):String(t[n])}function bt(t,n){return t[n]}function Di(t,n){return t==null&&n==null?0:t==null?1:n==null?-1:typeof t=="number"&&typeof n=="number"?t-n:String(t).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function Nn(t){const n=String(t??"");return n.includes(",")||n.includes('"')||n.includes(`
|
|
102
|
+
`)?`"${n.replace(/"/g,'""')}"`:n}function Bi({colCount:t}){const n=_.useTheme();return e.jsx("tbody",{children:Array.from({length:5},(r,o)=>e.jsx("tr",{children:Array.from({length:t},(s,l)=>e.jsx("td",{className:x.tkx("px-3 py-2"),style:{borderBottom:`1px solid ${n.border}`},children:e.jsx(xt,{height:16})},l))},o))})}function Wi({label:t,showExport:n,onExport:r,totalRows:o,selectedCount:s,theme:l}){return!n&&s===0?null:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:`1px solid ${l.border}`,backgroundColor:l.surface,gap:8},children:[e.jsx("span",{style:{fontSize:13,color:l.textMuted},children:s>0?`${s} of ${o} row${o!==1?"s":""} selected`:`${o} row${o!==1?"s":""}`}),n&&e.jsxs("button",{onClick:r,"aria-label":`Export ${t} as CSV`,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",fontSize:13,fontWeight:500,borderRadius:6,border:`1px solid ${l.border}`,backgroundColor:"transparent",color:l.text,cursor:"pointer"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"7 10 12 15 17 10"}),e.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"Export CSV"]})]})}function Pi({page:t,totalPages:n,pageSize:r,totalRows:o,onPageChange:s,theme:l}){const a=(t-1)*r+1,c=Math.min(t*r,o),d={display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:6,border:`1px solid ${l.border}`,backgroundColor:"transparent",color:l.text,cursor:"pointer",fontSize:13,fontWeight:500};return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderTop:`1px solid ${l.border}`,backgroundColor:l.surface,gap:8,flexWrap:"wrap"},role:"navigation","aria-label":"Pagination",children:[e.jsx("span",{style:{fontSize:13,color:l.textMuted},children:o===0?"0 rows":`${a}–${c} of ${o}`}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>s(1),disabled:t===1,"aria-label":"First page",style:{...d,opacity:t===1?.4:1},children:"«"}),e.jsx("button",{onClick:()=>s(t-1),disabled:t===1,"aria-label":"Previous page",style:{...d,opacity:t===1?.4:1},children:"‹"}),Array.from({length:Math.min(5,n)},(f,u)=>{let h=u+1;if(n>5){const p=Math.floor(2.5);h=Math.max(1,Math.min(t-p,n-4))+u}return e.jsx("button",{onClick:()=>s(h),"aria-label":`Page ${h}`,"aria-current":h===t?"page":void 0,style:{...d,backgroundColor:h===t?l.primary:"transparent",color:h===t?l.bg:l.text,borderColor:h===t?l.primary:l.border},children:h},h)}),e.jsx("button",{onClick:()=>s(t+1),disabled:t===n,"aria-label":"Next page",style:{...d,opacity:t===n?.4:1},children:"›"}),e.jsx("button",{onClick:()=>s(n),disabled:t===n,"aria-label":"Last page",style:{...d,opacity:t===n?.4:1},children:"»"})]})]})}function Fi({columns:t,data:n,rowKey:r,selectable:o=!1,selectedRows:s=[],onSelectionChange:l,sortable:a=!1,onSort:c,loading:d=!1,emptyMessage:f="No data to display",stickyHeader:u=!1,striped:h=!1,bordered:p=!1,compact:m=!1,maxHeight:y,onRowClick:k,virtualScroll:b,rowHeight:g=40,showFilters:M=!1,filterValues:j,onFilterChange:w,pageSize:I=0,showExport:v=!1,exportFileName:N="export",onLoadMore:$,hasMore:S,loadingMore:T=!1,loadMoreThreshold:E=200}){const C=_.useTheme(),H=Q.useReducedMotion(),z=i.useId(),[R,B]=i.useState(null),[V,D]=i.useState("asc"),O=i.useCallback(q=>{const F=R===q&&V==="asc"?"desc":"asc";B(q),D(F),c==null||c(q,F)},[R,V,c]),L=i.useMemo(()=>c||!R?n:[...n].sort((q,F)=>{const J=bt(q,R),re=bt(F,R),ae=Di(J,re);return V==="asc"?ae:-ae}),[n,R,V,c]),[P,W]=i.useState({}),K=j??P,ne=i.useCallback((q,F)=>{w?w(q,F):W(J=>({...J,[q]:F}))},[w]),Z=i.useMemo(()=>{const q=Object.entries(K).filter(([,F])=>F.trim()!=="");return q.length===0?L:L.filter(F=>q.every(([J,re])=>{const ae=bt(F,J);return String(ae??"").toLowerCase().includes(re.toLowerCase())}))},[L,K]),[ie,fe]=i.useState(1),pe=I>0,te=Z.length,ce=pe?Math.max(1,Math.ceil(te/I)):1;i.useEffect(()=>{fe(1)},[K,R,V]);const Y=i.useMemo(()=>pe?Z.slice((ie-1)*I,ie*I):Z,[Z,pe,ie,I]),se=10,le=b!==void 0?b:!pe&&y!==void 0&&Y.length>=50,ge=i.useRef(null),[he,ye]=i.useState(0),[de,xe]=i.useState(0),oe=i.useCallback(()=>{ge.current&&ye(ge.current.scrollTop)},[]);i.useEffect(()=>{if(!le||!ge.current)return;const q=ge.current;xe(q.clientHeight);const F=new ResizeObserver(()=>xe(q.clientHeight));return F.observe(q),()=>F.disconnect()},[le]),Y.length*g;const G=le?Math.max(0,Math.floor(he/g)-se):0,ue=le?Math.min(Y.length,Math.ceil((he+de)/g)+se):Y.length,ke=le?Y.slice(G,ue):Y,ve=G*g,Me=i.useRef(null),$e=i.useRef(!1);i.useEffect(()=>{$e.current=!1},[n.length]),i.useEffect(()=>{if(!$)return;const q=Me.current;if(!q)return;const F=new IntersectionObserver(J=>{J[0].isIntersecting&&!$e.current&&S!==!1&&($e.current=!0,$())},{root:ge.current,rootMargin:`0px 0px ${E}px 0px`,threshold:0});return F.observe(q),()=>F.disconnect()},[$,S,E]);const We=i.useMemo(()=>new Set(s),[s]),Te=i.useMemo(()=>Z.map(q=>En(q,r)),[Z,r]),ze=Te.length>0&&Te.every(q=>We.has(q)),Ke=Te.some(q=>We.has(q)),Ze=i.useCallback(()=>{l==null||l(ze?[]:Te)},[ze,Te,l]),Pe=i.useCallback(q=>{const F=We.has(q)?s.filter(J=>J!==q):[...s,q];l==null||l(F)},[We,s,l]),[Oe,Ge]=i.useState({}),Ee=i.useRef(null),qe=i.useCallback((q,F)=>{F.preventDefault(),F.stopPropagation();const J=F.target.closest("th");if(!J)return;const re=Oe[q]||J.getBoundingClientRect().width;Ee.current={key:q,startX:F.clientX,startWidth:re};const ae=Ie=>{if(!Ee.current)return;const we=Math.max(50,Ee.current.startWidth+Ie.clientX-Ee.current.startX);Ge(_e=>({..._e,[Ee.current.key]:we}))},Ce=()=>{Ee.current=null,document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",Ce)};document.addEventListener("mousemove",ae),document.addEventListener("mouseup",Ce)},[Oe]),rt=i.useCallback(()=>{const q=t.map(Ie=>Nn(Ie.header)).join(","),F=Z.map(Ie=>t.map(we=>{const _e=bt(Ie,we.key);return Nn(_e)}).join(",")),J=[q,...F].join(`
|
|
103
|
+
`),re=new Blob([J],{type:"text/csv;charset=utf-8;"}),ae=URL.createObjectURL(re),Ce=document.createElement("a");Ce.href=ae,Ce.download=`${N}.csv`,Ce.click(),URL.revokeObjectURL(ae)},[t,Z,N]),Qe=m?"4px":"8px",Re=m?"8px":"12px",Fe=q=>{const F=Oe[q.key]||q.width;return{width:F??void 0,minWidth:F??80,textAlign:q.align??"left",padding:`${Qe} ${Re}`}},Ae=p?`1px solid ${C.border}`:"none",Je=A.sanitizeString(f),Ue=t.length+(o?1:0),lt=t.some(q=>q.filterable);return e.jsxs("div",{role:"grid","aria-label":"Data grid","aria-rowcount":te,id:z,className:x.tkx("font-sans rounded-lg overflow-hidden"),style:{border:`1px solid ${C.border}`,backgroundColor:C.bg},children:[e.jsx(Wi,{label:"data grid",showExport:v,onExport:rt,totalRows:te,selectedCount:s.length,theme:C}),e.jsxs("div",{ref:ge,onScroll:le?oe:void 0,style:{maxHeight:y??"none",overflowX:"auto",overflowY:y?"auto":"visible"},children:[e.jsxs("table",{className:x.tkx("w-full"),style:{borderCollapse:"separate",borderSpacing:0,tableLayout:"auto"},children:[e.jsxs("thead",{children:[e.jsxs("tr",{role:"row",children:[o&&e.jsx("th",{scope:"col",role:"columnheader",style:{position:u?"sticky":"static",top:0,zIndex:2,backgroundColor:C.surface,borderBottom:`2px solid ${C.border}`,borderRight:Ae,padding:`${Qe} ${Re}`,width:40,textAlign:"center"},children:e.jsxs("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},children:[e.jsx("input",{type:"checkbox",checked:ze,ref:q=>{q&&(q.indeterminate=Ke&&!ze)},onChange:Ze,"aria-label":ze?"Deselect all rows":"Select all rows",style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),e.jsx(zn,{checked:ze,indeterminate:Ke&&!ze})]})}),t.map(q=>{const F=(q.sortable??a)&&q.sortable!==!1,J=R===q.key,re=A.sanitizeString(q.header);return e.jsx("th",{scope:"col",role:"columnheader","aria-sort":J?V==="asc"?"ascending":"descending":F?"none":void 0,className:x.tkx("text-xs font-semibold uppercase tracking-wider"),style:{...Fe(q),position:u?"sticky":"static",top:0,zIndex:2,backgroundColor:C.surface,color:C.textMuted,borderBottom:`2px solid ${C.border}`,borderRight:Ae,cursor:F?"pointer":"default",userSelect:"none",whiteSpace:"nowrap",transition:H?"none":"background-color 150ms ease"},onClick:F?()=>O(q.key):void 0,onKeyDown:F?ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),O(q.key))}:void 0,tabIndex:F?0:void 0,children:e.jsxs("div",{className:x.tkx("flex items-center gap-1"),style:{position:"relative"},children:[q.renderHeader?q.renderHeader(q):re,F&&e.jsx(Ai,{direction:J?V:null}),q.resizable&&e.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize column ${re}`,className:x.tkx("cursor-col-resize shrink-0"),style:{position:"absolute",right:0,top:0,bottom:0,width:4,backgroundColor:"transparent"},onMouseDown:ae=>qe(q.key,ae)})]})},q.key)})]}),(M||lt)&&e.jsxs("tr",{role:"row","aria-label":"Column filters",children:[o&&e.jsx("th",{scope:"col",style:{backgroundColor:C.surfaceAlt,borderBottom:`1px solid ${C.border}`,borderRight:Ae,padding:`4px ${Re}`,width:40}}),t.map(q=>e.jsx("th",{scope:"col",style:{backgroundColor:C.surfaceAlt,borderBottom:`1px solid ${C.border}`,borderRight:Ae,padding:`4px ${Re}`},children:(q.filterable||M)&&e.jsx("input",{type:"text",value:K[q.key]??"",onChange:F=>ne(q.key,F.target.value),placeholder:`Filter ${q.header}…`,"aria-label":`Filter by ${q.header}`,style:{width:"100%",padding:"3px 8px",fontSize:12,borderRadius:4,border:`1px solid ${C.border}`,backgroundColor:C.bg,color:C.text,outline:"none"}})},q.key))]})]}),d&&e.jsx(Bi,{colCount:Ue}),!d&&e.jsx("tbody",{children:Y.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:Ue,className:x.tkx("text-center py-10"),style:{color:C.textMuted},children:Je})}):e.jsxs(e.Fragment,{children:[le&&ve>0&&e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:Ue,style:{height:ve,padding:0,border:"none"}})}),ke.map((q,F)=>{const J=G+F,re=En(q,r),ae=We.has(re),Ce=h&&J%2===1;let Ie="transparent";return ae?Ie=`${C.primary}22`:Ce&&(Ie=C.surfaceAlt),e.jsxs("tr",{role:"row","aria-rowindex":J+1,"aria-selected":o?ae:void 0,onClick:k?()=>k(q):void 0,onKeyDown:k?we=>{(we.key==="Enter"||we.key===" ")&&(we.preventDefault(),k(q))}:void 0,tabIndex:k?0:void 0,className:x.tkx(k?"cursor-pointer":""),style:{backgroundColor:Ie,transition:H?"none":"background-color 120ms ease",...le?{height:g,boxSizing:"border-box"}:{}},onMouseEnter:k?we=>{we.currentTarget.style.backgroundColor=ae?`${C.primary}30`:C.surfaceAlt}:void 0,onMouseLeave:k?we=>{we.currentTarget.style.backgroundColor=Ie}:void 0,children:[o&&e.jsx("td",{role:"gridcell",style:{borderBottom:`1px solid ${C.border}`,borderRight:Ae,padding:`${Qe} ${Re}`,textAlign:"center",width:40},children:e.jsxs("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:we=>we.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:ae,onChange:()=>Pe(re),"aria-label":ae?`Deselect row ${re}`:`Select row ${re}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),e.jsx(zn,{checked:ae})]})}),t.map(we=>{const _e=bt(q,we.key),U=we.renderCell?we.renderCell(_e,q):typeof _e=="string"?A.sanitizeString(_e):String(_e??"");return e.jsx("td",{role:"gridcell",className:x.tkx("text-sm"),style:{...Fe(we),borderBottom:`1px solid ${C.border}`,borderRight:Ae,color:C.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U},we.key)})]},re)}),le&&ue<Y.length&&e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:Ue,style:{height:(Y.length-ue)*g,padding:0,border:"none"}})})]})})]}),(S||T)&&e.jsx("div",{ref:Me,style:{height:1,width:"100%"},children:T&&e.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:e.jsx("tbody",{children:Array.from({length:3},(q,F)=>e.jsx("tr",{children:t.map(J=>e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(xt,{variant:"text",height:"16px"})},J.key))},F))})})}),!S&&$&&e.jsx("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:C.textMuted},children:"✓ All rows loaded"})]}),pe&&!d&&e.jsx(Pi,{page:ie,totalPages:ce,pageSize:I,totalRows:te,onPageChange:fe,theme:C})]})}const Ct={md:768,lg:1024};function Hi(){const[t,n]=i.useState(()=>{if(typeof window>"u")return"lg";const r=window.innerWidth;return r>=Ct.lg?"lg":r>=Ct.md?"md":"sm"});return i.useEffect(()=>{if(typeof window>"u")return;const r=()=>{const o=window.innerWidth;o>=Ct.lg?n("lg"):o>=Ct.md?n("md"):n("sm")};return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),t}function Vi(t,n){return t===void 0?3:typeof t=="number"?Math.max(1,t):n==="lg"?t.lg??t.md??t.sm??3:n==="md"?t.md??t.sm??2:t.sm??1}let Ln=!1;function Oi(){if(Ln||typeof document>"u")return;Ln=!0;const t=document.createElement("style");t.id="tkx-masonry-kf",t.textContent=`
|
|
104
104
|
@keyframes tkx-masonry-fade-in {
|
|
105
105
|
from { opacity: 0; transform: translateY(8px); }
|
|
106
106
|
to { opacity: 1; transform: translateY(0); }
|
|
107
107
|
}
|
|
108
|
-
`,document.head.appendChild(t)}function
|
|
108
|
+
`,document.head.appendChild(t)}function _i({columns:t,gap:n=16,children:r}){_.useTheme();const o=Q.useReducedMotion(),s=Hi();i.useEffect(()=>{Oi()},[]);const l=Vi(t,s),a=i.Children.toArray(r),c=i.useMemo(()=>{const f=Array.from({length:l},()=>[]);return a.forEach((u,h)=>{f[h%l].push(u)}),f},[a,l]),d=f=>o?{}:{animation:"tkx-masonry-fade-in 300ms cubic-bezier(0.16,1,0.3,1) both",animationDelay:`${Math.min(f*40,400)}ms`};return e.jsx("div",{role:"list","aria-label":"Masonry grid",className:x.tkx("flex w-full"),style:{gap:n,alignItems:"flex-start"},children:c.map((f,u)=>e.jsx("div",{className:x.tkx("flex flex-col"),style:{flex:1,gap:n,minWidth:0},children:f.map((h,p)=>{const m=p*l+u;return e.jsx("div",{role:"listitem",style:d(m),children:h},p)})},u))})}const Yi={info:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),warning:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),success:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),danger:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})})},Ki={1:{fontSize:"1.75rem",fontWeight:700,lineHeight:1.25,marginTop:24,marginBottom:12},2:{fontSize:"1.375rem",fontWeight:600,lineHeight:1.3,marginTop:20,marginBottom:10},3:{fontSize:"1.1rem",fontWeight:600,lineHeight:1.35,marginTop:16,marginBottom:8}};function Ui({block:t}){const n=_.useTheme(),r=t.level??1,o=`h${r}`,s=A.sanitizeString(t.content??"");return e.jsx(o,{className:x.tkx("m-0"),style:{...Ki[r],color:n.text},children:s})}function Xi({block:t}){const n=_.useTheme(),r=A.sanitizeString(t.content??"");return e.jsx("p",{className:x.tkx("m-0"),style:{fontSize:"0.938rem",lineHeight:1.7,color:n.text,marginBottom:12},children:r})}function Zi({block:t}){const n=_.useTheme(),r=A.sanitizeString(t.content??"");return e.jsx("blockquote",{className:x.tkx("m-0"),style:{borderLeft:`3px solid ${n.primary}`,paddingLeft:16,paddingTop:8,paddingBottom:8,marginTop:12,marginBottom:12,backgroundColor:`${n.surfaceAlt}`,borderRadius:"0 6px 6px 0",color:n.textMuted,fontStyle:"italic",fontSize:"0.938rem",lineHeight:1.6},children:r})}function Gi({block:t}){const n=_.useTheme(),r=A.sanitizeString(t.content??""),o=t.language?A.sanitizeString(t.language):null;return e.jsxs("div",{className:x.tkx("rounded-lg overflow-hidden"),style:{marginTop:12,marginBottom:12,border:`1px solid ${n.border}`,backgroundColor:n.surfaceAlt},children:[o&&e.jsx("div",{className:x.tkx("px-3 py-1 text-[11px] font-semibold uppercase tracking-wider"),style:{color:n.textMuted,borderBottom:`1px solid ${n.border}`,backgroundColor:n.surface},children:o}),e.jsx("pre",{className:x.tkx("m-0 p-4 overflow-x-auto"),style:{fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace",fontSize:"0.85rem",lineHeight:1.6,color:n.text,tabSize:2},children:e.jsx("code",{"aria-label":o?`Code block in ${o}`:"Code block",children:r})})]})}function qi({block:t}){const n=_.useTheme(),r=t.ordered?"ol":"ul",o=(t.items??[]).map(s=>A.sanitizeString(s));return e.jsx(r,{className:x.tkx("m-0"),style:{paddingLeft:24,marginTop:8,marginBottom:12,color:n.text,fontSize:"0.938rem",lineHeight:1.7,listStyleType:t.ordered?"decimal":"disc"},role:"list",children:o.map((s,l)=>e.jsx("li",{role:"listitem",style:{marginBottom:4},children:s},l))})}function Qi(){const t=_.useTheme();return e.jsx("hr",{"aria-hidden":"true",style:{border:"none",borderTop:`1px solid ${t.border}`,marginTop:20,marginBottom:20}})}function Ji({block:t}){const n=_.useTheme(),r=A.sanitizeString(t.src??""),o=A.sanitizeString(t.alt??"Image");return e.jsxs("figure",{className:x.tkx("m-0"),style:{marginTop:12,marginBottom:12},children:[e.jsx("img",{src:r,alt:o,loading:"lazy",className:x.tkx("rounded-lg"),style:{maxWidth:"100%",height:"auto",display:"block",border:`1px solid ${n.border}`}}),t.alt&&e.jsx("figcaption",{className:x.tkx("text-xs mt-2 text-center"),style:{color:n.textMuted},children:o})]})}function el({block:t}){const n=_.useTheme(),r=t.variant??"info",o=A.sanitizeString(t.content??""),l={info:n.info,warning:n.warning,success:n.success,danger:n.danger}[r],a=Yi[r],c={info:"note",warning:"alert",success:"status",danger:"alert"};return e.jsxs("div",{role:c[r],className:x.tkx("flex gap-3 px-4 py-3 rounded-lg"),style:{backgroundColor:`${l}12`,border:`1px solid ${l}33`,marginTop:12,marginBottom:12},children:[e.jsx("span",{className:x.tkx("shrink-0 mt-[2px]"),style:{color:l},children:a}),e.jsx("div",{className:x.tkx("flex-1"),style:{fontSize:"0.9rem",lineHeight:1.6,color:n.text},children:o})]})}const tl={heading:Ui,paragraph:Xi,blockquote:Zi,code:Gi,list:qi,divider:Qi,image:Ji,callout:el};function nl({blocks:t,className:n,style:r}){const o=_.useTheme(),s=Q.useReducedMotion(),l=i.useMemo(()=>t.map((a,c)=>{const d=tl[a.type];return d?e.jsx("div",{style:s?void 0:{animation:"tkx-rich-text-fade-in 300ms ease both",animationDelay:`${Math.min(c*30,300)}ms`},children:e.jsx(d,{block:a,index:c})},c):null}),[t,s]);return i.useMemo(()=>{if(typeof document>"u"||document.getElementById("tkx-rich-text-kf"))return;const a=document.createElement("style");a.id="tkx-rich-text-kf",a.textContent=`
|
|
109
109
|
@keyframes tkx-rich-text-fade-in {
|
|
110
110
|
from { opacity: 0; }
|
|
111
111
|
to { opacity: 1; }
|
|
112
112
|
}
|
|
113
|
-
`,document.head.appendChild(
|
|
114
|
-
`),document.head.appendChild(
|
|
113
|
+
`,document.head.appendChild(a)},[]),e.jsx("article",{"aria-label":"Rich text content",className:x.tkx("font-sans",n??""),style:{color:o.text,maxWidth:720,...r},children:l})}const jr={sm:576,md:768,lg:992,xl:1200};function Sr(t){return typeof t=="number"?`${t}px`:t}const Mr=i.createContext({h:0,v:0}),Tr=i.forwardRef(({children:t,hasSider:n=!1,className:r,style:o,...s},l)=>{const a=_.useTheme(),c=x.tkx("flex min-h-0 w-full font-sans"),d=n?{flexDirection:"row"}:{flexDirection:"column"};return e.jsx("section",{ref:l,className:x.cx("tkx-layout",c,r),style:{minHeight:"100%",color:a.text,backgroundColor:a.bg,...d,...o},...s,children:t})});Tr.displayName="TkxLayout";const Cr=i.forwardRef(({children:t,height:n=64,fixed:r=!1,className:o,style:s,...l},a)=>{const c=_.useTheme(),d=Sr(n),f=x.tkx("flex items-center px-6 shrink-0 w-full"),u=r?{position:"fixed",top:0,left:0,right:0,zIndex:1e3}:{};return e.jsx("header",{ref:a,className:x.cx("tkx-layout-header",f,o),style:{height:d,minHeight:d,backgroundColor:c.surface,borderBottom:`1px solid ${c.border}`,...u,...s},...l,children:t})});Cr.displayName="TkxHeader";function rl({collapsed:t,onClick:n,color:r}){const o=Q.useReducedMotion();return e.jsx("button",{type:"button","aria-label":t?"Expand sidebar":"Collapse sidebar",onClick:n,className:x.tkx("flex items-center justify-center w-full py-3 cursor-pointer","border-0 bg-transparent"),style:{color:r},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{transform:t?"rotate(0deg)":"rotate(180deg)",transition:o?"none":"transform 200ms ease"},"aria-hidden":"true",children:e.jsx("path",{d:"M6 3l5 5-5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}const $r=i.forwardRef(({children:t,width:n=240,collapsedWidth:r=64,collapsed:o,onCollapse:s,collapsible:l=!1,breakpoint:a,trigger:c,className:d,style:f,...u},h)=>{const p=_.useTheme(),m=Q.useReducedMotion(),[y,k]=i.useState(!1),b=o??y,g=i.useCallback(v=>{o===void 0&&k(v),s==null||s(v)},[o,s]);i.useEffect(()=>{if(!a)return;const v=jr[a];if(!v)return;const N=window.matchMedia(`(max-width: ${v-1}px)`),$=S=>{g(S.matches)};return g(N.matches),N.addEventListener("change",$),()=>N.removeEventListener("change",$)},[a,g]);const M=Sr(n),j=b?`${r}px`:M,w=l&&c!==null,I=m?"none":"width 200ms ease, min-width 200ms ease, max-width 200ms ease";return e.jsxs("aside",{ref:h,className:x.cx("tkx-layout-sider",x.tkx("shrink-0 overflow-hidden flex flex-col"),d),style:{width:j,minWidth:j,maxWidth:j,backgroundColor:p.surface,borderRight:`1px solid ${p.border}`,transition:I,...f},...u,children:[e.jsx("div",{className:x.tkx("flex-1 overflow-y-auto overflow-x-hidden"),style:{width:j,transition:I},children:t}),w&&e.jsx("div",{className:x.tkx("shrink-0"),style:{borderTop:`1px solid ${p.border}`},children:c!==void 0?c:e.jsx(rl,{collapsed:b,onClick:()=>g(!b),color:p.textMuted})})]})});$r.displayName="TkxSider";const Ir=i.forwardRef(({children:t,className:n,style:r,...o},s)=>{const l=_.useTheme();return e.jsx("main",{ref:s,className:x.cx("tkx-layout-content",x.tkx("flex-1 min-w-0 min-h-0"),n),style:{backgroundColor:l.bg,padding:"24px",...r},...o,children:t})});Ir.displayName="TkxContent";const zr=i.forwardRef(({children:t,className:n,style:r,...o},s)=>{const l=_.useTheme();return e.jsx("footer",{ref:s,className:x.cx("tkx-layout-footer",x.tkx("flex items-center px-6 py-4 shrink-0"),n),style:{backgroundColor:l.surface,borderTop:`1px solid ${l.border}`,color:l.textMuted,...r},...o,children:t})});zr.displayName="TkxFooter";const sl={start:"flex-start",center:"center",end:"flex-end","space-between":"space-between","space-around":"space-around","space-evenly":"space-evenly"},ol={top:"flex-start",middle:"center",bottom:"flex-end",stretch:"stretch"},Er=i.forwardRef(({children:t,gutter:n,justify:r="start",align:o="top",wrap:s=!0,className:l,style:a,...c},d)=>{const[f,u]=Array.isArray(n)?n:[n??0,0],h=f/2,p=u/2,m=f||u?{marginLeft:-h,marginRight:-h,marginTop:-p,marginBottom:-p}:{},y={h,v:p};return e.jsx(Mr.Provider,{value:y,children:e.jsx("div",{ref:d,className:x.cx("tkx-row",x.tkx("flex w-full"),l),style:{flexWrap:s?"wrap":"nowrap",justifyContent:sl[r]??"flex-start",alignItems:ol[o]??"flex-start",...m,...a},...c,children:t})})});Er.displayName="TkxRow";let Rn=!1;function il(){if(Rn||typeof document>"u")return;Rn=!0;const t=[];for(const[r,o]of Object.entries(jr)){for(let s=1;s<=24;s++){const l=`${s/24*100}%`;t.push(`@media (min-width: ${o}px) { .tkx-col-${r}-${s} { flex: 0 0 ${l} !important; max-width: ${l} !important; } }`)}for(let s=0;s<=24;s++){const l=`${s/24*100}%`;t.push(`@media (min-width: ${o}px) { .tkx-col-${r}-offset-${s} { margin-left: ${l} !important; } }`)}}const n=document.createElement("style");n.id="tkx-col-responsive",n.textContent=t.join(`
|
|
114
|
+
`),document.head.appendChild(n)}function ll(t){if(t!==void 0)return typeof t=="number"?{span:t}:t}const Nr=i.forwardRef(({children:t,span:n,offset:r=0,push:o,pull:s,order:l,sm:a,md:c,lg:d,xl:f,className:u,style:h,...p},m)=>{i.useEffect(()=>{il()},[]);const y=i.useContext(Mr),k=n!==void 0?`${n/24*100}%`:void 0,b=r?`${r/24*100}%`:void 0,g=[],M=[["sm",a],["md",c],["lg",d],["xl",f]];for(const[w,I]of M){const v=ll(I);v&&(g.push(`tkx-col-${w}-${v.span}`),v.offset!==void 0&&v.offset>0&&g.push(`tkx-col-${w}-offset-${v.offset}`))}const j={};return o!==void 0&&(j.left=`${o/24*100}%`,j.position="relative"),s!==void 0&&(j.right=`${s/24*100}%`,j.position="relative"),l!==void 0&&(j.order=l),e.jsx("div",{ref:m,className:x.cx("tkx-col",x.tkx("box-border min-h-[1px]"),...g,u),style:{flex:k?`0 0 ${k}`:"1",maxWidth:k??"100%",marginLeft:b,paddingLeft:y.h||void 0,paddingRight:y.h||void 0,paddingTop:y.v||void 0,paddingBottom:y.v||void 0,...j,...h},...p,children:t})});Nr.displayName="TkxCol";const al={size:"md",variant:"default",animation:!0,bordered:!0},cl={locale:"en-US",direction:"ltr",componentDefaults:al,componentOverrides:{},prefixCls:"tkx",configured:!1,cls:t=>`tkx-${t}`,getSize:()=>"md",getAnimation:()=>!0,getBordered:()=>!0},Ot=i.createContext(cl);function Lr({children:t,locale:n,direction:r,componentDefaults:o,componentOverrides:s,prefixCls:l}){const a=i.useContext(Ot),c=i.useMemo(()=>({size:(o==null?void 0:o.size)??a.componentDefaults.size,variant:(o==null?void 0:o.variant)??a.componentDefaults.variant,animation:(o==null?void 0:o.animation)??a.componentDefaults.animation,bordered:(o==null?void 0:o.bordered)??a.componentDefaults.bordered}),[o,a.componentDefaults]),d=i.useMemo(()=>{const g=a.componentOverrides,M=s??{};return{button:{...g.button,...M.button},input:{...g.input,...M.input},table:{...g.table,...M.table},modal:{...g.modal,...M.modal}}},[s,a.componentOverrides]),f=n??a.locale,u=r??a.direction,h=l??a.prefixCls,p=i.useCallback(g=>`${h}-${g}`,[h]),m=i.useCallback((g,M)=>{if(M!==void 0)return M;if(g){const j=d[g];if(j!=null&&j.size)return j.size}return c.size},[c.size,d]),y=i.useCallback(g=>g!==void 0?g:c.animation,[c.animation]),k=i.useCallback((g,M)=>{if(M!==void 0)return M;if(g){const j=d[g];if((j==null?void 0:j.bordered)!==void 0)return j.bordered}return c.bordered},[c.bordered,d]),b=i.useMemo(()=>({locale:f,direction:u,componentDefaults:c,componentOverrides:d,prefixCls:h,configured:!0,cls:p,getSize:m,getAnimation:y,getBordered:k}),[f,u,c,d,h,p,m,y,k]);return e.jsx(Ot.Provider,{value:b,children:e.jsx("div",{dir:u,lang:f,className:`${h}-config-root`,style:{direction:u},children:t})})}Lr.displayName="TkxConfigProvider";function vt(){return i.useContext(Ot)}function dl(t,n){const{prefixCls:r}=vt();return`${n??r}-${t}`}function ul(t,n){const{getSize:r}=vt();return r(t,n)}const fl={sm:32,md:40,lg:48},xl={sm:"0.75rem",md:"0.875rem",lg:"1rem"},pl={sm:8,md:12,lg:16},hl={sm:4,md:8,lg:12},ml={sm:4,md:6,lg:8},gl={sm:14,md:16,lg:20};function bl(){const{direction:t}=vt();if(t==="rtl")return{transform:"scaleX(-1)"}}function yl(t,n=0){const{direction:r}=vt(),o=typeof t=="number"?`${t}px`:t,s=typeof n=="number"?`${n}px`:n;return r==="rtl"?{marginRight:o,marginLeft:s}:{marginLeft:o,marginRight:s}}const An={"en-US":"English (US)","en-GB":"English (UK)","es-ES":"Spanish","fr-FR":"French","de-DE":"German","ja-JP":"Japanese","ko-KR":"Korean","zh-CN":"Chinese (Simplified)","zh-TW":"Chinese (Traditional)","pt-BR":"Portuguese (Brazil)","ar-SA":"Arabic","hi-IN":"Hindi","ru-RU":"Russian","it-IT":"Italian","nl-NL":"Dutch","sv-SE":"Swedish","pl-PL":"Polish","tr-TR":"Turkish","th-TH":"Thai","vi-VN":"Vietnamese"},Dn=new Set(["ar","ar-SA","ar-EG","ar-AE","he","he-IL","fa","fa-IR","ur","ur-PK","ps","ps-AF"]);function kl(t){return Dn.has(t)||Dn.has(t.split("-")[0])}function vl(t){if(An[t])return An[t];if(typeof Intl<"u"&&Intl.DisplayNames)try{return new Intl.DisplayNames(["en"],{type:"language"}).of(t)??t}catch{return t}return t}function kt(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(kt).join(""):t&&typeof t=="object"&&"props"in t?kt(t.props.children):""}function Kt({text:t}){const n=_.useTheme(),[r,o]=i.useState(!1),s=i.useCallback(()=>{navigator.clipboard.writeText(t).then(()=>{o(!0),setTimeout(()=>o(!1),2e3)})},[t]);return i.createElement("button",{type:"button",onClick:s,"aria-label":r?"Copied":"Copy to clipboard",style:{display:"inline-flex",alignItems:"center",marginLeft:"4px",padding:"2px 6px",border:"none",background:"transparent",color:r?n.success:n.textMuted,cursor:"pointer",fontSize:"0.8em",borderRadius:"4px",transition:"color 0.2s"}},r?"Copied!":"⎘")}function Rr(t="default"){const n=_.useTheme();return{default:n.text,secondary:n.textMuted,success:n.success,warning:n.warning,danger:n.danger}[t]}const wl={1:{fontSize:"2.25rem",lineHeight:"1.2",fontWeight:700},2:{fontSize:"1.875rem",lineHeight:"1.25",fontWeight:700},3:{fontSize:"1.5rem",lineHeight:"1.3",fontWeight:600},4:{fontSize:"1.25rem",lineHeight:"1.35",fontWeight:600},5:{fontSize:"1rem",lineHeight:"1.4",fontWeight:600}};function jl({level:t=1,children:n,copyable:r=!1,type:o="default",style:s}){const l=Rr(o);_.useTheme();const a=wl[t],c=`h${t}`,d=typeof n=="string"?A.sanitizeString(n):n,f=kt(n);return i.createElement(c,{style:{color:l,fontSize:a.fontSize,lineHeight:a.lineHeight,fontWeight:a.fontWeight,margin:"0 0 0.5em 0",fontFamily:"inherit",...s}},d,r&&i.createElement(Kt,{text:f}))}function Sl({children:t,type:n="default",strong:r=!1,italic:o=!1,underline:s=!1,delete:l=!1,code:a=!1,mark:c=!1,copyable:d=!1,style:f}){const u=Rr(n),h=_.useTheme(),p=kt(t),m=typeof t=="string"?A.sanitizeString(t):t,y=[];s&&y.push("underline"),l&&y.push("line-through");let k=m;a&&(k=i.createElement("code",{style:{padding:"0.15em 0.4em",fontSize:"0.875em",backgroundColor:h.surfaceAlt,border:`1px solid ${h.border}`,borderRadius:"4px",fontFamily:"monospace"}},k)),c&&(k=i.createElement("mark",{style:{backgroundColor:`${h.warning}33`,color:u,padding:"0 2px",borderRadius:"2px"}},k));const b=r?"strong":o?"em":"span";return i.createElement(b,{style:{color:u,fontStyle:o?"italic":"normal",textDecoration:y.length>0?y.join(" "):"none",...f}},k,d&&i.createElement(Kt,{text:p}))}function Ml({children:t,type:n="default",copyable:r=!1,ellipsis:o=!1,style:s}){const l=_.useTheme(),a=n==="secondary"?l.textMuted:l.text,c=kt(t),d=typeof t=="string"?A.sanitizeString(t):t,f={};if(o){const u=typeof o=="object"?o.rows??3:3;f.display="-webkit-box",f.WebkitLineClamp=u,f.WebkitBoxOrient="vertical",f.overflow="hidden"}return i.createElement("div",{style:{color:a,fontSize:"1rem",lineHeight:"1.6",margin:"0 0 1em 0",...f,...s}},d,r&&i.createElement(Kt,{text:c}))}const Tl={sm:{dimension:20,borderWidth:2,fontSize:"0.75rem"},md:{dimension:32,borderWidth:3,fontSize:"0.875rem"},lg:{dimension:48,borderWidth:4,fontSize:"1rem"}};let Bn=!1;function Cl(){if(Bn||typeof document>"u")return;Bn=!0;const t=document.createElement("style");t.id="tkx-spin-styles",t.textContent=`
|
|
115
115
|
@keyframes tkx-spin-rotate {
|
|
116
116
|
0% { transform: rotate(0deg); }
|
|
117
117
|
100% { transform: rotate(360deg); }
|
|
118
118
|
}
|
|
119
|
-
`,document.head.appendChild(t)}function Ja({size:t,color:r}){return a.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Loading"},a.createElement("circle",{cx:12,cy:12,r:10,stroke:`${r}33`,strokeWidth:2.5,fill:"none"}),a.createElement("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:r,strokeWidth:2.5,strokeLinecap:"round",fill:"none"}))}function Qa({size:t,borderWidth:r,color:n,reducedMotion:i}){return i?a.createElement(Ja,{size:t,color:n}):(Ga(),a.createElement("div",{role:"img","aria-label":"Loading",style:{width:`${t}px`,height:`${t}px`,border:`${r}px solid ${n}33`,borderTopColor:n,borderRadius:"50%",animation:"tkx-spin-rotate 0.8s linear infinite",boxSizing:"border-box"}}))}function el({spinning:t=!0,size:r="md",tip:n,indicator:i,children:o,fullscreen:l=!1,delay:c=0,style:d}){const u=B.useTheme(),x=s.useReducedMotion(),[f,m]=a.useState(c===0&&t),p=a.useRef(null);if(a.useEffect(()=>(t&&c>0?p.current=setTimeout(()=>m(!0),c):m(t),()=>{p.current!==null&&clearTimeout(p.current)}),[t,c]),!f)return o?a.createElement("div",{style:d},o):null;const h=Za[r],y=n?s.sanitizeString(n):void 0,k=a.createElement("div",{role:"status","aria-live":"polite","aria-label":y??"Loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},i??a.createElement(Qa,{size:h.dimension,borderWidth:h.borderWidth,color:u.primary,reducedMotion:x}),y&&a.createElement("span",{style:{color:u.primary,fontSize:h.fontSize,marginTop:"4px"}},y));return l?a.createElement("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${u.bg}cc`,zIndex:9999,...d}},k):o?a.createElement("div",{style:{position:"relative",...d}},a.createElement("div",{style:{filter:"blur(1px)",opacity:.5,pointerEvents:"none",userSelect:"none",transition:x?"none":"opacity 0.2s, filter 0.2s"}},o),a.createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${u.bg}66`,borderRadius:"4px"}},k)):a.createElement("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",...d}},k)}function tl({color:t,mutedColor:r}){return a.createElement("svg",{width:120,height:100,viewBox:"0 0 120 100",fill:"none","aria-hidden":"true"},a.createElement("path",{d:"M20 40 L60 20 L100 40 L60 60 Z",fill:`${r}18`,stroke:r,strokeWidth:1.5,strokeLinejoin:"round"}),a.createElement("path",{d:"M20 40 L20 65 L60 85 L60 60 Z",fill:`${r}10`,stroke:r,strokeWidth:1.5,strokeLinejoin:"round"}),a.createElement("path",{d:"M100 40 L100 65 L60 85 L60 60 Z",fill:`${r}0d`,stroke:r,strokeWidth:1.5,strokeLinejoin:"round"}),a.createElement("path",{d:"M20 40 L40 28 L60 40 L40 52 Z",fill:`${t}15`,stroke:t,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}),a.createElement("path",{d:"M60 40 L80 28 L100 40 L80 52 Z",fill:`${t}15`,stroke:t,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}))}function rl({mutedColor:t}){return a.createElement("svg",{width:64,height:64,viewBox:"0 0 64 64",fill:"none","aria-hidden":"true"},a.createElement("rect",{x:16,y:8,width:32,height:40,rx:3,fill:`${t}12`,stroke:t,strokeWidth:1.5}),a.createElement("line",{x1:24,y1:20,x2:40,y2:20,stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),a.createElement("line",{x1:24,y1:28,x2:36,y2:28,stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),a.createElement("line",{x1:24,y1:36,x2:32,y2:36,stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),a.createElement("circle",{cx:32,cy:54,r:6,stroke:t,strokeWidth:1.2,fill:"none"}),a.createElement("line",{x1:28,y1:54,x2:36,y2:54,stroke:t,strokeWidth:1.2,strokeLinecap:"round"}))}function nl({image:t="default",description:r="No data",children:n,style:i}){const o=B.useTheme(),l=typeof r=="string"?s.sanitizeString(r):r;let c;return t==="default"?c=a.createElement(tl,{color:o.primary,mutedColor:o.textMuted}):t==="simple"?c=a.createElement(rl,{mutedColor:o.textMuted}):c=t,a.createElement("div",{role:"status",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",textAlign:"center",...i}},a.createElement("div",{style:{marginBottom:"12px",opacity:.85}},c),l&&a.createElement("div",{style:{color:o.textMuted,fontSize:"0.875rem",lineHeight:"1.5",maxWidth:"320px"}},l),n&&a.createElement("div",{style:{marginTop:"16px"}},n))}function sl(t,r,n=","){if(typeof t=="string")return t;const i=r!==void 0?t.toFixed(r):String(t),[o,l]=i.split("."),c=o.replace(/\B(?=(\d{3})+(?!\d))/g,n);return l!==void 0?`${c}.${l}`:c}function ol(t,r){if(t<=0)return r.replace(/DD?/g,"0").replace(/HH?/g,"00").replace(/mm?/g,"00").replace(/ss?/g,"00");const n=Math.floor(t/1e3),i=Math.floor(n/86400),o=Math.floor(n%86400/3600),l=Math.floor(n%3600/60),c=n%60,d=u=>String(u).padStart(2,"0");return r.replace(/DD/g,d(i)).replace(/D/g,String(i)).replace(/HH/g,d(o)).replace(/H/g,String(o)).replace(/mm/g,d(l)).replace(/m/g,String(l)).replace(/ss/g,d(c)).replace(/s/g,String(c))}function il({direction:t,color:r}){const n=t==="up"?"M6 10 L10 4 L14 10":"M6 4 L10 10 L14 4";return a.createElement("svg",{width:16,height:14,viewBox:"0 0 20 14",fill:"none","aria-hidden":"true",style:{display:"inline-block",verticalAlign:"middle"}},a.createElement("path",{d:n,stroke:r,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}))}let Ar=!1;function al(){if(Ar||typeof document>"u")return;Ar=!0;const t=document.createElement("style");t.id="tkx-statistic-skeleton",t.textContent="@keyframes tkx-stat-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}",document.head.appendChild(t)}function ll({w:t,h:r,alt:n,bdr:i,rm:o}){return o||al(),a.createElement("div",{"aria-hidden":"true",style:{width:t,height:r,borderRadius:"4px",background:o?n:`linear-gradient(90deg, ${n} 25%, ${i} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:o?"none":"tkx-stat-shimmer 1.5s ease-in-out infinite"}})}function cl({title:t,value:r,prefix:n,suffix:i,precision:o,groupSeparator:l=",",valueStyle:c,loading:d=!1,trend:u,trendValue:x,style:f}){const m=B.useTheme(),p=s.useReducedMotion(),h=s.sanitizeString(t),y=x?s.sanitizeString(x):void 0,k=u==="up"?m.success:u==="down"?m.danger:void 0;return a.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...f}},a.createElement("div",{style:{color:m.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},h),d?a.createElement(ll,{w:"120px",h:"32px",alt:m.surfaceAlt,bdr:m.border,rm:p}):a.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:m.text,fontVariantNumeric:"tabular-nums",...c}},n&&a.createElement("span",{style:{fontSize:"0.75em",fontWeight:400}},n),a.createElement("span",null,sl(r,o,l)),i&&a.createElement("span",{style:{fontSize:"0.6em",fontWeight:400,color:m.textMuted}},i)),u&&a.createElement("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"0.8125rem",color:k,marginTop:"2px"}},a.createElement(il,{direction:u,color:k}),y&&a.createElement("span",null,y)))}function dl({title:t,value:r,format:n="HH:mm:ss",onFinish:i,prefix:o,suffix:l,style:c}){const d=B.useTheme(),u=s.sanitizeString(t),x=a.useRef(i);x.current=i;const f=a.useRef(!1),[m,p]=a.useState(()=>Math.max(0,r-Date.now()));a.useEffect(()=>{f.current=!1;const y=()=>{var g;const b=Math.max(0,r-Date.now());p(b),b<=0&&!f.current&&(f.current=!0,(g=x.current)==null||g.call(x))};y();const k=setInterval(y,1e3);return()=>clearInterval(k)},[r]);const h=ol(m,n);return a.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...c}},a.createElement("div",{style:{color:d.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},u),a.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:m<=0?d.danger:d.text,fontVariantNumeric:"tabular-nums"}},o&&a.createElement("span",{style:{fontSize:"0.75em",fontWeight:400}},o),a.createElement("span",null,h),l&&a.createElement("span",{style:{fontSize:"0.6em",fontWeight:400,color:d.textMuted}},l)))}const ul={sm:{height:28,fontSize:12,px:10},md:{height:36,fontSize:14,px:16},lg:{height:44,fontSize:16,px:20}};function fl({options:t,value:r,onChange:n,size:i="md",block:o=!1}){const l=B.useTheme(),c=s.useReducedMotion(),d=a.useRef(null),[u,x]=a.useState(()=>Math.max(0,t.findIndex(k=>k.value===r))),[f,m]=a.useState({}),p=ul[i];a.useEffect(()=>{const k=t.findIndex(b=>b.value===r);k>=0&&x(k)},[r,t]),a.useEffect(()=>{const k=d.current;if(!k)return;const g=k.querySelectorAll("[data-seg-btn]")[u];g&&m({left:g.offsetLeft,width:g.offsetWidth,height:g.offsetHeight,transition:c?"none":"left 0.2s ease, width 0.2s ease"})},[u,t,c]);const h=a.useCallback(k=>{const b=t[k];!b||b.disabled||(x(k),n==null||n(b.value))},[t,n]),y=a.useCallback(k=>{var g,w,j;let b=u;if(k.key==="ArrowRight"||k.key==="ArrowDown")for(k.preventDefault(),b=(u+1)%t.length;(g=t[b])!=null&&g.disabled&&b!==u;)b=(b+1)%t.length;else if(k.key==="ArrowLeft"||k.key==="ArrowUp")for(k.preventDefault(),b=(u-1+t.length)%t.length;(w=t[b])!=null&&w.disabled&&b!==u;)b=(b-1+t.length)%t.length;if(b!==u){h(b);const S=d.current,z=S==null?void 0:S.querySelectorAll("[data-seg-btn]");(j=z==null?void 0:z[b])==null||j.focus()}},[u,t,h]);return e.jsxs("div",{ref:d,role:"radiogroup","aria-label":"Segmented control",className:s.tkx("relative inline-flex items-center rounded-lg p-1"),style:{backgroundColor:l.surfaceAlt,border:`1px solid ${l.border}`,width:o?"100%":void 0},onKeyDown:y,children:[e.jsx("div",{"aria-hidden":"true",className:s.tkx("absolute top-1 rounded-md"),style:{...f,backgroundColor:l.surface,boxShadow:`0 1px 3px ${l.border}`,zIndex:0}}),t.map((k,b)=>{const g=b===u,w=s.sanitizeString(k.label);return e.jsxs("button",{"data-seg-btn":!0,type:"button",role:"radio","aria-checked":g,"aria-disabled":k.disabled||void 0,disabled:k.disabled,tabIndex:g?0:-1,className:s.tkx("relative z-10 flex items-center justify-center gap-1 rounded-md border-0 cursor-pointer","font-sans whitespace-nowrap select-none"),style:{height:p.height,fontSize:p.fontSize,padding:`0 ${p.px}px`,flex:o?1:void 0,color:g?l.text:l.textMuted,backgroundColor:"transparent",opacity:k.disabled?.4:1,fontWeight:g?600:400,transition:c?"none":"color 0.15s ease"},onClick:()=>h(b),children:[k.icon&&e.jsx("span",{"aria-hidden":"true",children:k.icon}),w]},k.value)})]})}function xl({options:t,value:r="",onChange:n,trigger:i="@",placeholder:o,label:l}){const c=B.useTheme(),d=s.useReducedMotion(),u=a.useRef(null),x=a.useRef(null),[f,m]=a.useState(r),[p,h]=a.useState(!1),[y,k]=a.useState(""),[b,g]=a.useState(0),[w,j]=a.useState(-1);a.useEffect(()=>{r!==void 0&&m(r)},[r]);const S=t.filter(T=>T.label.toLowerCase().includes(y.toLowerCase())),z=a.useCallback(T=>{const E=T.target.value;m(E),n==null||n(E);const $=T.target.selectionStart??E.length,F=E.slice(0,$),I=F.lastIndexOf(i);if(I>=0){const W=F.slice(I+i.length);if(!/\s/.test(W)){k(W),j(I),h(!0),g(0);return}}h(!1)},[i,n]),v=a.useCallback(T=>{var I;const E=f.slice(0,w),$=f.slice(w+i.length+y.length),F=`${E}${i}${T.value} ${$}`;m(F),n==null||n(F),h(!1),(I=u.current)==null||I.focus()},[f,w,i,y,n]),N=a.useCallback(T=>{p&&(T.key==="ArrowDown"?(T.preventDefault(),g(E=>(E+1)%S.length)):T.key==="ArrowUp"?(T.preventDefault(),g(E=>(E-1+S.length)%S.length)):T.key==="Enter"&&S[b]?(T.preventDefault(),v(S[b])):T.key==="Escape"&&h(!1))},[p,S,b,v]);a.useEffect(()=>{if(!p||!x.current)return;const T=x.current.children[b];T==null||T.scrollIntoView({block:"nearest"})},[b,p]);const C=l?s.sanitizeString(l):void 0,M=o?s.sanitizeString(o):void 0;return e.jsxs("div",{className:s.tkx("relative font-sans"),style:{width:"100%"},children:[C&&e.jsx("label",{className:s.tkx("block text-sm font-medium mb-1"),style:{color:c.text},children:C}),e.jsx("textarea",{ref:u,role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-label":C??"Mentions input",value:f,placeholder:M,onChange:z,onKeyDown:N,onBlur:()=>setTimeout(()=>h(!1),200),className:s.tkx("w-full rounded-lg border px-3 py-2 text-sm resize-y"),style:{backgroundColor:c.surface,borderColor:c.border,color:c.text,minHeight:80,outline:"none"},rows:3}),p&&S.length>0&&e.jsx("ul",{ref:x,role:"listbox","aria-label":"Mention suggestions",className:s.tkx("absolute left-0 right-0 z-50 rounded-lg border overflow-auto"),style:{backgroundColor:c.surface,borderColor:c.border,maxHeight:200,top:"100%",marginTop:4,listStyle:"none",padding:0,boxShadow:`0 4px 12px ${c.bg}80`,animation:d?"none":"tkxFadeIn 0.15s ease"},children:S.map((T,E)=>e.jsxs("li",{role:"option","aria-selected":E===b,className:s.tkx("flex items-center gap-3 px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:E===b?c.surfaceAlt:"transparent",color:c.text},onMouseDown:$=>{$.preventDefault(),v(T)},onMouseEnter:()=>g(E),children:[T.avatar&&e.jsx("img",{src:s.sanitizeString(T.avatar),alt:"","aria-hidden":"true",width:24,height:24,className:s.tkx("rounded-full"),style:{objectFit:"cover"}}),e.jsx("span",{children:s.sanitizeString(T.label)}),e.jsxs("span",{style:{color:c.textMuted,marginLeft:"auto"},children:[i,s.sanitizeString(T.value)]})]},T.value))})]})}function pl(t){let r=5381;for(let n=0;n<t.length;n++)r=(r<<5)+r+t.charCodeAt(n)|0;return Math.abs(r)}function hl(t){let r=t;return()=>(r=r*1664525+1013904223|0,(r>>>0)/4294967295)}const ml={L:.38,M:.42,Q:.48,H:.55};function gl(t,r,n){const i=pl(t),o=hl(i),l=ml[n]??.42,c=Array.from({length:r},()=>Array.from({length:r},()=>!1)),d=(u,x)=>{for(let f=0;f<7;f++)for(let m=0;m<7;m++){const p=f===0||f===6||m===0||m===6,h=f>=2&&f<=4&&m>=2&&m<=4;c[u+f][x+m]=p||h}};d(0,0),d(0,r-7),d(r-7,0);for(let u=7;u<r-7;u++)c[6][u]=u%2===0,c[u][6]=u%2===0;for(let u=0;u<r;u++)for(let x=0;x<r;x++)u<8&&x<8||u<8&&x>=r-8||u>=r-8&&x<8||(u===6||x===6)||(c[u][x]=o()<l);return c}function bl({value:t,size:r=160,color:n,bgColor:i,errorLevel:o="M",icon:l,bordered:c=!0}){const d=B.useTheme(),u=s.useReducedMotion(),x=a.useRef(null),f=s.sanitizeString(t),m=n??d.text,p=i??d.surface,h=25,y=a.useMemo(()=>gl(f,h,o),[f,o]);return a.useEffect(()=>{const k=x.current;if(!k)return;const b=k.getContext("2d");if(!b)return;const g=window.devicePixelRatio||1;k.width=r*g,k.height=r*g,b.scale(g,g);const w=r/h;b.fillStyle=p,b.fillRect(0,0,r,r),b.fillStyle=m;for(let j=0;j<h;j++)for(let S=0;S<h;S++)y[j][S]&&b.fillRect(S*w,j*w,w,w);if(l){const j=r*.22,S=(r-j)/2;b.fillStyle=p,b.fillRect(S-2,S-2,j+4,j+4);const z=new Image;z.crossOrigin="anonymous",z.onload=()=>{b.drawImage(z,S,S,j,j)},z.src=s.sanitizeString(l)}},[y,r,m,p,l]),e.jsx("div",{role:"img","aria-label":`QR code for: ${f}`,className:s.tkx("inline-block rounded-lg"),style:{padding:c?12:0,backgroundColor:c?p:"transparent",border:c?`1px solid ${d.border}`:"none",lineHeight:0,animation:u?"none":"tkxFadeIn 0.2s ease"},children:e.jsx("canvas",{ref:x,"aria-hidden":"true",style:{width:r,height:r,display:"block"}})})}const yl={success:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M22 37l9 9 19-19",stroke:t,strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),error:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M26 26l20 20M46 26L26 46",stroke:t,strokeWidth:"4",strokeLinecap:"round"})]}),warning:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M36 6L4 64h64L36 6z",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M36 30v16",stroke:t,strokeWidth:"4",strokeLinecap:"round"}),e.jsx("circle",{cx:"36",cy:"54",r:"2.5",fill:t})]}),info:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M36 32v18",stroke:t,strokeWidth:"4",strokeLinecap:"round"}),e.jsx("circle",{cx:"36",cy:"22",r:"2.5",fill:t})]}),404:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:t,children:"404"})]}),403:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M28 30h16v16H28z",stroke:t,strokeWidth:"3",fill:"none"}),e.jsx("path",{d:"M32 30v-4a4 4 0 018 0v4",stroke:t,strokeWidth:"3",fill:"none"})]}),500:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:t,children:"500"})]})};function kl(t,r){switch(t){case"success":return r.success;case"error":case"500":return r.danger;case"warning":return r.warning;case"info":return r.info;case"404":case"403":return r.textMuted}}function vl({status:t,title:r,subTitle:n,icon:i,extra:o}){const l=B.useTheme(),c=s.useReducedMotion(),d=kl(t,l),u=s.sanitizeString(r),x=n?s.sanitizeString(n):void 0;return e.jsxs("div",{role:"status","aria-live":"polite",className:s.tkx("flex flex-col items-center text-center px-6 py-12 font-sans"),style:{animation:c?"none":"tkxFadeIn 0.3s ease"},children:[e.jsx("div",{className:s.tkx("mb-6"),children:i??yl[t](d)}),e.jsx("h2",{className:s.tkx("text-xl font-semibold m-0 mb-2"),style:{color:l.text},children:u}),x&&e.jsx("p",{className:s.tkx("text-sm m-0 mb-6 max-w-md leading-relaxed"),style:{color:l.textMuted},children:x}),o&&e.jsx("div",{className:s.tkx("flex items-center gap-3 mt-4"),children:o})]})}function wl(t){const r=document.querySelector(t);return r?r.getBoundingClientRect():null}function jl(t,r,n,i){switch(r){case"top":return{top:t.top-i-12+window.scrollY,left:t.left+t.width/2-n/2+window.scrollX};case"bottom":return{top:t.bottom+12+window.scrollY,left:t.left+t.width/2-n/2+window.scrollX};case"left":return{top:t.top+t.height/2-i/2+window.scrollY,left:t.left-n-12+window.scrollX};case"right":return{top:t.top+t.height/2-i/2+window.scrollY,left:t.right+12+window.scrollX};default:return{top:t.bottom+12+window.scrollY,left:t.left+window.scrollX}}}function Sl({steps:t,isOpen:r=!1,onClose:n,current:i,onChange:o}){const l=B.useTheme(),c=s.useReducedMotion(),[d,u]=a.useState(0),x=i??d,f=a.useRef(null),[m,p]=a.useState({top:0,left:0}),[h,y]=a.useState(null),k=t[x],b=a.useCallback(()=>{if(!k)return;const M=wl(k.target);if(y(M),M&&f.current){const T=f.current.offsetWidth,E=f.current.offsetHeight;p(jl(M,k.placement??"bottom",T,E))}},[k]);a.useEffect(()=>{if(r)return b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[r,x,b]),a.useEffect(()=>{var M;r&&((M=f.current)==null||M.focus())},[r,x]);const g=a.useCallback(M=>{u(M),o==null||o(M)},[o]),w=a.useCallback(()=>{x<t.length-1?g(x+1):n==null||n()},[x,t.length,g,n]),j=a.useCallback(()=>{x>0&&g(x-1)},[x,g]);if(!r||!k)return null;const S=6,z=s.sanitizeString(k.title),v=s.sanitizeString(k.description),C=e.jsxs("div",{"aria-hidden":"true",children:[e.jsx("div",{style:{position:"fixed",inset:0,zIndex:9998,backgroundColor:"rgba(0,0,0,0.55)",clipPath:h?`polygon(0% 0%, 0% 100%, ${h.left-S}px 100%, ${h.left-S}px ${h.top-S}px, ${h.right+S}px ${h.top-S}px, ${h.right+S}px ${h.bottom+S}px, ${h.left-S}px ${h.bottom+S}px, ${h.left-S}px 100%, 100% 100%, 100% 0%)`:void 0,transition:c?"none":"clip-path 0.25s ease"},onClick:n}),e.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-label":`Tour step ${x+1} of ${t.length}`,tabIndex:-1,style:{position:"absolute",zIndex:9999,top:m.top,left:m.left,width:300,backgroundColor:l.surface,border:`1px solid ${l.border}`,borderRadius:10,padding:20,boxShadow:`0 8px 24px ${l.bg}80`,animation:c?"none":"tkxFadeIn 0.2s ease",fontFamily:"inherit"},onKeyDown:M=>{M.key==="Escape"&&(n==null||n())},children:[e.jsx("h3",{className:s.tkx("m-0 mb-2 text-base font-semibold"),style:{color:l.text},children:z}),e.jsx("p",{className:s.tkx("m-0 mb-4 text-sm leading-relaxed"),style:{color:l.textMuted},children:v}),e.jsx("div",{className:s.tkx("flex items-center gap-1 mb-4"),"aria-label":"Tour progress",children:t.map((M,T)=>e.jsx("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",backgroundColor:T===x?l.primary:l.border,transition:c?"none":"background-color 0.2s"}},T))}),e.jsxs("div",{className:s.tkx("flex items-center justify-between gap-2"),children:[e.jsx("button",{type:"button","aria-label":"Skip tour",onClick:n,className:s.tkx("border-0 bg-transparent cursor-pointer text-sm px-2 py-1"),style:{color:l.textMuted},children:"Skip"}),e.jsxs("div",{className:s.tkx("flex gap-2"),children:[x>0&&e.jsx("button",{type:"button","aria-label":"Previous step",onClick:j,className:s.tkx("rounded-md border px-3 py-1 text-sm cursor-pointer bg-transparent"),style:{borderColor:l.border,color:l.text},children:"Prev"}),e.jsx("button",{type:"button","aria-label":x===t.length-1?"Finish tour":"Next step",onClick:w,className:s.tkx("rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium"),style:{backgroundColor:l.primary,color:"#fff"},children:x===t.length-1?"Finish":"Next"})]})]})]})]});return Le.createPortal(C,document.body)}function Cl(t,r,n,i,o){const l=document.createElement("canvas"),c=l.getContext("2d");if(!c)return"";const d=i*1.5,u=t.length*d,x=Math.max(...t.map(h=>h.length))*i*.6,f=n[0]+x,m=n[1]+u,p=2;return l.width=f*p,l.height=m*p,c.scale(p,p),c.translate(f/2,m/2),c.rotate(r*Math.PI/180),c.font=`${i}px sans-serif`,c.fillStyle=o,c.textAlign="center",c.textBaseline="middle",t.forEach((h,y)=>{const k=(y-(t.length-1)/2)*d;c.fillText(h,0,k)}),l.toDataURL()}function Tl({text:t,children:r,rotate:n=-22,gap:i=[100,100],fontSize:o=14,color:l,zIndex:c=10}){const d=B.useTheme(),u=s.useReducedMotion(),x=a.useRef(null),[f,m]=a.useState(""),p=a.useMemo(()=>(Array.isArray(t)?t:[t]).map(k=>s.sanitizeString(k)),[t]),h=l??`${d.textMuted}22`,y=a.useCallback(()=>Cl(p,n,i,o,h),[p,n,i,o,h]);return a.useEffect(()=>{const k=y();k&&m(`url(${k})`)},[y]),a.useEffect(()=>{var g;const k=(g=x.current)==null?void 0:g.querySelector("[data-watermark]");if(!k)return;const b=new MutationObserver(()=>{const w=y();w&&(k.style.backgroundImage=`url(${w})`)});return b.observe(k,{attributes:!0,attributeFilter:["style"]}),()=>b.disconnect()},[y]),e.jsxs("div",{ref:x,className:s.tkx("relative"),style:{overflow:"hidden"},children:[r,e.jsx("div",{"data-watermark":!0,"aria-hidden":"true",className:s.tkx("absolute inset-0 pointer-events-none"),style:{zIndex:c,backgroundImage:f,backgroundRepeat:"repeat",animation:u?"none":"tkxFadeIn 0.3s ease"}})]})}function Pr(t){if(t)try{return t()}catch{return window}return window}function Ml(t){if(t instanceof Window)return{top:0,bottom:t.innerHeight};const r=t.getBoundingClientRect();return{top:r.top,bottom:r.bottom}}function $l({children:t,offsetTop:r,offsetBottom:n,onChange:i,target:o}){const l=B.useTheme(),c=s.useReducedMotion(),d=a.useRef(null),u=a.useRef(null),[x,f]=a.useState(!1),[m,p]=a.useState({width:0,height:0}),h=a.useRef(!1),y=a.useMemo(()=>s.sanitizeString("Sticky content"),[]),k=a.useCallback(()=>{const w=d.current;if(!w)return;const j=w.getBoundingClientRect(),S=Ml(Pr(o));let z=!1;r!==void 0?z=j.top-S.top<=r:n!==void 0&&(z=S.bottom-j.bottom<=n),z!==h.current&&(h.current=z,f(z),p({width:j.width,height:j.height}),i==null||i(z))},[r,n,i,o]);a.useEffect(()=>{const w=Pr(o);return k(),w.addEventListener("scroll",k,{passive:!0}),window.addEventListener("resize",k),()=>{w.removeEventListener("scroll",k),window.removeEventListener("resize",k)}},[k,o]);const b=x?{position:"fixed",zIndex:100,...r!==void 0?{top:r}:{},...n!==void 0?{bottom:n}:{},width:m.width||void 0,transition:c?"none":"box-shadow 0.2s ease",boxShadow:`0 2px 8px ${l.border}`}:{},g=x?{height:m.height,width:m.width}:{};return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:d,"aria-hidden":x,style:g}),e.jsx("div",{ref:u,role:"region","aria-label":y,className:s.tkx(x?"tkx-affixed":""),style:b,children:t})]})}function En(t){const r=[];for(const n of t)r.push(n),n.children&&r.push(...En(n.children));return r}function Br(t){return t.startsWith("#")?t.slice(1):t}function Nn({item:t,activeKey:r,depth:n,onClick:i,theme:o,reducedMotion:l}){const c=t.key===r,d=s.sanitizeString(t.title);return e.jsxs("li",{role:"none",style:{listStyle:"none"},children:[e.jsx("a",{role:"treeitem","aria-current":c?"location":void 0,href:t.href,onClick:u=>{u.preventDefault(),i(t.href)},className:s.tkx("block text-sm py-1 no-underline"),style:{paddingLeft:12+n*16,color:c?o.primary:o.textMuted,fontWeight:c?600:400,borderLeft:`2px solid ${c?o.primary:"transparent"}`,transition:l?"none":"color 0.15s ease, border-color 0.15s ease"},children:d}),t.children&&t.children.length>0&&e.jsx("ul",{role:"group",style:{margin:0,padding:0},children:t.children.map(u=>e.jsx(Nn,{item:u,activeKey:r,depth:n+1,onClick:i,theme:o,reducedMotion:l},u.key))})]})}function zl({items:t,offsetTop:r=0,getCurrentAnchor:n,onChange:i}){var p;const o=B.useTheme(),l=s.useReducedMotion(),[c,d]=a.useState(((p=t[0])==null?void 0:p.key)??""),u=a.useRef(!1),x=En(t),f=a.useCallback(()=>{var y;if(u.current)return;let h=((y=x[0])==null?void 0:y.key)??"";for(const k of x){const b=Br(k.href),g=document.getElementById(b);g&&g.getBoundingClientRect().top<=r+10&&(h=k.key)}n&&(h=n(h)),h!==c&&(d(h),i==null||i(h))},[x,r,n,c,i]);a.useEffect(()=>(window.addEventListener("scroll",f,{passive:!0}),f(),()=>window.removeEventListener("scroll",f)),[f]);const m=a.useCallback(h=>{const y=Br(h),k=document.getElementById(y);if(!k)return;u.current=!0;const b=k.getBoundingClientRect().top+window.scrollY-r;window.scrollTo({top:b,behavior:l?"auto":"smooth"});const g=x.find(w=>w.href===h);g&&(d(g.key),i==null||i(g.key)),setTimeout(()=>{u.current=!1},800)},[x,r,l,i]);return e.jsx("nav",{role:"tree","aria-label":"Anchor navigation",className:s.tkx("font-sans"),style:{borderLeft:`1px solid ${o.border}`,padding:"4px 0"},children:e.jsx("ul",{role:"group",style:{margin:0,padding:0},children:t.map(h=>e.jsx(Nn,{item:h,activeKey:c,depth:0,onClick:m,theme:o,reducedMotion:l},h.key))})})}function Il(t,r){var o;const n=[t];let i=t;for(const l of r){const c=i.find(d=>d.value===l);if((o=c==null?void 0:c.children)!=null&&o.length)n.push(c.children),i=c.children;else break}return n}function Rn(t,r){const n=[];let i=t;for(const o of r){const l=i.find(c=>c.value===o);if(l)n.push(l),i=l.children??[];else break}return n}function El(t,r){return Rn(t,r).map(n=>s.sanitizeString(n.label)).join(" / ")}function Nl({options:t,value:r=[],onChange:n,placeholder:i="Select...",label:o,multiple:l=!1}){const c=B.useTheme(),d=s.useReducedMotion(),u=a.useRef(null),x=a.useRef(null),[f,m]=a.useState(!1),[p,h]=a.useState(r),[y,k]=a.useState({top:0,left:0,width:0}),b=o?s.sanitizeString(o):void 0,g=s.sanitizeString(i),w=r.length>0?El(t,r):"";a.useEffect(()=>{if(!f||!u.current)return;const N=u.current.getBoundingClientRect();k({top:N.bottom+4+window.scrollY,left:N.left+window.scrollX,width:Math.max(N.width,200)})},[f]),a.useEffect(()=>{if(!f)return;const N=C=>{var M,T;!((M=u.current)!=null&&M.contains(C.target))&&!((T=x.current)!=null&&T.contains(C.target))&&m(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[f]);const j=a.useCallback((N,C)=>{var T;if(C.disabled)return;const M=[...p.slice(0,N),C.value];if(h(M),!((T=C.children)!=null&&T.length)){const E=Rn(t,M);n==null||n(M,E),l||m(!1)}},[p,t,n,l]),S=a.useCallback(N=>{var C;N.key==="Escape"?(m(!1),(C=u.current)==null||C.focus()):(N.key==="Enter"||N.key===" ")&&(f||(N.preventDefault(),m(!0)))},[f]),z=Il(t,p),v=f?Le.createPortal(e.jsx("div",{ref:x,role:"tree","aria-label":b??"Cascader options",className:s.tkx("flex rounded-lg border overflow-hidden"),style:{position:"absolute",zIndex:9999,top:y.top,left:y.left,backgroundColor:c.surface,borderColor:c.border,boxShadow:`0 4px 16px ${c.bg}80`,animation:d?"none":"tkxFadeIn 0.15s ease"},children:z.map((N,C)=>e.jsx("ul",{role:"group",className:s.tkx("m-0 p-0 overflow-auto"),style:{listStyle:"none",minWidth:160,maxHeight:260,borderRight:C<z.length-1?`1px solid ${c.border}`:"none"},children:N.map(M=>{var $;const T=p[C]===M.value,E=s.sanitizeString(M.label);return e.jsxs("li",{role:"treeitem","aria-selected":T,"aria-disabled":M.disabled||void 0,"aria-expanded":($=M.children)!=null&&$.length?T:void 0,className:s.tkx("flex items-center justify-between px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:T?c.surfaceAlt:"transparent",color:M.disabled?c.textMuted:c.text,opacity:M.disabled?.5:1,cursor:M.disabled?"not-allowed":"pointer"},onClick:()=>j(C,M),onMouseEnter:()=>{M.disabled||h(F=>[...F.slice(0,C),M.value])},children:[e.jsx("span",{children:E}),M.children&&M.children.length>0&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:c.textMuted,flexShrink:0},children:e.jsx("path",{d:"M10 6l6 6-6 6V6z"})})]},M.value)})},C))}),document.body):null;return e.jsxs("div",{className:s.tkx("relative font-sans"),onKeyDown:S,children:[b&&e.jsx("label",{className:s.tkx("block text-sm font-medium mb-1"),style:{color:c.text},children:b}),e.jsxs("button",{ref:u,type:"button",role:"combobox","aria-expanded":f,"aria-haspopup":"tree","aria-label":b??"Cascader",className:s.tkx("w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer"),style:{backgroundColor:c.surface,borderColor:f?c.primary:c.border,color:w?c.text:c.textMuted,outline:"none",minHeight:38,textAlign:"left"},onClick:()=>m(N=>!N),children:[e.jsx("span",{className:s.tkx("truncate"),children:w||g}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:c.textMuted,transform:f?"rotate(180deg)":"rotate(0deg)",transition:d?"none":"transform 0.2s ease",flexShrink:0},children:e.jsx("path",{d:"M7 10l5 5 5-5H7z"})})]}),v]})}const Rl={sm:"8px 12px",md:"12px 16px",lg:"16px 20px"};function Ll({theme:t,reducedMotion:r}){return e.jsxs("div",{className:s.tkx("flex items-center gap-3 px-4 py-3"),"aria-hidden":"true",children:[e.jsx("div",{style:{width:40,height:40,borderRadius:"50%",backgroundColor:t.surfaceAlt,animation:r?"none":"tkxPulse 1.5s ease infinite"}}),e.jsxs("div",{className:s.tkx("flex-1"),children:[e.jsx("div",{style:{width:"60%",height:14,borderRadius:4,backgroundColor:t.surfaceAlt,marginBottom:8,animation:r?"none":"tkxPulse 1.5s ease infinite"}}),e.jsx("div",{style:{width:"40%",height:12,borderRadius:4,backgroundColor:t.surfaceAlt,animation:r?"none":"tkxPulse 1.5s ease infinite"}})]})]})}function Dl({items:t,header:r,footer:n,bordered:i=!0,size:o="md",loading:l=!1,emptyText:c="No data",grid:d}){const u=B.useTheme(),x=s.useReducedMotion(),f=s.sanitizeString(c),m=Rl[o],p=!!d,h=(d==null?void 0:d.column)??1,y=(d==null?void 0:d.gutter)??16;return e.jsxs("div",{role:"list","aria-label":"List","aria-busy":l,className:s.tkx("font-sans rounded-lg overflow-hidden"),style:{border:i?`1px solid ${u.border}`:"none",backgroundColor:u.surface},children:[r&&e.jsx("div",{className:s.tkx("font-semibold text-sm"),style:{padding:m,color:u.text,borderBottom:`1px solid ${u.border}`,backgroundColor:u.surfaceAlt},children:r}),l&&e.jsx("div",{children:Array.from({length:3}).map((k,b)=>e.jsx(Ll,{theme:u,reducedMotion:x},b))}),!l&&t.length===0&&e.jsx("div",{role:"status",className:s.tkx("text-center py-12 text-sm"),style:{color:u.textMuted},children:f}),!l&&t.length>0&&e.jsx("div",{style:p?{display:"grid",gridTemplateColumns:`repeat(${h}, 1fr)`,gap:y,padding:y}:void 0,children:t.map((k,b)=>{const g=s.sanitizeString(k.title),w=k.description?s.sanitizeString(k.description):void 0;return e.jsxs("div",{role:"listitem",className:s.tkx("flex items-start gap-3"),style:{padding:m,borderBottom:!p&&b<t.length-1?`1px solid ${u.border}`:"none",...p?{border:`1px solid ${u.border}`,borderRadius:8,backgroundColor:u.surface}:{},animation:x?"none":`tkxFadeIn 0.2s ease ${b*.03}s both`},children:[k.avatar&&e.jsx("div",{"aria-hidden":"true",className:s.tkx("shrink-0"),children:k.avatar}),e.jsxs("div",{className:s.tkx("flex-1 min-w-0"),children:[e.jsx("div",{className:s.tkx("text-sm font-medium"),style:{color:u.text},children:g}),w&&e.jsx("div",{className:s.tkx("text-xs mt-1 leading-relaxed"),style:{color:u.textMuted},children:w})]}),k.extra&&e.jsx("div",{className:s.tkx("shrink-0 ml-auto"),style:{color:u.textMuted},children:k.extra}),k.actions&&e.jsx("div",{className:s.tkx("shrink-0 flex items-center gap-2"),children:k.actions})]},k.key)})}),n&&e.jsx("div",{className:s.tkx("text-sm"),style:{padding:m,color:u.textMuted,borderTop:`1px solid ${u.border}`,backgroundColor:u.surfaceAlt},children:n})]})}const Tt={close:"Close",cancel:"Cancel",confirm:"Confirm",save:"Save",delete:"Delete",search:"Search",loading:"Loading...",noResults:"No results found",required:"Required",previous:"Previous",next:"Next",pageOf:(t,r)=>`Page ${t} of ${r}`,selectPlaceholder:"Select...",clearSelection:"Clear selection",selectDate:"Select a date",today:"Today",dropFiles:"Drop files here or",browse:"Browse",noData:"No data available",sortAscending:"Sort ascending",sortDescending:"Sort descending",filterPlaceholder:"Filter...",exportCsv:"Export CSV",rowsSelected:t=>`${t} row${t===1?"":"s"} selected`},Ln={close:"Cerrar",cancel:"Cancelar",confirm:"Confirmar",save:"Guardar",delete:"Eliminar",search:"Buscar",loading:"Cargando...",noResults:"No se encontraron resultados",required:"Requerido",previous:"Anterior",next:"Siguiente",pageOf:(t,r)=>`Página ${t} de ${r}`,selectPlaceholder:"Seleccionar...",clearSelection:"Limpiar selección",selectDate:"Seleccionar fecha",today:"Hoy",dropFiles:"Suelte archivos aquí o",browse:"Explorar",noData:"No hay datos disponibles",sortAscending:"Orden ascendente",sortDescending:"Orden descendente",filterPlaceholder:"Filtrar...",exportCsv:"Exportar CSV",rowsSelected:t=>`${t} fila${t===1?"":"s"} seleccionada${t===1?"":"s"}`},Dn={close:"Fechar",cancel:"Cancelar",confirm:"Confirmar",save:"Salvar",delete:"Excluir",search:"Pesquisar",loading:"Carregando...",noResults:"Nenhum resultado encontrado",required:"Obrigatório",previous:"Anterior",next:"Próximo",pageOf:(t,r)=>`Página ${t} de ${r}`,selectPlaceholder:"Selecionar...",clearSelection:"Limpar seleção",selectDate:"Selecionar data",today:"Hoje",dropFiles:"Solte arquivos aqui ou",browse:"Procurar",noData:"Nenhum dado disponível",sortAscending:"Ordenar crescente",sortDescending:"Ordenar decrescente",filterPlaceholder:"Filtrar...",exportCsv:"Exportar CSV",rowsSelected:t=>`${t} linha${t===1?"":"s"} selecionada${t===1?"":"s"}`},An={close:"Fechar",cancel:"Cancelar",confirm:"Confirmar",save:"Guardar",delete:"Eliminar",search:"Pesquisar",loading:"A carregar...",noResults:"Sem resultados",required:"Obrigatório",previous:"Anterior",next:"Próximo",pageOf:(t,r)=>`Página ${t} de ${r}`,selectPlaceholder:"Selecionar...",clearSelection:"Limpar seleção",selectDate:"Selecionar data",today:"Hoje",dropFiles:"Largue ficheiros aqui ou",browse:"Procurar",noData:"Sem dados disponíveis",sortAscending:"Ordenar crescente",sortDescending:"Ordenar decrescente",filterPlaceholder:"Filtrar...",exportCsv:"Exportar CSV",rowsSelected:t=>`${t} linha${t===1?"":"s"} selecionada${t===1?"":"s"}`},Pn={close:"Fermer",cancel:"Annuler",confirm:"Confirmer",save:"Enregistrer",delete:"Supprimer",search:"Rechercher",loading:"Chargement...",noResults:"Aucun résultat trouvé",required:"Obligatoire",previous:"Précédent",next:"Suivant",pageOf:(t,r)=>`Page ${t} sur ${r}`,selectPlaceholder:"Sélectionner...",clearSelection:"Effacer la sélection",selectDate:"Sélectionner une date",today:"Aujourd'hui",dropFiles:"Déposez les fichiers ici ou",browse:"Parcourir",noData:"Aucune donnée disponible",sortAscending:"Tri croissant",sortDescending:"Tri décroissant",filterPlaceholder:"Filtrer...",exportCsv:"Exporter CSV",rowsSelected:t=>`${t} ligne${t===1?"":"s"} sélectionnée${t===1?"":"s"}`},Bn={close:"Schließen",cancel:"Abbrechen",confirm:"Bestätigen",save:"Speichern",delete:"Löschen",search:"Suchen",loading:"Wird geladen...",noResults:"Keine Ergebnisse gefunden",required:"Erforderlich",previous:"Zurück",next:"Weiter",pageOf:(t,r)=>`Seite ${t} von ${r}`,selectPlaceholder:"Auswählen...",clearSelection:"Auswahl löschen",selectDate:"Datum auswählen",today:"Heute",dropFiles:"Dateien hier ablegen oder",browse:"Durchsuchen",noData:"Keine Daten verfügbar",sortAscending:"Aufsteigend sortieren",sortDescending:"Absteigend sortieren",filterPlaceholder:"Filtern...",exportCsv:"CSV exportieren",rowsSelected:t=>`${t} Zeile${t===1?"":"n"} ausgewählt`},Fn={close:"Chiudi",cancel:"Annulla",confirm:"Conferma",save:"Salva",delete:"Elimina",search:"Cerca",loading:"Caricamento...",noResults:"Nessun risultato trovato",required:"Obbligatorio",previous:"Precedente",next:"Successivo",pageOf:(t,r)=>`Pagina ${t} di ${r}`,selectPlaceholder:"Seleziona...",clearSelection:"Cancella selezione",selectDate:"Seleziona una data",today:"Oggi",dropFiles:"Trascina file qui o",browse:"Sfoglia",noData:"Nessun dato disponibile",sortAscending:"Ordinamento crescente",sortDescending:"Ordinamento decrescente",filterPlaceholder:"Filtra...",exportCsv:"Esporta CSV",rowsSelected:t=>`${t} riga${t===1?"":"i"} selezionat${t===1?"a":"e"}`},Wn={close:"Sluiten",cancel:"Annuleren",confirm:"Bevestigen",save:"Opslaan",delete:"Verwijderen",search:"Zoeken",loading:"Laden...",noResults:"Geen resultaten gevonden",required:"Verplicht",previous:"Vorige",next:"Volgende",pageOf:(t,r)=>`Pagina ${t} van ${r}`,selectPlaceholder:"Selecteer...",clearSelection:"Selectie wissen",selectDate:"Selecteer een datum",today:"Vandaag",dropFiles:"Zet bestanden hier neer of",browse:"Bladeren",noData:"Geen gegevens beschikbaar",sortAscending:"Oplopend sorteren",sortDescending:"Aflopend sorteren",filterPlaceholder:"Filteren...",exportCsv:"CSV exporteren",rowsSelected:t=>`${t} rij${t===1?"":"en"} geselecteerd`},Hn={close:"Zamknij",cancel:"Anuluj",confirm:"Potwierdź",save:"Zapisz",delete:"Usuń",search:"Szukaj",loading:"Ładowanie...",noResults:"Nie znaleziono wyników",required:"Wymagane",previous:"Poprzednia",next:"Następna",pageOf:(t,r)=>`Strona ${t} z ${r}`,selectPlaceholder:"Wybierz...",clearSelection:"Wyczyść wybór",selectDate:"Wybierz datę",today:"Dzisiaj",dropFiles:"Upuść pliki tutaj lub",browse:"Przeglądaj",noData:"Brak danych",sortAscending:"Sortuj rosnąco",sortDescending:"Sortuj malejąco",filterPlaceholder:"Filtruj...",exportCsv:"Eksportuj CSV",rowsSelected:t=>`Wybrano ${t} wier${t===1?"sz":"sze"}`},Vn={close:"Закрыть",cancel:"Отмена",confirm:"Подтвердить",save:"Сохранить",delete:"Удалить",search:"Поиск",loading:"Загрузка...",noResults:"Результаты не найдены",required:"Обязательно",previous:"Назад",next:"Вперёд",pageOf:(t,r)=>`Страница ${t} из ${r}`,selectPlaceholder:"Выбрать...",clearSelection:"Снять выделение",selectDate:"Выбрать дату",today:"Сегодня",dropFiles:"Перетащите файлы сюда или",browse:"Обзор",noData:"Нет данных",sortAscending:"По возрастанию",sortDescending:"По убыванию",filterPlaceholder:"Фильтр...",exportCsv:"Экспорт CSV",rowsSelected:t=>`Выбрано ${t} строк`},On={close:"Закрити",cancel:"Скасувати",confirm:"Підтвердити",save:"Зберегти",delete:"Видалити",search:"Пошук",loading:"Завантаження...",noResults:"Результати не знайдено",required:"Обов'язково",previous:"Назад",next:"Далі",pageOf:(t,r)=>`Сторінка ${t} з ${r}`,selectPlaceholder:"Вибрати...",clearSelection:"Очистити вибір",selectDate:"Вибрати дату",today:"Сьогодні",dropFiles:"Перетягніть файли або",browse:"Огляд",noData:"Немає даних",sortAscending:"За зростанням",sortDescending:"За спаданням",filterPlaceholder:"Фільтр...",exportCsv:"Експорт CSV",rowsSelected:t=>`Вибрано ${t} рядків`},_n={close:"Kapat",cancel:"İptal",confirm:"Onayla",save:"Kaydet",delete:"Sil",search:"Ara",loading:"Yükleniyor...",noResults:"Sonuç bulunamadı",required:"Zorunlu",previous:"Önceki",next:"Sonraki",pageOf:(t,r)=>`${r} sayfadan ${t}. sayfa`,selectPlaceholder:"Seçin...",clearSelection:"Seçimi temizle",selectDate:"Tarih seçin",today:"Bugün",dropFiles:"Dosyaları buraya bırakın veya",browse:"Gözat",noData:"Veri yok",sortAscending:"Artan sıralama",sortDescending:"Azalan sıralama",filterPlaceholder:"Filtrele...",exportCsv:"CSV dışa aktar",rowsSelected:t=>`${t} satır seçildi`},Yn={close:"Stäng",cancel:"Avbryt",confirm:"Bekräfta",save:"Spara",delete:"Ta bort",search:"Sök",loading:"Laddar...",noResults:"Inga resultat hittades",required:"Obligatoriskt",previous:"Föregående",next:"Nästa",pageOf:(t,r)=>`Sida ${t} av ${r}`,selectPlaceholder:"Välj...",clearSelection:"Rensa val",selectDate:"Välj ett datum",today:"Idag",dropFiles:"Släpp filer här eller",browse:"Bläddra",noData:"Inga data tillgängliga",sortAscending:"Sortera stigande",sortDescending:"Sortera fallande",filterPlaceholder:"Filtrera...",exportCsv:"Exportera CSV",rowsSelected:t=>`${t} rad${t===1?"":"er"} vald${t===1?"":"a"}`},Un={close:"Luk",cancel:"Annuller",confirm:"Bekræft",save:"Gem",delete:"Slet",search:"Søg",loading:"Indlæser...",noResults:"Ingen resultater fundet",required:"Påkrævet",previous:"Forrige",next:"Næste",pageOf:(t,r)=>`Side ${t} af ${r}`,selectPlaceholder:"Vælg...",clearSelection:"Ryd valg",selectDate:"Vælg en dato",today:"I dag",dropFiles:"Slip filer her eller",browse:"Gennemse",noData:"Ingen data tilgængelige",sortAscending:"Sorter stigende",sortDescending:"Sorter faldende",filterPlaceholder:"Filtrer...",exportCsv:"Eksporter CSV",rowsSelected:t=>`${t} række${t===1?"":"r"} valgt`},Kn={close:"Zavřít",cancel:"Zrušit",confirm:"Potvrdit",save:"Uložit",delete:"Smazat",search:"Hledat",loading:"Načítání...",noResults:"Žádné výsledky",required:"Povinné",previous:"Předchozí",next:"Další",pageOf:(t,r)=>`Stránka ${t} z ${r}`,selectPlaceholder:"Vyberte...",clearSelection:"Vymazat výběr",selectDate:"Vyberte datum",today:"Dnes",dropFiles:"Přetáhněte soubory nebo",browse:"Procházet",noData:"Žádná data",sortAscending:"Seřadit vzestupně",sortDescending:"Seřadit sestupně",filterPlaceholder:"Filtrovat...",exportCsv:"Exportovat CSV",rowsSelected:t=>`Vybráno ${t} řádků`},Xn={close:"Bezárás",cancel:"Mégse",confirm:"Megerősítés",save:"Mentés",delete:"Törlés",search:"Keresés",loading:"Betöltés...",noResults:"Nincs találat",required:"Kötelező",previous:"Előző",next:"Következő",pageOf:(t,r)=>`${t}. oldal / ${r}`,selectPlaceholder:"Válasszon...",clearSelection:"Kijelölés törlése",selectDate:"Válasszon dátumot",today:"Ma",dropFiles:"Húzza ide a fájlokat vagy",browse:"Tallózás",noData:"Nincs adat",sortAscending:"Növekvő sorrend",sortDescending:"Csökkenő sorrend",filterPlaceholder:"Szűrés...",exportCsv:"CSV exportálása",rowsSelected:t=>`${t} sor kiválasztva`},qn={close:"إغلاق",cancel:"إلغاء",confirm:"تأكيد",save:"حفظ",delete:"حذف",search:"بحث",loading:"...جارٍ التحميل",noResults:"لم يتم العثور على نتائج",required:"مطلوب",previous:"السابق",next:"التالي",pageOf:(t,r)=>`صفحة ${t} من ${r}`,selectPlaceholder:"...اختر",clearSelection:"مسح الاختيار",selectDate:"اختر تاريخ",today:"اليوم",dropFiles:"أفلت الملفات هنا أو",browse:"تصفح",noData:"لا توجد بيانات",sortAscending:"ترتيب تصاعدي",sortDescending:"ترتيب تنازلي",filterPlaceholder:"...فلترة",exportCsv:"تصدير CSV",rowsSelected:t=>`تم تحديد ${t} صفوف`},Zn={close:"סגור",cancel:"ביטול",confirm:"אישור",save:"שמור",delete:"מחק",search:"חיפוש",loading:"טוען...",noResults:"לא נמצאו תוצאות",required:"חובה",previous:"הקודם",next:"הבא",pageOf:(t,r)=>`עמוד ${t} מתוך ${r}`,selectPlaceholder:"בחר...",clearSelection:"נקה בחירה",selectDate:"בחר תאריך",today:"היום",dropFiles:"גרור קבצים לכאן או",browse:"עיון",noData:"אין נתונים",sortAscending:"מיון עולה",sortDescending:"מיון יורד",filterPlaceholder:"סינון...",exportCsv:"ייצוא CSV",rowsSelected:t=>`נבחרו ${t} שורות`},Gn={close:"بستن",cancel:"لغو",confirm:"تأیید",save:"ذخیره",delete:"حذف",search:"جستجو",loading:"...در حال بارگذاری",noResults:"نتیجهای یافت نشد",required:"الزامی",previous:"قبلی",next:"بعدی",pageOf:(t,r)=>`صفحه ${t} از ${r}`,selectPlaceholder:"...انتخاب کنید",clearSelection:"پاک کردن انتخاب",selectDate:"تاریخ را انتخاب کنید",today:"امروز",dropFiles:"فایلها را اینجا رها کنید یا",browse:"مرور",noData:"دادهای موجود نیست",sortAscending:"مرتبسازی صعودی",sortDescending:"مرتبسازی نزولی",filterPlaceholder:"...فیلتر",exportCsv:"خروجی CSV",rowsSelected:t=>`${t} ردیف انتخاب شده`},Jn={close:"閉じる",cancel:"キャンセル",confirm:"確認",save:"保存",delete:"削除",search:"検索",loading:"読み込み中...",noResults:"結果が見つかりません",required:"必須",previous:"前へ",next:"次へ",pageOf:(t,r)=>`${r}ページ中${t}ページ`,selectPlaceholder:"選択...",clearSelection:"選択解除",selectDate:"日付を選択",today:"今日",dropFiles:"ファイルをドロップまたは",browse:"参照",noData:"データなし",sortAscending:"昇順",sortDescending:"降順",filterPlaceholder:"フィルター...",exportCsv:"CSVエクスポート",rowsSelected:t=>`${t}行選択中`},Qn={close:"닫기",cancel:"취소",confirm:"확인",save:"저장",delete:"삭제",search:"검색",loading:"로딩 중...",noResults:"검색 결과 없음",required:"필수",previous:"이전",next:"다음",pageOf:(t,r)=>`${r}페이지 중 ${t}페이지`,selectPlaceholder:"선택...",clearSelection:"선택 해제",selectDate:"날짜 선택",today:"오늘",dropFiles:"여기에 파일을 놓거나",browse:"찾아보기",noData:"데이터 없음",sortAscending:"오름차순 정렬",sortDescending:"내림차순 정렬",filterPlaceholder:"필터...",exportCsv:"CSV 내보내기",rowsSelected:t=>`${t}개 행 선택됨`},es={close:"关闭",cancel:"取消",confirm:"确认",save:"保存",delete:"删除",search:"搜索",loading:"加载中...",noResults:"未找到结果",required:"必填",previous:"上一页",next:"下一页",pageOf:(t,r)=>`第 ${t} 页,共 ${r} 页`,selectPlaceholder:"请选择...",clearSelection:"清除选择",selectDate:"选择日期",today:"今天",dropFiles:"将文件拖到此处或",browse:"浏览",noData:"暂无数据",sortAscending:"升序排列",sortDescending:"降序排列",filterPlaceholder:"筛选...",exportCsv:"导出 CSV",rowsSelected:t=>`已选择 ${t} 行`},ts={close:"關閉",cancel:"取消",confirm:"確認",save:"儲存",delete:"刪除",search:"搜尋",loading:"載入中...",noResults:"未找到結果",required:"必填",previous:"上一頁",next:"下一頁",pageOf:(t,r)=>`第 ${t} 頁,共 ${r} 頁`,selectPlaceholder:"請選擇...",clearSelection:"清除選擇",selectDate:"選擇日期",today:"今天",dropFiles:"將檔案拖曳至此或",browse:"瀏覽",noData:"暫無資料",sortAscending:"升冪排列",sortDescending:"降冪排列",filterPlaceholder:"篩選...",exportCsv:"匯出 CSV",rowsSelected:t=>`已選擇 ${t} 行`},rs={close:"ปิด",cancel:"ยกเลิก",confirm:"ยืนยัน",save:"บันทึก",delete:"ลบ",search:"ค้นหา",loading:"กำลังโหลด...",noResults:"ไม่พบผลลัพธ์",required:"จำเป็น",previous:"ก่อนหน้า",next:"ถัดไป",pageOf:(t,r)=>`หน้า ${t} จาก ${r}`,selectPlaceholder:"เลือก...",clearSelection:"ล้างการเลือก",selectDate:"เลือกวันที่",today:"วันนี้",dropFiles:"วางไฟล์ที่นี่หรือ",browse:"เรียกดู",noData:"ไม่มีข้อมูล",sortAscending:"เรียงจากน้อยไปมาก",sortDescending:"เรียงจากมากไปน้อย",filterPlaceholder:"กรอง...",exportCsv:"ส่งออก CSV",rowsSelected:t=>`เลือก ${t} แถว`},ns={close:"Đóng",cancel:"Hủy",confirm:"Xác nhận",save:"Lưu",delete:"Xóa",search:"Tìm kiếm",loading:"Đang tải...",noResults:"Không tìm thấy kết quả",required:"Bắt buộc",previous:"Trước",next:"Tiếp",pageOf:(t,r)=>`Trang ${t} / ${r}`,selectPlaceholder:"Chọn...",clearSelection:"Xóa lựa chọn",selectDate:"Chọn ngày",today:"Hôm nay",dropFiles:"Thả tệp vào đây hoặc",browse:"Duyệt",noData:"Không có dữ liệu",sortAscending:"Sắp xếp tăng dần",sortDescending:"Sắp xếp giảm dần",filterPlaceholder:"Lọc...",exportCsv:"Xuất CSV",rowsSelected:t=>`Đã chọn ${t} hàng`},ss={close:"Tutup",cancel:"Batal",confirm:"Konfirmasi",save:"Simpan",delete:"Hapus",search:"Cari",loading:"Memuat...",noResults:"Tidak ada hasil",required:"Wajib",previous:"Sebelumnya",next:"Berikutnya",pageOf:(t,r)=>`Halaman ${t} dari ${r}`,selectPlaceholder:"Pilih...",clearSelection:"Hapus pilihan",selectDate:"Pilih tanggal",today:"Hari ini",dropFiles:"Seret file ke sini atau",browse:"Jelajahi",noData:"Tidak ada data",sortAscending:"Urutkan naik",sortDescending:"Urutkan turun",filterPlaceholder:"Filter...",exportCsv:"Ekspor CSV",rowsSelected:t=>`${t} baris dipilih`},os={close:"Închide",cancel:"Anulează",confirm:"Confirmă",save:"Salvează",delete:"Șterge",search:"Caută",loading:"Se încarcă...",noResults:"Nu s-au găsit rezultate",required:"Obligatoriu",previous:"Anterior",next:"Următor",pageOf:(t,r)=>`Pagina ${t} din ${r}`,selectPlaceholder:"Selectați...",clearSelection:"Șterge selecția",selectDate:"Selectați o dată",today:"Astăzi",dropFiles:"Trageți fișierele aici sau",browse:"Răsfoiți",noData:"Nu există date",sortAscending:"Sortare crescătoare",sortDescending:"Sortare descrescătoare",filterPlaceholder:"Filtrați...",exportCsv:"Exportați CSV",rowsSelected:t=>`${t} rând${t===1?"":"uri"} selectat${t===1?"":"e"}`},is={"en-US":Tt,"es-ES":Ln,"pt-BR":Dn,"pt-PT":An,"fr-FR":Pn,"de-DE":Bn,"it-IT":Fn,"nl-NL":Wn,"pl-PL":Hn,"ru-RU":Vn,"uk-UA":On,"tr-TR":_n,"sv-SE":Yn,"da-DK":Un,"cs-CZ":Kn,"hu-HU":Xn,"ar-SA":qn,"he-IL":Zn,"fa-IR":Gn,"ja-JP":Jn,"ko-KR":Qn,"zh-CN":es,"zh-TW":ts,"th-TH":rs,"vi-VN":ns,"id-ID":ss,"ro-RO":os},Al=new Set(["ar-SA","he-IL","fa-IR","ur-PK"]);function as(t){return Al.has(t)}const gt=a.createContext({locale:"en-US",direction:"ltr",strings:Tt});function Pl(){return a.useContext(gt)}function Bl(){return a.useContext(gt).strings}function Fl(){return a.useContext(gt).direction}function Wl({locale:t="en-US",direction:r,strings:n,children:i}){const o=a.useMemo(()=>{const l=is[t]??Tt,c=n?{...l,...n}:l,d=r??(as(t)?"rtl":"ltr");return{locale:t,direction:d,strings:c}},[t,r,n]);return e.jsx(gt.Provider,{value:o,children:e.jsx("div",{dir:o.direction,style:{direction:o.direction,display:"contents"},children:i})})}function Hl({contentId:t="tkx-main-content",label:r="Skip to main content"}){return e.jsx("a",{href:`#${t}`,className:"tkx-skip-nav",children:r})}function Vl({politeness:t="polite",children:r,atomic:n=!0}){return e.jsx("div",{role:"status","aria-live":t,"aria-atomic":n,className:"tkx-sr-only",children:r})}function Ol({active:t,children:r,as:n="div"}){const i=s.useFocusTrap(t);return e.jsx(n,{ref:i,children:r})}function _l({as:t,children:r,...n}){const i=t??"span";return e.jsx(i,{className:"tkx-sr-only",...n,children:r})}exports.LRUCache=B.LRUCache;exports.Quantum=B.Quantum;exports.TKX=B.TKX;exports.ThemeContext=B.ThemeContext;exports.ThemeProvider=B.ThemeProvider;exports.WCAGEngine=B.WCAGEngine;exports.auroraLight=B.auroraLight;exports.batchUpdate=B.batchUpdate;exports.breakpoints=B.breakpoints;exports.contrastRatio=B.contrastRatio;exports.createFocusTrap=B.createFocusTrap;exports.createTheme=B.createTheme;exports.css=B.css;exports.cssVar=B.cssVar;exports.extractCSS=B.extractCSS;exports.fnv1aHash=B.fnv1aHash;exports.fromObject=B.fromObject;exports.generatePalette=B.generatePalette;exports.getAccessibleForeground=B.getAccessibleForeground;exports.injectStyles=B.injectStyles;exports.keyframes=B.keyframes;exports.meetsAA=B.meetsAA;exports.meetsAAA=B.meetsAAA;exports.memoize=B.memoize;exports.prefersHighContrast=B.prefersHighContrast;exports.prefersReducedMotion=B.prefersReducedMotion;exports.quantumDark=B.quantumDark;exports.radii=B.radii;exports.responsive=B.responsive;exports.shadows=B.shadows;exports.spacing=B.spacing;exports.typography=B.typography;exports.useTheme=B.useTheme;exports.zIndex=B.zIndex;exports.Shield=s.Shield;exports.TkxForm=s.TkxForm;exports.TkxFormField=s.TkxFormField;exports.audit=s.audit;exports.cx=s.cx;exports.extractAtomicCSS=s.extractAtomicCSS;exports.getAuditLog=s.getAuditLog;exports.resetAtomicCSS=s.resetAtomicCSS;exports.resolvePluginUtility=s.resolvePluginUtility;exports.sanitizeProps=s.sanitizeProps;exports.sanitizeString=s.sanitizeString;exports.tkx=s.tkx;exports.tkxListPlugins=s.tkxListPlugins;exports.tkxPlugin=s.tkxPlugin;exports.tkxRemovePlugin=s.tkxRemovePlugin;exports.tx=s.tx;exports.useAnnounce=s.useAnnounce;exports.useClickOutside=s.useClickOutside;exports.useEscapeKey=s.useEscapeKey;exports.useFocusTrap=s.useFocusTrap;exports.useHighContrast=s.useHighContrast;exports.useReducedMotion=s.useReducedMotion;exports.useTkxForm=s.useTkxForm;exports.validateProps=s.validateProps;exports.verifyAuditIntegrity=s.verifyAuditIntegrity;exports.FocusTrap=Ol;exports.I18nContext=gt;exports.I18nProvider=Wl;exports.LOCALES=is;exports.LiveRegion=Vl;exports.SIZE_BORDER_RADIUS=Wa;exports.SIZE_FONT=Pa;exports.SIZE_HEIGHT=Aa;exports.SIZE_ICON=Ha;exports.SIZE_PADDING_X=Ba;exports.SIZE_PADDING_Y=Fa;exports.SkipNav=Hl;exports.TkxAccordion=tn;exports.TkxAffix=$l;exports.TkxAlert=Ts;exports.TkxAnchor=zl;exports.TkxAppBar=qi;exports.TkxAutocomplete=zi;exports.TkxAvatar=Kr;exports.TkxBadge=Vr;exports.TkxBottomNav=Qi;exports.TkxBreadcrumb=Si;exports.TkxButton=Fr;exports.TkxCard=Wr;exports.TkxCardBody=bs;exports.TkxCardFooter=ys;exports.TkxCardHeader=gs;exports.TkxCarousel=bn;exports.TkxCascader=Nl;exports.TkxChat=Bo;exports.TkxChatBubble=an;exports.TkxCheckbox=Zr;exports.TkxClock=un;exports.TkxCol=$n;exports.TkxColorPicker=ui;exports.TkxCommand=gn;exports.TkxConfigProvider=zn;exports.TkxContent=Cn;exports.TkxCountdown=dl;exports.TkxDataGrid=da;exports.TkxDatePicker=rn;exports.TkxDivider=Xr;exports.TkxDrawer=lo;exports.TkxEmpty=nl;exports.TkxFileUpload=Mo;exports.TkxFooter=Tn;exports.TkxHeader=jn;exports.TkxImage=jo;exports.TkxInput=Hr;exports.TkxLayout=wn;exports.TkxList=Dl;exports.TkxMasonry=pa;exports.TkxMentions=xl;exports.TkxMenu=dn;exports.TkxModal=zs;exports.TkxNumberInput=hn;exports.TkxOTP=mn;exports.TkxPagination=sn;exports.TkxParagraph=qa;exports.TkxPopover=Ti;exports.TkxProgress=Or;exports.TkxQRCode=bl;exports.TkxRadio=Jr;exports.TkxRadioGroup=Ks;exports.TkxRating=Lo;exports.TkxResult=vl;exports.TkxRichTextDisplay=Ta;exports.TkxRow=Mn;exports.TkxSegmented=fl;exports.TkxSelect=qr;exports.TkxSider=Sn;exports.TkxSkeleton=Ct;exports.TkxSlider=nn;exports.TkxSnackbar=sa;exports.TkxSpeedDial=Yi;exports.TkxSpin=el;exports.TkxStatistic=cl;exports.TkxStepper=xn;exports.TkxTab=Ns;exports.TkxTabList=Es;exports.TkxTabPanel=Ls;exports.TkxTabPanels=Rs;exports.TkxTable=Ws;exports.TkxTabs=Is;exports.TkxTag=ln;exports.TkxTagInput=_o;exports.TkxText=Xa;exports.TkxThinkingIndicator=on;exports.TkxTimeline=Ko;exports.TkxTitle=Ka;exports.TkxToastProvider=to;exports.TkxToggle=_r;exports.TkxToolbar=Di;exports.TkxTooltip=As;exports.TkxTour=Sl;exports.TkxTransferList=Fi;exports.TkxTreeView=Ri;exports.TkxVideoPlayer=fn;exports.TkxWatermark=Tl;exports.VisuallyHidden=_l;exports.arSA=qn;exports.csCZ=Kn;exports.daDK=Un;exports.deDE=Bn;exports.enUS=Tt;exports.esES=Ln;exports.faIR=Gn;exports.frFR=Pn;exports.getLocaleDisplayName=Ya;exports.heIL=Zn;exports.huHU=Xn;exports.idID=ss;exports.isRTL=as;exports.isRtlLocale=_a;exports.itIT=Fn;exports.jaJP=Jn;exports.koKR=Qn;exports.nlNL=Wn;exports.plPL=Hn;exports.ptBR=Dn;exports.ptPT=An;exports.roRO=os;exports.ruRU=Vn;exports.svSE=Yn;exports.thTH=rs;exports.trTR=_n;exports.ukUA=On;exports.useComponentSize=Da;exports.useConfig=mt;exports.useDirection=Fl;exports.useI18n=Pl;exports.useLocale=Bl;exports.useLogicalSpacing=Oa;exports.usePrefixCls=La;exports.useRtlFlip=Va;exports.useTkxCommand=bi;exports.useToast=Zs;exports.viVN=ns;exports.zhCN=es;exports.zhTW=ts;
|
|
119
|
+
`,document.head.appendChild(t)}function $l({size:t,color:n}){return i.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Loading"},i.createElement("circle",{cx:12,cy:12,r:10,stroke:`${n}33`,strokeWidth:2.5,fill:"none"}),i.createElement("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:n,strokeWidth:2.5,strokeLinecap:"round",fill:"none"}))}function Il({size:t,borderWidth:n,color:r,reducedMotion:o}){return o?i.createElement($l,{size:t,color:r}):(Cl(),i.createElement("div",{role:"img","aria-label":"Loading",style:{width:`${t}px`,height:`${t}px`,border:`${n}px solid ${r}33`,borderTopColor:r,borderRadius:"50%",animation:"tkx-spin-rotate 0.8s linear infinite",boxSizing:"border-box"}}))}function zl({spinning:t=!0,size:n="md",tip:r,indicator:o,children:s,fullscreen:l=!1,delay:a=0,style:c}){const d=_.useTheme(),f=Q.useReducedMotion(),[u,h]=i.useState(a===0&&t),p=i.useRef(null);if(i.useEffect(()=>(t&&a>0?p.current=setTimeout(()=>h(!0),a):h(t),()=>{p.current!==null&&clearTimeout(p.current)}),[t,a]),!u)return s?i.createElement("div",{style:c},s):null;const m=Tl[n],y=r?A.sanitizeString(r):void 0,k=i.createElement("div",{role:"status","aria-live":"polite","aria-label":y??"Loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},o??i.createElement(Il,{size:m.dimension,borderWidth:m.borderWidth,color:d.primary,reducedMotion:f}),y&&i.createElement("span",{style:{color:d.primary,fontSize:m.fontSize,marginTop:"4px"}},y));return l?i.createElement("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${d.bg}cc`,zIndex:9999,...c}},k):s?i.createElement("div",{style:{position:"relative",...c}},i.createElement("div",{style:{filter:"blur(1px)",opacity:.5,pointerEvents:"none",userSelect:"none",transition:f?"none":"opacity 0.2s, filter 0.2s"}},s),i.createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${d.bg}66`,borderRadius:"4px"}},k)):i.createElement("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",...c}},k)}function El({color:t,mutedColor:n}){return i.createElement("svg",{width:120,height:100,viewBox:"0 0 120 100",fill:"none","aria-hidden":"true"},i.createElement("path",{d:"M20 40 L60 20 L100 40 L60 60 Z",fill:`${n}18`,stroke:n,strokeWidth:1.5,strokeLinejoin:"round"}),i.createElement("path",{d:"M20 40 L20 65 L60 85 L60 60 Z",fill:`${n}10`,stroke:n,strokeWidth:1.5,strokeLinejoin:"round"}),i.createElement("path",{d:"M100 40 L100 65 L60 85 L60 60 Z",fill:`${n}0d`,stroke:n,strokeWidth:1.5,strokeLinejoin:"round"}),i.createElement("path",{d:"M20 40 L40 28 L60 40 L40 52 Z",fill:`${t}15`,stroke:t,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}),i.createElement("path",{d:"M60 40 L80 28 L100 40 L80 52 Z",fill:`${t}15`,stroke:t,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}))}function Nl({mutedColor:t}){return i.createElement("svg",{width:64,height:64,viewBox:"0 0 64 64",fill:"none","aria-hidden":"true"},i.createElement("rect",{x:16,y:8,width:32,height:40,rx:3,fill:`${t}12`,stroke:t,strokeWidth:1.5}),i.createElement("line",{x1:24,y1:20,x2:40,y2:20,stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),i.createElement("line",{x1:24,y1:28,x2:36,y2:28,stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),i.createElement("line",{x1:24,y1:36,x2:32,y2:36,stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),i.createElement("circle",{cx:32,cy:54,r:6,stroke:t,strokeWidth:1.2,fill:"none"}),i.createElement("line",{x1:28,y1:54,x2:36,y2:54,stroke:t,strokeWidth:1.2,strokeLinecap:"round"}))}function Ll({image:t="default",description:n="No data",children:r,style:o}){const s=_.useTheme(),l=typeof n=="string"?A.sanitizeString(n):n;let a;return t==="default"?a=i.createElement(El,{color:s.primary,mutedColor:s.textMuted}):t==="simple"?a=i.createElement(Nl,{mutedColor:s.textMuted}):a=t,i.createElement("div",{role:"status",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",textAlign:"center",...o}},i.createElement("div",{style:{marginBottom:"12px",opacity:.85}},a),l&&i.createElement("div",{style:{color:s.textMuted,fontSize:"0.875rem",lineHeight:"1.5",maxWidth:"320px"}},l),r&&i.createElement("div",{style:{marginTop:"16px"}},r))}function Rl(t,n,r=","){if(typeof t=="string")return t;const o=n!==void 0?t.toFixed(n):String(t),[s,l]=o.split("."),a=s.replace(/\B(?=(\d{3})+(?!\d))/g,r);return l!==void 0?`${a}.${l}`:a}function Al(t,n){if(t<=0)return n.replace(/DD?/g,"0").replace(/HH?/g,"00").replace(/mm?/g,"00").replace(/ss?/g,"00");const r=Math.floor(t/1e3),o=Math.floor(r/86400),s=Math.floor(r%86400/3600),l=Math.floor(r%3600/60),a=r%60,c=d=>String(d).padStart(2,"0");return n.replace(/DD/g,c(o)).replace(/D/g,String(o)).replace(/HH/g,c(s)).replace(/H/g,String(s)).replace(/mm/g,c(l)).replace(/m/g,String(l)).replace(/ss/g,c(a)).replace(/s/g,String(a))}function Dl({direction:t,color:n}){const r=t==="up"?"M6 10 L10 4 L14 10":"M6 4 L10 10 L14 4";return i.createElement("svg",{width:16,height:14,viewBox:"0 0 20 14",fill:"none","aria-hidden":"true",style:{display:"inline-block",verticalAlign:"middle"}},i.createElement("path",{d:r,stroke:n,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}))}let Wn=!1;function Bl(){if(Wn||typeof document>"u")return;Wn=!0;const t=document.createElement("style");t.id="tkx-statistic-skeleton",t.textContent="@keyframes tkx-stat-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}",document.head.appendChild(t)}function Wl({w:t,h:n,alt:r,bdr:o,rm:s}){return s||Bl(),i.createElement("div",{"aria-hidden":"true",style:{width:t,height:n,borderRadius:"4px",background:s?r:`linear-gradient(90deg, ${r} 25%, ${o} 50%, ${r} 75%)`,backgroundSize:"200% 100%",animation:s?"none":"tkx-stat-shimmer 1.5s ease-in-out infinite"}})}function Pl({title:t,value:n,prefix:r,suffix:o,precision:s,groupSeparator:l=",",valueStyle:a,loading:c=!1,trend:d,trendValue:f,style:u}){const h=_.useTheme(),p=Q.useReducedMotion(),m=A.sanitizeString(t),y=f?A.sanitizeString(f):void 0,k=d==="up"?h.success:d==="down"?h.danger:void 0;return i.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...u}},i.createElement("div",{style:{color:h.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},m),c?i.createElement(Wl,{w:"120px",h:"32px",alt:h.surfaceAlt,bdr:h.border,rm:p}):i.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:h.text,fontVariantNumeric:"tabular-nums",...a}},r&&i.createElement("span",{style:{fontSize:"0.75em",fontWeight:400}},r),i.createElement("span",null,Rl(n,s,l)),o&&i.createElement("span",{style:{fontSize:"0.6em",fontWeight:400,color:h.textMuted}},o)),d&&i.createElement("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"0.8125rem",color:k,marginTop:"2px"}},i.createElement(Dl,{direction:d,color:k}),y&&i.createElement("span",null,y)))}function Fl({title:t,value:n,format:r="HH:mm:ss",onFinish:o,prefix:s,suffix:l,style:a}){const c=_.useTheme(),d=A.sanitizeString(t),f=i.useRef(o);f.current=o;const u=i.useRef(!1),[h,p]=i.useState(()=>Math.max(0,n-Date.now()));i.useEffect(()=>{u.current=!1;const y=()=>{var g;const b=Math.max(0,n-Date.now());p(b),b<=0&&!u.current&&(u.current=!0,(g=f.current)==null||g.call(f))};y();const k=setInterval(y,1e3);return()=>clearInterval(k)},[n]);const m=Al(h,r);return i.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...a}},i.createElement("div",{style:{color:c.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},d),i.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:h<=0?c.danger:c.text,fontVariantNumeric:"tabular-nums"}},s&&i.createElement("span",{style:{fontSize:"0.75em",fontWeight:400}},s),i.createElement("span",null,m),l&&i.createElement("span",{style:{fontSize:"0.6em",fontWeight:400,color:c.textMuted}},l)))}const Hl={sm:{height:28,fontSize:12,px:10},md:{height:36,fontSize:14,px:16},lg:{height:44,fontSize:16,px:20}};function Vl({options:t,value:n,onChange:r,size:o="md",block:s=!1}){const l=_.useTheme(),a=Q.useReducedMotion(),c=i.useRef(null),[d,f]=i.useState(()=>Math.max(0,t.findIndex(k=>k.value===n))),[u,h]=i.useState({}),p=Hl[o];i.useEffect(()=>{const k=t.findIndex(b=>b.value===n);k>=0&&f(k)},[n,t]),i.useEffect(()=>{const k=c.current;if(!k)return;const g=k.querySelectorAll("[data-seg-btn]")[d];g&&h({left:g.offsetLeft,width:g.offsetWidth,height:g.offsetHeight,transition:a?"none":"left 0.2s ease, width 0.2s ease"})},[d,t,a]);const m=i.useCallback(k=>{const b=t[k];!b||b.disabled||(f(k),r==null||r(b.value))},[t,r]),y=i.useCallback(k=>{var g,M,j;let b=d;if(k.key==="ArrowRight"||k.key==="ArrowDown")for(k.preventDefault(),b=(d+1)%t.length;(g=t[b])!=null&&g.disabled&&b!==d;)b=(b+1)%t.length;else if(k.key==="ArrowLeft"||k.key==="ArrowUp")for(k.preventDefault(),b=(d-1+t.length)%t.length;(M=t[b])!=null&&M.disabled&&b!==d;)b=(b-1+t.length)%t.length;if(b!==d){m(b);const w=c.current,I=w==null?void 0:w.querySelectorAll("[data-seg-btn]");(j=I==null?void 0:I[b])==null||j.focus()}},[d,t,m]);return e.jsxs("div",{ref:c,role:"radiogroup","aria-label":"Segmented control",className:x.tkx("relative inline-flex items-center rounded-lg p-1"),style:{backgroundColor:l.surfaceAlt,border:`1px solid ${l.border}`,width:s?"100%":void 0},onKeyDown:y,children:[e.jsx("div",{"aria-hidden":"true",className:x.tkx("absolute top-1 rounded-md"),style:{...u,backgroundColor:l.surface,boxShadow:`0 1px 3px ${l.border}`,zIndex:0}}),t.map((k,b)=>{const g=b===d,M=A.sanitizeString(k.label);return e.jsxs("button",{"data-seg-btn":!0,type:"button",role:"radio","aria-checked":g,"aria-disabled":k.disabled||void 0,disabled:k.disabled,tabIndex:g?0:-1,className:x.tkx("relative z-10 flex items-center justify-center gap-1 rounded-md border-0 cursor-pointer","font-sans whitespace-nowrap select-none"),style:{height:p.height,fontSize:p.fontSize,padding:`0 ${p.px}px`,flex:s?1:void 0,color:g?l.text:l.textMuted,backgroundColor:"transparent",opacity:k.disabled?.4:1,fontWeight:g?600:400,transition:a?"none":"color 0.15s ease"},onClick:()=>m(b),children:[k.icon&&e.jsx("span",{"aria-hidden":"true",children:k.icon}),M]},k.value)})]})}function Ol({options:t,value:n="",onChange:r,trigger:o="@",placeholder:s,label:l}){const a=_.useTheme(),c=Q.useReducedMotion(),d=i.useRef(null),f=i.useRef(null),[u,h]=i.useState(n),[p,m]=i.useState(!1),[y,k]=i.useState(""),[b,g]=i.useState(0),[M,j]=i.useState(-1);i.useEffect(()=>{n!==void 0&&h(n)},[n]);const w=t.filter(T=>T.label.toLowerCase().includes(y.toLowerCase())),I=i.useCallback(T=>{const E=T.target.value;h(E),r==null||r(E);const C=T.target.selectionStart??E.length,H=E.slice(0,C),z=H.lastIndexOf(o);if(z>=0){const R=H.slice(z+o.length);if(!/\s/.test(R)){k(R),j(z),m(!0),g(0);return}}m(!1)},[o,r]),v=i.useCallback(T=>{var z;const E=u.slice(0,M),C=u.slice(M+o.length+y.length),H=`${E}${o}${T.value} ${C}`;h(H),r==null||r(H),m(!1),(z=d.current)==null||z.focus()},[u,M,o,y,r]),N=i.useCallback(T=>{p&&(T.key==="ArrowDown"?(T.preventDefault(),g(E=>(E+1)%w.length)):T.key==="ArrowUp"?(T.preventDefault(),g(E=>(E-1+w.length)%w.length)):T.key==="Enter"&&w[b]?(T.preventDefault(),v(w[b])):T.key==="Escape"&&m(!1))},[p,w,b,v]);i.useEffect(()=>{if(!p||!f.current)return;const T=f.current.children[b];T==null||T.scrollIntoView({block:"nearest"})},[b,p]);const $=l?A.sanitizeString(l):void 0,S=s?A.sanitizeString(s):void 0;return e.jsxs("div",{className:x.tkx("relative font-sans"),style:{width:"100%"},children:[$&&e.jsx("label",{className:x.tkx("block text-sm font-medium mb-1"),style:{color:a.text},children:$}),e.jsx("textarea",{ref:d,role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-label":$??"Mentions input",value:u,placeholder:S,onChange:I,onKeyDown:N,onBlur:()=>setTimeout(()=>m(!1),200),className:x.tkx("w-full rounded-lg border px-3 py-2 text-sm resize-y"),style:{backgroundColor:a.surface,borderColor:a.border,color:a.text,minHeight:80,outline:"none"},rows:3}),p&&w.length>0&&e.jsx("ul",{ref:f,role:"listbox","aria-label":"Mention suggestions",className:x.tkx("absolute left-0 right-0 z-50 rounded-lg border overflow-auto"),style:{backgroundColor:a.surface,borderColor:a.border,maxHeight:200,top:"100%",marginTop:4,listStyle:"none",padding:0,boxShadow:`0 4px 12px ${a.bg}80`,animation:c?"none":"tkxFadeIn 0.15s ease"},children:w.map((T,E)=>e.jsxs("li",{role:"option","aria-selected":E===b,className:x.tkx("flex items-center gap-3 px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:E===b?a.surfaceAlt:"transparent",color:a.text},onMouseDown:C=>{C.preventDefault(),v(T)},onMouseEnter:()=>g(E),children:[T.avatar&&e.jsx("img",{src:A.sanitizeString(T.avatar),alt:"","aria-hidden":"true",width:24,height:24,className:x.tkx("rounded-full"),style:{objectFit:"cover"}}),e.jsx("span",{children:A.sanitizeString(T.label)}),e.jsxs("span",{style:{color:a.textMuted,marginLeft:"auto"},children:[o,A.sanitizeString(T.value)]})]},T.value))})]})}function _l(t){let n=5381;for(let r=0;r<t.length;r++)n=(n<<5)+n+t.charCodeAt(r)|0;return Math.abs(n)}function Yl(t){let n=t;return()=>(n=n*1664525+1013904223|0,(n>>>0)/4294967295)}const Kl={L:.38,M:.42,Q:.48,H:.55};function Ul(t,n,r){const o=_l(t),s=Yl(o),l=Kl[r]??.42,a=Array.from({length:n},()=>Array.from({length:n},()=>!1)),c=(d,f)=>{for(let u=0;u<7;u++)for(let h=0;h<7;h++){const p=u===0||u===6||h===0||h===6,m=u>=2&&u<=4&&h>=2&&h<=4;a[d+u][f+h]=p||m}};c(0,0),c(0,n-7),c(n-7,0);for(let d=7;d<n-7;d++)a[6][d]=d%2===0,a[d][6]=d%2===0;for(let d=0;d<n;d++)for(let f=0;f<n;f++)d<8&&f<8||d<8&&f>=n-8||d>=n-8&&f<8||(d===6||f===6)||(a[d][f]=s()<l);return a}function Xl({value:t,size:n=160,color:r,bgColor:o,errorLevel:s="M",icon:l,bordered:a=!0}){const c=_.useTheme(),d=Q.useReducedMotion(),f=i.useRef(null),u=A.sanitizeString(t),h=r??c.text,p=o??c.surface,m=25,y=i.useMemo(()=>Ul(u,m,s),[u,s]);return i.useEffect(()=>{const k=f.current;if(!k)return;const b=k.getContext("2d");if(!b)return;const g=window.devicePixelRatio||1;k.width=n*g,k.height=n*g,b.scale(g,g);const M=n/m;b.fillStyle=p,b.fillRect(0,0,n,n),b.fillStyle=h;for(let j=0;j<m;j++)for(let w=0;w<m;w++)y[j][w]&&b.fillRect(w*M,j*M,M,M);if(l){const j=n*.22,w=(n-j)/2;b.fillStyle=p,b.fillRect(w-2,w-2,j+4,j+4);const I=new Image;I.crossOrigin="anonymous",I.onload=()=>{b.drawImage(I,w,w,j,j)},I.src=A.sanitizeString(l)}},[y,n,h,p,l]),e.jsx("div",{role:"img","aria-label":`QR code for: ${u}`,className:x.tkx("inline-block rounded-lg"),style:{padding:a?12:0,backgroundColor:a?p:"transparent",border:a?`1px solid ${c.border}`:"none",lineHeight:0,animation:d?"none":"tkxFadeIn 0.2s ease"},children:e.jsx("canvas",{ref:f,"aria-hidden":"true",style:{width:n,height:n,display:"block"}})})}const Zl={success:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M22 37l9 9 19-19",stroke:t,strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),error:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M26 26l20 20M46 26L26 46",stroke:t,strokeWidth:"4",strokeLinecap:"round"})]}),warning:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M36 6L4 64h64L36 6z",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M36 30v16",stroke:t,strokeWidth:"4",strokeLinecap:"round"}),e.jsx("circle",{cx:"36",cy:"54",r:"2.5",fill:t})]}),info:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M36 32v18",stroke:t,strokeWidth:"4",strokeLinecap:"round"}),e.jsx("circle",{cx:"36",cy:"22",r:"2.5",fill:t})]}),404:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:t,children:"404"})]}),403:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M28 30h16v16H28z",stroke:t,strokeWidth:"3",fill:"none"}),e.jsx("path",{d:"M32 30v-4a4 4 0 018 0v4",stroke:t,strokeWidth:"3",fill:"none"})]}),500:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:t,children:"500"})]})};function Gl(t,n){switch(t){case"success":return n.success;case"error":case"500":return n.danger;case"warning":return n.warning;case"info":return n.info;case"404":case"403":return n.textMuted}}function ql({status:t,title:n,subTitle:r,icon:o,extra:s}){const l=_.useTheme(),a=Q.useReducedMotion(),c=Gl(t,l),d=A.sanitizeString(n),f=r?A.sanitizeString(r):void 0;return e.jsxs("div",{role:"status","aria-live":"polite",className:x.tkx("flex flex-col items-center text-center px-6 py-12 font-sans"),style:{animation:a?"none":"tkxFadeIn 0.3s ease"},children:[e.jsx("div",{className:x.tkx("mb-6"),children:o??Zl[t](c)}),e.jsx("h2",{className:x.tkx("text-xl font-semibold m-0 mb-2"),style:{color:l.text},children:d}),f&&e.jsx("p",{className:x.tkx("text-sm m-0 mb-6 max-w-md leading-relaxed"),style:{color:l.textMuted},children:f}),s&&e.jsx("div",{className:x.tkx("flex items-center gap-3 mt-4"),children:s})]})}function Ql(t){const n=document.querySelector(t);return n?n.getBoundingClientRect():null}function Jl(t,n,r,o){switch(n){case"top":return{top:t.top-o-12+window.scrollY,left:t.left+t.width/2-r/2+window.scrollX};case"bottom":return{top:t.bottom+12+window.scrollY,left:t.left+t.width/2-r/2+window.scrollX};case"left":return{top:t.top+t.height/2-o/2+window.scrollY,left:t.left-r-12+window.scrollX};case"right":return{top:t.top+t.height/2-o/2+window.scrollY,left:t.right+12+window.scrollX};default:return{top:t.bottom+12+window.scrollY,left:t.left+window.scrollX}}}function ea({steps:t,isOpen:n=!1,onClose:r,current:o,onChange:s}){const l=_.useTheme(),a=Q.useReducedMotion(),[c,d]=i.useState(0),f=o??c,u=i.useRef(null),[h,p]=i.useState({top:0,left:0}),[m,y]=i.useState(null),k=t[f],b=i.useCallback(()=>{if(!k)return;const S=Ql(k.target);if(y(S),S&&u.current){const T=u.current.offsetWidth,E=u.current.offsetHeight;p(Jl(S,k.placement??"bottom",T,E))}},[k]);i.useEffect(()=>{if(n)return b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[n,f,b]),i.useEffect(()=>{var S;n&&((S=u.current)==null||S.focus())},[n,f]);const g=i.useCallback(S=>{d(S),s==null||s(S)},[s]),M=i.useCallback(()=>{f<t.length-1?g(f+1):r==null||r()},[f,t.length,g,r]),j=i.useCallback(()=>{f>0&&g(f-1)},[f,g]);if(!n||!k)return null;const w=6,I=A.sanitizeString(k.title),v=A.sanitizeString(k.description),$=e.jsxs("div",{"aria-hidden":"true",children:[e.jsx("div",{style:{position:"fixed",inset:0,zIndex:9998,backgroundColor:"rgba(0,0,0,0.55)",clipPath:m?`polygon(0% 0%, 0% 100%, ${m.left-w}px 100%, ${m.left-w}px ${m.top-w}px, ${m.right+w}px ${m.top-w}px, ${m.right+w}px ${m.bottom+w}px, ${m.left-w}px ${m.bottom+w}px, ${m.left-w}px 100%, 100% 100%, 100% 0%)`:void 0,transition:a?"none":"clip-path 0.25s ease"},onClick:r}),e.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":`Tour step ${f+1} of ${t.length}`,tabIndex:-1,style:{position:"absolute",zIndex:9999,top:h.top,left:h.left,width:300,backgroundColor:l.surface,border:`1px solid ${l.border}`,borderRadius:10,padding:20,boxShadow:`0 8px 24px ${l.bg}80`,animation:a?"none":"tkxFadeIn 0.2s ease",fontFamily:"inherit"},onKeyDown:S=>{S.key==="Escape"&&(r==null||r())},children:[e.jsx("h3",{className:x.tkx("m-0 mb-2 text-base font-semibold"),style:{color:l.text},children:I}),e.jsx("p",{className:x.tkx("m-0 mb-4 text-sm leading-relaxed"),style:{color:l.textMuted},children:v}),e.jsx("div",{className:x.tkx("flex items-center gap-1 mb-4"),"aria-label":"Tour progress",children:t.map((S,T)=>e.jsx("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",backgroundColor:T===f?l.primary:l.border,transition:a?"none":"background-color 0.2s"}},T))}),e.jsxs("div",{className:x.tkx("flex items-center justify-between gap-2"),children:[e.jsx("button",{type:"button","aria-label":"Skip tour",onClick:r,className:x.tkx("border-0 bg-transparent cursor-pointer text-sm px-2 py-1"),style:{color:l.textMuted},children:"Skip"}),e.jsxs("div",{className:x.tkx("flex gap-2"),children:[f>0&&e.jsx("button",{type:"button","aria-label":"Previous step",onClick:j,className:x.tkx("rounded-md border px-3 py-1 text-sm cursor-pointer bg-transparent"),style:{borderColor:l.border,color:l.text},children:"Prev"}),e.jsx("button",{type:"button","aria-label":f===t.length-1?"Finish tour":"Next step",onClick:M,className:x.tkx("rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium"),style:{backgroundColor:l.primary,color:"#fff"},children:f===t.length-1?"Finish":"Next"})]})]})]})]});return Le.createPortal($,document.body)}function ta(t,n,r,o,s){const l=document.createElement("canvas"),a=l.getContext("2d");if(!a)return"";const c=o*1.5,d=t.length*c,f=Math.max(...t.map(m=>m.length))*o*.6,u=r[0]+f,h=r[1]+d,p=2;return l.width=u*p,l.height=h*p,a.scale(p,p),a.translate(u/2,h/2),a.rotate(n*Math.PI/180),a.font=`${o}px sans-serif`,a.fillStyle=s,a.textAlign="center",a.textBaseline="middle",t.forEach((m,y)=>{const k=(y-(t.length-1)/2)*c;a.fillText(m,0,k)}),l.toDataURL()}function na({text:t,children:n,rotate:r=-22,gap:o=[100,100],fontSize:s=14,color:l,zIndex:a=10}){const c=_.useTheme(),d=Q.useReducedMotion(),f=i.useRef(null),[u,h]=i.useState(""),p=i.useMemo(()=>(Array.isArray(t)?t:[t]).map(k=>A.sanitizeString(k)),[t]),m=l??`${c.textMuted}22`,y=i.useCallback(()=>ta(p,r,o,s,m),[p,r,o,s,m]);return i.useEffect(()=>{const k=y();k&&h(`url(${k})`)},[y]),i.useEffect(()=>{var g;const k=(g=f.current)==null?void 0:g.querySelector("[data-watermark]");if(!k)return;const b=new MutationObserver(()=>{const M=y();M&&(k.style.backgroundImage=`url(${M})`)});return b.observe(k,{attributes:!0,attributeFilter:["style"]}),()=>b.disconnect()},[y]),e.jsxs("div",{ref:f,className:x.tkx("relative"),style:{overflow:"hidden"},children:[n,e.jsx("div",{"data-watermark":!0,"aria-hidden":"true",className:x.tkx("absolute inset-0 pointer-events-none"),style:{zIndex:a,backgroundImage:u,backgroundRepeat:"repeat",animation:d?"none":"tkxFadeIn 0.3s ease"}})]})}function Pn(t){if(t)try{return t()}catch{return window}return window}function ra(t){if(t instanceof Window)return{top:0,bottom:t.innerHeight};const n=t.getBoundingClientRect();return{top:n.top,bottom:n.bottom}}function sa({children:t,offsetTop:n,offsetBottom:r,onChange:o,target:s}){const l=_.useTheme(),a=Q.useReducedMotion(),c=i.useRef(null),d=i.useRef(null),[f,u]=i.useState(!1),[h,p]=i.useState({width:0,height:0}),m=i.useRef(!1),y=i.useMemo(()=>A.sanitizeString("Sticky content"),[]),k=i.useCallback(()=>{const M=c.current;if(!M)return;const j=M.getBoundingClientRect(),w=ra(Pn(s));let I=!1;n!==void 0?I=j.top-w.top<=n:r!==void 0&&(I=w.bottom-j.bottom<=r),I!==m.current&&(m.current=I,u(I),p({width:j.width,height:j.height}),o==null||o(I))},[n,r,o,s]);i.useEffect(()=>{const M=Pn(s);return k(),M.addEventListener("scroll",k,{passive:!0}),window.addEventListener("resize",k),()=>{M.removeEventListener("scroll",k),window.removeEventListener("resize",k)}},[k,s]);const b=f?{position:"fixed",zIndex:100,...n!==void 0?{top:n}:{},...r!==void 0?{bottom:r}:{},width:h.width||void 0,transition:a?"none":"box-shadow 0.2s ease",boxShadow:`0 2px 8px ${l.border}`}:{},g=f?{height:h.height,width:h.width}:{};return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:c,"aria-hidden":f,style:g}),e.jsx("div",{ref:d,role:"region","aria-label":y,className:x.tkx(f?"tkx-affixed":""),style:b,children:t})]})}function Ar(t){const n=[];for(const r of t)n.push(r),r.children&&n.push(...Ar(r.children));return n}function Fn(t){return t.startsWith("#")?t.slice(1):t}function Dr({item:t,activeKey:n,depth:r,onClick:o,theme:s,reducedMotion:l}){const a=t.key===n,c=A.sanitizeString(t.title);return e.jsxs("li",{role:"none",style:{listStyle:"none"},children:[e.jsx("a",{role:"treeitem","aria-current":a?"location":void 0,href:t.href,onClick:d=>{d.preventDefault(),o(t.href)},className:x.tkx("block text-sm py-1 no-underline"),style:{paddingLeft:12+r*16,color:a?s.primary:s.textMuted,fontWeight:a?600:400,borderLeft:`2px solid ${a?s.primary:"transparent"}`,transition:l?"none":"color 0.15s ease, border-color 0.15s ease"},children:c}),t.children&&t.children.length>0&&e.jsx("ul",{role:"group",style:{margin:0,padding:0},children:t.children.map(d=>e.jsx(Dr,{item:d,activeKey:n,depth:r+1,onClick:o,theme:s,reducedMotion:l},d.key))})]})}function oa({items:t,offsetTop:n=0,getCurrentAnchor:r,onChange:o}){var p;const s=_.useTheme(),l=Q.useReducedMotion(),[a,c]=i.useState(((p=t[0])==null?void 0:p.key)??""),d=i.useRef(!1),f=Ar(t),u=i.useCallback(()=>{var y;if(d.current)return;let m=((y=f[0])==null?void 0:y.key)??"";for(const k of f){const b=Fn(k.href),g=document.getElementById(b);g&&g.getBoundingClientRect().top<=n+10&&(m=k.key)}r&&(m=r(m)),m!==a&&(c(m),o==null||o(m))},[f,n,r,a,o]);i.useEffect(()=>(window.addEventListener("scroll",u,{passive:!0}),u(),()=>window.removeEventListener("scroll",u)),[u]);const h=i.useCallback(m=>{const y=Fn(m),k=document.getElementById(y);if(!k)return;d.current=!0;const b=k.getBoundingClientRect().top+window.scrollY-n;window.scrollTo({top:b,behavior:l?"auto":"smooth"});const g=f.find(M=>M.href===m);g&&(c(g.key),o==null||o(g.key)),setTimeout(()=>{d.current=!1},800)},[f,n,l,o]);return e.jsx("nav",{role:"tree","aria-label":"Anchor navigation",className:x.tkx("font-sans"),style:{borderLeft:`1px solid ${s.border}`,padding:"4px 0"},children:e.jsx("ul",{role:"group",style:{margin:0,padding:0},children:t.map(m=>e.jsx(Dr,{item:m,activeKey:a,depth:0,onClick:h,theme:s,reducedMotion:l},m.key))})})}function ia(t,n){var s;const r=[t];let o=t;for(const l of n){const a=o.find(c=>c.value===l);if((s=a==null?void 0:a.children)!=null&&s.length)r.push(a.children),o=a.children;else break}return r}function Br(t,n){const r=[];let o=t;for(const s of n){const l=o.find(a=>a.value===s);if(l)r.push(l),o=l.children??[];else break}return r}function la(t,n){return Br(t,n).map(r=>A.sanitizeString(r.label)).join(" / ")}function aa({options:t,value:n=[],onChange:r,placeholder:o="Select...",label:s,multiple:l=!1}){const a=_.useTheme(),c=Q.useReducedMotion(),d=i.useRef(null),f=i.useRef(null),[u,h]=i.useState(!1),[p,m]=i.useState(n),[y,k]=i.useState({top:0,left:0,width:0}),b=s?A.sanitizeString(s):void 0,g=A.sanitizeString(o),M=n.length>0?la(t,n):"";i.useEffect(()=>{if(!u||!d.current)return;const N=d.current.getBoundingClientRect();k({top:N.bottom+4+window.scrollY,left:N.left+window.scrollX,width:Math.max(N.width,200)})},[u]),i.useEffect(()=>{if(!u)return;const N=$=>{var S,T;!((S=d.current)!=null&&S.contains($.target))&&!((T=f.current)!=null&&T.contains($.target))&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[u]);const j=i.useCallback((N,$)=>{var T;if($.disabled)return;const S=[...p.slice(0,N),$.value];if(m(S),!((T=$.children)!=null&&T.length)){const E=Br(t,S);r==null||r(S,E),l||h(!1)}},[p,t,r,l]),w=i.useCallback(N=>{var $;N.key==="Escape"?(h(!1),($=d.current)==null||$.focus()):(N.key==="Enter"||N.key===" ")&&(u||(N.preventDefault(),h(!0)))},[u]),I=ia(t,p),v=u?Le.createPortal(e.jsx("div",{ref:f,role:"tree","aria-label":b??"Cascader options",className:x.tkx("flex rounded-lg border overflow-hidden"),style:{position:"absolute",zIndex:9999,top:y.top,left:y.left,backgroundColor:a.surface,borderColor:a.border,boxShadow:`0 4px 16px ${a.bg}80`,animation:c?"none":"tkxFadeIn 0.15s ease"},children:I.map((N,$)=>e.jsx("ul",{role:"group",className:x.tkx("m-0 p-0 overflow-auto"),style:{listStyle:"none",minWidth:160,maxHeight:260,borderRight:$<I.length-1?`1px solid ${a.border}`:"none"},children:N.map(S=>{var C;const T=p[$]===S.value,E=A.sanitizeString(S.label);return e.jsxs("li",{role:"treeitem","aria-selected":T,"aria-disabled":S.disabled||void 0,"aria-expanded":(C=S.children)!=null&&C.length?T:void 0,className:x.tkx("flex items-center justify-between px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:T?a.surfaceAlt:"transparent",color:S.disabled?a.textMuted:a.text,opacity:S.disabled?.5:1,cursor:S.disabled?"not-allowed":"pointer"},onClick:()=>j($,S),onMouseEnter:()=>{S.disabled||m(H=>[...H.slice(0,$),S.value])},children:[e.jsx("span",{children:E}),S.children&&S.children.length>0&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:a.textMuted,flexShrink:0},children:e.jsx("path",{d:"M10 6l6 6-6 6V6z"})})]},S.value)})},$))}),document.body):null;return e.jsxs("div",{className:x.tkx("relative font-sans"),onKeyDown:w,children:[b&&e.jsx("label",{className:x.tkx("block text-sm font-medium mb-1"),style:{color:a.text},children:b}),e.jsxs("button",{ref:d,type:"button",role:"combobox","aria-expanded":u,"aria-haspopup":"tree","aria-label":b??"Cascader",className:x.tkx("w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer"),style:{backgroundColor:a.surface,borderColor:u?a.primary:a.border,color:M?a.text:a.textMuted,outline:"none",minHeight:38,textAlign:"left"},onClick:()=>h(N=>!N),children:[e.jsx("span",{className:x.tkx("truncate"),children:M||g}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:a.textMuted,transform:u?"rotate(180deg)":"rotate(0deg)",transition:c?"none":"transform 0.2s ease",flexShrink:0},children:e.jsx("path",{d:"M7 10l5 5 5-5H7z"})})]}),v]})}const ca={sm:"8px 12px",md:"12px 16px",lg:"16px 20px"};function da({theme:t,reducedMotion:n}){return e.jsxs("div",{className:x.tkx("flex items-center gap-3 px-4 py-3"),"aria-hidden":"true",children:[e.jsx("div",{style:{width:40,height:40,borderRadius:"50%",backgroundColor:t.surfaceAlt,animation:n?"none":"tkxPulse 1.5s ease infinite"}}),e.jsxs("div",{className:x.tkx("flex-1"),children:[e.jsx("div",{style:{width:"60%",height:14,borderRadius:4,backgroundColor:t.surfaceAlt,marginBottom:8,animation:n?"none":"tkxPulse 1.5s ease infinite"}}),e.jsx("div",{style:{width:"40%",height:12,borderRadius:4,backgroundColor:t.surfaceAlt,animation:n?"none":"tkxPulse 1.5s ease infinite"}})]})]})}function ua({items:t,header:n,footer:r,bordered:o=!0,size:s="md",loading:l=!1,emptyText:a="No data",grid:c}){const d=_.useTheme(),f=Q.useReducedMotion(),u=A.sanitizeString(a),h=ca[s],p=!!c,m=(c==null?void 0:c.column)??1,y=(c==null?void 0:c.gutter)??16;return e.jsxs("div",{role:"list","aria-label":"List","aria-busy":l,className:x.tkx("font-sans rounded-lg overflow-hidden"),style:{border:o?`1px solid ${d.border}`:"none",backgroundColor:d.surface},children:[n&&e.jsx("div",{className:x.tkx("font-semibold text-sm"),style:{padding:h,color:d.text,borderBottom:`1px solid ${d.border}`,backgroundColor:d.surfaceAlt},children:n}),l&&e.jsx("div",{children:Array.from({length:3}).map((k,b)=>e.jsx(da,{theme:d,reducedMotion:f},b))}),!l&&t.length===0&&e.jsx("div",{role:"status",className:x.tkx("text-center py-12 text-sm"),style:{color:d.textMuted},children:u}),!l&&t.length>0&&e.jsx("div",{style:p?{display:"grid",gridTemplateColumns:`repeat(${m}, 1fr)`,gap:y,padding:y}:void 0,children:t.map((k,b)=>{const g=A.sanitizeString(k.title),M=k.description?A.sanitizeString(k.description):void 0;return e.jsxs("div",{role:"listitem",className:x.tkx("flex items-start gap-3"),style:{padding:h,borderBottom:!p&&b<t.length-1?`1px solid ${d.border}`:"none",...p?{border:`1px solid ${d.border}`,borderRadius:8,backgroundColor:d.surface}:{},animation:f?"none":`tkxFadeIn 0.2s ease ${b*.03}s both`},children:[k.avatar&&e.jsx("div",{"aria-hidden":"true",className:x.tkx("shrink-0"),children:k.avatar}),e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[e.jsx("div",{className:x.tkx("text-sm font-medium"),style:{color:d.text},children:g}),M&&e.jsx("div",{className:x.tkx("text-xs mt-1 leading-relaxed"),style:{color:d.textMuted},children:M})]}),k.extra&&e.jsx("div",{className:x.tkx("shrink-0 ml-auto"),style:{color:d.textMuted},children:k.extra}),k.actions&&e.jsx("div",{className:x.tkx("shrink-0 flex items-center gap-2"),children:k.actions})]},k.key)})}),r&&e.jsx("div",{className:x.tkx("text-sm"),style:{padding:h,color:d.textMuted,borderTop:`1px solid ${d.border}`,backgroundColor:d.surfaceAlt},children:r})]})}function fa({locale:t="en-US",direction:n,strings:r,children:o}){const s=i.useMemo(()=>{const l=nt.LOCALES[t]??nt.enUS,a=r?{...l,...r}:l,c=n??(nt.isRTL(t)?"rtl":"ltr");return{locale:t,direction:c,strings:a}},[t,n,r]);return e.jsx(nt.I18nContext.Provider,{value:s,children:e.jsx("div",{dir:s.direction,style:{direction:s.direction,display:"contents"},children:o})})}function xa({contentId:t="tkx-main-content",label:n="Skip to main content"}){return e.jsx("a",{href:`#${t}`,className:"tkx-skip-nav",children:n})}function pa({politeness:t="polite",children:n,atomic:r=!0}){return e.jsx("div",{role:"status","aria-live":t,"aria-atomic":r,className:"tkx-sr-only",children:n})}function ha({active:t,children:n,as:r="div"}){const o=Q.useFocusTrap(t);return e.jsx(r,{ref:o,children:n})}function ma({as:t,children:n,...r}){const o=t??"span";return e.jsx(o,{className:"tkx-sr-only",...r,children:n})}function Hn(t,n,r,o){const s=t.getBoundingClientRect(),l=n?n.offsetHeight:320,a=n?n.offsetWidth:200,c=window.innerWidth,d=window.innerHeight,f=window.scrollX,u=window.scrollY;let h=0,p=0;switch(r){case"bottom-start":h=s.bottom+u+o,p=s.left+f;break;case"bottom-end":h=s.bottom+u+o,p=s.right+f-a;break;case"top-start":h=s.top+u-o-l,p=s.left+f;break;case"top-end":h=s.top+u-o-l,p=s.right+f-a;break;case"right":h=s.top+u,p=s.right+f+o;break;case"left":h=s.top+u,p=s.left+f-o-a;break;default:h=s.bottom+u+o,p=s.left+f}return r.startsWith("bottom")&&s.bottom+l>d&&(h=s.top+u-o-l),r.startsWith("top")&&s.top-l<0&&(h=s.bottom+u+o),p+a>c+f&&(p=c+f-a-8),p<f&&(p=f+8),{top:h,left:p,minWidth:s.width}}function Vn(t,n){if(!n)return t;const o=t.toLowerCase().indexOf(n.toLowerCase());return o===-1?t:e.jsxs(e.Fragment,{children:[t.slice(0,o),e.jsx("mark",{style:{background:"rgba(0,245,212,0.3)",color:"inherit",borderRadius:2},children:t.slice(o,o+n.length)}),t.slice(o+n.length)]})}function ga(t,n){const r=[];for(const o of t)for(const s of o.items)s.disabled||(!n||s.label.toLowerCase().includes(n.toLowerCase()))&&r.push(s);return r}function ba({groups:t,position:n,maxHeight:r,minWidth:o,selectedKeys:s,multiSelect:l,searchable:a,searchPlaceholder:c,onSelect:d,onClose:f,renderItem:u,menuRef:h,isPortal:p,menuId:m}){const y=_.useTheme(),[k,b]=i.useState(""),[g,M]=i.useState(0),[j,w]=i.useState(null),[I,v]=i.useState(0),N=i.useRef(null),$=i.useRef([]),S=i.useRef([]),T=k?t.map(R=>({...R,items:R.items.filter(B=>{var V,D;return B.label.toLowerCase().includes(k.toLowerCase())||((V=B.description)==null?void 0:V.toLowerCase().includes(k.toLowerCase()))||((D=B.children)==null?void 0:D.some(O=>O.label.toLowerCase().includes(k.toLowerCase())))})})).filter(R=>R.items.length>0):t,E=ga(T,k);i.useEffect(()=>{var R;a&&N.current?N.current.focus():(R=$.current[0])==null||R.focus(),M(0)},[a]),i.useEffect(()=>{var R;(!a||k!=="")&&((R=$.current[g])==null||R.focus())},[g,a,k]);const C=i.useCallback(R=>{var B,V,D;switch(R.key){case"ArrowDown":if(R.preventDefault(),j){const L=(((B=E.find(P=>P.key===j))==null?void 0:B.children)??[]).filter(P=>!P.disabled);v(P=>Math.min(P+1,L.length-1))}else M(O=>Math.min(O+1,E.length-1));break;case"ArrowUp":R.preventDefault(),j?v(O=>Math.max(O-1,0)):M(O=>Math.max(O-1,0));break;case"ArrowRight":{R.preventDefault();const O=E[g];(V=O==null?void 0:O.children)!=null&&V.length&&(w(O.key),v(0));break}case"ArrowLeft":R.preventDefault(),w(null);break;case"Enter":case" ":if(R.preventDefault(),j){const P=(((D=E.find(W=>W.key===j))==null?void 0:D.children)??[]).filter(W=>!W.disabled)[I];P&&d(P.key,P)}else{const O=E[g];O&&d(O.key,O)}break;case"Escape":R.preventDefault(),j?w(null):f();break;case"Tab":f();break}},[E,g,f,d,j,I]);i.useEffect(()=>{var R;j&&((R=S.current[I])==null||R.focus())},[I,j]);const H={position:p?"fixed":"absolute",top:p?n.top:void 0,left:p?n.left:void 0,minWidth:Math.max(o,n.minWidth),maxHeight:r,overflowY:"auto",background:y.surface,border:`1px solid ${y.border}`,borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:9999,outline:"none",transformOrigin:"top left",animation:"tkx-dropdown-in 150ms ease forwards"};let z=0;return e.jsxs("div",{ref:h,id:m,role:"menu","aria-label":"Dropdown menu",tabIndex:-1,style:H,onKeyDown:C,children:[e.jsx("style",{children:`
|
|
120
|
+
@keyframes tkx-dropdown-in {
|
|
121
|
+
from { opacity: 0; transform: scale(0.95); }
|
|
122
|
+
to { opacity: 1; transform: scale(1); }
|
|
123
|
+
}
|
|
124
|
+
`}),a&&e.jsx("div",{style:{padding:"8px 8px 4px"},children:e.jsx("input",{ref:N,type:"text",value:k,onChange:R=>{b(R.target.value),M(0)},placeholder:c,"aria-label":"Search items",style:{width:"100%",boxSizing:"border-box",padding:"6px 10px",background:y.surfaceAlt,border:`1px solid ${y.border}`,borderRadius:6,color:y.text,fontSize:13,outline:"none"}})}),T.length===0&&e.jsx("div",{style:{padding:"12px 16px",color:y.textMuted,fontSize:13,textAlign:"center"},children:"No results found"}),T.map((R,B)=>e.jsxs("div",{role:"group","aria-label":R.label,children:[R.label&&e.jsx("div",{style:{padding:"8px 12px 4px",fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:y.textMuted},children:A.sanitizeString(R.label)}),R.items.map(V=>{var ne;const D=z;V.disabled||z++;const O=s.includes(V.key),L=D===g&&!V.disabled,P=!!((ne=V.children)!=null&&ne.length),W=j===V.key,K=u?u(V,O):e.jsx(On,{item:V,isSelected:O,isFocused:L,multiSelect:l,query:k,theme:y,hasSubmenu:P});return e.jsxs("div",{children:[V.divider&&e.jsx("div",{role:"separator",style:{height:1,background:y.border,margin:"4px 0"}}),e.jsxs("div",{ref:Z=>{$.current[D]=Z},role:"menuitem","aria-disabled":V.disabled,"aria-checked":l?O:void 0,"aria-selected":l?void 0:O,"aria-haspopup":P?"menu":void 0,"aria-expanded":P?W:void 0,tabIndex:V.disabled?-1:0,style:{position:"relative",cursor:V.disabled?"not-allowed":"pointer",opacity:V.disabled?.5:1},onClick:()=>{V.disabled||(P?(w(W?null:V.key),v(0)):d(V.key,V))},onMouseEnter:()=>{V.disabled||(M(D),P?(w(V.key),v(0)):w(null))},onFocus:()=>{V.disabled||M(D)},children:[K,P&&W&&e.jsx("div",{role:"menu",style:{position:"absolute",top:0,left:"100%",minWidth:180,background:y.surface,border:`1px solid ${y.border}`,borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:1e4,animation:"tkx-dropdown-in 120ms ease forwards"},children:V.children.map((Z,ie)=>{const fe=s.includes(Z.key),pe=ie===I;return e.jsx("div",{ref:te=>{S.current[ie]=te},role:"menuitem","aria-disabled":Z.disabled,"aria-selected":fe,tabIndex:Z.disabled?-1:0,style:{cursor:Z.disabled?"not-allowed":"pointer",opacity:Z.disabled?.5:1},onClick:te=>{te.stopPropagation(),Z.disabled||d(Z.key,Z)},onMouseEnter:()=>v(ie),children:e.jsx(On,{item:Z,isSelected:fe,isFocused:pe,multiSelect:l,query:k,theme:y,hasSubmenu:!1})},Z.key)})})]})]},V.key)})]},B))]})}function On({item:t,isSelected:n,isFocused:r,multiSelect:o,query:s,theme:l,hasSubmenu:a}){const c=r?t.danger?`${l.danger}20`:`${l.primary}18`:"transparent";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:c,transition:"background 80ms",color:t.danger?l.danger:l.text,fontSize:14,userSelect:"none"},children:[o&&e.jsx("div",{style:{width:16,height:16,border:`2px solid ${n?l.primary:l.border}`,borderRadius:4,background:n?l.primary:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 120ms"},children:n&&e.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:e.jsx("path",{d:"M1 4l3 3L9 1",stroke:l.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),t.icon&&e.jsx("span",{style:{display:"flex",alignItems:"center",flexShrink:0,color:t.danger?l.danger:l.textMuted},children:t.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:n&&!o?600:400},children:Vn(t.label,s)}),t.description&&e.jsx("div",{style:{fontSize:12,color:l.textMuted,marginTop:1},children:Vn(t.description,s)})]}),t.badge!==void 0&&e.jsx("span",{style:{background:l.primary,color:l.bg,fontSize:11,fontWeight:700,borderRadius:10,padding:"1px 7px",flexShrink:0},children:t.badge}),t.shortcut&&!a&&e.jsx("span",{style:{fontSize:12,color:l.textMuted,flexShrink:0},children:t.shortcut}),a&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:"M4 2l4 4-4 4",stroke:l.textMuted,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),!o&&n&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:"M2 7l4 4L12 3",stroke:l.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function ya({trigger:t,items:n,groups:r,placement:o="bottom-start",onSelect:s,selectedKeys:l,multiSelect:a=!1,searchable:c=!1,searchPlaceholder:d="Search…",closeOnSelect:f,disabled:u=!1,maxHeight:h=320,minWidth:p=200,open:m,onOpenChange:y,portal:k=!0,offset:b=6,renderItem:g}){const[M,j]=i.useState(!1),[w,I]=i.useState([]),[v,N]=i.useState({top:0,left:0,minWidth:p}),$=i.useRef(null),S=i.useRef(null),T=i.useId(),E=m!==void 0?m:M,C=l!==void 0?l:w,H=f!==void 0?f:!a,z=r??(n?[{items:n}]:[{items:[]}]),R=i.useCallback(L=>{m===void 0&&j(L),y==null||y(L)},[m,y]),B=i.useCallback((L,P)=>{a&&l===void 0&&I(W=>W.includes(L)?W.filter(K=>K!==L):[...W,L]),s==null||s(L,P),H&&R(!1)},[a,l,s,H,R]),V=i.useCallback(()=>R(!1),[R]);i.useEffect(()=>{if(E&&$.current){const L=Hn($.current,S.current,o,b);N(L)}},[E,o,b]),i.useEffect(()=>{if(E&&$.current&&S.current){const L=Hn($.current,S.current,o,b);N(L)}},[E,o,b]),i.useEffect(()=>{if(!E)return;const L=P=>{const W=P.target;$.current&&!$.current.contains(W)&&S.current&&!S.current.contains(W)&&R(!1)};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[E,R]);const D=()=>{u||R(!E)},O=E?e.jsx(ba,{groups:z,position:v,maxHeight:h,minWidth:p,selectedKeys:C,multiSelect:a,searchable:c,searchPlaceholder:d,onSelect:B,onClose:V,renderItem:g,menuRef:S,isPortal:k,menuId:T}):null;return e.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[e.jsx("div",{ref:$,onClick:D,"aria-haspopup":"menu","aria-expanded":E,"aria-controls":E?T:void 0,"aria-disabled":u,style:{cursor:u?"not-allowed":"pointer",opacity:u?.5:1,display:"inline-block"},children:t}),k&&typeof document<"u"?Le.createPortal(O,document.body):O]})}exports.LRUCache=_.LRUCache;exports.Quantum=_.Quantum;exports.TKX=_.TKX;exports.ThemeContext=_.ThemeContext;exports.ThemeProvider=_.ThemeProvider;exports.WCAGEngine=_.WCAGEngine;exports.auroraLight=_.auroraLight;exports.batchUpdate=_.batchUpdate;exports.breakpoints=_.breakpoints;exports.contrastRatio=_.contrastRatio;exports.createFocusTrap=_.createFocusTrap;exports.createTheme=_.createTheme;exports.css=_.css;exports.cssVar=_.cssVar;exports.extractCSS=_.extractCSS;exports.fnv1aHash=_.fnv1aHash;exports.fromObject=_.fromObject;exports.generatePalette=_.generatePalette;exports.getAccessibleForeground=_.getAccessibleForeground;exports.injectStyles=_.injectStyles;exports.keyframes=_.keyframes;exports.meetsAA=_.meetsAA;exports.meetsAAA=_.meetsAAA;exports.memoize=_.memoize;exports.prefersHighContrast=_.prefersHighContrast;exports.prefersReducedMotion=_.prefersReducedMotion;exports.quantumDark=_.quantumDark;exports.radii=_.radii;exports.responsive=_.responsive;exports.shadows=_.shadows;exports.spacing=_.spacing;exports.typography=_.typography;exports.useTheme=_.useTheme;exports.zIndex=_.zIndex;exports.Shield=A.Shield;exports.audit=A.audit;exports.getAuditLog=A.getAuditLog;exports.sanitizeProps=A.sanitizeProps;exports.sanitizeString=A.sanitizeString;exports.validateProps=A.validateProps;exports.verifyAuditIntegrity=A.verifyAuditIntegrity;exports.TkxForm=Q.TkxForm;exports.TkxFormField=Q.TkxFormField;exports.useAnnounce=Q.useAnnounce;exports.useClickOutside=Q.useClickOutside;exports.useEscapeKey=Q.useEscapeKey;exports.useFocusTrap=Q.useFocusTrap;exports.useHighContrast=Q.useHighContrast;exports.useReducedMotion=Q.useReducedMotion;exports.useTkxForm=Q.useTkxForm;exports.cx=x.cx;exports.extractAtomicCSS=x.extractAtomicCSS;exports.resetAtomicCSS=x.resetAtomicCSS;exports.resolvePluginUtility=x.resolvePluginUtility;exports.tkx=x.tkx;exports.tkxListPlugins=x.tkxListPlugins;exports.tkxPlugin=x.tkxPlugin;exports.tkxRemovePlugin=x.tkxRemovePlugin;exports.tx=x.tx;exports.I18nContext=nt.I18nContext;exports.isRTL=nt.isRTL;exports.useDirection=nt.useDirection;exports.useI18n=nt.useI18n;exports.useLocale=nt.useLocale;exports.FocusTrap=ha;exports.I18nProvider=fa;exports.LiveRegion=pa;exports.SIZE_BORDER_RADIUS=ml;exports.SIZE_FONT=xl;exports.SIZE_HEIGHT=fl;exports.SIZE_ICON=gl;exports.SIZE_PADDING_X=pl;exports.SIZE_PADDING_Y=hl;exports.SkipNav=xa;exports.TkxAccordion=ir;exports.TkxAffix=sa;exports.TkxAlert=ns;exports.TkxAnchor=oa;exports.TkxAppBar=Mi;exports.TkxAutocomplete=oi;exports.TkxAvatar=Qn;exports.TkxBadge=Un;exports.TkxBottomNav=Ii;exports.TkxBreadcrumb=ei;exports.TkxButton=_n;exports.TkxCard=Yn;exports.TkxCardBody=Xr;exports.TkxCardFooter=Zr;exports.TkxCardHeader=Ur;exports.TkxCarousel=wr;exports.TkxCascader=aa;exports.TkxChat=po;exports.TkxChatBubble=ur;exports.TkxCheckbox=tr;exports.TkxClock=hr;exports.TkxCol=Nr;exports.TkxColorPicker=Ho;exports.TkxCommand=vr;exports.TkxConfigProvider=Lr;exports.TkxContent=Ir;exports.TkxCountdown=Fl;exports.TkxDataGrid=Fi;exports.TkxDatePicker=lr;exports.TkxDivider=Jn;exports.TkxDrawer=Ws;exports.TkxDropdown=ya;exports.TkxEmpty=Ll;exports.TkxFileUpload=no;exports.TkxFooter=zr;exports.TkxHeader=Cr;exports.TkxImage=Qs;exports.TkxInput=Kn;exports.TkxLayout=Tr;exports.TkxList=ua;exports.TkxMasonry=_i;exports.TkxMentions=Ol;exports.TkxMenu=pr;exports.TkxModal=os;exports.TkxNumberInput=yr;exports.TkxOTP=kr;exports.TkxPagination=cr;exports.TkxParagraph=Ml;exports.TkxPopover=ni;exports.TkxProgress=Xn;exports.TkxQRCode=Xl;exports.TkxRadio=rr;exports.TkxRadioGroup=js;exports.TkxRating=co;exports.TkxResult=ql;exports.TkxRichTextDisplay=nl;exports.TkxRow=Er;exports.TkxSegmented=Vl;exports.TkxSelect=er;exports.TkxSider=$r;exports.TkxSkeleton=xt;exports.TkxSlider=ar;exports.TkxSnackbar=Ri;exports.TkxSpeedDial=vi;exports.TkxSpin=zl;exports.TkxStatistic=Pl;exports.TkxStepper=gr;exports.TkxTab=as;exports.TkxTabList=ls;exports.TkxTabPanel=ds;exports.TkxTabPanels=cs;exports.TkxTable=ms;exports.TkxTabs=is;exports.TkxTag=fr;exports.TkxTagInput=ko;exports.TkxText=Sl;exports.TkxThinkingIndicator=dr;exports.TkxTimeline=jo;exports.TkxTitle=jl;exports.TkxToastProvider=Es;exports.TkxToggle=Zn;exports.TkxToolbar=ui;exports.TkxTooltip=fs;exports.TkxTour=ea;exports.TkxTransferList=hi;exports.TkxTreeView=ci;exports.TkxVideoPlayer=mr;exports.TkxWatermark=na;exports.VisuallyHidden=ma;exports.getLocaleDisplayName=vl;exports.isRtlLocale=kl;exports.useComponentSize=ul;exports.useConfig=vt;exports.useLogicalSpacing=yl;exports.usePrefixCls=dl;exports.useRtlFlip=bl;exports.useTkxCommand=Xo;exports.useToast=Ts;
|