tekivex-ui 2.5.16 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/realtime.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./chunk-DmRB1Blb.js");const e=require("./chunk-DjxOP8W4.js"),t=require("./chunk-Dc4_ud5s.js");let n=require("react");var o=!1;function r({item:e,isNew:o,showTimestamps:r,onItemClick:i,renderItem:s,theme:a,style:l}){const c=function(e,t){switch(e){case"info":return t.info;case"success":return t.success;case"warning":return t.warning;case"error":return t.danger;default:return t.border}}(e.type,a);return s?(0,n.createElement)("div",{style:l,className:o?"tkx-feed-item-new":void 0},s(e)):(0,n.createElement)("div",{style:{...l,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderLeft:`3px solid ${c}`,cursor:i?"pointer":"default",boxSizing:"border-box",height:64,background:a.surface,transition:"background 0.15s"},className:o?"tkx-feed-item-new":void 0,onClick:i?()=>i(e):void 0,role:i?"button":void 0,tabIndex:i?0:void 0,onKeyDown:i?t=>{"Enter"!==t.key&&" "!==t.key||i(e)}:void 0},(0,n.createElement)("div",{style:{width:36,height:36,borderRadius:"50%",background:c,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:a.bg,flexShrink:0,overflow:"hidden"}},e.avatar?(0,n.createElement)("img",{src:e.avatar,alt:e.author??"",style:{width:"100%",height:"100%",objectFit:"cover"}}):(d=e.author)?d.split(" ").map(e=>e[0]??"").slice(0,2).join("").toUpperCase():"?"),(0,n.createElement)("div",{style:{flex:1,minWidth:0}},(0,n.createElement)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2}},e.author&&(0,n.createElement)("span",{style:{fontWeight:600,fontSize:13,color:a.text}},t.sanitizeString(e.author)),e.meta&&(0,n.createElement)("span",{style:{fontSize:11,color:a.textMuted,background:a.surfaceAlt,borderRadius:4,padding:"1px 5px"}},t.sanitizeString(e.meta))),(0,n.createElement)("div",{style:{fontSize:13,color:a.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.sanitizeString(e.content))),r&&(0,n.createElement)("div",{style:{fontSize:11,color:a.textMuted,flexShrink:0}},function(e){const t=Date.now()-e;return t<1e4?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}(e.timestamp)));var d}var i=!1;function s(e,t){if("string"==typeof e)return e;const n=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Number.isInteger(e)?e:e.toFixed(2));return t?`${n}${t}`:n}function a({data:e,color:t}){if(e.length<2)return null;const o=Math.min(...e),r=Math.max(...e)-o||1,i=e.map((t,n)=>{const i=n/(e.length-1)*80,s=24-(t-o)/r*22-1;return`${i.toFixed(1)},${s.toFixed(1)}`});return(0,n.createElement)("svg",{width:80,height:24,viewBox:"0 0 80 24","aria-hidden":"true"},(0,n.createElement)("polyline",{points:i.join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}))}function l({trend:e,theme:t}){return"up"===e?(0,n.createElement)("span",{style:{color:t.success,fontSize:14,fontWeight:700}},"▲"):"down"===e?(0,n.createElement)("span",{style:{color:t.danger,fontSize:14,fontWeight:700}},"▼"):(0,n.createElement)("span",{style:{color:t.textMuted,fontSize:14}},"→")}function c({metric:e,animate:o,onMetricClick:r,theme:i}){const c=e.color??function(e,t){switch(e){case"warning":return t.warning;case"critical":return t.danger;default:return t.primary}}(e.status,i),d="number"==typeof e.value?e.value:NaN,u=function(e,t,o){const[r,i]=(0,n.useState)(e),s=(0,n.useRef)(e),a=(0,n.useRef)(null),l=(0,n.useRef)(null),c=function(){const[e,t]=(0,n.useState)(()=>"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,n.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}();return(0,n.useEffect)(()=>{if(!o||c)return i(e),void(s.current=e);const t=s.current;if(t===e)return;a.current=null;const n=o=>{null===a.current&&(a.current=o);const r=o-a.current,c=Math.min(r/600,1),d=1-Math.pow(1-c,3);i(t+(e-t)*d),c<1?l.current=requestAnimationFrame(n):s.current=e};return l.current=requestAnimationFrame(n),()=>{null!==l.current&&cancelAnimationFrame(l.current)}},[e,600,o,c]),r}(isNaN(d)?0:d,0,o&&!isNaN(d)),[f,h]=(0,n.useState)(!1),m=(0,n.useRef)(e.value);(0,n.useEffect)(()=>{if(m.current!==e.value){m.current=e.value,h(!0);const t=window.setTimeout(()=>h(!1),700);return()=>clearTimeout(t)}},[e.value]);const p=void 0!==e.previousValue&&e.previousValue!==d,g={background:i.surface,border:`1px solid ${i.border}`,borderLeft:`4px solid ${c}`,borderRadius:8,padding:"14px 16px",cursor:r?"pointer":"default",position:"relative",overflow:"hidden",boxSizing:"border-box"},y=f?{position:"absolute",inset:0,background:`linear-gradient(90deg, transparent 0%, ${c}22 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"tkx-metric-shimmer 0.6s ease-in-out",pointerEvents:"none"}:{},x=isNaN(d)?t.sanitizeString(String(e.value)):s(u,e.unit);return(0,n.createElement)("div",{style:g,className:f?"tkx-metric-shimmer":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0},f&&(0,n.createElement)("div",{style:y}),(0,n.createElement)("div",{style:{fontSize:12,color:i.textMuted,marginBottom:6,fontWeight:500,letterSpacing:"0.03em"}},t.sanitizeString(e.label)),(0,n.createElement)("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginBottom:6}},(0,n.createElement)("span",{style:{fontSize:28,fontWeight:700,color:i.text,lineHeight:1}},x),e.unit&&isNaN(d)&&(0,n.createElement)("span",{style:{fontSize:14,color:i.textMuted,marginBottom:2}},t.sanitizeString(e.unit))),(e.trend||e.trendValue)&&(0,n.createElement)("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:e.sparkline?8:0}},e.trend&&(0,n.createElement)(l,{trend:e.trend,theme:i}),e.trendValue&&(0,n.createElement)("span",{style:{fontSize:12,color:i.textMuted}},t.sanitizeString(e.trendValue))),p&&(0,n.createElement)("div",{style:{fontSize:11,color:i.textMuted,marginTop:2}},`was ${s(e.previousValue)}`),e.sparkline&&e.sparkline.length>=2&&(0,n.createElement)("div",{style:{marginTop:8}},(0,n.createElement)(a,{data:e.sparkline,color:c})))}function d(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}`}function u(e){return Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(2)}var f={debug:0,info:1,warn:2,error:3,fatal:4},h=!1;function m({entry:e,showLevel:o,showTimestamp:r,showSource:i,searchQuery:s,monospace:a,isExpanded:l,onToggle:c,onEntryClick:d,theme:u,style:f}){const h=function(e,t){switch(e){case"debug":default:return t.textMuted;case"info":return t.info;case"warn":return t.warning;case"error":case"fatal":return t.danger}}(e.level,u),m=function(e,t){return"fatal"===e?`${t.danger}22`:"transparent"}(e.level,u),p=e.metadata&&Object.keys(e.metadata).length>0,g={...f,display:"flex",alignItems:"center",gap:6,padding:"0 10px",fontSize:12,fontFamily:a?'"JetBrains Mono", "Fira Mono", Consolas, monospace':"inherit",cursor:p||d?"pointer":"default",background:m,boxSizing:"border-box",height:28,overflow:"hidden",whiteSpace:"nowrap",borderBottom:`1px solid ${u.border}22`};return(0,n.createElement)("div",{style:g,className:"tkx-log-row",onClick:()=>{p&&c(),d&&d(e)},role:p?"button":void 0,tabIndex:p?0:void 0,onKeyDown:p?e=>{"Enter"!==e.key&&" "!==e.key||c()}:void 0,"aria-expanded":p?l:void 0},r&&(0,n.createElement)("span",{style:{color:u.textMuted,flexShrink:0,minWidth:84}},function(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}(e.timestamp)),o&&(0,n.createElement)("span",{style:{color:h,flexShrink:0,fontWeight:"fatal"===e.level?700:500,minWidth:56}},`[${e.level.toUpperCase().padEnd(5)}]`),i&&e.source&&(0,n.createElement)("span",{style:{background:u.surfaceAlt,border:`1px solid ${u.border}`,borderRadius:10,padding:"0 5px",fontSize:10,color:u.textMuted,flexShrink:0,maxWidth:80,overflow:"hidden",textOverflow:"ellipsis"}},t.sanitizeString(e.source)),(0,n.createElement)("span",{style:{flex:1,color:u.text,overflow:"hidden",textOverflow:"ellipsis"}},...function(e,o){if(!o)return[e];const r=t.sanitizeString(e),i=t.sanitizeString(o);if(!i)return[r];try{const e=new RegExp(`(${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return r.split(e).map((t,o)=>e.test(t)?(0,n.createElement)("mark",{key:o,className:"tkx-log-highlight"},t):t)}catch{return[r]}}(e.message,s)),p&&(0,n.createElement)("span",{style:{color:u.textMuted,fontSize:10,flexShrink:0}},l?"▲":"▼"))}function p({metadata:e,theme:o,style:r}){return(0,n.createElement)("div",{style:{...r,background:o.surfaceAlt,borderBottom:`1px solid ${o.border}`,padding:"6px 10px 6px 56px",display:"flex",flexWrap:"wrap",gap:6,boxSizing:"border-box"}},...Object.entries(e).map(([e,r])=>(0,n.createElement)("span",{key:e,style:{fontSize:11,fontFamily:"monospace",color:o.textMuted,background:o.surface,border:`1px solid ${o.border}`,borderRadius:4,padding:"1px 6px"}},(0,n.createElement)("span",{style:{color:o.info}},`${t.sanitizeString(e)}: `),t.sanitizeString(String(r)))))}exports.TkxLiveFeed=function({items:i,maxItems:s=100,height:a=400,autoScroll:l=!0,showTimestamps:c=!0,onItemClick:d,emptyMessage:u="No activity yet.",pauseOnHover:f=!0,renderItem:h}){const m=e.useTheme();!function(){if(o||"undefined"==typeof document)return;o=!0;const e=document.createElement("style");e.id="tkx-live-feed-styles",e.textContent="\n@keyframes tkx-feed-slide-in {\n from { transform: translateY(-20px); opacity: 0; }\n to { transform: translateY(0); opacity: 1; }\n}\n.tkx-feed-item-new {\n animation: tkx-feed-slide-in 0.25s ease-out both;\n}\n ".trim(),document.head.appendChild(e)}();const p=(0,n.useRef)(null),[g,y]=(0,n.useState)(0),[x,b]=(0,n.useState)(!1),[k,v]=(0,n.useState)(new Set),w=(0,n.useRef)([]),S=(0,n.useMemo)(()=>i.slice(-s),[i,s]),$="number"==typeof a?a:400,M=64*S.length;(0,n.useEffect)(()=>{const e=new Set(w.current.map(e=>e.id)),t=S.filter(t=>!e.has(t.id)).map(e=>e.id);if(t.length>0){v(e=>{const n=new Set(e);return t.forEach(e=>n.add(e)),n});const e=window.setTimeout(()=>{v(e=>{const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},400);return()=>clearTimeout(e)}},[S]),(0,n.useEffect)(()=>{w.current=S},[S]);const z=l&&!(f&&x);(0,n.useEffect)(()=>{if(!z||!p.current)return;const e=p.current;(e.scrollHeight-e.scrollTop-e.clientHeight<192||S.length<=5)&&(e.scrollTop=e.scrollHeight)},[S.length,z]);const N=(0,n.useCallback)(()=>{p.current&&y(p.current.scrollTop)},[]),W=Math.max(0,Math.floor(g/64)-5),I=Math.min(S.length-1,Math.ceil((g+$)/64)+5),L={position:"relative",overflow:"auto",height:"number"==typeof a?`${a}px`:a,background:m.bg,border:`1px solid ${m.border}`,borderRadius:8,boxSizing:"border-box"},C={position:"relative",height:M,minHeight:"100%"};if(0===S.length)return(0,n.createElement)("div",{style:{...L,display:"flex",alignItems:"center",justifyContent:"center"}},(0,n.createElement)("span",{style:{color:m.textMuted,fontSize:14}},t.sanitizeString(u)));const j=[];for(let e=W;e<=I;e++){const t=S[e];t&&j.push((0,n.createElement)(r,{key:t.id,item:t,isNew:k.has(t.id),showTimestamps:c,onItemClick:d,renderItem:h,theme:m,style:{position:"absolute",top:64*e,left:0,right:0}}))}return(0,n.createElement)("div",{ref:p,style:L,onScroll:N,onMouseEnter:f?()=>b(!0):void 0,onMouseLeave:f?()=>b(!1):void 0,"aria-label":"Live feed",role:"feed"},(0,n.createElement)("div",{style:C},...j))},exports.TkxLiveLog=function({entries:t,maxEntries:o=500,height:r=400,autoScroll:i=!0,showLevel:s=!0,showTimestamp:a=!0,showSource:l=!0,filterLevel:c,searchQuery:d="",monospace:u=!0,onEntryClick:g}){const y=e.useTheme();!function(){if(h||"undefined"==typeof document)return;h=!0;const e=document.createElement("style");e.id="tkx-live-log-styles",e.textContent="\n.tkx-log-row:hover { filter: brightness(1.12); }\n.tkx-log-highlight { background: #ffbe0b55; border-radius: 2px; padding: 0 1px; }\n ".trim(),document.head.appendChild(e)}();const x=(0,n.useRef)(null),[b,k]=(0,n.useState)(0),[v,w]=(0,n.useState)(new Set),[S,$]=(0,n.useState)(!1),M=(0,n.useRef)(t.length),z=(0,n.useMemo)(()=>{let e=t.slice(-o);if(void 0!==c){const t=f[c];e=e.filter(e=>f[e.level]>=t)}if(d){const t=d.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||(e.source??"").toLowerCase().includes(t))}return e},[t,o,c,d]),N="number"==typeof r?r:400,W=(0,n.useMemo)(()=>{const e=[];let t=0;for(const n of z)e.push(t),t+=28+(v.has(n.id)?40:0);return e.push(t),e},[z,v]),I=W[W.length-1]??0;(0,n.useEffect)(()=>{i&&!S&&z.length!==M.current&&(M.current=z.length,x.current&&(x.current.scrollTop=x.current.scrollHeight))},[z.length,i,S]);const L=(0,n.useCallback)(()=>{if(!x.current)return;const e=x.current;$(!(e.scrollHeight-e.scrollTop-e.clientHeight<56)),k(e.scrollTop)},[]),C=(0,n.useCallback)(e=>{w(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),j=z.length>0?function(e){let t=0,n=z.length-1;for(;t<n;){const o=t+n>>1;(W[o+1]??0)<=e?t=o+1:n=o}return Math.max(0,t-8)}(b):0,T=z.length>0?function(e){let t=0,n=z.length-1;for(;t<n;){const o=t+n+1>>1;(W[o]??0)>=e+N?n=o-1:t=o}return Math.min(z.length-1,t+8)}(b):-1,E={position:"relative",overflow:"auto",height:"number"==typeof r?`${r}px`:r,background:y.bg,border:`1px solid ${y.border}`,borderRadius:8,boxSizing:"border-box"},R={position:"relative",height:I,minHeight:"100%"};if(0===z.length)return(0,n.createElement)("div",{style:{...E,display:"flex",alignItems:"center",justifyContent:"center"}},(0,n.createElement)("span",{style:{color:y.textMuted,fontSize:13,fontFamily:"monospace"}},"No log entries."));const B=[];for(let e=j;e<=T;e++){const t=z[e];if(!t)continue;const o=W[e]??0,r=v.has(t.id);B.push((0,n.createElement)(m,{key:t.id,entry:t,showLevel:s,showTimestamp:a,showSource:l,searchQuery:d,monospace:u,isExpanded:r,onToggle:()=>C(t.id),onEntryClick:g,theme:y,style:{position:"absolute",top:o,left:0,right:0}})),r&&t.metadata&&Object.keys(t.metadata).length>0&&B.push((0,n.createElement)(p,{key:`${t.id}-meta`,metadata:t.metadata,theme:y,style:{position:"absolute",top:o+28,left:0,right:0,height:40}}))}return(0,n.createElement)("div",{ref:x,style:E,onScroll:L,role:"log","aria-live":"polite","aria-label":"Log viewer"},(0,n.createElement)("div",{style:R},...B))},exports.TkxLiveMetrics=function({metrics:t,columns:o=3,animate:r=!0,onMetricClick:s}){const a=e.useTheme();return function(){if(i||"undefined"==typeof document)return;i=!0;const e=document.createElement("style");e.id="tkx-live-metrics-styles",e.textContent="\n@keyframes tkx-metric-pulse {\n 0% { opacity: 1; }\n 40% { opacity: 0.4; }\n 100% { opacity: 1; }\n}\n@keyframes tkx-metric-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n.tkx-metric-shimmer {\n animation: tkx-metric-shimmer 0.6s ease-in-out;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-metric-shimmer { animation: none; }\n .tkx-metric-pulse { animation: none; }\n}\n ".trim(),document.head.appendChild(e)}(),(0,n.createElement)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`,gap:16}},...t.map(e=>(0,n.createElement)(c,{key:e.id,metric:e,animate:r,onMetricClick:s,theme:a})))},exports.TkxRealTimeChart=function({data:o,maxPoints:r=60,height:i=200,width:s="100%",color:a,fill:l=!0,showGrid:c=!0,showLabels:f=!0,showTooltip:h=!0,label:m,unit:p,animate:g=!0,yMin:y,yMax:x}){const b=e.useTheme(),k=a??b.primary,v=(0,n.useRef)(null),[w,S]=(0,n.useState)(600),[$,M]=(0,n.useState)(null),[z,N]=(0,n.useState)(0),W=(0,n.useRef)(o.length);(0,n.useEffect)(()=>{if(!v.current)return;const e=new ResizeObserver(e=>{const t=e[0];t&&S(t.contentRect.width)});return e.observe(v.current),S(v.current.offsetWidth),()=>e.disconnect()},[]);const I=(0,n.useMemo)(()=>o.slice(-r),[o,r]);(0,n.useEffect)(()=>{I.length>W.current&&N(e=>e+1),W.current=I.length},[I.length]);const L=f?48:12,C=m?28:12,j=Math.max(w-L-12,1),T=Math.max(i-C-28,1),E=I.length?Math.min(...I.map(e=>e.value)):0,R=I.length?Math.max(...I.map(e=>e.value)):1,B=R-E||1,O=void 0!==y?y:E-.1*B,F=(void 0!==x?x:R+.1*B)-O||1;function D(e){return I.length<2?j/2:e/(I.length-1)*j}function q(e){return T-(e-O)/F*T}const A=I.length>=2?I.map((e,t)=>`${0===t?"M":"L"}${D(t).toFixed(2)},${q(e.value).toFixed(2)}`).join(" "):"",H=A?`${A} L${D(I.length-1).toFixed(2)},${T} L${D(0).toFixed(2)},${T} Z`:"",P=[];for(let e=0;e<=4;e++)P.push(e);const Q=P.map(e=>{const t=O+e/4*F;return{y:q(t),text:u(t)}}),K=Math.min(4,I.length),Y=K>0?Array.from({length:K},(e,t)=>Math.round(t/Math.max(K-1,1)*(I.length-1))):[],G=(0,n.useCallback)(e=>{if(!h||0===I.length)return;const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-L;let o=0,r=1/0;I.forEach((e,t)=>{const i=Math.abs(D(t)-n);i<r&&(r=i,o=t)});const i=I[o];i&&M({x:D(o)+L,y:q(i.value)+C,point:i})},[I,h,L,C]),J=(0,n.useCallback)(()=>M(null),[]),Z=w,U=i,V=`tkx-chart-clip-${z}`;return(0,n.createElement)("div",{ref:v,style:{position:"relative",width:"number"==typeof s?`${s}px`:s,background:b.surface,border:`1px solid ${b.border}`,borderRadius:8,overflow:"hidden",boxSizing:"border-box"}},(0,n.createElement)("svg",{width:Z,height:U,viewBox:`0 0 ${Z} ${U}`,onMouseMove:G,onMouseLeave:J,style:{display:"block",userSelect:"none"},"aria-label":m?t.sanitizeString(m):"Real-time chart"},g&&I.length>=2&&(0,n.createElement)("defs",null,(0,n.createElement)("clipPath",{id:V},(0,n.createElement)("rect",{x:0,y:0,width:j,height:U},(0,n.createElement)("animate",{attributeName:"width",from:Math.max(0,j-j/Math.max(I.length-1,1)),to:j,dur:"0.3s",fill:"freeze"})))),m&&(0,n.createElement)("text",{x:L,y:18,fill:b.textMuted,fontSize:12,fontWeight:500},t.sanitizeString(m)),c&&P.map(e=>{const t=q(O+e/4*F)+C;return(0,n.createElement)("line",{key:`grid-${e}`,x1:L,y1:t,x2:L+j,y2:t,stroke:b.border,strokeWidth:1,strokeDasharray:"4 4"})}),f&&Q.map((e,t)=>(0,n.createElement)("text",{key:`yl-${t}`,x:L-4,y:e.y+C+4,fill:b.textMuted,fontSize:10,textAnchor:"end"},e.text)),p&&(0,n.createElement)("text",{x:4,y:C+10,fill:b.textMuted,fontSize:9},t.sanitizeString(p)),l&&H&&(0,n.createElement)("path",{d:H,fill:`${k}22`,clipPath:g?`url(#${V})`:void 0,transform:`translate(${L}, ${C})`}),A&&(0,n.createElement)("path",{d:A,fill:"none",stroke:k,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",clipPath:g?`url(#${V})`:void 0,transform:`translate(${L}, ${C})`}),Y.map(e=>{const t=I[e];return t?(0,n.createElement)("text",{key:`xl-${e}`,x:L+D(e),y:U-8,fill:b.textMuted,fontSize:9,textAnchor:"middle"},d(t.timestamp)):null}),$&&(0,n.createElement)("line",{x1:$.x,y1:C,x2:$.x,y2:C+T,stroke:k,strokeWidth:1,strokeDasharray:"3 3",opacity:.6}),$&&(0,n.createElement)("circle",{cx:$.x,cy:$.y,r:4,fill:k,stroke:b.surface,strokeWidth:2}),$&&(()=>{const e=Math.min($.x+8,Z-100),t=Math.max($.y-36,4),o=`${u($.point.value)}${p||""}`,r=d($.point.timestamp);return(0,n.createElement)("g",null,(0,n.createElement)("rect",{x:e-4,y:t-2,width:90,height:34,rx:4,fill:b.surfaceAlt,stroke:b.border,strokeWidth:1}),(0,n.createElement)("text",{x:e,y:t+11,fill:b.text,fontSize:12,fontWeight:700},o),(0,n.createElement)("text",{x:e,y:t+26,fill:b.textMuted,fontSize:10},r))})()))};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./chunk-DmRB1Blb.js");const e=require("./chunk-DjxOP8W4.js"),t=require("./chunk-LWkKqC8d.js");let n=require("react");var o=!1;function r({item:e,isNew:o,showTimestamps:r,onItemClick:i,renderItem:s,theme:a,style:l}){const c=function(e,t){switch(e){case"info":return t.info;case"success":return t.success;case"warning":return t.warning;case"error":return t.danger;default:return t.border}}(e.type,a);return s?(0,n.createElement)("div",{style:l,className:o?"tkx-feed-item-new":void 0},s(e)):(0,n.createElement)("div",{style:{...l,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderLeft:`3px solid ${c}`,cursor:i?"pointer":"default",boxSizing:"border-box",height:64,background:a.surface,transition:"background 0.15s"},className:o?"tkx-feed-item-new":void 0,onClick:i?()=>i(e):void 0,role:i?"button":void 0,tabIndex:i?0:void 0,onKeyDown:i?t=>{"Enter"!==t.key&&" "!==t.key||i(e)}:void 0},(0,n.createElement)("div",{style:{width:36,height:36,borderRadius:"50%",background:c,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:a.bg,flexShrink:0,overflow:"hidden"}},e.avatar?(0,n.createElement)("img",{src:e.avatar,alt:e.author??"",style:{width:"100%",height:"100%",objectFit:"cover"}}):(d=e.author)?d.split(" ").map(e=>e[0]??"").slice(0,2).join("").toUpperCase():"?"),(0,n.createElement)("div",{style:{flex:1,minWidth:0}},(0,n.createElement)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2}},e.author&&(0,n.createElement)("span",{style:{fontWeight:600,fontSize:13,color:a.text}},t.sanitizeString(e.author)),e.meta&&(0,n.createElement)("span",{style:{fontSize:11,color:a.textMuted,background:a.surfaceAlt,borderRadius:4,padding:"1px 5px"}},t.sanitizeString(e.meta))),(0,n.createElement)("div",{style:{fontSize:13,color:a.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.sanitizeString(e.content))),r&&(0,n.createElement)("div",{style:{fontSize:11,color:a.textMuted,flexShrink:0}},function(e){const t=Date.now()-e;return t<1e4?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}(e.timestamp)));var d}var i=!1;function s(e,t){if("string"==typeof e)return e;const n=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Number.isInteger(e)?e:e.toFixed(2));return t?`${n}${t}`:n}function a({data:e,color:t}){if(e.length<2)return null;const o=Math.min(...e),r=Math.max(...e)-o||1,i=e.map((t,n)=>{const i=n/(e.length-1)*80,s=24-(t-o)/r*22-1;return`${i.toFixed(1)},${s.toFixed(1)}`});return(0,n.createElement)("svg",{width:80,height:24,viewBox:"0 0 80 24","aria-hidden":"true"},(0,n.createElement)("polyline",{points:i.join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}))}function l({trend:e,theme:t}){return"up"===e?(0,n.createElement)("span",{style:{color:t.success,fontSize:14,fontWeight:700}},"▲"):"down"===e?(0,n.createElement)("span",{style:{color:t.danger,fontSize:14,fontWeight:700}},"▼"):(0,n.createElement)("span",{style:{color:t.textMuted,fontSize:14}},"→")}function c({metric:e,animate:o,onMetricClick:r,theme:i}){const c=e.color??function(e,t){switch(e){case"warning":return t.warning;case"critical":return t.danger;default:return t.primary}}(e.status,i),d="number"==typeof e.value?e.value:NaN,u=function(e,t,o){const[r,i]=(0,n.useState)(e),s=(0,n.useRef)(e),a=(0,n.useRef)(null),l=(0,n.useRef)(null),c=function(){const[e,t]=(0,n.useState)(()=>"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,n.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}();return(0,n.useEffect)(()=>{if(!o||c)return i(e),void(s.current=e);const t=s.current;if(t===e)return;a.current=null;const n=o=>{null===a.current&&(a.current=o);const r=o-a.current,c=Math.min(r/600,1),d=1-Math.pow(1-c,3);i(t+(e-t)*d),c<1?l.current=requestAnimationFrame(n):s.current=e};return l.current=requestAnimationFrame(n),()=>{null!==l.current&&cancelAnimationFrame(l.current)}},[e,600,o,c]),r}(isNaN(d)?0:d,0,o&&!isNaN(d)),[f,h]=(0,n.useState)(!1),m=(0,n.useRef)(e.value);(0,n.useEffect)(()=>{if(m.current!==e.value){m.current=e.value,h(!0);const t=window.setTimeout(()=>h(!1),700);return()=>clearTimeout(t)}},[e.value]);const p=void 0!==e.previousValue&&e.previousValue!==d,g={background:i.surface,border:`1px solid ${i.border}`,borderLeft:`4px solid ${c}`,borderRadius:8,padding:"14px 16px",cursor:r?"pointer":"default",position:"relative",overflow:"hidden",boxSizing:"border-box"},y=f?{position:"absolute",inset:0,background:`linear-gradient(90deg, transparent 0%, ${c}22 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"tkx-metric-shimmer 0.6s ease-in-out",pointerEvents:"none"}:{},x=isNaN(d)?t.sanitizeString(String(e.value)):s(u,e.unit);return(0,n.createElement)("div",{style:g,className:f?"tkx-metric-shimmer":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0},f&&(0,n.createElement)("div",{style:y}),(0,n.createElement)("div",{style:{fontSize:12,color:i.textMuted,marginBottom:6,fontWeight:500,letterSpacing:"0.03em"}},t.sanitizeString(e.label)),(0,n.createElement)("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginBottom:6}},(0,n.createElement)("span",{style:{fontSize:28,fontWeight:700,color:i.text,lineHeight:1}},x),e.unit&&isNaN(d)&&(0,n.createElement)("span",{style:{fontSize:14,color:i.textMuted,marginBottom:2}},t.sanitizeString(e.unit))),(e.trend||e.trendValue)&&(0,n.createElement)("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:e.sparkline?8:0}},e.trend&&(0,n.createElement)(l,{trend:e.trend,theme:i}),e.trendValue&&(0,n.createElement)("span",{style:{fontSize:12,color:i.textMuted}},t.sanitizeString(e.trendValue))),p&&(0,n.createElement)("div",{style:{fontSize:11,color:i.textMuted,marginTop:2}},`was ${s(e.previousValue)}`),e.sparkline&&e.sparkline.length>=2&&(0,n.createElement)("div",{style:{marginTop:8}},(0,n.createElement)(a,{data:e.sparkline,color:c})))}function d(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}`}function u(e){return Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(2)}var f={debug:0,info:1,warn:2,error:3,fatal:4},h=!1;function m({entry:e,showLevel:o,showTimestamp:r,showSource:i,searchQuery:s,monospace:a,isExpanded:l,onToggle:c,onEntryClick:d,theme:u,style:f}){const h=function(e,t){switch(e){case"debug":default:return t.textMuted;case"info":return t.info;case"warn":return t.warning;case"error":case"fatal":return t.danger}}(e.level,u),m=function(e,t){return"fatal"===e?`${t.danger}22`:"transparent"}(e.level,u),p=e.metadata&&Object.keys(e.metadata).length>0,g={...f,display:"flex",alignItems:"center",gap:6,padding:"0 10px",fontSize:12,fontFamily:a?'"JetBrains Mono", "Fira Mono", Consolas, monospace':"inherit",cursor:p||d?"pointer":"default",background:m,boxSizing:"border-box",height:28,overflow:"hidden",whiteSpace:"nowrap",borderBottom:`1px solid ${u.border}22`};return(0,n.createElement)("div",{style:g,className:"tkx-log-row",onClick:()=>{p&&c(),d&&d(e)},role:p?"button":void 0,tabIndex:p?0:void 0,onKeyDown:p?e=>{"Enter"!==e.key&&" "!==e.key||c()}:void 0,"aria-expanded":p?l:void 0},r&&(0,n.createElement)("span",{style:{color:u.textMuted,flexShrink:0,minWidth:84}},function(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}(e.timestamp)),o&&(0,n.createElement)("span",{style:{color:h,flexShrink:0,fontWeight:"fatal"===e.level?700:500,minWidth:56}},`[${e.level.toUpperCase().padEnd(5)}]`),i&&e.source&&(0,n.createElement)("span",{style:{background:u.surfaceAlt,border:`1px solid ${u.border}`,borderRadius:10,padding:"0 5px",fontSize:10,color:u.textMuted,flexShrink:0,maxWidth:80,overflow:"hidden",textOverflow:"ellipsis"}},t.sanitizeString(e.source)),(0,n.createElement)("span",{style:{flex:1,color:u.text,overflow:"hidden",textOverflow:"ellipsis"}},...function(e,o){if(!o)return[e];const r=t.sanitizeString(e),i=t.sanitizeString(o);if(!i)return[r];try{const e=new RegExp(`(${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return r.split(e).map((t,o)=>e.test(t)?(0,n.createElement)("mark",{key:o,className:"tkx-log-highlight"},t):t)}catch{return[r]}}(e.message,s)),p&&(0,n.createElement)("span",{style:{color:u.textMuted,fontSize:10,flexShrink:0}},l?"▲":"▼"))}function p({metadata:e,theme:o,style:r}){return(0,n.createElement)("div",{style:{...r,background:o.surfaceAlt,borderBottom:`1px solid ${o.border}`,padding:"6px 10px 6px 56px",display:"flex",flexWrap:"wrap",gap:6,boxSizing:"border-box"}},...Object.entries(e).map(([e,r])=>(0,n.createElement)("span",{key:e,style:{fontSize:11,fontFamily:"monospace",color:o.textMuted,background:o.surface,border:`1px solid ${o.border}`,borderRadius:4,padding:"1px 6px"}},(0,n.createElement)("span",{style:{color:o.info}},`${t.sanitizeString(e)}: `),t.sanitizeString(String(r)))))}exports.TkxLiveFeed=function({items:i,maxItems:s=100,height:a=400,autoScroll:l=!0,showTimestamps:c=!0,onItemClick:d,emptyMessage:u="No activity yet.",pauseOnHover:f=!0,renderItem:h}){const m=e.useTheme();!function(){if(o||"undefined"==typeof document)return;o=!0;const e=document.createElement("style");e.id="tkx-live-feed-styles",e.textContent="\n@keyframes tkx-feed-slide-in {\n from { transform: translateY(-20px); opacity: 0; }\n to { transform: translateY(0); opacity: 1; }\n}\n.tkx-feed-item-new {\n animation: tkx-feed-slide-in 0.25s ease-out both;\n}\n ".trim(),document.head.appendChild(e)}();const p=(0,n.useRef)(null),[g,y]=(0,n.useState)(0),[x,b]=(0,n.useState)(!1),[k,v]=(0,n.useState)(new Set),w=(0,n.useRef)([]),S=(0,n.useMemo)(()=>i.slice(-s),[i,s]),$="number"==typeof a?a:400,M=64*S.length;(0,n.useEffect)(()=>{const e=new Set(w.current.map(e=>e.id)),t=S.filter(t=>!e.has(t.id)).map(e=>e.id);if(t.length>0){v(e=>{const n=new Set(e);return t.forEach(e=>n.add(e)),n});const e=window.setTimeout(()=>{v(e=>{const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},400);return()=>clearTimeout(e)}},[S]),(0,n.useEffect)(()=>{w.current=S},[S]);const z=l&&!(f&&x);(0,n.useEffect)(()=>{if(!z||!p.current)return;const e=p.current;(e.scrollHeight-e.scrollTop-e.clientHeight<192||S.length<=5)&&(e.scrollTop=e.scrollHeight)},[S.length,z]);const N=(0,n.useCallback)(()=>{p.current&&y(p.current.scrollTop)},[]),W=Math.max(0,Math.floor(g/64)-5),I=Math.min(S.length-1,Math.ceil((g+$)/64)+5),L={position:"relative",overflow:"auto",height:"number"==typeof a?`${a}px`:a,background:m.bg,border:`1px solid ${m.border}`,borderRadius:8,boxSizing:"border-box"},C={position:"relative",height:M,minHeight:"100%"};if(0===S.length)return(0,n.createElement)("div",{style:{...L,display:"flex",alignItems:"center",justifyContent:"center"}},(0,n.createElement)("span",{style:{color:m.textMuted,fontSize:14}},t.sanitizeString(u)));const j=[];for(let e=W;e<=I;e++){const t=S[e];t&&j.push((0,n.createElement)(r,{key:t.id,item:t,isNew:k.has(t.id),showTimestamps:c,onItemClick:d,renderItem:h,theme:m,style:{position:"absolute",top:64*e,left:0,right:0}}))}return(0,n.createElement)("div",{ref:p,style:L,onScroll:N,onMouseEnter:f?()=>b(!0):void 0,onMouseLeave:f?()=>b(!1):void 0,"aria-label":"Live feed",role:"feed"},(0,n.createElement)("div",{style:C},...j))},exports.TkxLiveLog=function({entries:t,maxEntries:o=500,height:r=400,autoScroll:i=!0,showLevel:s=!0,showTimestamp:a=!0,showSource:l=!0,filterLevel:c,searchQuery:d="",monospace:u=!0,onEntryClick:g}){const y=e.useTheme();!function(){if(h||"undefined"==typeof document)return;h=!0;const e=document.createElement("style");e.id="tkx-live-log-styles",e.textContent="\n.tkx-log-row:hover { filter: brightness(1.12); }\n.tkx-log-highlight { background: #ffbe0b55; border-radius: 2px; padding: 0 1px; }\n ".trim(),document.head.appendChild(e)}();const x=(0,n.useRef)(null),[b,k]=(0,n.useState)(0),[v,w]=(0,n.useState)(new Set),[S,$]=(0,n.useState)(!1),M=(0,n.useRef)(t.length),z=(0,n.useMemo)(()=>{let e=t.slice(-o);if(void 0!==c){const t=f[c];e=e.filter(e=>f[e.level]>=t)}if(d){const t=d.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||(e.source??"").toLowerCase().includes(t))}return e},[t,o,c,d]),N="number"==typeof r?r:400,W=(0,n.useMemo)(()=>{const e=[];let t=0;for(const n of z)e.push(t),t+=28+(v.has(n.id)?40:0);return e.push(t),e},[z,v]),I=W[W.length-1]??0;(0,n.useEffect)(()=>{i&&!S&&z.length!==M.current&&(M.current=z.length,x.current&&(x.current.scrollTop=x.current.scrollHeight))},[z.length,i,S]);const L=(0,n.useCallback)(()=>{if(!x.current)return;const e=x.current;$(!(e.scrollHeight-e.scrollTop-e.clientHeight<56)),k(e.scrollTop)},[]),C=(0,n.useCallback)(e=>{w(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),j=z.length>0?function(e){let t=0,n=z.length-1;for(;t<n;){const o=t+n>>1;(W[o+1]??0)<=e?t=o+1:n=o}return Math.max(0,t-8)}(b):0,T=z.length>0?function(e){let t=0,n=z.length-1;for(;t<n;){const o=t+n+1>>1;(W[o]??0)>=e+N?n=o-1:t=o}return Math.min(z.length-1,t+8)}(b):-1,E={position:"relative",overflow:"auto",height:"number"==typeof r?`${r}px`:r,background:y.bg,border:`1px solid ${y.border}`,borderRadius:8,boxSizing:"border-box"},R={position:"relative",height:I,minHeight:"100%"};if(0===z.length)return(0,n.createElement)("div",{style:{...E,display:"flex",alignItems:"center",justifyContent:"center"}},(0,n.createElement)("span",{style:{color:y.textMuted,fontSize:13,fontFamily:"monospace"}},"No log entries."));const B=[];for(let e=j;e<=T;e++){const t=z[e];if(!t)continue;const o=W[e]??0,r=v.has(t.id);B.push((0,n.createElement)(m,{key:t.id,entry:t,showLevel:s,showTimestamp:a,showSource:l,searchQuery:d,monospace:u,isExpanded:r,onToggle:()=>C(t.id),onEntryClick:g,theme:y,style:{position:"absolute",top:o,left:0,right:0}})),r&&t.metadata&&Object.keys(t.metadata).length>0&&B.push((0,n.createElement)(p,{key:`${t.id}-meta`,metadata:t.metadata,theme:y,style:{position:"absolute",top:o+28,left:0,right:0,height:40}}))}return(0,n.createElement)("div",{ref:x,style:E,onScroll:L,role:"log","aria-live":"polite","aria-label":"Log viewer"},(0,n.createElement)("div",{style:R},...B))},exports.TkxLiveMetrics=function({metrics:t,columns:o=3,animate:r=!0,onMetricClick:s}){const a=e.useTheme();return function(){if(i||"undefined"==typeof document)return;i=!0;const e=document.createElement("style");e.id="tkx-live-metrics-styles",e.textContent="\n@keyframes tkx-metric-pulse {\n 0% { opacity: 1; }\n 40% { opacity: 0.4; }\n 100% { opacity: 1; }\n}\n@keyframes tkx-metric-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n.tkx-metric-shimmer {\n animation: tkx-metric-shimmer 0.6s ease-in-out;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-metric-shimmer { animation: none; }\n .tkx-metric-pulse { animation: none; }\n}\n ".trim(),document.head.appendChild(e)}(),(0,n.createElement)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`,gap:16}},...t.map(e=>(0,n.createElement)(c,{key:e.id,metric:e,animate:r,onMetricClick:s,theme:a})))},exports.TkxRealTimeChart=function({data:o,maxPoints:r=60,height:i=200,width:s="100%",color:a,fill:l=!0,showGrid:c=!0,showLabels:f=!0,showTooltip:h=!0,label:m,unit:p,animate:g=!0,yMin:y,yMax:x}){const b=e.useTheme(),k=a??b.primary,v=(0,n.useRef)(null),[w,S]=(0,n.useState)(600),[$,M]=(0,n.useState)(null),[z,N]=(0,n.useState)(0),W=(0,n.useRef)(o.length);(0,n.useEffect)(()=>{if(!v.current)return;const e=new ResizeObserver(e=>{const t=e[0];t&&S(t.contentRect.width)});return e.observe(v.current),S(v.current.offsetWidth),()=>e.disconnect()},[]);const I=(0,n.useMemo)(()=>o.slice(-r),[o,r]);(0,n.useEffect)(()=>{I.length>W.current&&N(e=>e+1),W.current=I.length},[I.length]);const L=f?48:12,C=m?28:12,j=Math.max(w-L-12,1),T=Math.max(i-C-28,1),E=I.length?Math.min(...I.map(e=>e.value)):0,R=I.length?Math.max(...I.map(e=>e.value)):1,B=R-E||1,O=void 0!==y?y:E-.1*B,F=(void 0!==x?x:R+.1*B)-O||1;function D(e){return I.length<2?j/2:e/(I.length-1)*j}function q(e){return T-(e-O)/F*T}const A=I.length>=2?I.map((e,t)=>`${0===t?"M":"L"}${D(t).toFixed(2)},${q(e.value).toFixed(2)}`).join(" "):"",H=A?`${A} L${D(I.length-1).toFixed(2)},${T} L${D(0).toFixed(2)},${T} Z`:"",P=[];for(let e=0;e<=4;e++)P.push(e);const Q=P.map(e=>{const t=O+e/4*F;return{y:q(t),text:u(t)}}),K=Math.min(4,I.length),Y=K>0?Array.from({length:K},(e,t)=>Math.round(t/Math.max(K-1,1)*(I.length-1))):[],G=(0,n.useCallback)(e=>{if(!h||0===I.length)return;const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-L;let o=0,r=1/0;I.forEach((e,t)=>{const i=Math.abs(D(t)-n);i<r&&(r=i,o=t)});const i=I[o];i&&M({x:D(o)+L,y:q(i.value)+C,point:i})},[I,h,L,C]),J=(0,n.useCallback)(()=>M(null),[]),Z=w,U=i,V=`tkx-chart-clip-${z}`;return(0,n.createElement)("div",{ref:v,style:{position:"relative",width:"number"==typeof s?`${s}px`:s,background:b.surface,border:`1px solid ${b.border}`,borderRadius:8,overflow:"hidden",boxSizing:"border-box"}},(0,n.createElement)("svg",{width:Z,height:U,viewBox:`0 0 ${Z} ${U}`,onMouseMove:G,onMouseLeave:J,style:{display:"block",userSelect:"none"},"aria-label":m?t.sanitizeString(m):"Real-time chart"},g&&I.length>=2&&(0,n.createElement)("defs",null,(0,n.createElement)("clipPath",{id:V},(0,n.createElement)("rect",{x:0,y:0,width:j,height:U},(0,n.createElement)("animate",{attributeName:"width",from:Math.max(0,j-j/Math.max(I.length-1,1)),to:j,dur:"0.3s",fill:"freeze"})))),m&&(0,n.createElement)("text",{x:L,y:18,fill:b.textMuted,fontSize:12,fontWeight:500},t.sanitizeString(m)),c&&P.map(e=>{const t=q(O+e/4*F)+C;return(0,n.createElement)("line",{key:`grid-${e}`,x1:L,y1:t,x2:L+j,y2:t,stroke:b.border,strokeWidth:1,strokeDasharray:"4 4"})}),f&&Q.map((e,t)=>(0,n.createElement)("text",{key:`yl-${t}`,x:L-4,y:e.y+C+4,fill:b.textMuted,fontSize:10,textAnchor:"end"},e.text)),p&&(0,n.createElement)("text",{x:4,y:C+10,fill:b.textMuted,fontSize:9},t.sanitizeString(p)),l&&H&&(0,n.createElement)("path",{d:H,fill:`${k}22`,clipPath:g?`url(#${V})`:void 0,transform:`translate(${L}, ${C})`}),A&&(0,n.createElement)("path",{d:A,fill:"none",stroke:k,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",clipPath:g?`url(#${V})`:void 0,transform:`translate(${L}, ${C})`}),Y.map(e=>{const t=I[e];return t?(0,n.createElement)("text",{key:`xl-${e}`,x:L+D(e),y:U-8,fill:b.textMuted,fontSize:9,textAnchor:"middle"},d(t.timestamp)):null}),$&&(0,n.createElement)("line",{x1:$.x,y1:C,x2:$.x,y2:C+T,stroke:k,strokeWidth:1,strokeDasharray:"3 3",opacity:.6}),$&&(0,n.createElement)("circle",{cx:$.x,cy:$.y,r:4,fill:k,stroke:b.surface,strokeWidth:2}),$&&(()=>{const e=Math.min($.x+8,Z-100),t=Math.max($.y-36,4),o=`${u($.point.value)}${p||""}`,r=d($.point.timestamp);return(0,n.createElement)("g",null,(0,n.createElement)("rect",{x:e-4,y:t-2,width:90,height:34,rx:4,fill:b.surfaceAlt,stroke:b.border,strokeWidth:1}),(0,n.createElement)("text",{x:e,y:t+11,fill:b.text,fontSize:12,fontWeight:700},o),(0,n.createElement)("text",{x:e,y:t+26,fill:b.textMuted,fontSize:10},r))})()))};
package/dist/realtime.js CHANGED
@@ -1 +1 @@
1
- import{f as e}from"./chunk-PJ50l0JC.js";import{m as t}from"./chunk-Dj40UFcz.js";import{createElement as n,useCallback as o,useEffect as i,useMemo as r,useRef as s,useState as a}from"react";var l=!1;function c({item:e,isNew:o,showTimestamps:i,onItemClick:r,renderItem:s,theme:a,style:l}){const c=function(e,t){switch(e){case"info":return t.info;case"success":return t.success;case"warning":return t.warning;case"error":return t.danger;default:return t.border}}(e.type,a);return s?n("div",{style:l,className:o?"tkx-feed-item-new":void 0},s(e)):n("div",{style:{...l,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderLeft:`3px solid ${c}`,cursor:r?"pointer":"default",boxSizing:"border-box",height:64,background:a.surface,transition:"background 0.15s"},className:o?"tkx-feed-item-new":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0,onKeyDown:r?t=>{"Enter"!==t.key&&" "!==t.key||r(e)}:void 0},n("div",{style:{width:36,height:36,borderRadius:"50%",background:c,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:a.bg,flexShrink:0,overflow:"hidden"}},e.avatar?n("img",{src:e.avatar,alt:e.author??"",style:{width:"100%",height:"100%",objectFit:"cover"}}):(d=e.author)?d.split(" ").map(e=>e[0]??"").slice(0,2).join("").toUpperCase():"?"),n("div",{style:{flex:1,minWidth:0}},n("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2}},e.author&&n("span",{style:{fontWeight:600,fontSize:13,color:a.text}},t(e.author)),e.meta&&n("span",{style:{fontSize:11,color:a.textMuted,background:a.surfaceAlt,borderRadius:4,padding:"1px 5px"}},t(e.meta))),n("div",{style:{fontSize:13,color:a.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t(e.content))),i&&n("div",{style:{fontSize:11,color:a.textMuted,flexShrink:0}},function(e){const t=Date.now()-e;return t<1e4?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}(e.timestamp)));var d}function d({items:d,maxItems:u=100,height:f=400,autoScroll:h=!0,showTimestamps:m=!0,onItemClick:p,emptyMessage:g="No activity yet.",pauseOnHover:y=!0,renderItem:x}){const b=e();!function(){if(l||"undefined"==typeof document)return;l=!0;const e=document.createElement("style");e.id="tkx-live-feed-styles",e.textContent="\n@keyframes tkx-feed-slide-in {\n from { transform: translateY(-20px); opacity: 0; }\n to { transform: translateY(0); opacity: 1; }\n}\n.tkx-feed-item-new {\n animation: tkx-feed-slide-in 0.25s ease-out both;\n}\n ".trim(),document.head.appendChild(e)}();const k=s(null),[v,w]=a(0),[S,$]=a(!1),[M,z]=a(/* @__PURE__ */new Set),N=s([]),W=r(()=>d.slice(-u),[d,u]),I="number"==typeof f?f:400,L=64*W.length;i(()=>{const e=new Set(N.current.map(e=>e.id)),t=W.filter(t=>!e.has(t.id)).map(e=>e.id);if(t.length>0){z(e=>{const n=new Set(e);return t.forEach(e=>n.add(e)),n});const e=window.setTimeout(()=>{z(e=>{const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},400);return()=>clearTimeout(e)}},[W]),i(()=>{N.current=W},[W]);const C=h&&!(y&&S);i(()=>{if(!C||!k.current)return;const e=k.current;(e.scrollHeight-e.scrollTop-e.clientHeight<192||W.length<=5)&&(e.scrollTop=e.scrollHeight)},[W.length,C]);const T=o(()=>{k.current&&w(k.current.scrollTop)},[]),j=Math.max(0,Math.floor(v/64)-5),E=Math.min(W.length-1,Math.ceil((v+I)/64)+5),R={position:"relative",overflow:"auto",height:"number"==typeof f?`${f}px`:f,background:b.bg,border:`1px solid ${b.border}`,borderRadius:8,boxSizing:"border-box"},B={position:"relative",height:L,minHeight:"100%"};if(0===W.length)return n("div",{style:{...R,display:"flex",alignItems:"center",justifyContent:"center"}},n("span",{style:{color:b.textMuted,fontSize:14}},t(g)));const F=[];for(let e=j;e<=E;e++){const t=W[e];t&&F.push(n(c,{key:t.id,item:t,isNew:M.has(t.id),showTimestamps:m,onItemClick:p,renderItem:x,theme:b,style:{position:"absolute",top:64*e,left:0,right:0}}))}return n("div",{ref:k,style:R,onScroll:T,onMouseEnter:y?()=>$(!0):void 0,onMouseLeave:y?()=>$(!1):void 0,"aria-label":"Live feed",role:"feed"},n("div",{style:B},...F))}var u=!1;function f(e,t){if("string"==typeof e)return e;const n=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Number.isInteger(e)?e:e.toFixed(2));return t?`${n}${t}`:n}function h({data:e,color:t}){if(e.length<2)return null;const o=Math.min(...e),i=Math.max(...e)-o||1,r=e.map((t,n)=>{const r=n/(e.length-1)*80,s=24-(t-o)/i*22-1;return`${r.toFixed(1)},${s.toFixed(1)}`});return n("svg",{width:80,height:24,viewBox:"0 0 80 24","aria-hidden":"true"},n("polyline",{points:r.join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}))}function m({trend:e,theme:t}){return"up"===e?n("span",{style:{color:t.success,fontSize:14,fontWeight:700}},"▲"):"down"===e?n("span",{style:{color:t.danger,fontSize:14,fontWeight:700}},"▼"):n("span",{style:{color:t.textMuted,fontSize:14}},"→")}function p({metric:e,animate:o,onMetricClick:r,theme:l}){const c=e.color??function(e,t){switch(e){case"warning":return t.warning;case"critical":return t.danger;default:return t.primary}}(e.status,l),d="number"==typeof e.value?e.value:NaN,u=function(e,t,n){const[o,r]=a(e),l=s(e),c=s(null),d=s(null),u=function(){const[e,t]=a(()=>"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}();return i(()=>{if(!n||u)return r(e),void(l.current=e);const t=l.current;if(t===e)return;c.current=null;const o=n=>{null===c.current&&(c.current=n);const i=n-c.current,s=Math.min(i/600,1),a=1-Math.pow(1-s,3);r(t+(e-t)*a),s<1?d.current=requestAnimationFrame(o):l.current=e};return d.current=requestAnimationFrame(o),()=>{null!==d.current&&cancelAnimationFrame(d.current)}},[e,600,n,u]),o}(isNaN(d)?0:d,0,o&&!isNaN(d)),[p,g]=a(!1),y=s(e.value);i(()=>{if(y.current!==e.value){y.current=e.value,g(!0);const t=window.setTimeout(()=>g(!1),700);return()=>clearTimeout(t)}},[e.value]);const x=void 0!==e.previousValue&&e.previousValue!==d,b={background:l.surface,border:`1px solid ${l.border}`,borderLeft:`4px solid ${c}`,borderRadius:8,padding:"14px 16px",cursor:r?"pointer":"default",position:"relative",overflow:"hidden",boxSizing:"border-box"},k=p?{position:"absolute",inset:0,background:`linear-gradient(90deg, transparent 0%, ${c}22 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"tkx-metric-shimmer 0.6s ease-in-out",pointerEvents:"none"}:{},v=isNaN(d)?t(String(e.value)):f(u,e.unit);return n("div",{style:b,className:p?"tkx-metric-shimmer":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0},p&&n("div",{style:k}),n("div",{style:{fontSize:12,color:l.textMuted,marginBottom:6,fontWeight:500,letterSpacing:"0.03em"}},t(e.label)),n("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginBottom:6}},n("span",{style:{fontSize:28,fontWeight:700,color:l.text,lineHeight:1}},v),e.unit&&isNaN(d)&&n("span",{style:{fontSize:14,color:l.textMuted,marginBottom:2}},t(e.unit))),(e.trend||e.trendValue)&&n("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:e.sparkline?8:0}},e.trend&&n(m,{trend:e.trend,theme:l}),e.trendValue&&n("span",{style:{fontSize:12,color:l.textMuted}},t(e.trendValue))),x&&n("div",{style:{fontSize:11,color:l.textMuted,marginTop:2}},`was ${f(e.previousValue)}`),e.sparkline&&e.sparkline.length>=2&&n("div",{style:{marginTop:8}},n(h,{data:e.sparkline,color:c})))}function g({metrics:t,columns:o=3,animate:i=!0,onMetricClick:r}){const s=e();return function(){if(u||"undefined"==typeof document)return;u=!0;const e=document.createElement("style");e.id="tkx-live-metrics-styles",e.textContent="\n@keyframes tkx-metric-pulse {\n 0% { opacity: 1; }\n 40% { opacity: 0.4; }\n 100% { opacity: 1; }\n}\n@keyframes tkx-metric-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n.tkx-metric-shimmer {\n animation: tkx-metric-shimmer 0.6s ease-in-out;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-metric-shimmer { animation: none; }\n .tkx-metric-pulse { animation: none; }\n}\n ".trim(),document.head.appendChild(e)}(),n("div",{style:{display:"grid",gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`,gap:16}},...t.map(e=>n(p,{key:e.id,metric:e,animate:i,onMetricClick:r,theme:s})))}function y(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}`}function x(e){return Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(2)}function b({data:l,maxPoints:c=60,height:d=200,width:u="100%",color:f,fill:h=!0,showGrid:m=!0,showLabels:p=!0,showTooltip:g=!0,label:b,unit:k,animate:v=!0,yMin:w,yMax:S}){const $=e(),M=f??$.primary,z=s(null),[N,W]=a(600),[I,L]=a(null),[C,T]=a(0),j=s(l.length);i(()=>{if(!z.current)return;const e=new ResizeObserver(e=>{const t=e[0];t&&W(t.contentRect.width)});return e.observe(z.current),W(z.current.offsetWidth),()=>e.disconnect()},[]);const E=r(()=>l.slice(-c),[l,c]);i(()=>{E.length>j.current&&T(e=>e+1),j.current=E.length},[E.length]);const R=p?48:12,B=b?28:12,F=Math.max(N-R-12,1),O=Math.max(d-B-28,1),D=E.length?Math.min(...E.map(e=>e.value)):0,A=E.length?Math.max(...E.map(e=>e.value)):1,H=A-D||1,P=void 0!==w?w:D-.1*H,Q=(void 0!==S?S:A+.1*H)-P||1;function q(e){return E.length<2?F/2:e/(E.length-1)*F}function K(e){return O-(e-P)/Q*O}const Y=E.length>=2?E.map((e,t)=>`${0===t?"M":"L"}${q(t).toFixed(2)},${K(e.value).toFixed(2)}`).join(" "):"",G=Y?`${Y} L${q(E.length-1).toFixed(2)},${O} L${q(0).toFixed(2)},${O} Z`:"",J=[];for(let e=0;e<=4;e++)J.push(e);const Z=J.map(e=>{const t=P+e/4*Q;return{y:K(t),text:x(t)}}),U=Math.min(4,E.length),V=U>0?Array.from({length:U},(e,t)=>Math.round(t/Math.max(U-1,1)*(E.length-1))):[],X=o(e=>{if(!g||0===E.length)return;const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-R;let o=0,i=1/0;E.forEach((e,t)=>{const r=Math.abs(q(t)-n);r<i&&(i=r,o=t)});const r=E[o];r&&L({x:q(o)+R,y:K(r.value)+B,point:r})},[E,g,R,B]),_=o(()=>L(null),[]),ee=N,te=d,ne=`tkx-chart-clip-${C}`;return n("div",{ref:z,style:{position:"relative",width:"number"==typeof u?`${u}px`:u,background:$.surface,border:`1px solid ${$.border}`,borderRadius:8,overflow:"hidden",boxSizing:"border-box"}},n("svg",{width:ee,height:te,viewBox:`0 0 ${ee} ${te}`,onMouseMove:X,onMouseLeave:_,style:{display:"block",userSelect:"none"},"aria-label":b?t(b):"Real-time chart"},v&&E.length>=2&&n("defs",null,n("clipPath",{id:ne},n("rect",{x:0,y:0,width:F,height:te},n("animate",{attributeName:"width",from:Math.max(0,F-F/Math.max(E.length-1,1)),to:F,dur:"0.3s",fill:"freeze"})))),b&&n("text",{x:R,y:18,fill:$.textMuted,fontSize:12,fontWeight:500},t(b)),m&&J.map(e=>{const t=K(P+e/4*Q)+B;return n("line",{key:`grid-${e}`,x1:R,y1:t,x2:R+F,y2:t,stroke:$.border,strokeWidth:1,strokeDasharray:"4 4"})}),p&&Z.map((e,t)=>n("text",{key:`yl-${t}`,x:R-4,y:e.y+B+4,fill:$.textMuted,fontSize:10,textAnchor:"end"},e.text)),k&&n("text",{x:4,y:B+10,fill:$.textMuted,fontSize:9},t(k)),h&&G&&n("path",{d:G,fill:`${M}22`,clipPath:v?`url(#${ne})`:void 0,transform:`translate(${R}, ${B})`}),Y&&n("path",{d:Y,fill:"none",stroke:M,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",clipPath:v?`url(#${ne})`:void 0,transform:`translate(${R}, ${B})`}),V.map(e=>{const t=E[e];return t?n("text",{key:`xl-${e}`,x:R+q(e),y:te-8,fill:$.textMuted,fontSize:9,textAnchor:"middle"},y(t.timestamp)):null}),I&&n("line",{x1:I.x,y1:B,x2:I.x,y2:B+O,stroke:M,strokeWidth:1,strokeDasharray:"3 3",opacity:.6}),I&&n("circle",{cx:I.x,cy:I.y,r:4,fill:M,stroke:$.surface,strokeWidth:2}),I&&(()=>{const e=Math.min(I.x+8,ee-100),t=Math.max(I.y-36,4),o=`${x(I.point.value)}${k||""}`,i=y(I.point.timestamp);return n("g",null,n("rect",{x:e-4,y:t-2,width:90,height:34,rx:4,fill:$.surfaceAlt,stroke:$.border,strokeWidth:1}),n("text",{x:e,y:t+11,fill:$.text,fontSize:12,fontWeight:700},o),n("text",{x:e,y:t+26,fill:$.textMuted,fontSize:10},i))})()))}var k={debug:0,info:1,warn:2,error:3,fatal:4},v=!1;function w({entry:e,showLevel:o,showTimestamp:i,showSource:r,searchQuery:s,monospace:a,isExpanded:l,onToggle:c,onEntryClick:d,theme:u,style:f}){const h=function(e,t){switch(e){case"debug":default:return t.textMuted;case"info":return t.info;case"warn":return t.warning;case"error":case"fatal":return t.danger}}(e.level,u),m=function(e,t){return"fatal"===e?`${t.danger}22`:"transparent"}(e.level,u),p=e.metadata&&Object.keys(e.metadata).length>0,g={...f,display:"flex",alignItems:"center",gap:6,padding:"0 10px",fontSize:12,fontFamily:a?'"JetBrains Mono", "Fira Mono", Consolas, monospace':"inherit",cursor:p||d?"pointer":"default",background:m,boxSizing:"border-box",height:28,overflow:"hidden",whiteSpace:"nowrap",borderBottom:`1px solid ${u.border}22`};return n("div",{style:g,className:"tkx-log-row",onClick:()=>{p&&c(),d&&d(e)},role:p?"button":void 0,tabIndex:p?0:void 0,onKeyDown:p?e=>{"Enter"!==e.key&&" "!==e.key||c()}:void 0,"aria-expanded":p?l:void 0},i&&n("span",{style:{color:u.textMuted,flexShrink:0,minWidth:84}},function(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}(e.timestamp)),o&&n("span",{style:{color:h,flexShrink:0,fontWeight:"fatal"===e.level?700:500,minWidth:56}},`[${e.level.toUpperCase().padEnd(5)}]`),r&&e.source&&n("span",{style:{background:u.surfaceAlt,border:`1px solid ${u.border}`,borderRadius:10,padding:"0 5px",fontSize:10,color:u.textMuted,flexShrink:0,maxWidth:80,overflow:"hidden",textOverflow:"ellipsis"}},t(e.source)),n("span",{style:{flex:1,color:u.text,overflow:"hidden",textOverflow:"ellipsis"}},...function(e,o){if(!o)return[e];const i=t(e),r=t(o);if(!r)return[i];try{const e=new RegExp(`(${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return i.split(e).map((t,o)=>e.test(t)?n("mark",{key:o,className:"tkx-log-highlight"},t):t)}catch{return[i]}}(e.message,s)),p&&n("span",{style:{color:u.textMuted,fontSize:10,flexShrink:0}},l?"▲":"▼"))}function S({metadata:e,theme:o,style:i}){return n("div",{style:{...i,background:o.surfaceAlt,borderBottom:`1px solid ${o.border}`,padding:"6px 10px 6px 56px",display:"flex",flexWrap:"wrap",gap:6,boxSizing:"border-box"}},...Object.entries(e).map(([e,i])=>n("span",{key:e,style:{fontSize:11,fontFamily:"monospace",color:o.textMuted,background:o.surface,border:`1px solid ${o.border}`,borderRadius:4,padding:"1px 6px"}},n("span",{style:{color:o.info}},`${t(e)}: `),t(String(i)))))}function $({entries:t,maxEntries:l=500,height:c=400,autoScroll:d=!0,showLevel:u=!0,showTimestamp:f=!0,showSource:h=!0,filterLevel:m,searchQuery:p="",monospace:g=!0,onEntryClick:y}){const x=e();!function(){if(v||"undefined"==typeof document)return;v=!0;const e=document.createElement("style");e.id="tkx-live-log-styles",e.textContent="\n.tkx-log-row:hover { filter: brightness(1.12); }\n.tkx-log-highlight { background: #ffbe0b55; border-radius: 2px; padding: 0 1px; }\n ".trim(),document.head.appendChild(e)}();const b=s(null),[$,M]=a(0),[z,N]=a(/* @__PURE__ */new Set),[W,I]=a(!1),L=s(t.length),C=r(()=>{let e=t.slice(-l);if(void 0!==m){const t=k[m];e=e.filter(e=>k[e.level]>=t)}if(p){const t=p.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||(e.source??"").toLowerCase().includes(t))}return e},[t,l,m,p]),T="number"==typeof c?c:400,j=r(()=>{const e=[];let t=0;for(const n of C)e.push(t),t+=28+(z.has(n.id)?40:0);return e.push(t),e},[C,z]),E=j[j.length-1]??0;i(()=>{d&&!W&&C.length!==L.current&&(L.current=C.length,b.current&&(b.current.scrollTop=b.current.scrollHeight))},[C.length,d,W]);const R=o(()=>{if(!b.current)return;const e=b.current;I(!(e.scrollHeight-e.scrollTop-e.clientHeight<56)),M(e.scrollTop)},[]),B=o(e=>{N(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),F=C.length>0?function(e){let t=0,n=C.length-1;for(;t<n;){const o=t+n>>1;(j[o+1]??0)<=e?t=o+1:n=o}return Math.max(0,t-8)}($):0,O=C.length>0?function(e){let t=0,n=C.length-1;for(;t<n;){const o=t+n+1>>1;(j[o]??0)>=e+T?n=o-1:t=o}return Math.min(C.length-1,t+8)}($):-1,D={position:"relative",overflow:"auto",height:"number"==typeof c?`${c}px`:c,background:x.bg,border:`1px solid ${x.border}`,borderRadius:8,boxSizing:"border-box"},A={position:"relative",height:E,minHeight:"100%"};if(0===C.length)return n("div",{style:{...D,display:"flex",alignItems:"center",justifyContent:"center"}},n("span",{style:{color:x.textMuted,fontSize:13,fontFamily:"monospace"}},"No log entries."));const H=[];for(let e=F;e<=O;e++){const t=C[e];if(!t)continue;const o=j[e]??0,i=z.has(t.id);H.push(n(w,{key:t.id,entry:t,showLevel:u,showTimestamp:f,showSource:h,searchQuery:p,monospace:g,isExpanded:i,onToggle:()=>B(t.id),onEntryClick:y,theme:x,style:{position:"absolute",top:o,left:0,right:0}})),i&&t.metadata&&Object.keys(t.metadata).length>0&&H.push(n(S,{key:`${t.id}-meta`,metadata:t.metadata,theme:x,style:{position:"absolute",top:o+28,left:0,right:0,height:40}}))}return n("div",{ref:b,style:D,onScroll:R,role:"log","aria-live":"polite","aria-label":"Log viewer"},n("div",{style:A},...H))}export{d as TkxLiveFeed,$ as TkxLiveLog,g as TkxLiveMetrics,b as TkxRealTimeChart};
1
+ import{f as e}from"./chunk-PJ50l0JC.js";import{E as t}from"./chunk-DnCXUUx5.js";import{createElement as n,useCallback as o,useEffect as i,useMemo as r,useRef as s,useState as a}from"react";var l=!1;function c({item:e,isNew:o,showTimestamps:i,onItemClick:r,renderItem:s,theme:a,style:l}){const c=function(e,t){switch(e){case"info":return t.info;case"success":return t.success;case"warning":return t.warning;case"error":return t.danger;default:return t.border}}(e.type,a);return s?n("div",{style:l,className:o?"tkx-feed-item-new":void 0},s(e)):n("div",{style:{...l,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderLeft:`3px solid ${c}`,cursor:r?"pointer":"default",boxSizing:"border-box",height:64,background:a.surface,transition:"background 0.15s"},className:o?"tkx-feed-item-new":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0,onKeyDown:r?t=>{"Enter"!==t.key&&" "!==t.key||r(e)}:void 0},n("div",{style:{width:36,height:36,borderRadius:"50%",background:c,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:a.bg,flexShrink:0,overflow:"hidden"}},e.avatar?n("img",{src:e.avatar,alt:e.author??"",style:{width:"100%",height:"100%",objectFit:"cover"}}):(d=e.author)?d.split(" ").map(e=>e[0]??"").slice(0,2).join("").toUpperCase():"?"),n("div",{style:{flex:1,minWidth:0}},n("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2}},e.author&&n("span",{style:{fontWeight:600,fontSize:13,color:a.text}},t(e.author)),e.meta&&n("span",{style:{fontSize:11,color:a.textMuted,background:a.surfaceAlt,borderRadius:4,padding:"1px 5px"}},t(e.meta))),n("div",{style:{fontSize:13,color:a.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t(e.content))),i&&n("div",{style:{fontSize:11,color:a.textMuted,flexShrink:0}},function(e){const t=Date.now()-e;return t<1e4?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}(e.timestamp)));var d}function d({items:d,maxItems:u=100,height:f=400,autoScroll:h=!0,showTimestamps:m=!0,onItemClick:p,emptyMessage:g="No activity yet.",pauseOnHover:y=!0,renderItem:x}){const b=e();!function(){if(l||"undefined"==typeof document)return;l=!0;const e=document.createElement("style");e.id="tkx-live-feed-styles",e.textContent="\n@keyframes tkx-feed-slide-in {\n from { transform: translateY(-20px); opacity: 0; }\n to { transform: translateY(0); opacity: 1; }\n}\n.tkx-feed-item-new {\n animation: tkx-feed-slide-in 0.25s ease-out both;\n}\n ".trim(),document.head.appendChild(e)}();const k=s(null),[v,w]=a(0),[S,$]=a(!1),[M,z]=a(/* @__PURE__ */new Set),N=s([]),W=r(()=>d.slice(-u),[d,u]),I="number"==typeof f?f:400,L=64*W.length;i(()=>{const e=new Set(N.current.map(e=>e.id)),t=W.filter(t=>!e.has(t.id)).map(e=>e.id);if(t.length>0){z(e=>{const n=new Set(e);return t.forEach(e=>n.add(e)),n});const e=window.setTimeout(()=>{z(e=>{const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},400);return()=>clearTimeout(e)}},[W]),i(()=>{N.current=W},[W]);const C=h&&!(y&&S);i(()=>{if(!C||!k.current)return;const e=k.current;(e.scrollHeight-e.scrollTop-e.clientHeight<192||W.length<=5)&&(e.scrollTop=e.scrollHeight)},[W.length,C]);const T=o(()=>{k.current&&w(k.current.scrollTop)},[]),j=Math.max(0,Math.floor(v/64)-5),E=Math.min(W.length-1,Math.ceil((v+I)/64)+5),R={position:"relative",overflow:"auto",height:"number"==typeof f?`${f}px`:f,background:b.bg,border:`1px solid ${b.border}`,borderRadius:8,boxSizing:"border-box"},B={position:"relative",height:L,minHeight:"100%"};if(0===W.length)return n("div",{style:{...R,display:"flex",alignItems:"center",justifyContent:"center"}},n("span",{style:{color:b.textMuted,fontSize:14}},t(g)));const F=[];for(let e=j;e<=E;e++){const t=W[e];t&&F.push(n(c,{key:t.id,item:t,isNew:M.has(t.id),showTimestamps:m,onItemClick:p,renderItem:x,theme:b,style:{position:"absolute",top:64*e,left:0,right:0}}))}return n("div",{ref:k,style:R,onScroll:T,onMouseEnter:y?()=>$(!0):void 0,onMouseLeave:y?()=>$(!1):void 0,"aria-label":"Live feed",role:"feed"},n("div",{style:B},...F))}var u=!1;function f(e,t){if("string"==typeof e)return e;const n=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Number.isInteger(e)?e:e.toFixed(2));return t?`${n}${t}`:n}function h({data:e,color:t}){if(e.length<2)return null;const o=Math.min(...e),i=Math.max(...e)-o||1,r=e.map((t,n)=>{const r=n/(e.length-1)*80,s=24-(t-o)/i*22-1;return`${r.toFixed(1)},${s.toFixed(1)}`});return n("svg",{width:80,height:24,viewBox:"0 0 80 24","aria-hidden":"true"},n("polyline",{points:r.join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}))}function m({trend:e,theme:t}){return"up"===e?n("span",{style:{color:t.success,fontSize:14,fontWeight:700}},"▲"):"down"===e?n("span",{style:{color:t.danger,fontSize:14,fontWeight:700}},"▼"):n("span",{style:{color:t.textMuted,fontSize:14}},"→")}function p({metric:e,animate:o,onMetricClick:r,theme:l}){const c=e.color??function(e,t){switch(e){case"warning":return t.warning;case"critical":return t.danger;default:return t.primary}}(e.status,l),d="number"==typeof e.value?e.value:NaN,u=function(e,t,n){const[o,r]=a(e),l=s(e),c=s(null),d=s(null),u=function(){const[e,t]=a(()=>"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}();return i(()=>{if(!n||u)return r(e),void(l.current=e);const t=l.current;if(t===e)return;c.current=null;const o=n=>{null===c.current&&(c.current=n);const i=n-c.current,s=Math.min(i/600,1),a=1-Math.pow(1-s,3);r(t+(e-t)*a),s<1?d.current=requestAnimationFrame(o):l.current=e};return d.current=requestAnimationFrame(o),()=>{null!==d.current&&cancelAnimationFrame(d.current)}},[e,600,n,u]),o}(isNaN(d)?0:d,0,o&&!isNaN(d)),[p,g]=a(!1),y=s(e.value);i(()=>{if(y.current!==e.value){y.current=e.value,g(!0);const t=window.setTimeout(()=>g(!1),700);return()=>clearTimeout(t)}},[e.value]);const x=void 0!==e.previousValue&&e.previousValue!==d,b={background:l.surface,border:`1px solid ${l.border}`,borderLeft:`4px solid ${c}`,borderRadius:8,padding:"14px 16px",cursor:r?"pointer":"default",position:"relative",overflow:"hidden",boxSizing:"border-box"},k=p?{position:"absolute",inset:0,background:`linear-gradient(90deg, transparent 0%, ${c}22 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"tkx-metric-shimmer 0.6s ease-in-out",pointerEvents:"none"}:{},v=isNaN(d)?t(String(e.value)):f(u,e.unit);return n("div",{style:b,className:p?"tkx-metric-shimmer":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0},p&&n("div",{style:k}),n("div",{style:{fontSize:12,color:l.textMuted,marginBottom:6,fontWeight:500,letterSpacing:"0.03em"}},t(e.label)),n("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginBottom:6}},n("span",{style:{fontSize:28,fontWeight:700,color:l.text,lineHeight:1}},v),e.unit&&isNaN(d)&&n("span",{style:{fontSize:14,color:l.textMuted,marginBottom:2}},t(e.unit))),(e.trend||e.trendValue)&&n("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:e.sparkline?8:0}},e.trend&&n(m,{trend:e.trend,theme:l}),e.trendValue&&n("span",{style:{fontSize:12,color:l.textMuted}},t(e.trendValue))),x&&n("div",{style:{fontSize:11,color:l.textMuted,marginTop:2}},`was ${f(e.previousValue)}`),e.sparkline&&e.sparkline.length>=2&&n("div",{style:{marginTop:8}},n(h,{data:e.sparkline,color:c})))}function g({metrics:t,columns:o=3,animate:i=!0,onMetricClick:r}){const s=e();return function(){if(u||"undefined"==typeof document)return;u=!0;const e=document.createElement("style");e.id="tkx-live-metrics-styles",e.textContent="\n@keyframes tkx-metric-pulse {\n 0% { opacity: 1; }\n 40% { opacity: 0.4; }\n 100% { opacity: 1; }\n}\n@keyframes tkx-metric-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n.tkx-metric-shimmer {\n animation: tkx-metric-shimmer 0.6s ease-in-out;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-metric-shimmer { animation: none; }\n .tkx-metric-pulse { animation: none; }\n}\n ".trim(),document.head.appendChild(e)}(),n("div",{style:{display:"grid",gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`,gap:16}},...t.map(e=>n(p,{key:e.id,metric:e,animate:i,onMetricClick:r,theme:s})))}function y(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}`}function x(e){return Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(2)}function b({data:l,maxPoints:c=60,height:d=200,width:u="100%",color:f,fill:h=!0,showGrid:m=!0,showLabels:p=!0,showTooltip:g=!0,label:b,unit:k,animate:v=!0,yMin:w,yMax:S}){const $=e(),M=f??$.primary,z=s(null),[N,W]=a(600),[I,L]=a(null),[C,T]=a(0),j=s(l.length);i(()=>{if(!z.current)return;const e=new ResizeObserver(e=>{const t=e[0];t&&W(t.contentRect.width)});return e.observe(z.current),W(z.current.offsetWidth),()=>e.disconnect()},[]);const E=r(()=>l.slice(-c),[l,c]);i(()=>{E.length>j.current&&T(e=>e+1),j.current=E.length},[E.length]);const R=p?48:12,B=b?28:12,F=Math.max(N-R-12,1),O=Math.max(d-B-28,1),D=E.length?Math.min(...E.map(e=>e.value)):0,A=E.length?Math.max(...E.map(e=>e.value)):1,H=A-D||1,P=void 0!==w?w:D-.1*H,Q=(void 0!==S?S:A+.1*H)-P||1;function q(e){return E.length<2?F/2:e/(E.length-1)*F}function K(e){return O-(e-P)/Q*O}const Y=E.length>=2?E.map((e,t)=>`${0===t?"M":"L"}${q(t).toFixed(2)},${K(e.value).toFixed(2)}`).join(" "):"",G=Y?`${Y} L${q(E.length-1).toFixed(2)},${O} L${q(0).toFixed(2)},${O} Z`:"",J=[];for(let e=0;e<=4;e++)J.push(e);const Z=J.map(e=>{const t=P+e/4*Q;return{y:K(t),text:x(t)}}),U=Math.min(4,E.length),V=U>0?Array.from({length:U},(e,t)=>Math.round(t/Math.max(U-1,1)*(E.length-1))):[],X=o(e=>{if(!g||0===E.length)return;const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-R;let o=0,i=1/0;E.forEach((e,t)=>{const r=Math.abs(q(t)-n);r<i&&(i=r,o=t)});const r=E[o];r&&L({x:q(o)+R,y:K(r.value)+B,point:r})},[E,g,R,B]),_=o(()=>L(null),[]),ee=N,te=d,ne=`tkx-chart-clip-${C}`;return n("div",{ref:z,style:{position:"relative",width:"number"==typeof u?`${u}px`:u,background:$.surface,border:`1px solid ${$.border}`,borderRadius:8,overflow:"hidden",boxSizing:"border-box"}},n("svg",{width:ee,height:te,viewBox:`0 0 ${ee} ${te}`,onMouseMove:X,onMouseLeave:_,style:{display:"block",userSelect:"none"},"aria-label":b?t(b):"Real-time chart"},v&&E.length>=2&&n("defs",null,n("clipPath",{id:ne},n("rect",{x:0,y:0,width:F,height:te},n("animate",{attributeName:"width",from:Math.max(0,F-F/Math.max(E.length-1,1)),to:F,dur:"0.3s",fill:"freeze"})))),b&&n("text",{x:R,y:18,fill:$.textMuted,fontSize:12,fontWeight:500},t(b)),m&&J.map(e=>{const t=K(P+e/4*Q)+B;return n("line",{key:`grid-${e}`,x1:R,y1:t,x2:R+F,y2:t,stroke:$.border,strokeWidth:1,strokeDasharray:"4 4"})}),p&&Z.map((e,t)=>n("text",{key:`yl-${t}`,x:R-4,y:e.y+B+4,fill:$.textMuted,fontSize:10,textAnchor:"end"},e.text)),k&&n("text",{x:4,y:B+10,fill:$.textMuted,fontSize:9},t(k)),h&&G&&n("path",{d:G,fill:`${M}22`,clipPath:v?`url(#${ne})`:void 0,transform:`translate(${R}, ${B})`}),Y&&n("path",{d:Y,fill:"none",stroke:M,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",clipPath:v?`url(#${ne})`:void 0,transform:`translate(${R}, ${B})`}),V.map(e=>{const t=E[e];return t?n("text",{key:`xl-${e}`,x:R+q(e),y:te-8,fill:$.textMuted,fontSize:9,textAnchor:"middle"},y(t.timestamp)):null}),I&&n("line",{x1:I.x,y1:B,x2:I.x,y2:B+O,stroke:M,strokeWidth:1,strokeDasharray:"3 3",opacity:.6}),I&&n("circle",{cx:I.x,cy:I.y,r:4,fill:M,stroke:$.surface,strokeWidth:2}),I&&(()=>{const e=Math.min(I.x+8,ee-100),t=Math.max(I.y-36,4),o=`${x(I.point.value)}${k||""}`,i=y(I.point.timestamp);return n("g",null,n("rect",{x:e-4,y:t-2,width:90,height:34,rx:4,fill:$.surfaceAlt,stroke:$.border,strokeWidth:1}),n("text",{x:e,y:t+11,fill:$.text,fontSize:12,fontWeight:700},o),n("text",{x:e,y:t+26,fill:$.textMuted,fontSize:10},i))})()))}var k={debug:0,info:1,warn:2,error:3,fatal:4},v=!1;function w({entry:e,showLevel:o,showTimestamp:i,showSource:r,searchQuery:s,monospace:a,isExpanded:l,onToggle:c,onEntryClick:d,theme:u,style:f}){const h=function(e,t){switch(e){case"debug":default:return t.textMuted;case"info":return t.info;case"warn":return t.warning;case"error":case"fatal":return t.danger}}(e.level,u),m=function(e,t){return"fatal"===e?`${t.danger}22`:"transparent"}(e.level,u),p=e.metadata&&Object.keys(e.metadata).length>0,g={...f,display:"flex",alignItems:"center",gap:6,padding:"0 10px",fontSize:12,fontFamily:a?'"JetBrains Mono", "Fira Mono", Consolas, monospace':"inherit",cursor:p||d?"pointer":"default",background:m,boxSizing:"border-box",height:28,overflow:"hidden",whiteSpace:"nowrap",borderBottom:`1px solid ${u.border}22`};return n("div",{style:g,className:"tkx-log-row",onClick:()=>{p&&c(),d&&d(e)},role:p?"button":void 0,tabIndex:p?0:void 0,onKeyDown:p?e=>{"Enter"!==e.key&&" "!==e.key||c()}:void 0,"aria-expanded":p?l:void 0},i&&n("span",{style:{color:u.textMuted,flexShrink:0,minWidth:84}},function(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}(e.timestamp)),o&&n("span",{style:{color:h,flexShrink:0,fontWeight:"fatal"===e.level?700:500,minWidth:56}},`[${e.level.toUpperCase().padEnd(5)}]`),r&&e.source&&n("span",{style:{background:u.surfaceAlt,border:`1px solid ${u.border}`,borderRadius:10,padding:"0 5px",fontSize:10,color:u.textMuted,flexShrink:0,maxWidth:80,overflow:"hidden",textOverflow:"ellipsis"}},t(e.source)),n("span",{style:{flex:1,color:u.text,overflow:"hidden",textOverflow:"ellipsis"}},...function(e,o){if(!o)return[e];const i=t(e),r=t(o);if(!r)return[i];try{const e=new RegExp(`(${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return i.split(e).map((t,o)=>e.test(t)?n("mark",{key:o,className:"tkx-log-highlight"},t):t)}catch{return[i]}}(e.message,s)),p&&n("span",{style:{color:u.textMuted,fontSize:10,flexShrink:0}},l?"▲":"▼"))}function S({metadata:e,theme:o,style:i}){return n("div",{style:{...i,background:o.surfaceAlt,borderBottom:`1px solid ${o.border}`,padding:"6px 10px 6px 56px",display:"flex",flexWrap:"wrap",gap:6,boxSizing:"border-box"}},...Object.entries(e).map(([e,i])=>n("span",{key:e,style:{fontSize:11,fontFamily:"monospace",color:o.textMuted,background:o.surface,border:`1px solid ${o.border}`,borderRadius:4,padding:"1px 6px"}},n("span",{style:{color:o.info}},`${t(e)}: `),t(String(i)))))}function $({entries:t,maxEntries:l=500,height:c=400,autoScroll:d=!0,showLevel:u=!0,showTimestamp:f=!0,showSource:h=!0,filterLevel:m,searchQuery:p="",monospace:g=!0,onEntryClick:y}){const x=e();!function(){if(v||"undefined"==typeof document)return;v=!0;const e=document.createElement("style");e.id="tkx-live-log-styles",e.textContent="\n.tkx-log-row:hover { filter: brightness(1.12); }\n.tkx-log-highlight { background: #ffbe0b55; border-radius: 2px; padding: 0 1px; }\n ".trim(),document.head.appendChild(e)}();const b=s(null),[$,M]=a(0),[z,N]=a(/* @__PURE__ */new Set),[W,I]=a(!1),L=s(t.length),C=r(()=>{let e=t.slice(-l);if(void 0!==m){const t=k[m];e=e.filter(e=>k[e.level]>=t)}if(p){const t=p.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||(e.source??"").toLowerCase().includes(t))}return e},[t,l,m,p]),T="number"==typeof c?c:400,j=r(()=>{const e=[];let t=0;for(const n of C)e.push(t),t+=28+(z.has(n.id)?40:0);return e.push(t),e},[C,z]),E=j[j.length-1]??0;i(()=>{d&&!W&&C.length!==L.current&&(L.current=C.length,b.current&&(b.current.scrollTop=b.current.scrollHeight))},[C.length,d,W]);const R=o(()=>{if(!b.current)return;const e=b.current;I(!(e.scrollHeight-e.scrollTop-e.clientHeight<56)),M(e.scrollTop)},[]),B=o(e=>{N(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),F=C.length>0?function(e){let t=0,n=C.length-1;for(;t<n;){const o=t+n>>1;(j[o+1]??0)<=e?t=o+1:n=o}return Math.max(0,t-8)}($):0,O=C.length>0?function(e){let t=0,n=C.length-1;for(;t<n;){const o=t+n+1>>1;(j[o]??0)>=e+T?n=o-1:t=o}return Math.min(C.length-1,t+8)}($):-1,D={position:"relative",overflow:"auto",height:"number"==typeof c?`${c}px`:c,background:x.bg,border:`1px solid ${x.border}`,borderRadius:8,boxSizing:"border-box"},A={position:"relative",height:E,minHeight:"100%"};if(0===C.length)return n("div",{style:{...D,display:"flex",alignItems:"center",justifyContent:"center"}},n("span",{style:{color:x.textMuted,fontSize:13,fontFamily:"monospace"}},"No log entries."));const H=[];for(let e=F;e<=O;e++){const t=C[e];if(!t)continue;const o=j[e]??0,i=z.has(t.id);H.push(n(w,{key:t.id,entry:t,showLevel:u,showTimestamp:f,showSource:h,searchQuery:p,monospace:g,isExpanded:i,onToggle:()=>B(t.id),onEntryClick:y,theme:x,style:{position:"absolute",top:o,left:0,right:0}})),i&&t.metadata&&Object.keys(t.metadata).length>0&&H.push(n(S,{key:`${t.id}-meta`,metadata:t.metadata,theme:x,style:{position:"absolute",top:o+28,left:0,right:0,height:40}}))}return n("div",{ref:b,style:D,onScroll:R,role:"log","aria-live":"polite","aria-label":"Log viewer"},n("div",{style:A},...H))}export{d as TkxLiveFeed,$ as TkxLiveLog,g as TkxLiveMetrics,b as TkxRealTimeChart};
@@ -8,5 +8,6 @@ export interface TkxInputProps extends Omit<InputHTMLAttributes<HTMLInputElement
8
8
  rightAddon?: ReactNode;
9
9
  isInvalid?: boolean;
10
10
  isRequired?: boolean;
11
+ unicodeSafe?: boolean;
11
12
  }
12
13
  export declare const TkxInput: import("react").ForwardRefExoticComponent<TkxInputProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,32 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ export interface OrgNode {
3
+ id: string;
4
+ label: string;
5
+ subLabel?: string;
6
+ badge?: string;
7
+ avatar?: string;
8
+ accent?: string;
9
+ children?: OrgNode[];
10
+ meta?: Record<string, unknown>;
11
+ }
12
+ export interface TkxOrgChartProps {
13
+ data: OrgNode;
14
+ direction?: 'vertical' | 'horizontal';
15
+ interactive?: boolean;
16
+ initialZoom?: number;
17
+ nodeWidth?: number;
18
+ nodeHeight?: number;
19
+ siblingGap?: number;
20
+ levelGap?: number;
21
+ onNodeClick?: (node: OrgNode) => void;
22
+ renderNode?: (node: OrgNode, isActive: boolean) => ReactNode;
23
+ collapsedByDefault?: boolean;
24
+ height?: number | string;
25
+ ariaLabel?: string;
26
+ className?: string;
27
+ style?: CSSProperties;
28
+ }
29
+ export declare function TkxOrgChart({ data, direction, interactive, initialZoom, nodeWidth, nodeHeight, siblingGap, levelGap, onNodeClick, renderNode, collapsedByDefault, height, ariaLabel, className, style, }: TkxOrgChartProps): import("react/jsx-runtime").JSX.Element;
30
+ export declare namespace TkxOrgChart {
31
+ var displayName: string;
32
+ }
@@ -69,6 +69,7 @@ export * from './TkxAffix';
69
69
  export * from './TkxAnchor';
70
70
  export * from './TkxCascader';
71
71
  export * from './TkxList';
72
+ export * from './TkxOrgChart';
72
73
  export * from './TkxDropdown';
73
74
  export * from './TkxAIConfidenceBar';
74
75
  export * from './TkxAIChatBubble';
@@ -41,6 +41,51 @@ export interface AuditFilter {
41
41
  export declare function audit(action: string, component: string, meta?: Record<string, unknown>): AuditEntry;
42
42
  export declare function getAuditLog(filter?: AuditFilter): readonly AuditEntry[];
43
43
  export declare function verifyAuditIntegrity(): boolean;
44
+ export declare function sanitizeHref(raw: unknown): string | null;
45
+ export declare function sanitizeHTML(raw: unknown): string;
46
+ export declare function sanitizeCSS(raw: unknown): string;
47
+ export declare function sanitizeJSON<T = unknown>(raw: string): T | null;
48
+ export declare function isSafeAttrName(name: unknown): boolean;
49
+ export declare function sanitizeUnicode(raw: unknown): string;
50
+ export interface TkxCSPOptions {
51
+ allowInlineStyles?: boolean;
52
+ imgHosts?: string[];
53
+ connectHosts?: string[];
54
+ fontHosts?: string[];
55
+ scriptNonce?: string;
56
+ reportOnly?: boolean;
57
+ reportUri?: string;
58
+ }
59
+ export declare function buildTkxCSP(opts?: TkxCSPOptions): string;
60
+ export declare function installTrustedTypes(): void;
61
+ export declare function isFramed(): boolean;
62
+ export declare function installFrameBuster(onDetect?: () => void): void;
63
+ export interface RateLimiter {
64
+ check(): boolean;
65
+ reset(): void;
66
+ }
67
+ export declare function createRateLimiter(n: number, intervalMs: number): RateLimiter;
68
+ export declare function sniffMimeType(file: File): Promise<string | null>;
69
+ export declare function scrubPII(raw: unknown): string;
70
+ export declare function deepFreeze<T>(obj: T): Readonly<T>;
71
+ export declare const SecurityCore: Readonly<{
72
+ sanitizeString: typeof sanitizeString;
73
+ sanitizeHref: typeof sanitizeHref;
74
+ sanitizeHTML: typeof sanitizeHTML;
75
+ sanitizeCSS: typeof sanitizeCSS;
76
+ sanitizeJSON: typeof sanitizeJSON;
77
+ sanitizeUnicode: typeof sanitizeUnicode;
78
+ isSafeAttrName: typeof isSafeAttrName;
79
+ buildTkxCSP: typeof buildTkxCSP;
80
+ installTrustedTypes: typeof installTrustedTypes;
81
+ isFramed: typeof isFramed;
82
+ installFrameBuster: typeof installFrameBuster;
83
+ createRateLimiter: typeof createRateLimiter;
84
+ sniffMimeType: typeof sniffMimeType;
85
+ scrubPII: typeof scrubPII;
86
+ deepFreeze: typeof deepFreeze;
87
+ __brand: "TekiVex SecurityCore v2.6.0 © 007krcs";
88
+ }>;
44
89
  export declare const Shield: {
45
90
  sanitize: typeof sanitizeString;
46
91
  sanitizeProps: typeof sanitizeProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tekivex-ui",
3
- "version": "2.5.16",
3
+ "version": "2.6.0",
4
4
  "description": "Production-grade React component library — 70+ components, WCAG 2.1 AAA, WAI-ARIA 1.2, built-in charts, headless primitives, zero-runtime CSS engine, TypeScript-first.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1 +0,0 @@
1
- const e=require("./chunk-DjxOP8W4.js");var t={"<":"&lt;",">":"&gt;","&":"&amp;","'":"&#39;",'"':"&quot;","`":"&#96;"};function r(e){let r=String(e);return r=r.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,""),r.replace(/[<>&'"`]/g,e=>t[e]??e)}function n(e){const t={};for(const r of Object.keys(e))t[r]=o(e[r]);return t}function o(e){return"string"==typeof e?r(e):Array.isArray(e)?e.map(o):null===e||"object"!=typeof e||function(e){return"object"==typeof e&&null!==e&&"$$typeof"in e}(e)?e:n(e)}function i(e,t){const r=[];for(const[n,o]of Object.entries(t)){const t=e[n],i=null==t;o.required&&i?r.push(`prop '${n}' is required`):i||(typeof t===o.type?("number"===o.type&&"number"==typeof t&&(void 0!==o.min&&t<o.min&&r.push(`prop '${n}' must be >= ${o.min}`),void 0!==o.max&&t>o.max&&r.push(`prop '${n}' must be <= ${o.max}`)),"string"===o.type&&"string"==typeof t&&o.pattern&&!o.pattern.test(t)&&r.push(`prop '${n}' does not match pattern ${o.pattern}`),o.enum&&!o.enum.includes(t)&&r.push(`prop '${n}' must be one of: ${o.enum.join(", ")}`)):r.push(`prop '${n}' must be of type ${o.type}, got ${typeof t}`))}return{valid:0===r.length,errors:r}}var l=new Map,s=[];function a(t,r,n){const o=e.fnv1aHash(JSON.stringify(n??{})),i=e.fnv1aHash((s.length>0?s[s.length-1].chainHash:"00000000")+o+r+t),l=Object.freeze({timestamp:Date.now(),component:r,action:t,propsHash:o,chainHash:i});return s=Object.freeze([...s,l]),l}function f(e){let t=s;return e?.component&&(t=t.filter(t=>t.component===e.component)),e?.action&&(t=t.filter(t=>t.action===e.action)),e?.limit&&(t=t.slice(-e.limit)),t}function u(){let t="00000000";for(const r of s){if(e.fnv1aHash(t+r.propsHash+r.component+r.action)!==r.chainHash)return!1;t=r.chainHash}return!0}var c={sanitize:r,sanitizeProps:n,validateProps:i,createCSP:function(e,t){const r={componentId:e,permissions:t,directives:{"default-src":["'self'"],"style-src":t.allowInlineStyles?["'self'","'unsafe-inline'"]:["'self'"],"img-src":t.allowDataUrls?["'self'","data:"]:t.allowExternalSrc?["'self'","*"]:["'self'"],"script-src":t.allowScripts?["'self'"]:["'none'"]}};return l.set(e,r),r},hasPermission:function(e,t){return!0===l.get(e)?.permissions[t]},audit:a,getAuditLog:f,verifyAuditIntegrity:u},d={0:"0",px:"1px",.5:"2px",1:"4px",1.5:"6px",2:"8px",2.5:"10px",3:"12px",3.5:"14px",4:"16px",5:"20px",6:"24px",7:"28px",8:"32px",9:"36px",10:"40px",11:"44px",12:"48px",14:"56px",16:"64px",20:"80px",24:"96px",28:"112px",32:"128px",36:"144px",40:"160px",44:"176px",48:"192px",52:"208px",56:"224px",60:"240px",64:"256px",72:"288px",80:"320px",96:"384px",auto:"auto",full:"100%",screen:"100vw",svh:"100svh",dvh:"100dvh",fit:"fit-content",max:"max-content",min:"min-content"},p={...d,screen:"100vh"},b={"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","5/6":"83.333333%","1/12":"8.333333%","5/12":"41.666667%","7/12":"58.333333%","11/12":"91.666667%"},m={none:"0",sm:"2px","":"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px","3xl":"24px",full:"9999px"},x={sm:"0 1px 2px 0 rgba(0,0,0,.05)","":"0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1)",md:"0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)",lg:"0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1)",xl:"0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1)","2xl":"0 25px 50px -12px rgba(0,0,0,.25)",inner:"inset 0 2px 4px 0 rgba(0,0,0,.05)",none:"none"},g={xs:["0.75rem","1rem"],sm:["0.875rem","1.25rem"],base:["1rem","1.5rem"],lg:["1.125rem","1.75rem"],xl:["1.25rem","1.75rem"],"2xl":["1.5rem","2rem"],"3xl":["1.875rem","2.25rem"],"4xl":["2.25rem","2.5rem"],"5xl":["3rem","1"],"6xl":["3.75rem","1"],"7xl":["4.5rem","1"],"8xl":["6rem","1"],"9xl":["8rem","1"]},h={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},w={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},$={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},y={none:"0",sm:"4px","":"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},v=Object.fromEntries([0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100].map(e=>[String(e),String(e/100)])),k=new Set(["bg","surface","surfaceAlt","border","text","textMuted","primary","secondary","danger","warning","success","info"]),j={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},z=/javascript\s*:|vbscript\s*:|data\s*:\s*text\/html|data\s*:\s*text\/javascript|expression\s*\(|[\r\n\x00]/i,O=new Set(["behavior","-moz-binding","-webkit-binding","src"]),S=new Set(["width","min-width","max-width","height","min-height","max-height","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","position","top","right","bottom","left","z-index","inset","flex","flex-grow","flex-shrink","flex-basis","flex-direction","flex-wrap","align-items","align-self","align-content","justify-content","justify-items","justify-self","gap","row-gap","column-gap","grid-template-columns","grid-template-rows","grid-column","grid-row","grid-area","grid-template-areas","font-size","font-weight","font-family","font-style","line-height","letter-spacing","text-align","text-decoration","text-transform","text-overflow","white-space","word-break","word-wrap","overflow-wrap","color","background","background-color","background-image","background-position","background-size","background-repeat","opacity","border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-radius","outline","outline-offset","box-shadow","text-shadow","filter","backdrop-filter","transform","transition","animation","display","overflow","overflow-x","overflow-y","visibility","pointer-events","cursor","user-select","aspect-ratio","object-fit","object-position","list-style","vertical-align","float","clear","resize","scroll-behavior","content"]);function A(e){return z.test(e)||e.includes("}")||e.includes("{")||e.includes("<")||e.includes(">")?null:e}function P(e){const t=e.match(/^\[(.+)]$/);return t?A(t[1]):null}function C(e){return k.has(e)?`var(--tkx-${e})`:"transparent"===e?"transparent":"current"===e?"currentColor":"white"===e?"#ffffff":"black"===e?"#000000":"inherit"===e?"inherit":P(e)||(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),e)}function q(e){const t=e.match(/^\[([a-zA-Z-]+):(.+)]$/);if(t){const e=function(e){const t=e.toLowerCase().trim();return O.has(t)?null:S.has(t)?t:null}(t[1]),r=A(t[2]);return e&&r?{[e]:r}:null}const r={flex:"flex","inline-flex":"inline-flex",grid:"grid","inline-grid":"inline-grid",block:"block","inline-block":"inline-block",inline:"inline",hidden:"none",contents:"contents","flow-root":"flow-root",table:"table","table-row":"table-row","table-cell":"table-cell","table-caption":"table-caption","list-item":"list-item"};if(r[e])return{display:r[e]};const n={"flex-row":"row","flex-col":"column","flex-row-reverse":"row-reverse","flex-col-reverse":"column-reverse"};if(n[e])return{"flex-direction":n[e]};const o={"flex-wrap":"wrap","flex-nowrap":"nowrap","flex-wrap-reverse":"wrap-reverse"};if(o[e])return{"flex-wrap":o[e]};const i={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-none":"none","flex-initial":"0 1 auto"};if(i[e])return{flex:i[e]};if("grow"===e||"flex-grow"===e)return{"flex-grow":"1"};if("grow-0"===e)return{"flex-grow":"0"};if("shrink"===e||"flex-shrink"===e)return{"flex-shrink":"1"};if("shrink-0"===e||"flex-shrink-0"===e)return{"flex-shrink":"0"};const l={"items-start":"flex-start","items-end":"flex-end","items-center":"center","items-stretch":"stretch","items-baseline":"baseline"};if(l[e])return{"align-items":l[e]};const s={"justify-start":"flex-start","justify-end":"flex-end","justify-center":"center","justify-between":"space-between","justify-around":"space-around","justify-evenly":"space-evenly","justify-stretch":"stretch","justify-normal":"normal"};if(s[e])return{"justify-content":s[e]};const a={"self-auto":"auto","self-start":"flex-start","self-end":"flex-end","self-center":"center","self-stretch":"stretch","self-baseline":"baseline"};if(a[e])return{"align-self":a[e]};const f={"content-start":"flex-start","content-end":"flex-end","content-center":"center","content-between":"space-between","content-around":"space-around","content-evenly":"space-evenly","content-stretch":"stretch"};if(f[e])return{"align-content":f[e]};let u;if(u=e.match(/^grid-cols-(\d+|none|subgrid)$/))return{"grid-template-columns":"none"===u[1]?"none":"subgrid"===u[1]?"subgrid":`repeat(${u[1]},minmax(0,1fr))`};if(u=e.match(/^grid-rows-(\d+|none|subgrid)$/))return{"grid-template-rows":"none"===u[1]?"none":"subgrid"===u[1]?"subgrid":`repeat(${u[1]},minmax(0,1fr))`};if(u=e.match(/^col-span-(full|\d+)$/))return{"grid-column":"full"===u[1]?"1 / -1":`span ${u[1]} / span ${u[1]}`};if(u=e.match(/^col-start-(\d+|auto)$/))return{"grid-column-start":u[1]};if(u=e.match(/^col-end-(\d+|auto)$/))return{"grid-column-end":u[1]};if(u=e.match(/^row-span-(full|\d+)$/))return{"grid-row":"full"===u[1]?"1 / -1":`span ${u[1]} / span ${u[1]}`};if(u=e.match(/^row-start-(\d+|auto)$/))return{"grid-row-start":u[1]};if(u=e.match(/^row-end-(\d+|auto)$/))return{"grid-row-end":u[1]};if("grid-flow-row"===e)return{"grid-auto-flow":"row"};if("grid-flow-col"===e)return{"grid-auto-flow":"column"};if("grid-flow-dense"===e)return{"grid-auto-flow":"dense"};if("grid-flow-row-dense"===e)return{"grid-auto-flow":"row dense"};if("grid-flow-col-dense"===e)return{"grid-auto-flow":"column dense"};if(u=e.match(/^p-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{padding:e}}if(u=e.match(/^px-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{"padding-left":e,"padding-right":e}}if(u=e.match(/^py-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{"padding-top":e,"padding-bottom":e}}if(u=e.match(/^pt-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{"padding-top":e}}if(u=e.match(/^pr-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{"padding-right":e}}if(u=e.match(/^pb-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{"padding-bottom":e}}if(u=e.match(/^pl-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{"padding-left":e}}if(u=e.match(/^-?m-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??P(u[1]);if(r)return{margin:t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?mx-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??P(u[1]);if(r){const e=t&&"0"!==r?`-${r}`:r;return{"margin-left":e,"margin-right":e}}}if(u=e.match(/^-?my-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??P(u[1]);if(r){const e=t&&"0"!==r?`-${r}`:r;return{"margin-top":e,"margin-bottom":e}}}if(u=e.match(/^-?mt-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??P(u[1]);if(r)return{"margin-top":t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?mr-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??P(u[1]);if(r)return{"margin-right":t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?mb-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??P(u[1]);if(r)return{"margin-bottom":t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?ml-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??P(u[1]);if(r)return{"margin-left":t&&"0"!==r?`-${r}`:r}}if("mx-auto"===e)return{"margin-left":"auto","margin-right":"auto"};if("my-auto"===e)return{"margin-top":"auto","margin-bottom":"auto"};if(u=e.match(/^gap-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{gap:e}}if(u=e.match(/^gap-x-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{"column-gap":e}}if(u=e.match(/^gap-y-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{"row-gap":e}}if(u=e.match(/^w-(.+)$/)){const e=u[1],t=d[e]??b[e]??P(e);if(t)return{width:t}}if(u=e.match(/^min-w-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{"min-width":e}}if(u=e.match(/^max-w-(.+)$/)){const e={none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content"}[u[1]]??d[u[1]]??P(u[1]);if(e)return{"max-width":e}}if(u=e.match(/^h-(.+)$/)){const e=u[1],t=p[e]??b[e]??P(e);if(t)return{height:t}}if(u=e.match(/^min-h-(.+)$/)){const e={0:"0",full:"100%",screen:"100vh",svh:"100svh",dvh:"100dvh"}[u[1]]??d[u[1]]??P(u[1]);if(e)return{"min-height":e}}if(u=e.match(/^max-h-(.+)$/)){const e=p[u[1]]??P(u[1]);if(e)return{"max-height":e}}if(u=e.match(/^size-(.+)$/)){const e=d[u[1]]??b[u[1]]??P(u[1]);if(e)return{width:e,height:e}}if(u=e.match(/^text-(xs|sm|base|lg|[2-9]xl|\d+xl)$/)){const[e,t]=g[u[1]]??["1rem","1.5rem"];return{"font-size":e,"line-height":t}}if(u=e.match(/^font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black|\d+)$/))return{"font-weight":h[u[1]]??u[1]};if(u=e.match(/^leading-(.+)$/)){const e=w[u[1]]??P(u[1]);if(e)return{"line-height":e}}if(u=e.match(/^tracking-(.+)$/)){const e=$[u[1]]??P(u[1]);if(e)return{"letter-spacing":e}}const c={"text-left":"left","text-center":"center","text-right":"right","text-justify":"justify","text-start":"start","text-end":"end"};if(c[e])return{"text-align":c[e]};if("italic"===e)return{"font-style":"italic"};if("not-italic"===e)return{"font-style":"normal"};if("uppercase"===e)return{"text-transform":"uppercase"};if("lowercase"===e)return{"text-transform":"lowercase"};if("capitalize"===e)return{"text-transform":"capitalize"};if("normal-case"===e)return{"text-transform":"none"};if("underline"===e)return{"text-decoration-line":"underline"};if("overline"===e)return{"text-decoration-line":"overline"};if("line-through"===e)return{"text-decoration-line":"line-through"};if("no-underline"===e)return{"text-decoration-line":"none"};if("truncate"===e)return{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"};if("text-ellipsis"===e)return{"text-overflow":"ellipsis"};if("text-clip"===e)return{"text-overflow":"clip"};if("whitespace-normal"===e)return{"white-space":"normal"};if("whitespace-nowrap"===e)return{"white-space":"nowrap"};if("whitespace-pre"===e)return{"white-space":"pre"};if("whitespace-pre-wrap"===e)return{"white-space":"pre-wrap"};if("whitespace-pre-line"===e)return{"white-space":"pre-line"};if("break-words"===e)return{"overflow-wrap":"break-word"};if("break-all"===e)return{"word-break":"break-all"};if("break-keep"===e)return{"word-break":"keep-all"};if("font-mono"===e)return{"font-family":"var(--tkx-font-mono,monospace)"};if("font-sans"===e)return{"font-family":"var(--tkx-font-family,system-ui,sans-serif)"};if("font-serif"===e)return{"font-family":"ui-serif,Georgia,serif"};if("antialiased"===e)return{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"};if(u=e.match(/^indent-(.+)$/)){const e=d[u[1]]??P(u[1]);if(e)return{"text-indent":e}}if(u=e.match(/^line-clamp-(\d+)$/))return{overflow:"hidden",display:"-webkit-box","-webkit-line-clamp":u[1],"-webkit-box-orient":"vertical"};if(u=e.match(/^text-(.+)$/)){const[e,t]=u[1].split("/"),r=C(e);if(!["left","center","right","justify","start","end","xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl","9xl"].includes(e)){if(t){const e=parseInt(t)/100;return{color:r,opacity:String(e)}}return{color:r}}}if(u=e.match(/^bg-(.+)$/)){const[e,t]=u[1].split("/"),r=C(e);return t?{"background-color":r,opacity:String(parseInt(t)/100)}:"none"===e?{background:"none"}:{"background-color":r}}if(u=e.match(/^border-color-(.+)$/))return{"border-color":C(u[1])};if(u=e.match(/^fill-(.+)$/))return{fill:C(u[1])};if(u=e.match(/^stroke-(.+)$/))return{stroke:C(u[1])};if(u=e.match(/^shadow-color-(.+)$/))return{"--tkx-shadow-color":C(u[1])};if(u=e.match(/^ring-color-(.+)$/))return{"--tkx-ring-color":C(u[1])};if(u=e.match(/^accent-(.+)$/))return{"accent-color":C(u[1])};if(u=e.match(/^caret-(.+)$/))return{"caret-color":C(u[1])};if(u=e.match(/^outline-color-(.+)$/))return{"outline-color":C(u[1])};if("border"===e)return{"border-width":"1px"};if(u=e.match(/^border-(\d+)$/))return{"border-width":`${u[1]}px`};if("border-t"===e)return{"border-top-width":"1px"};if(u=e.match(/^border-t-(\d+)$/))return{"border-top-width":`${u[1]}px`};if("border-r"===e)return{"border-right-width":"1px"};if(u=e.match(/^border-r-(\d+)$/))return{"border-right-width":`${u[1]}px`};if("border-b"===e)return{"border-bottom-width":"1px"};if(u=e.match(/^border-b-(\d+)$/))return{"border-bottom-width":`${u[1]}px`};if("border-l"===e)return{"border-left-width":"1px"};if(u=e.match(/^border-l-(\d+)$/))return{"border-left-width":`${u[1]}px`};if("border-x"===e)return{"border-left-width":"1px","border-right-width":"1px"};if("border-y"===e)return{"border-top-width":"1px","border-bottom-width":"1px"};if("border-none"===e)return{"border-style":"none"};if("border-solid"===e)return{"border-style":"solid"};if("border-dashed"===e)return{"border-style":"dashed"};if("border-dotted"===e)return{"border-style":"dotted"};if("border-double"===e)return{"border-style":"double"};if((u=e.match(/^border-([a-zA-Z].*)$/))&&k.has(u[1]))return{"border-color":`var(--tkx-${u[1]})`};if(u=e.match(/^border-\[(.+)]$/))return{"border-color":u[1]};if("border-0"===e)return{"border-width":"0"};if("rounded"===e)return{"border-radius":m[""]};if(u=e.match(/^rounded-(none|sm|md|lg|xl|2xl|3xl|full|\[.+])$/))return{"border-radius":m[u[1]]??P(u[1])??u[1]};if(u=e.match(/^rounded-(t|r|b|l|tl|tr|br|bl)(?:-(none|sm|md|lg|xl|2xl|3xl|full))?$/)){const e=u[1],t=m[u[2]??""]??m[""];return{t:{"border-top-left-radius":t,"border-top-right-radius":t},r:{"border-top-right-radius":t,"border-bottom-right-radius":t},b:{"border-bottom-left-radius":t,"border-bottom-right-radius":t},l:{"border-top-left-radius":t,"border-bottom-left-radius":t},tl:{"border-top-left-radius":t},tr:{"border-top-right-radius":t},br:{"border-bottom-right-radius":t},bl:{"border-bottom-left-radius":t}}[e]??{}}const j={0:"0",1:"1px",2:"2px",ring:"3px",4:"4px",8:"8px"};if("ring"===e)return{"box-shadow":"0 0 0 3px var(--tkx-ring-color,var(--tkx-primary))"};if((u=e.match(/^ring-(\d+)$/))&&j[u[1]])return{"box-shadow":`0 0 0 ${j[u[1]]} var(--tkx-ring-color,var(--tkx-primary))`};if("ring-inset"===e)return{"--tkx-ring-offset":"inset"};if(u=e.match(/^ring-offset-(\d+)$/))return{"--tkx-ring-offset-width":`${u[1]}px`,"box-shadow":`0 0 0 ${u[1]}px var(--tkx-bg)`};if("shadow"===e)return{"box-shadow":x[""]};if(u=e.match(/^shadow-(sm|md|lg|xl|2xl|inner|none)$/))return{"box-shadow":x[u[1]]};if(u=e.match(/^opacity-(\d+)$/)){const e=v[u[1]];if(void 0!==e)return{opacity:e}}if("bg-none"===e)return{background:"none"};const z={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"};if(z[e])return{"background-size":z[e]};const q={"bg-center":"center","bg-top":"top","bg-bottom":"bottom","bg-left":"left","bg-right":"right"};if(q[e])return{"background-position":q[e]};const F={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y"};if(F[e])return{"background-repeat":F[e]};if("backdrop-blur"===e)return{"backdrop-filter":`blur(${y[""]})`};if(u=e.match(/^backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{"backdrop-filter":`blur(${y[u[1]]})`};if("blur"===e)return{filter:`blur(${y[""]})`};if(u=e.match(/^blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{filter:`blur(${y[u[1]]})`};if("grayscale"===e)return{filter:"grayscale(100%)"};if("grayscale-0"===e)return{filter:"grayscale(0)"};if("invert"===e)return{filter:"invert(100%)"};if("invert-0"===e)return{filter:"invert(0)"};const I={static:"static",relative:"relative",absolute:"absolute",fixed:"fixed",sticky:"sticky"};if(I[e])return{position:I[e]};if("inset-0"===e)return{top:"0",right:"0",bottom:"0",left:"0"};if("inset-auto"===e)return{top:"auto",right:"auto",bottom:"auto",left:"auto"};if("inset-full"===e)return{top:"100%",right:"100%",bottom:"100%",left:"100%"};if("inset-x-0"===e)return{left:"0",right:"0"};if("inset-y-0"===e)return{top:"0",bottom:"0"};if(u=e.match(/^-?top-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??b[u[1]]??P(u[1]);if(r)return{top:t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?right-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??b[u[1]]??P(u[1]);if(r)return{right:t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?bottom-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??b[u[1]]??P(u[1]);if(r)return{bottom:t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?left-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??b[u[1]]??P(u[1]);if(r)return{left:t&&"0"!==r?`-${r}`:r}}const M={0:"0",10:"10",20:"20",30:"30",40:"40",50:"50",100:"100",1e3:"1000",9e3:"9000",auto:"auto"};if(u=e.match(/^z-(.+)$/)){const e=M[u[1]]??P(u[1]);if(e)return{"z-index":e}}const X={"overflow-auto":"auto","overflow-hidden":"hidden","overflow-visible":"visible","overflow-scroll":"scroll","overflow-clip":"clip"};if(X[e])return{overflow:X[e]};if(u=e.match(/^overflow-(x|y)-(auto|hidden|visible|scroll|clip)$/))return{[`overflow-${u[1]}`]:u[2]};if("scrollbar-hide"===e)return{"-ms-overflow-style":"none","scrollbar-width":"none"};if("visible"===e)return{visibility:"visible"};if("invisible"===e)return{visibility:"hidden"};if("collapse"===e)return{visibility:"collapse"};const Y={"cursor-auto":"auto","cursor-default":"default","cursor-pointer":"pointer","cursor-wait":"wait","cursor-text":"text","cursor-move":"move","cursor-help":"help","cursor-not-allowed":"not-allowed","cursor-none":"none","cursor-grab":"grab","cursor-grabbing":"grabbing","cursor-zoom-in":"zoom-in","cursor-zoom-out":"zoom-out","cursor-crosshair":"crosshair"};if(Y[e])return{cursor:Y[e]};if("select-none"===e)return{"user-select":"none"};if("select-text"===e)return{"user-select":"text"};if("select-all"===e)return{"user-select":"all"};if("select-auto"===e)return{"user-select":"auto"};if("pointer-events-none"===e)return{"pointer-events":"none"};if("pointer-events-auto"===e)return{"pointer-events":"auto"};const B={0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5"};if(u=e.match(/^scale-(.+)$/)){const e=B[u[1]]??P(u[1]);if(e)return{transform:`scale(${e})`}}if(u=e.match(/^scale-x-(.+)$/)){const e=B[u[1]]??P(u[1]);if(e)return{transform:`scaleX(${e})`}}if(u=e.match(/^scale-y-(.+)$/)){const e=B[u[1]]??P(u[1]);if(e)return{transform:`scaleY(${e})`}}const L={0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg"};if(u=e.match(/^-?rotate-(.+)$/)){const t=e.startsWith("-"),r=L[u[1]]??P(u[1]);if(r)return{transform:t?`rotate(-${r})`:`rotate(${r})`}}if(u=e.match(/^-?translate-x-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??b[u[1]]??P(u[1]);if(r)return{transform:`translateX(${t&&"0"!==r?`-${r}`:r})`}}if(u=e.match(/^-?translate-y-(.+)$/)){const t=e.startsWith("-"),r=d[u[1]]??b[u[1]]??P(u[1]);if(r)return{transform:`translateY(${t&&"0"!==r?`-${r}`:r})`}}if(u=e.match(/^-?skew-x-(.+)$/)){const t=e.startsWith("-"),r=P(u[1])??`${u[1]}deg`;return{transform:t?`skewX(-${r})`:`skewX(${r})`}}if(u=e.match(/^-?skew-y-(.+)$/)){const t=e.startsWith("-"),r=P(u[1])??`${u[1]}deg`;return{transform:t?`skewY(-${r})`:`skewY(${r})`}}const Z={"origin-center":"center","origin-top":"top","origin-top-right":"top right","origin-right":"right","origin-bottom-right":"bottom right","origin-bottom":"bottom","origin-bottom-left":"bottom left","origin-left":"left","origin-top-left":"top left"};if(Z[e])return{"transform-origin":Z[e]};const H={transition:"color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter","transition-all":"all","transition-colors":"color,background-color,border-color,text-decoration-color,fill,stroke","transition-opacity":"opacity","transition-shadow":"box-shadow","transition-transform":"transform","transition-none":"none"};if(H[e])return{"transition-property":H[e],"transition-timing-function":"cubic-bezier(0.4,0,0.2,1)","transition-duration":"150ms"};const D={75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"};if(u=e.match(/^duration-(.+)$/)){const e=D[u[1]]??P(u[1]);if(e)return{"transition-duration":e}}if(u=e.match(/^delay-(.+)$/)){const e=D[u[1]]??P(u[1]);if(e)return{"transition-delay":e}}const E={"ease-linear":"linear","ease-in":"cubic-bezier(0.4,0,1,1)","ease-out":"cubic-bezier(0,0,0.2,1)","ease-in-out":"cubic-bezier(0.4,0,0.2,1)"};if(E[e])return{"transition-timing-function":E[e]};const G={"animate-none":"none","animate-spin":"tkx-spin 1s linear infinite","animate-ping":"tkx-ping 1s cubic-bezier(0,0,0.2,1) infinite","animate-pulse":"tkx-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite","animate-bounce":"tkx-bounce 1s infinite","animate-fade-in":"tkx-fade-in 200ms ease both","animate-slide-up":"tkx-slide-up 200ms ease both","animate-shimmer":"tkx-shimmer 1.5s infinite"};if(G[e])return{animation:G[e]};const J={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"};return J[e]?{"object-fit":J[e]}:"aspect-square"===e?{"aspect-ratio":"1 / 1"}:"aspect-video"===e?{"aspect-ratio":"16 / 9"}:"aspect-auto"===e?{"aspect-ratio":"auto"}:(u=e.match(/^aspect-\[(.+)]$/))?{"aspect-ratio":u[1]}:"list-none"===e?{"list-style-type":"none"}:"list-disc"===e?{"list-style-type":"disc"}:"list-decimal"===e?{"list-style-type":"decimal"}:"list-inside"===e?{"list-style-position":"inside"}:"list-outside"===e?{"list-style-position":"outside"}:(u=e.match(/^columns-(\d+)$/))?{columns:u[1]}:"resize"===e?{resize:"both"}:"resize-none"===e?{resize:"none"}:"resize-x"===e?{resize:"horizontal"}:"resize-y"===e?{resize:"vertical"}:"sr-only"===e?{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)","white-space":"nowrap",border:"0"}:"not-sr-only"===e?{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"}:"focus-ring"===e?{outline:"2px solid var(--tkx-primary)","outline-offset":"2px","border-radius":"2px"}:"appearance-none"===e?{appearance:"none"}:"outline-none"===e?{outline:"none"}:"outline"===e?{outline:"2px solid currentColor","outline-offset":"2px"}:"float-left"===e?{float:"left"}:"float-right"===e?{float:"right"}:"float-none"===e?{float:"none"}:"clear-both"===e?{clear:"both"}:"isolate"===e?{isolation:"isolate"}:"isolation-auto"===e?{isolation:"auto"}:(u=e.match(/^will-change-(.+)$/))?{"will-change":u[1]}:"touch-manipulation"===e?{"touch-action":"manipulation"}:"touch-none"===e?{"touch-action":"none"}:"touch-pan-x"===e?{"touch-action":"pan-x"}:"touch-pan-y"===e?{"touch-action":"pan-y"}:"scroll-smooth"===e?{"scroll-behavior":"smooth"}:"scroll-auto"===e?{"scroll-behavior":"auto"}:(u=e.match(/^\[(--[a-zA-Z0-9-]+):(.+)]$/))?{[u[1]]:u[2]}:Q(e)||null}function F(e){let t=0,r=-1;for(let n=0;n<e.length;n++)if("["===e[n])t++;else if("]"===e[n])t--;else if(":"===e[n]&&0===t){r=n;break}return-1===r?{variant:null,utility:e}:{variant:e.slice(0,r),utility:e.slice(r+1)}}function I(e,t){for(const[r,n]of Object.entries(t))e[r]=n}function M(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}var X=new Map,Y=null,B=null;function L(){return Y&&Y.isConnected||(Y=document.getElementById("tkx-atomic"))||((Y=document.createElement("style")).id="tkx-atomic",document.head.appendChild(Y)),Y}function Z(e){const t=[];for(const r of e)if(r)if("string"==typeof r)t.push(...r.split(/\s+/).filter(Boolean));else if(Array.isArray(r))t.push(...Z(r));else if("object"==typeof r)for(const[e,n]of Object.entries(r))n&&t.push(e);return t}function H(...t){const r=Z(t);if(0===r.length)return"";const n={base:{},variants:{}};for(const e of r){const{variant:t,utility:r}=F(e),o=q(r);o&&(t?(n.variants[t]||(n.variants[t]={}),I(n.variants[t],o)):I(n.base,o))}const o=[],i=M(n.base),l=e.fnv1aHash([i,...Object.entries(n.variants).map(([e,t])=>`${e}{${M(t)}}`)].join("|")),s=`tkx-${l}`;i&&o.push(`.${s}{${i}}`);for(const[e,a]of Object.entries(n.variants)){const t=M(a);if(t)if(e.startsWith("@")){const r=j[e.slice(1)];r&&o.push(`@media(min-width:${r}){.${s}{${t}}}`)}else if("motion-safe"===e)o.push(`@media(prefers-reduced-motion:no-preference){.${s}{${t}}}`);else if("motion-reduce"===e)o.push(`@media(prefers-reduced-motion:reduce){.${s}{${t}}}`);else if("contrast-more"===e)o.push(`@media(prefers-contrast:more){.${s}{${t}}}`);else if("forced-colors"===e)o.push(`@media(forced-colors:active){.${s}{${t}}}`);else if("dark"===e)o.push(`@media(prefers-color-scheme:dark){.${s}{${t}}}`);else if("print"===e)o.push(`@media print{.${s}{${t}}}`);else if("group-hover"===e)o.push(`.group:hover .${s}{${t}}`);else if("group-focus"===e)o.push(`.group:focus-within .${s}{${t}}`);else if("peer-hover"===e)o.push(`.peer:hover~.${s}{${t}}`);else{const r={hover:":hover",focus:":focus","focus-visible":":focus-visible","focus-within":":focus-within",active:":active",disabled:":disabled",checked:":checked",required:":required",valid:":valid",invalid:":invalid",first:":first-child",last:":last-child",odd:":nth-child(odd)",even:":nth-child(even)","first-of-type":":first-of-type","last-of-type":":last-of-type","only-child":":only-child","only-of-type":":only-of-type",empty:":empty",visited:":visited",target:":target","placeholder-shown":":placeholder-shown","read-only":":read-only",before:"::before",after:"::after",placeholder:"::placeholder",selection:"::selection","file-selector":"::file-selector-button",marker:"::marker"}[e]??`:${e}`;o.push(`.${s}${r}{${t}}`)}}return o.length>0&&function(e,t){if(X.has(e))return;if(X.set(e,t),"undefined"==typeof document)return;const r=function(){if(B)return B;try{const e=new CSSStyleSheet;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],B=e,e}catch{return null}}();if(r){const e=function(e){const t=[];let r=0,n=0;for(let o=0;o<e.length;o++)if("{"===e[o])r++;else if("}"===e[o]&&(r--,0===r)){const r=e.slice(n,o+1).trim();r&&t.push(r),n=o+1}return t}(t);for(const t of e)try{r.insertRule(t,r.cssRules.length)}catch{L().textContent+=t+"\n"}}else L().textContent+=t+"\n"}(l,o.join("")),s}var D=H;function E(){return Array.from(X.values()).join("\n")}function G(){X.clear(),Y=null,B&&"undefined"!=typeof document&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==B),B=null)}function J(...e){return e.filter(Boolean).join(" ")}var N=new Map;function R(e){N.set(e.name,e.utilities)}function U(e){N.delete(e)}function K(){return Array.from(N.keys())}function Q(e){for(const t of N.values())if(t[e])return t[e];return null}Object.defineProperty(exports,"Shield",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"audit",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"cx",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"extractAtomicCSS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"getAuditLog",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"resetAtomicCSS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"resolvePluginUtility",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"sanitizeProps",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"sanitizeString",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"tkx",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"tkxListPlugins",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"tkxPlugin",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"tkxRemovePlugin",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"tx",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"validateProps",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"verifyAuditIntegrity",{enumerable:!0,get:function(){return u}});
@@ -1 +0,0 @@
1
- import{I as e}from"./chunk-PJ50l0JC.js";var t={"<":"&lt;",">":"&gt;","&":"&amp;","'":"&#39;",'"':"&quot;","`":"&#96;"};function r(e){let r=String(e);return r=r.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,""),r.replace(/[<>&'"`]/g,e=>t[e]??e)}function o(e){const t={};for(const r of Object.keys(e))t[r]=n(e[r]);return t}function n(e){return"string"==typeof e?r(e):Array.isArray(e)?e.map(n):null===e||"object"!=typeof e||function(e){return"object"==typeof e&&null!==e&&"$$typeof"in e}(e)?e:o(e)}function i(e,t){const r=[];for(const[o,n]of Object.entries(t)){const t=e[o],i=null==t;n.required&&i?r.push(`prop '${o}' is required`):i||(typeof t===n.type?("number"===n.type&&"number"==typeof t&&(void 0!==n.min&&t<n.min&&r.push(`prop '${o}' must be >= ${n.min}`),void 0!==n.max&&t>n.max&&r.push(`prop '${o}' must be <= ${n.max}`)),"string"===n.type&&"string"==typeof t&&n.pattern&&!n.pattern.test(t)&&r.push(`prop '${o}' does not match pattern ${n.pattern}`),n.enum&&!n.enum.includes(t)&&r.push(`prop '${o}' must be one of: ${n.enum.join(", ")}`)):r.push(`prop '${o}' must be of type ${n.type}, got ${typeof t}`))}return{valid:0===r.length,errors:r}}var s=/* @__PURE__ */new Map,l=[];function a(t,r,o){const n=e(JSON.stringify(o??{})),i=e((l.length>0?l[l.length-1].chainHash:"00000000")+n+r+t),s=Object.freeze({timestamp:Date.now(),component:r,action:t,propsHash:n,chainHash:i});return l=Object.freeze([...l,s]),s}function f(e){let t=l;return e?.component&&(t=t.filter(t=>t.component===e.component)),e?.action&&(t=t.filter(t=>t.action===e.action)),e?.limit&&(t=t.slice(-e.limit)),t}function c(){let t="00000000";for(const r of l){if(e(t+r.propsHash+r.component+r.action)!==r.chainHash)return!1;t=r.chainHash}return!0}var u={sanitize:r,sanitizeProps:o,validateProps:i,createCSP:function(e,t){const r={componentId:e,permissions:t,directives:{"default-src":["'self'"],"style-src":t.allowInlineStyles?["'self'","'unsafe-inline'"]:["'self'"],"img-src":t.allowDataUrls?["'self'","data:"]:t.allowExternalSrc?["'self'","*"]:["'self'"],"script-src":t.allowScripts?["'self'"]:["'none'"]}};return s.set(e,r),r},hasPermission:function(e,t){return!0===s.get(e)?.permissions[t]},audit:a,getAuditLog:f,verifyAuditIntegrity:c},d={0:"0",px:"1px",.5:"2px",1:"4px",1.5:"6px",2:"8px",2.5:"10px",3:"12px",3.5:"14px",4:"16px",5:"20px",6:"24px",7:"28px",8:"32px",9:"36px",10:"40px",11:"44px",12:"48px",14:"56px",16:"64px",20:"80px",24:"96px",28:"112px",32:"128px",36:"144px",40:"160px",44:"176px",48:"192px",52:"208px",56:"224px",60:"240px",64:"256px",72:"288px",80:"320px",96:"384px",auto:"auto",full:"100%",screen:"100vw",svh:"100svh",dvh:"100dvh",fit:"fit-content",max:"max-content",min:"min-content"},p={...d,screen:"100vh"},m={"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","5/6":"83.333333%","1/12":"8.333333%","5/12":"41.666667%","7/12":"58.333333%","11/12":"91.666667%"},x={none:"0",sm:"2px","":"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px","3xl":"24px",full:"9999px"},b={sm:"0 1px 2px 0 rgba(0,0,0,.05)","":"0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1)",md:"0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)",lg:"0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1)",xl:"0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1)","2xl":"0 25px 50px -12px rgba(0,0,0,.25)",inner:"inset 0 2px 4px 0 rgba(0,0,0,.05)",none:"none"},g={xs:["0.75rem","1rem"],sm:["0.875rem","1.25rem"],base:["1rem","1.5rem"],lg:["1.125rem","1.75rem"],xl:["1.25rem","1.75rem"],"2xl":["1.5rem","2rem"],"3xl":["1.875rem","2.25rem"],"4xl":["2.25rem","2.5rem"],"5xl":["3rem","1"],"6xl":["3.75rem","1"],"7xl":["4.5rem","1"],"8xl":["6rem","1"],"9xl":["8rem","1"]},h={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},w={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},$={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},y={none:"0",sm:"4px","":"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},v=Object.fromEntries([0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100].map(e=>[String(e),String(e/100)])),k=new Set(["bg","surface","surfaceAlt","border","text","textMuted","primary","secondary","danger","warning","success","info"]),j={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},z=/javascript\s*:|vbscript\s*:|data\s*:\s*text\/html|data\s*:\s*text\/javascript|expression\s*\(|[\r\n\x00]/i,S=new Set(["behavior","-moz-binding","-webkit-binding","src"]),A=new Set(["width","min-width","max-width","height","min-height","max-height","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","position","top","right","bottom","left","z-index","inset","flex","flex-grow","flex-shrink","flex-basis","flex-direction","flex-wrap","align-items","align-self","align-content","justify-content","justify-items","justify-self","gap","row-gap","column-gap","grid-template-columns","grid-template-rows","grid-column","grid-row","grid-area","grid-template-areas","font-size","font-weight","font-family","font-style","line-height","letter-spacing","text-align","text-decoration","text-transform","text-overflow","white-space","word-break","word-wrap","overflow-wrap","color","background","background-color","background-image","background-position","background-size","background-repeat","opacity","border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-radius","outline","outline-offset","box-shadow","text-shadow","filter","backdrop-filter","transform","transition","animation","display","overflow","overflow-x","overflow-y","visibility","pointer-events","cursor","user-select","aspect-ratio","object-fit","object-position","list-style","vertical-align","float","clear","resize","scroll-behavior","content"]);function O(e){return z.test(e)||e.includes("}")||e.includes("{")||e.includes("<")||e.includes(">")?null:e}function q(e){const t=e.match(/^\[(.+)]$/);return t?O(t[1]):null}function C(e){return k.has(e)?`var(--tkx-${e})`:"transparent"===e?"transparent":"current"===e?"currentColor":"white"===e?"#ffffff":"black"===e?"#000000":"inherit"===e?"inherit":q(e)||(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),e)}function F(e){const t=e.match(/^\[([a-zA-Z-]+):(.+)]$/);if(t){const e=function(e){const t=e.toLowerCase().trim();return S.has(t)?null:A.has(t)?t:null}(t[1]),r=O(t[2]);return e&&r?{[e]:r}:null}const r={flex:"flex","inline-flex":"inline-flex",grid:"grid","inline-grid":"inline-grid",block:"block","inline-block":"inline-block",inline:"inline",hidden:"none",contents:"contents","flow-root":"flow-root",table:"table","table-row":"table-row","table-cell":"table-cell","table-caption":"table-caption","list-item":"list-item"};if(r[e])return{display:r[e]};const o={"flex-row":"row","flex-col":"column","flex-row-reverse":"row-reverse","flex-col-reverse":"column-reverse"};if(o[e])return{"flex-direction":o[e]};const n={"flex-wrap":"wrap","flex-nowrap":"nowrap","flex-wrap-reverse":"wrap-reverse"};if(n[e])return{"flex-wrap":n[e]};const i={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-none":"none","flex-initial":"0 1 auto"};if(i[e])return{flex:i[e]};if("grow"===e||"flex-grow"===e)return{"flex-grow":"1"};if("grow-0"===e)return{"flex-grow":"0"};if("shrink"===e||"flex-shrink"===e)return{"flex-shrink":"1"};if("shrink-0"===e||"flex-shrink-0"===e)return{"flex-shrink":"0"};const s={"items-start":"flex-start","items-end":"flex-end","items-center":"center","items-stretch":"stretch","items-baseline":"baseline"};if(s[e])return{"align-items":s[e]};const l={"justify-start":"flex-start","justify-end":"flex-end","justify-center":"center","justify-between":"space-between","justify-around":"space-around","justify-evenly":"space-evenly","justify-stretch":"stretch","justify-normal":"normal"};if(l[e])return{"justify-content":l[e]};const a={"self-auto":"auto","self-start":"flex-start","self-end":"flex-end","self-center":"center","self-stretch":"stretch","self-baseline":"baseline"};if(a[e])return{"align-self":a[e]};const f={"content-start":"flex-start","content-end":"flex-end","content-center":"center","content-between":"space-between","content-around":"space-around","content-evenly":"space-evenly","content-stretch":"stretch"};if(f[e])return{"align-content":f[e]};let c;if(c=e.match(/^grid-cols-(\d+|none|subgrid)$/))return{"grid-template-columns":"none"===c[1]?"none":"subgrid"===c[1]?"subgrid":`repeat(${c[1]},minmax(0,1fr))`};if(c=e.match(/^grid-rows-(\d+|none|subgrid)$/))return{"grid-template-rows":"none"===c[1]?"none":"subgrid"===c[1]?"subgrid":`repeat(${c[1]},minmax(0,1fr))`};if(c=e.match(/^col-span-(full|\d+)$/))return{"grid-column":"full"===c[1]?"1 / -1":`span ${c[1]} / span ${c[1]}`};if(c=e.match(/^col-start-(\d+|auto)$/))return{"grid-column-start":c[1]};if(c=e.match(/^col-end-(\d+|auto)$/))return{"grid-column-end":c[1]};if(c=e.match(/^row-span-(full|\d+)$/))return{"grid-row":"full"===c[1]?"1 / -1":`span ${c[1]} / span ${c[1]}`};if(c=e.match(/^row-start-(\d+|auto)$/))return{"grid-row-start":c[1]};if(c=e.match(/^row-end-(\d+|auto)$/))return{"grid-row-end":c[1]};if("grid-flow-row"===e)return{"grid-auto-flow":"row"};if("grid-flow-col"===e)return{"grid-auto-flow":"column"};if("grid-flow-dense"===e)return{"grid-auto-flow":"dense"};if("grid-flow-row-dense"===e)return{"grid-auto-flow":"row dense"};if("grid-flow-col-dense"===e)return{"grid-auto-flow":"column dense"};if(c=e.match(/^p-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{padding:e}}if(c=e.match(/^px-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{"padding-left":e,"padding-right":e}}if(c=e.match(/^py-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{"padding-top":e,"padding-bottom":e}}if(c=e.match(/^pt-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{"padding-top":e}}if(c=e.match(/^pr-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{"padding-right":e}}if(c=e.match(/^pb-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{"padding-bottom":e}}if(c=e.match(/^pl-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{"padding-left":e}}if(c=e.match(/^-?m-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??q(c[1]);if(r)return{margin:t&&"0"!==r?`-${r}`:r}}if(c=e.match(/^-?mx-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??q(c[1]);if(r){const e=t&&"0"!==r?`-${r}`:r;return{"margin-left":e,"margin-right":e}}}if(c=e.match(/^-?my-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??q(c[1]);if(r){const e=t&&"0"!==r?`-${r}`:r;return{"margin-top":e,"margin-bottom":e}}}if(c=e.match(/^-?mt-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??q(c[1]);if(r)return{"margin-top":t&&"0"!==r?`-${r}`:r}}if(c=e.match(/^-?mr-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??q(c[1]);if(r)return{"margin-right":t&&"0"!==r?`-${r}`:r}}if(c=e.match(/^-?mb-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??q(c[1]);if(r)return{"margin-bottom":t&&"0"!==r?`-${r}`:r}}if(c=e.match(/^-?ml-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??q(c[1]);if(r)return{"margin-left":t&&"0"!==r?`-${r}`:r}}if("mx-auto"===e)return{"margin-left":"auto","margin-right":"auto"};if("my-auto"===e)return{"margin-top":"auto","margin-bottom":"auto"};if(c=e.match(/^gap-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{gap:e}}if(c=e.match(/^gap-x-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{"column-gap":e}}if(c=e.match(/^gap-y-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{"row-gap":e}}if(c=e.match(/^w-(.+)$/)){const e=c[1],t=d[e]??m[e]??q(e);if(t)return{width:t}}if(c=e.match(/^min-w-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{"min-width":e}}if(c=e.match(/^max-w-(.+)$/)){const e={none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content"}[c[1]]??d[c[1]]??q(c[1]);if(e)return{"max-width":e}}if(c=e.match(/^h-(.+)$/)){const e=c[1],t=p[e]??m[e]??q(e);if(t)return{height:t}}if(c=e.match(/^min-h-(.+)$/)){const e={0:"0",full:"100%",screen:"100vh",svh:"100svh",dvh:"100dvh"}[c[1]]??d[c[1]]??q(c[1]);if(e)return{"min-height":e}}if(c=e.match(/^max-h-(.+)$/)){const e=p[c[1]]??q(c[1]);if(e)return{"max-height":e}}if(c=e.match(/^size-(.+)$/)){const e=d[c[1]]??m[c[1]]??q(c[1]);if(e)return{width:e,height:e}}if(c=e.match(/^text-(xs|sm|base|lg|[2-9]xl|\d+xl)$/)){const[e,t]=g[c[1]]??["1rem","1.5rem"];return{"font-size":e,"line-height":t}}if(c=e.match(/^font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black|\d+)$/))return{"font-weight":h[c[1]]??c[1]};if(c=e.match(/^leading-(.+)$/)){const e=w[c[1]]??q(c[1]);if(e)return{"line-height":e}}if(c=e.match(/^tracking-(.+)$/)){const e=$[c[1]]??q(c[1]);if(e)return{"letter-spacing":e}}const u={"text-left":"left","text-center":"center","text-right":"right","text-justify":"justify","text-start":"start","text-end":"end"};if(u[e])return{"text-align":u[e]};if("italic"===e)return{"font-style":"italic"};if("not-italic"===e)return{"font-style":"normal"};if("uppercase"===e)return{"text-transform":"uppercase"};if("lowercase"===e)return{"text-transform":"lowercase"};if("capitalize"===e)return{"text-transform":"capitalize"};if("normal-case"===e)return{"text-transform":"none"};if("underline"===e)return{"text-decoration-line":"underline"};if("overline"===e)return{"text-decoration-line":"overline"};if("line-through"===e)return{"text-decoration-line":"line-through"};if("no-underline"===e)return{"text-decoration-line":"none"};if("truncate"===e)return{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"};if("text-ellipsis"===e)return{"text-overflow":"ellipsis"};if("text-clip"===e)return{"text-overflow":"clip"};if("whitespace-normal"===e)return{"white-space":"normal"};if("whitespace-nowrap"===e)return{"white-space":"nowrap"};if("whitespace-pre"===e)return{"white-space":"pre"};if("whitespace-pre-wrap"===e)return{"white-space":"pre-wrap"};if("whitespace-pre-line"===e)return{"white-space":"pre-line"};if("break-words"===e)return{"overflow-wrap":"break-word"};if("break-all"===e)return{"word-break":"break-all"};if("break-keep"===e)return{"word-break":"keep-all"};if("font-mono"===e)return{"font-family":"var(--tkx-font-mono,monospace)"};if("font-sans"===e)return{"font-family":"var(--tkx-font-family,system-ui,sans-serif)"};if("font-serif"===e)return{"font-family":"ui-serif,Georgia,serif"};if("antialiased"===e)return{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"};if(c=e.match(/^indent-(.+)$/)){const e=d[c[1]]??q(c[1]);if(e)return{"text-indent":e}}if(c=e.match(/^line-clamp-(\d+)$/))return{overflow:"hidden",display:"-webkit-box","-webkit-line-clamp":c[1],"-webkit-box-orient":"vertical"};if(c=e.match(/^text-(.+)$/)){const[e,t]=c[1].split("/"),r=C(e);if(!["left","center","right","justify","start","end","xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl","9xl"].includes(e)){if(t){const e=parseInt(t)/100;return{color:r,opacity:String(e)}}return{color:r}}}if(c=e.match(/^bg-(.+)$/)){const[e,t]=c[1].split("/"),r=C(e);return t?{"background-color":r,opacity:String(parseInt(t)/100)}:"none"===e?{background:"none"}:{"background-color":r}}if(c=e.match(/^border-color-(.+)$/))return{"border-color":C(c[1])};if(c=e.match(/^fill-(.+)$/))return{fill:C(c[1])};if(c=e.match(/^stroke-(.+)$/))return{stroke:C(c[1])};if(c=e.match(/^shadow-color-(.+)$/))return{"--tkx-shadow-color":C(c[1])};if(c=e.match(/^ring-color-(.+)$/))return{"--tkx-ring-color":C(c[1])};if(c=e.match(/^accent-(.+)$/))return{"accent-color":C(c[1])};if(c=e.match(/^caret-(.+)$/))return{"caret-color":C(c[1])};if(c=e.match(/^outline-color-(.+)$/))return{"outline-color":C(c[1])};if("border"===e)return{"border-width":"1px"};if(c=e.match(/^border-(\d+)$/))return{"border-width":`${c[1]}px`};if("border-t"===e)return{"border-top-width":"1px"};if(c=e.match(/^border-t-(\d+)$/))return{"border-top-width":`${c[1]}px`};if("border-r"===e)return{"border-right-width":"1px"};if(c=e.match(/^border-r-(\d+)$/))return{"border-right-width":`${c[1]}px`};if("border-b"===e)return{"border-bottom-width":"1px"};if(c=e.match(/^border-b-(\d+)$/))return{"border-bottom-width":`${c[1]}px`};if("border-l"===e)return{"border-left-width":"1px"};if(c=e.match(/^border-l-(\d+)$/))return{"border-left-width":`${c[1]}px`};if("border-x"===e)return{"border-left-width":"1px","border-right-width":"1px"};if("border-y"===e)return{"border-top-width":"1px","border-bottom-width":"1px"};if("border-none"===e)return{"border-style":"none"};if("border-solid"===e)return{"border-style":"solid"};if("border-dashed"===e)return{"border-style":"dashed"};if("border-dotted"===e)return{"border-style":"dotted"};if("border-double"===e)return{"border-style":"double"};if((c=e.match(/^border-([a-zA-Z].*)$/))&&k.has(c[1]))return{"border-color":`var(--tkx-${c[1]})`};if(c=e.match(/^border-\[(.+)]$/))return{"border-color":c[1]};if("border-0"===e)return{"border-width":"0"};if("rounded"===e)return{"border-radius":x[""]};if(c=e.match(/^rounded-(none|sm|md|lg|xl|2xl|3xl|full|\[.+])$/))return{"border-radius":x[c[1]]??q(c[1])??c[1]};if(c=e.match(/^rounded-(t|r|b|l|tl|tr|br|bl)(?:-(none|sm|md|lg|xl|2xl|3xl|full))?$/)){const e=c[1],t=x[c[2]??""]??x[""];return{t:{"border-top-left-radius":t,"border-top-right-radius":t},r:{"border-top-right-radius":t,"border-bottom-right-radius":t},b:{"border-bottom-left-radius":t,"border-bottom-right-radius":t},l:{"border-top-left-radius":t,"border-bottom-left-radius":t},tl:{"border-top-left-radius":t},tr:{"border-top-right-radius":t},br:{"border-bottom-right-radius":t},bl:{"border-bottom-left-radius":t}}[e]??{}}const j={0:"0",1:"1px",2:"2px",ring:"3px",4:"4px",8:"8px"};if("ring"===e)return{"box-shadow":"0 0 0 3px var(--tkx-ring-color,var(--tkx-primary))"};if((c=e.match(/^ring-(\d+)$/))&&j[c[1]])return{"box-shadow":`0 0 0 ${j[c[1]]} var(--tkx-ring-color,var(--tkx-primary))`};if("ring-inset"===e)return{"--tkx-ring-offset":"inset"};if(c=e.match(/^ring-offset-(\d+)$/))return{"--tkx-ring-offset-width":`${c[1]}px`,"box-shadow":`0 0 0 ${c[1]}px var(--tkx-bg)`};if("shadow"===e)return{"box-shadow":b[""]};if(c=e.match(/^shadow-(sm|md|lg|xl|2xl|inner|none)$/))return{"box-shadow":b[c[1]]};if(c=e.match(/^opacity-(\d+)$/)){const e=v[c[1]];if(void 0!==e)return{opacity:e}}if("bg-none"===e)return{background:"none"};const z={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"};if(z[e])return{"background-size":z[e]};const F={"bg-center":"center","bg-top":"top","bg-bottom":"bottom","bg-left":"left","bg-right":"right"};if(F[e])return{"background-position":F[e]};const I={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y"};if(I[e])return{"background-repeat":I[e]};if("backdrop-blur"===e)return{"backdrop-filter":`blur(${y[""]})`};if(c=e.match(/^backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{"backdrop-filter":`blur(${y[c[1]]})`};if("blur"===e)return{filter:`blur(${y[""]})`};if(c=e.match(/^blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{filter:`blur(${y[c[1]]})`};if("grayscale"===e)return{filter:"grayscale(100%)"};if("grayscale-0"===e)return{filter:"grayscale(0)"};if("invert"===e)return{filter:"invert(100%)"};if("invert-0"===e)return{filter:"invert(0)"};const M={static:"static",relative:"relative",absolute:"absolute",fixed:"fixed",sticky:"sticky"};if(M[e])return{position:M[e]};if("inset-0"===e)return{top:"0",right:"0",bottom:"0",left:"0"};if("inset-auto"===e)return{top:"auto",right:"auto",bottom:"auto",left:"auto"};if("inset-full"===e)return{top:"100%",right:"100%",bottom:"100%",left:"100%"};if("inset-x-0"===e)return{left:"0",right:"0"};if("inset-y-0"===e)return{top:"0",bottom:"0"};if(c=e.match(/^-?top-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??m[c[1]]??q(c[1]);if(r)return{top:t&&"0"!==r?`-${r}`:r}}if(c=e.match(/^-?right-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??m[c[1]]??q(c[1]);if(r)return{right:t&&"0"!==r?`-${r}`:r}}if(c=e.match(/^-?bottom-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??m[c[1]]??q(c[1]);if(r)return{bottom:t&&"0"!==r?`-${r}`:r}}if(c=e.match(/^-?left-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??m[c[1]]??q(c[1]);if(r)return{left:t&&"0"!==r?`-${r}`:r}}const P={0:"0",10:"10",20:"20",30:"30",40:"40",50:"50",100:"100",1e3:"1000",9e3:"9000",auto:"auto"};if(c=e.match(/^z-(.+)$/)){const e=P[c[1]]??q(c[1]);if(e)return{"z-index":e}}const X={"overflow-auto":"auto","overflow-hidden":"hidden","overflow-visible":"visible","overflow-scroll":"scroll","overflow-clip":"clip"};if(X[e])return{overflow:X[e]};if(c=e.match(/^overflow-(x|y)-(auto|hidden|visible|scroll|clip)$/))return{[`overflow-${c[1]}`]:c[2]};if("scrollbar-hide"===e)return{"-ms-overflow-style":"none","scrollbar-width":"none"};if("visible"===e)return{visibility:"visible"};if("invisible"===e)return{visibility:"hidden"};if("collapse"===e)return{visibility:"collapse"};const Y={"cursor-auto":"auto","cursor-default":"default","cursor-pointer":"pointer","cursor-wait":"wait","cursor-text":"text","cursor-move":"move","cursor-help":"help","cursor-not-allowed":"not-allowed","cursor-none":"none","cursor-grab":"grab","cursor-grabbing":"grabbing","cursor-zoom-in":"zoom-in","cursor-zoom-out":"zoom-out","cursor-crosshair":"crosshair"};if(Y[e])return{cursor:Y[e]};if("select-none"===e)return{"user-select":"none"};if("select-text"===e)return{"user-select":"text"};if("select-all"===e)return{"user-select":"all"};if("select-auto"===e)return{"user-select":"auto"};if("pointer-events-none"===e)return{"pointer-events":"none"};if("pointer-events-auto"===e)return{"pointer-events":"auto"};const B={0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5"};if(c=e.match(/^scale-(.+)$/)){const e=B[c[1]]??q(c[1]);if(e)return{transform:`scale(${e})`}}if(c=e.match(/^scale-x-(.+)$/)){const e=B[c[1]]??q(c[1]);if(e)return{transform:`scaleX(${e})`}}if(c=e.match(/^scale-y-(.+)$/)){const e=B[c[1]]??q(c[1]);if(e)return{transform:`scaleY(${e})`}}const Z={0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg"};if(c=e.match(/^-?rotate-(.+)$/)){const t=e.startsWith("-"),r=Z[c[1]]??q(c[1]);if(r)return{transform:t?`rotate(-${r})`:`rotate(${r})`}}if(c=e.match(/^-?translate-x-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??m[c[1]]??q(c[1]);if(r)return{transform:`translateX(${t&&"0"!==r?`-${r}`:r})`}}if(c=e.match(/^-?translate-y-(.+)$/)){const t=e.startsWith("-"),r=d[c[1]]??m[c[1]]??q(c[1]);if(r)return{transform:`translateY(${t&&"0"!==r?`-${r}`:r})`}}if(c=e.match(/^-?skew-x-(.+)$/)){const t=e.startsWith("-"),r=q(c[1])??`${c[1]}deg`;return{transform:t?`skewX(-${r})`:`skewX(${r})`}}if(c=e.match(/^-?skew-y-(.+)$/)){const t=e.startsWith("-"),r=q(c[1])??`${c[1]}deg`;return{transform:t?`skewY(-${r})`:`skewY(${r})`}}const H={"origin-center":"center","origin-top":"top","origin-top-right":"top right","origin-right":"right","origin-bottom-right":"bottom right","origin-bottom":"bottom","origin-bottom-left":"bottom left","origin-left":"left","origin-top-left":"top left"};if(H[e])return{"transform-origin":H[e]};const D={transition:"color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter","transition-all":"all","transition-colors":"color,background-color,border-color,text-decoration-color,fill,stroke","transition-opacity":"opacity","transition-shadow":"box-shadow","transition-transform":"transform","transition-none":"none"};if(D[e])return{"transition-property":D[e],"transition-timing-function":"cubic-bezier(0.4,0,0.2,1)","transition-duration":"150ms"};const E={75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"};if(c=e.match(/^duration-(.+)$/)){const e=E[c[1]]??q(c[1]);if(e)return{"transition-duration":e}}if(c=e.match(/^delay-(.+)$/)){const e=E[c[1]]??q(c[1]);if(e)return{"transition-delay":e}}const G={"ease-linear":"linear","ease-in":"cubic-bezier(0.4,0,1,1)","ease-out":"cubic-bezier(0,0,0.2,1)","ease-in-out":"cubic-bezier(0.4,0,0.2,1)"};if(G[e])return{"transition-timing-function":G[e]};const J={"animate-none":"none","animate-spin":"tkx-spin 1s linear infinite","animate-ping":"tkx-ping 1s cubic-bezier(0,0,0.2,1) infinite","animate-pulse":"tkx-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite","animate-bounce":"tkx-bounce 1s infinite","animate-fade-in":"tkx-fade-in 200ms ease both","animate-slide-up":"tkx-slide-up 200ms ease both","animate-shimmer":"tkx-shimmer 1.5s infinite"};if(J[e])return{animation:J[e]};const L={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"};return L[e]?{"object-fit":L[e]}:"aspect-square"===e?{"aspect-ratio":"1 / 1"}:"aspect-video"===e?{"aspect-ratio":"16 / 9"}:"aspect-auto"===e?{"aspect-ratio":"auto"}:(c=e.match(/^aspect-\[(.+)]$/))?{"aspect-ratio":c[1]}:"list-none"===e?{"list-style-type":"none"}:"list-disc"===e?{"list-style-type":"disc"}:"list-decimal"===e?{"list-style-type":"decimal"}:"list-inside"===e?{"list-style-position":"inside"}:"list-outside"===e?{"list-style-position":"outside"}:(c=e.match(/^columns-(\d+)$/))?{columns:c[1]}:"resize"===e?{resize:"both"}:"resize-none"===e?{resize:"none"}:"resize-x"===e?{resize:"horizontal"}:"resize-y"===e?{resize:"vertical"}:"sr-only"===e?{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)","white-space":"nowrap",border:"0"}:"not-sr-only"===e?{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"}:"focus-ring"===e?{outline:"2px solid var(--tkx-primary)","outline-offset":"2px","border-radius":"2px"}:"appearance-none"===e?{appearance:"none"}:"outline-none"===e?{outline:"none"}:"outline"===e?{outline:"2px solid currentColor","outline-offset":"2px"}:"float-left"===e?{float:"left"}:"float-right"===e?{float:"right"}:"float-none"===e?{float:"none"}:"clear-both"===e?{clear:"both"}:"isolate"===e?{isolation:"isolate"}:"isolation-auto"===e?{isolation:"auto"}:(c=e.match(/^will-change-(.+)$/))?{"will-change":c[1]}:"touch-manipulation"===e?{"touch-action":"manipulation"}:"touch-none"===e?{"touch-action":"none"}:"touch-pan-x"===e?{"touch-action":"pan-x"}:"touch-pan-y"===e?{"touch-action":"pan-y"}:"scroll-smooth"===e?{"scroll-behavior":"smooth"}:"scroll-auto"===e?{"scroll-behavior":"auto"}:(c=e.match(/^\[(--[a-zA-Z0-9-]+):(.+)]$/))?{[c[1]]:c[2]}:T(e)||null}function I(e){let t=0,r=-1;for(let o=0;o<e.length;o++)if("["===e[o])t++;else if("]"===e[o])t--;else if(":"===e[o]&&0===t){r=o;break}return-1===r?{variant:null,utility:e}:{variant:e.slice(0,r),utility:e.slice(r+1)}}function M(e,t){for(const[r,o]of Object.entries(t))e[r]=o}function P(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}var X=/* @__PURE__ */new Map,Y=null,B=null;function Z(){return Y&&Y.isConnected||(Y=document.getElementById("tkx-atomic"))||((Y=document.createElement("style")).id="tkx-atomic",document.head.appendChild(Y)),Y}function H(e){const t=[];for(const r of e)if(r)if("string"==typeof r)t.push(...r.split(/\s+/).filter(Boolean));else if(Array.isArray(r))t.push(...H(r));else if("object"==typeof r)for(const[e,o]of Object.entries(r))o&&t.push(e);return t}function D(...t){const r=H(t);if(0===r.length)return"";const o={base:{},variants:{}};for(const e of r){const{variant:t,utility:r}=I(e),n=F(r);n&&(t?(o.variants[t]||(o.variants[t]={}),M(o.variants[t],n)):M(o.base,n))}const n=[],i=P(o.base),s=e([i,...Object.entries(o.variants).map(([e,t])=>`${e}{${P(t)}}`)].join("|")),l=`tkx-${s}`;i&&n.push(`.${l}{${i}}`);for(const[e,a]of Object.entries(o.variants)){const t=P(a);if(t)if(e.startsWith("@")){const r=j[e.slice(1)];r&&n.push(`@media(min-width:${r}){.${l}{${t}}}`)}else if("motion-safe"===e)n.push(`@media(prefers-reduced-motion:no-preference){.${l}{${t}}}`);else if("motion-reduce"===e)n.push(`@media(prefers-reduced-motion:reduce){.${l}{${t}}}`);else if("contrast-more"===e)n.push(`@media(prefers-contrast:more){.${l}{${t}}}`);else if("forced-colors"===e)n.push(`@media(forced-colors:active){.${l}{${t}}}`);else if("dark"===e)n.push(`@media(prefers-color-scheme:dark){.${l}{${t}}}`);else if("print"===e)n.push(`@media print{.${l}{${t}}}`);else if("group-hover"===e)n.push(`.group:hover .${l}{${t}}`);else if("group-focus"===e)n.push(`.group:focus-within .${l}{${t}}`);else if("peer-hover"===e)n.push(`.peer:hover~.${l}{${t}}`);else{const r={hover:":hover",focus:":focus","focus-visible":":focus-visible","focus-within":":focus-within",active:":active",disabled:":disabled",checked:":checked",required:":required",valid:":valid",invalid:":invalid",first:":first-child",last:":last-child",odd:":nth-child(odd)",even:":nth-child(even)","first-of-type":":first-of-type","last-of-type":":last-of-type","only-child":":only-child","only-of-type":":only-of-type",empty:":empty",visited:":visited",target:":target","placeholder-shown":":placeholder-shown","read-only":":read-only",before:"::before",after:"::after",placeholder:"::placeholder",selection:"::selection","file-selector":"::file-selector-button",marker:"::marker"}[e]??`:${e}`;n.push(`.${l}${r}{${t}}`)}}return n.length>0&&function(e,t){if(X.has(e))return;if(X.set(e,t),"undefined"==typeof document)return;const r=function(){if(B)return B;try{const e=new CSSStyleSheet;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],B=e,e}catch{return null}}();if(r){const e=function(e){const t=[];let r=0,o=0;for(let n=0;n<e.length;n++)if("{"===e[n])r++;else if("}"===e[n]&&(r--,0===r)){const r=e.slice(o,n+1).trim();r&&t.push(r),o=n+1}return t}(t);for(const t of e)try{r.insertRule(t,r.cssRules.length)}catch{Z().textContent+=t+"\n"}}else Z().textContent+=t+"\n"}(s,n.join("")),l}var E=D;function G(){return Array.from(X.values()).join("\n")}function J(){X.clear(),Y=null,B&&"undefined"!=typeof document&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==B),B=null)}function L(...e){return e.filter(Boolean).join(" ")}var N=/* @__PURE__ */new Map;function K(e){N.set(e.name,e.utilities)}function Q(e){N.delete(e)}function R(){return Array.from(N.keys())}function T(e){for(const t of N.values())if(t[e])return t[e];return null}export{D as a,Q as c,a as d,f,c as g,i as h,T as i,E as l,r as m,G as n,R as o,o as p,J as r,K as s,L as t,u};