tekivex-ui 3.18.1 → 3.19.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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import*as e from"react";import{Children as t,cloneElement as n,createContext as r,createElement as o,forwardRef as i,useCallback as a,useContext as l,useEffect as s,useId as d,useImperativeHandle as c,useLayoutEffect as u,useMemo as p,useReducer as h,useRef as f,useState as m}from"react";import{Fragment as g,jsx as x,jsxs as b}from"react/jsx-runtime";import{createPortal as y}from"react-dom";function v(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}var w=class{constructor(e=512){this.cache=/* @__PURE__ */new Map,this.hits=0,this.misses=0,this.ceiling=Math.min(e,512)}get(e){if(!this.cache.has(e))return void this.misses++;this.hits++;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size>=this.ceiling&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}has(e){return this.cache.has(e)}invalidate(e){void 0!==e?this.cache.delete(e):this.cache.clear()}get size(){return this.cache.size}get cacheHitRate(){const e=this.hits+this.misses;return 0===e?0:this.hits/e*100}},k=new w(512);function $(e,t){const n=k.get(e);if(void 0!==n)return n;const r=t();return k.set(e,r),r}var S=[],C=!1,z=[],M=0,N=0;function D(e){S.push(e),C||(C=!0,queueMicrotask(()=>{!function(){const e=S.splice(0),t=performance.now();for(const r of e)try{r()}catch{}const n=performance.now()-t;M+=n,N++,z.push({duration:n,timestamp:Date.now()}),z.length>100&&z.shift()}(),C=!1}))}var P={hash:v,memoize:$,batchUpdate:D,invalidate:function(e){void 0!==e?k.invalidate(e):k.invalidate()},get avgRenderTime(){return 0===N?0:M/N},get cacheHitRate(){return k.cacheHitRate},getMetrics:function(e){const t=void 0!==e?z.slice(-e):z.slice();return{avgRenderTime:0===N?0:M/N,cacheHitRate:k.cacheHitRate,renderCount:N,recent:t}}},R=/* @__PURE__ */new Map;function F(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function I(e){const t=function(e){return"tkx-"+v(e)}(e);return R.has(t)||R.set(t,e),t}function A(e,...t){const n=e.reduce((e,n,r)=>e+n+(void 0!==t[r]?String(t[r]):""),"");return{className:I(n.trim()),styles:n.trim()}}function L(e){const t=Object.entries(e).map(([e,t])=>`${F(e)}: ${t};`).join(" ");return{className:I(t),styles:t}}var T={xs:"480px",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function W(e,t){return`@media (min-width: ${T[e]}) { ${t} }`}function j(e,t){return`@keyframes ${e} { ${Object.entries(t).map(([e,t])=>`${e} { ${Object.entries(t).map(([e,t])=>`${F(e)}: ${t};`).join(" ")} }`).join(" ")} }`}function E(e,t){return void 0!==t?`--tkx-${e}: ${t};`:`var(--tkx-${e})`}function B(){return Array.from(R.entries()).map(([e,t])=>`.${e} { ${t} }`).join("\n")}function V(){if("undefined"==typeof document)return;let e=document.getElementById("tkx-styles");e||(e=document.createElement("style"),e.id="tkx-styles",document.head.appendChild(e)),e.textContent=B()}var H={css:A,fromObject:L,responsive:W,keyframes:j,cssVar:E,extractCSS:B,injectStyles:V,resetStyles:function(){R.clear()}};function O(e){const[t,n,r]=function(e){if(!e||"string"!=typeof e)return[0,0,0];const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t,r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return[isNaN(r)?0:r,isNaN(o)?0:o,isNaN(i)?0:i]}(e).map(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*r}function q(e,t){const n=O(e),r=O(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function U(e,t,n=!1){return q(e,t)>=(n?3:4.5)}function K(e,t,n=!1){return q(e,t)>=(n?4.5:7)}function Y(e,t){const n=t??["#ffffff","#000000"];return n.reduce((t,n)=>q(n,e)>q(t,e)?n:t,n[0])}function X(){const e=document.createElement("div"),t=document.createElement("div");for(const n of[e,t])n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",document.body.appendChild(n);return e.setAttribute("aria-live","polite"),t.setAttribute("aria-live","assertive"),{announce(n,r="polite"){const o="assertive"===r?t:e;o.textContent="",setTimeout(()=>{o.textContent=n},0)},destroy(){e.remove(),t.remove()}}}var Z=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])',"details > summary"].join(", ");function G(e){let t=null,n=null;function r(){return Array.from(e.querySelectorAll(Z)).filter(e=>!e.closest("[hidden]")&&!e.closest('[aria-hidden="true"]'))}return{activate(){t=document.activeElement;const o=r();o.length>0&&o[0].focus(),n=e=>{if("Tab"!==e.key)return;const t=r();if(0===t.length)return;const n=t[0],o=t[t.length-1];e.shiftKey?document.activeElement===n&&(e.preventDefault(),o.focus()):document.activeElement===o&&(e.preventDefault(),n.focus())},e.addEventListener("keydown",n)},deactivate(){n&&e.removeEventListener("keydown",n),t instanceof HTMLElement&&t.focus(),t=null,n=null}}}function _(e,t,n,r){let o=t;switch(e.key){case"ArrowLeft":case"ArrowUp":e.preventDefault(),o=0===t?n-1:t-1;break;case"ArrowRight":case"ArrowDown":e.preventDefault(),o=t===n-1?0:t+1;break;case"Home":e.preventDefault(),o=0;break;case"End":e.preventDefault(),o=n-1;break;case"Enter":case" ":return e.preventDefault(),void r(t);default:return}r(o)}function J(){return"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Q(){return"undefined"!=typeof window&&window.matchMedia("(forced-colors: active)").matches}var ee={contrastRatio:q,meetsAA:U,meetsAAA:K,getAccessibleForeground:Y,createAnnouncer:X,createFocusTrap:G,handleTabsKeyboard:_,handleMenuKeyboard:function(e,t,n,r,o){let i=t;switch(e.key){case"ArrowUp":e.preventDefault(),i=0===t?n-1:t-1;break;case"ArrowDown":e.preventDefault(),i=t===n-1?0:t+1;break;case"Home":e.preventDefault(),i=0;break;case"End":e.preventDefault(),i=n-1;break;case"Enter":case" ":return e.preventDefault(),void r(t);case"Escape":return e.preventDefault(),void o?.();default:return}r(i)},prefersReducedMotion:J,prefersHighContrast:Q,announce:function(e,t="polite"){if("undefined"==typeof document)return;let n=document.getElementById("tkx-live-region");n||(n=document.createElement("div"),n.id="tkx-live-region",n.setAttribute("aria-live",t),n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",document.body.appendChild(n)),n.textContent="",setTimeout(()=>{n&&(n.textContent=e)},0)}},te="undefined"!=typeof window?u:s,ne={bg:"#0a0a0f",surface:"#12121a",surfaceAlt:"#1a1a2e",border:"#2a2a3e",text:"#e8e8f4",textMuted:"#8888aa",primary:"#00f5d4",secondary:"#7b2ff7",danger:"#f72585",warning:"#ffbe0b",success:"#06d6a0",info:"#3a86ff"},re={bg:"#f8f6f1",surface:"#ffffff",surfaceAlt:"#f0ede6",border:"#ddd8cc",text:"#1a1815",textMuted:"#6b6560",primary:"#0d7c5f",secondary:"#6930c3",danger:"#c1121f",warning:"#d4a017",success:"#0d7c5f",info:"#1d4ed8"},oe=/^#[0-9a-fA-F]{3,8}$/;function ie(e,t){const n={...e,...t};for(const[r,o]of Object.entries(n))if(!oe.test(o))throw new Error(`Invalid hex color for theme token '${r}': ${o}`);return U(n.text,n.bg),U(n.primary,n.bg),K(n.text,n.bg),n}var ae=r(ne);function le({theme:e,mode:t,lightTheme:n=re,darkTheme:r=ne,defaultMode:i="light",suppressHydrationWarning:a=!1,children:l}){const d=void 0!==e,c=function(e){const[t,n]=m(null);return s(()=>{if(!e||"undefined"==typeof window||!window.matchMedia)return;const t=window.matchMedia("(prefers-color-scheme: dark)");n(t.matches);const r=e=>n(e.matches);return t.addEventListener?(t.addEventListener("change",r),()=>t.removeEventListener("change",r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}(!d&&("auto"===t||void 0===t)),u=function(){const[e,t]=m(!1);return s(()=>t(!0),[]),e}();let p;p=d?e:"light"===t?n:"dark"===t?r:null===c?"dark"===i?r:n:c?r:n;const h=a&&!u;te(()=>{if(h)return;const e=Object.entries(p).map(([e,t])=>E(e,t)).join(" ");let t=document.getElementById("tkx-theme");if(!t){t=document.createElement("style"),t.id="tkx-theme";const e=document.head.querySelector("style");e?document.head.insertBefore(t,e):document.head.appendChild(t)}t.textContent=`:root { ${e} }`,document.documentElement.setAttribute("data-tkx-scheme",p===r?"dark":p===n?"light":"custom")},[p,r,n,h]);const f=h?{}:Object.fromEntries(Object.entries(p).map(([e,t])=>[`--tkx-${e}`,t]));return o(ae.Provider,{value:p},o("div",{style:{display:"contents",...f}},l))}function se(){return l(ae)}function de(){const[e,t]=m(()=>"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":"dark");return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=e=>t(e.matches?"dark":"light");return e.addEventListener?(e.addEventListener("change",n),()=>e.removeEventListener("change",n)):(e.addListener(n),()=>e.removeListener(n))},[]),e}function ce(e,t,n){n/=100;const r=(t/=100)*Math.min(n,1-n),o=t=>{const o=(t+e/30)%12,i=n-r*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}function ue(e){const[t,n]=function(e){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,o=parseInt(t.slice(4,6),16)/255,i=Math.max(n,r,o),a=Math.min(n,r,o);let l=0,s=0;const d=(i+a)/2;if(i!==a){const e=i-a;switch(s=d>.5?e/(2-i-a):e/(i+a),i){case n:l=((r-o)/e+(r<o?6:0))/6;break;case r:l=((o-n)/e+2)/6;break;case o:l=((n-r)/e+4)/6}}return[Math.round(360*l),Math.round(100*s),Math.round(100*d)]}(e);return{50:ce(t,Math.min(n,30),96),100:ce(t,Math.min(n,40),90),200:ce(t,Math.min(n,50),80),300:ce(t,n,70),400:ce(t,n,60),500:e,600:ce(t,n,45),700:ce(t,n,35),800:ce(t,n,25),900:ce(t,n,15)}}var pe={xs:{fontSize:"0.75rem",lineHeight:"1rem"},sm:{fontSize:"0.875rem",lineHeight:"1.25rem"},base:{fontSize:"1rem",lineHeight:"1.5rem"},lg:{fontSize:"1.125rem",lineHeight:"1.75rem"},xl:{fontSize:"1.25rem",lineHeight:"1.75rem"},"2xl":{fontSize:"1.5rem",lineHeight:"2rem"},"3xl":{fontSize:"1.875rem",lineHeight:"2.25rem"},"4xl":{fontSize:"2.25rem",lineHeight:"2.5rem"},"5xl":{fontSize:"3rem",lineHeight:"1.15"}},he={0:"0px",.5:"2px",1:"4px",1.5:"6px",2:"8px",2.5:"10px",3:"12px",4:"16px",5:"20px",6:"24px",8:"32px",10:"40px",12:"48px",16:"64px",20:"80px",24:"96px"},fe={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},me={none:"none",xs:"0 1px 2px 0 rgba(0,0,0,0.05)",sm:"0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)",md:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",lg:"0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",xl:"0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)","2xl":"0 25px 50px -12px rgba(0,0,0,0.25)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)"},ge={hide:-1,base:0,dropdown:1e3,sticky:1100,fixed:1200,overlay:1300,modal:1400,popover:1500,tooltip:1600,toast:1700,max:9999},xe={none:"0",sm:"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px",full:"9999px"},be=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function ye(e,t){return e>>>t|e<<32-t}function ve(e){const t=[];for(let a=0;a<e.length;a++){let n=e.charCodeAt(a);n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(a++,n=65536+((1023&n)<<10|1023&e.charCodeAt(a)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}const n=8*t.length;for(t.push(128);t.length%64!=56;)t.push(0);for(let a=0;a<4;a++)t.push(0);t.push(n>>>24&255,n>>>16&255,n>>>8&255,255&n);const r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),o=new Uint32Array(64);for(let a=0;a<t.length;a+=64){for(let r=0;r<16;r++)o[r]=t[a+4*r]<<24|t[a+4*r+1]<<16|t[a+4*r+2]<<8|t[a+4*r+3];for(let t=16;t<64;t++){const e=ye(o[t-15],7)^ye(o[t-15],18)^o[t-15]>>>3,n=ye(o[t-2],17)^ye(o[t-2],19)^o[t-2]>>>10;o[t]=o[t-16]+e+o[t-7]+n|0}let[e,n,i,l,s,d,c,u]=r;for(let t=0;t<64;t++){const r=u+(ye(s,6)^ye(s,11)^ye(s,25))+(s&d^~s&c)+be[t]+o[t]|0,a=(ye(e,2)^ye(e,13)^ye(e,22))+(e&n^e&i^n&i)|0;u=c,c=d,d=s,s=l+r|0,l=i,i=n,n=e,e=r+a|0}r[0]=r[0]+e|0,r[1]=r[1]+n|0,r[2]=r[2]+i|0,r[3]=r[3]+l|0,r[4]=r[4]+s|0,r[5]=r[5]+d|0,r[6]=r[6]+c|0,r[7]=r[7]+u|0}let i="";for(let a=0;a<8;a++)i+=(r[a]>>>0).toString(16).padStart(8,"0");return i}var we={"<":"&lt;",">":"&gt;","&":"&amp;","'":"&#39;",'"':"&quot;","`":"&#96;"};function ke(e){if(null==e)return"";let t=String(e);return t=t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,""),t.replace(/[<>&'"`]/g,e=>we[e]??e)}function $e(e){const t={};for(const n of Object.keys(e))t[n]=Se(e[n]);return t}function Se(e){return"string"==typeof e?ke(e):Array.isArray(e)?e.map(Se):null===e||"object"!=typeof e||function(e){return"object"==typeof e&&null!==e&&"$$typeof"in e}(e)?e:$e(e)}function Ce(e,t){const n=[];for(const[r,o]of Object.entries(t)){const t=e[r],i=null==t;o.required&&i?n.push(`prop '${r}' is required`):i||(typeof t===o.type?("number"===o.type&&"number"==typeof t&&(void 0!==o.min&&t<o.min&&n.push(`prop '${r}' must be >= ${o.min}`),void 0!==o.max&&t>o.max&&n.push(`prop '${r}' must be <= ${o.max}`)),"string"===o.type&&"string"==typeof t&&o.pattern&&!o.pattern.test(t)&&n.push(`prop '${r}' does not match pattern ${o.pattern}`),o.enum&&!o.enum.includes(t)&&n.push(`prop '${r}' must be one of: ${o.enum.join(", ")}`)):n.push(`prop '${r}' must be of type ${o.type}, got ${typeof t}`))}return{valid:0===n.length,errors:n}}var ze=/* @__PURE__ */new Map,Me=[];function Ne(e,t,n){const r=ve(JSON.stringify(n??{})),o=ve((Me.length>0?Me[Me.length-1].chainHash:"0000000000000000000000000000000000000000000000000000000000000000")+r+t+e),i=Object.freeze({timestamp:Date.now(),component:t,action:e,propsHash:r,chainHash:o});return Me=Object.freeze([...Me,i]),i}function De(e){let t=Me;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 Pe(){let e="0000000000000000000000000000000000000000000000000000000000000000";for(const t of Me){if(ve(e+t.propsHash+t.component+t.action)!==t.chainHash)return!1;e=t.chainHash}return!0}function Re(e){if("string"!=typeof e)return null;const t=e.trim();if(!t)return null;const n=t.replace(/[\u0000-\u001F\u007F]/g,"");return/^javascript:/i.test(n)||/^vbscript:/i.test(n)||/^data:/i.test(n)&&!/^data:image\//i.test(n)||/^file:/i.test(n)?null:n}var Fe=new Set(["a","abbr","b","blockquote","br","code","del","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","mark","ol","p","pre","q","s","samp","small","span","strong","sub","sup","table","tbody","td","tfoot","th","thead","tr","u","ul"]),Ie={a:new Set(["href","title","target","rel"]),img:new Set(["src","alt","title","width","height","loading","decoding"]),th:new Set(["scope","colspan","rowspan","align"]),td:new Set(["colspan","rowspan","align"]),"*":new Set(["id","class","lang","dir","title"])},Ae=new Set(["constructor","prototype","__proto__","submit","reset","action","method","enctype","target","elements","children","firstChild","nextSibling","parentNode","ownerDocument","cookie","domain","location","documentElement","body","head","title","contentWindow","contentDocument"]);function Le(e){if("string"!=typeof e)return"";if("undefined"==typeof DOMParser)return ke(e);const t=(new DOMParser).parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;return t?(Te(t),t.innerHTML):""}function Te(e){const t=Array.from(e.children);for(const n of t){const e=n.tagName.toLowerCase();if(Fe.has(e)){for(const t of Array.from(n.attributes)){const r=t.name.toLowerCase();if(r.startsWith("on"))n.removeAttribute(t.name);else if(Ae.has(r))n.removeAttribute(t.name);else if("style"!==r)if((Ie[e]??/* @__PURE__ */new Set).has(r)||Ie["*"].has(r)){if(("href"===r||"src"===r)&&"string"==typeof t.value){const e=Re(t.value);null===e?n.removeAttribute(t.name):n.setAttribute(t.name,e)}"name"!==r&&"id"!==r||!Ae.has(t.value.toLowerCase())||n.removeAttribute(t.name)}else n.removeAttribute(t.name);else n.setAttribute("style",We(t.value))}Te(n)}else n.remove()}}function We(e){if("string"!=typeof e)return"";let t=e;return t=t.replace(/expression\s*\([^)]*\)/gi,""),t=t.replace(/url\s*\(\s*['"]?\s*(javascript|vbscript|data)\s*:[^)]*\)/gi,"url(#)"),t=t.replace(/@import[^;]*;?/gi,""),t=t.replace(/behavior\s*:[^;]*;?/gi,""),t=t.replace(/-moz-binding[^;]*;?/gi,""),t=t.replace(/[<>]/g,""),t=t.replace(/[\u0000-\u001F\u007F]/g,""),t.trim()}var je=new Set(["__proto__","constructor","prototype"]);function Ee(e){try{return Be(JSON.parse(e,(e,t)=>{if(!je.has(e))return t}))}catch{return null}}function Be(e){if(Array.isArray(e))return e.map(Be);if(e&&"object"==typeof e){const t={};for(const[n,r]of Object.entries(e))je.has(n)||(t[n]=Be(r));return t}return e}function Ve(e){return!("string"!=typeof e||!e||/[\u0000-\u001F\u007F<>"]/.test(e)||Ae.has(e.toLowerCase()))}function He(e){return"string"!=typeof e?"":e.replace(/[\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFEFF\u00AD]/g,"")}function Oe(e={}){const{allowInlineStyles:t=!0,imgHosts:n=[],connectHosts:r=[],fontHosts:o=[],scriptNonce:i,reportUri:a}=e,l=["default-src 'self'","script-src "+(i?`'self' 'nonce-${i}'`:"'self'"),"style-src "+(t?"'self' 'unsafe-inline'":"'self'"),`img-src ${["'self'","data:","https:",...n].join(" ")}`,`font-src ${["'self'","https:","data:",...o].join(" ")}`,`connect-src ${["'self'",...r].join(" ")}`,"frame-ancestors 'none'","form-action 'self'","base-uri 'self'","object-src 'none'","upgrade-insecure-requests"];return a&&l.push(`report-uri ${a}`),l.join("; ")}function qe(){if("undefined"==typeof window)return;const e=window.trustedTypes;if(e)try{e.createPolicy("tkx",{createHTML:Le,createScriptURL:e=>Re(e)??"",createScript:()=>{throw new Error("TekiVex: inline script creation forbidden")}})}catch{}}function Ue(){if("undefined"==typeof window)return!1;try{return window.top!==window.self}catch{return!0}}function Ke(e){if("undefined"!=typeof window&&Ue())if(e)e();else try{window.top.location.href=window.self.location.href}catch{}}function Ye(e,t){let n=e,r=Date.now();return{check(){const o=Date.now(),i=o-r,a=Math.floor(i/t);return a>0&&(n=Math.min(e,n+a),r=o),!(n<=0||(n-=1,0))},reset(){n=e,r=Date.now()}}}async function Xe(e){const t=new Uint8Array(await e.slice(0,12).arrayBuffer()),n=(...e)=>e.every((e,n)=>t[n]===e);return n(137,80,78,71)?"image/png":n(255,216,255)?"image/jpeg":n(71,73,70,56)?"image/gif":n(66,77)?"image/bmp":n(82,73,70,70)&&87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?"image/webp":n(37,80,68,70)?"application/pdf":n(80,75,3,4)?"application/zip":123===t[0]||91===t[0]?"application/json":[...t].includes(0)?null:"text/plain"}var Ze=[{name:"ssn",re:/\b\d{3}-\d{2}-\d{4}\b/g,repl:"[redacted-ssn]"},{name:"credit",re:/\b(?:\d[ -]?){13,19}\b/g,repl:e=>{const t=e.replace(/[ -]/g,"");return t.length<13||t.length>19?e:function(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let o=e.charCodeAt(r)-48;if(o<0||o>9)return!1;n&&(o*=2,o>9&&(o-=9)),t+=o,n=!n}return t>0&&t%10==0}(t)?"[redacted-card]":e}},{name:"email",re:/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,repl:"[redacted-email]"},{name:"phone",re:/\b(\+?\d{1,3}[ -])?\(?\d{3}\)?[ -]?\d{3}[ -]?\d{4}\b/g,repl:"[redacted-phone]"},{name:"apikey",re:/\b(sk|pk|rk)-[A-Za-z0-9]{20,}\b/g,repl:"[redacted-key]"}];function Ge(e){if("string"!=typeof e)return"";let t=e;for(const{re:n,repl:r}of Ze)t=t.replace(n,r);return t}function _e(e){if(e&&"object"==typeof e&&!Object.isFrozen(e)){for(const t of Object.keys(e))_e(e[t]);Object.freeze(e)}return e}var Je=Object.freeze({sanitizeString:ke,sanitizeHref:Re,sanitizeHTML:Le,sanitizeCSS:We,sanitizeJSON:Ee,sanitizeUnicode:He,isSafeAttrName:Ve,buildTkxCSP:Oe,installTrustedTypes:qe,isFramed:Ue,installFrameBuster:Ke,createRateLimiter:Ye,sniffMimeType:Xe,scrubPII:Ge,deepFreeze:_e,__brand:"TekiVex SecurityCore v2.6.0 © 007krcs"}),Qe={sanitize:ke,sanitizeProps:$e,validateProps:Ce,createCSP:function(e,t){const n={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 ze.set(e,n),n},hasPermission:function(e,t){return!0===ze.get(e)?.permissions[t]},audit:Ne,getAuditLog:De,verifyAuditIntegrity:Pe};function et(){const[e,t]=m(()=>"undefined"!=typeof window&&J());return s(()=>{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}function tt(){const[e,t]=m(()=>"undefined"!=typeof window&&Q());return s(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(forced-colors: active)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}function nt(e){const t=f(null);return s(()=>{if(!e||!t.current)return;const n=G(t.current);return n.activate(),()=>n.deactivate()},[e]),t}function rt(){const e=f(null);return s(()=>{if("undefined"!=typeof document)return e.current=X(),()=>{e.current?.destroy()}},[]),a((t,n="polite")=>{e.current?.announce(t,n)},[])}function ot(e,t=!0){const n=f(e);n.current=e,s(()=>{if(!t||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&n.current()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t])}function it(e,t){const n=f(t);n.current=t,s(()=>{const t=t=>{e.current&&!e.current.contains(t.target)&&n.current()};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[e])}var at={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"},lt={...at,screen:"100vh"},st={"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%"},dt={none:"0",sm:"2px","":"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px","3xl":"24px",full:"9999px"},ct={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"},ut={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"]},pt={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},ht={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"},ft={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},mt={none:"0",sm:"4px","":"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},gt=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)])),xt=new Set(["bg","surface","surfaceAlt","border","text","textMuted","primary","secondary","danger","warning","success","info"]),bt={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},yt=/javascript\s*:|vbscript\s*:|data\s*:\s*text\/html|data\s*:\s*text\/javascript|expression\s*\(|[\r\n\x00]/i,vt=new Set(["behavior","-moz-binding","-webkit-binding","src"]),wt=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 kt(e){return yt.test(e)||e.includes("}")||e.includes("{")||e.includes("<")||e.includes(">")?null:e}function $t(e){const t=e.match(/^\[(.+)]$/);return t?kt(t[1]):null}function St(e){return xt.has(e)?`var(--tkx-${e})`:"transparent"===e?"transparent":"current"===e?"currentColor":"white"===e?"#ffffff":"black"===e?"#000000":"inherit"===e?"inherit":$t(e)||(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),e)}function Ct(e){const t=e.match(/^\[(--[a-zA-Z0-9_-]+):(.+)]$/);if(t){const e=kt(t[2]);return e?{[t[1]]:e}:null}const n=e.match(/^\[([a-zA-Z-]+):(.+)]$/);if(n){const e=function(e){const t=e.toLowerCase().trim();return vt.has(t)?null:wt.has(t)?t:null}(n[1]),t=kt(n[2]);return e&&t?{[e]:t}: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 i={"flex-wrap":"wrap","flex-nowrap":"nowrap","flex-wrap-reverse":"wrap-reverse"};if(i[e])return{"flex-wrap":i[e]};const a={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-none":"none","flex-initial":"0 1 auto"};if(a[e])return{flex:a[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 d={"self-auto":"auto","self-start":"flex-start","self-end":"flex-end","self-center":"center","self-stretch":"stretch","self-baseline":"baseline"};if(d[e])return{"align-self":d[e]};const c={"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(c[e])return{"align-content":c[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=at[u[1]]??$t(u[1]);if(e)return{padding:e}}if(u=e.match(/^px-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-left":e,"padding-right":e}}if(u=e.match(/^py-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-top":e,"padding-bottom":e}}if(u=e.match(/^pt-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-top":e}}if(u=e.match(/^pr-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-right":e}}if(u=e.match(/^pb-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-bottom":e}}if(u=e.match(/^pl-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-left":e}}if(u=e.match(/^-?m-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n)return{margin:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mx-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n){const e=t&&"0"!==n?`-${n}`:n;return{"margin-left":e,"margin-right":e}}}if(u=e.match(/^-?my-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n){const e=t&&"0"!==n?`-${n}`:n;return{"margin-top":e,"margin-bottom":e}}}if(u=e.match(/^-?mt-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n)return{"margin-top":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mr-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n)return{"margin-right":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mb-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n)return{"margin-bottom":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?ml-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n)return{"margin-left":t&&"0"!==n?`-${n}`:n}}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=at[u[1]]??$t(u[1]);if(e)return{gap:e}}if(u=e.match(/^gap-x-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"column-gap":e}}if(u=e.match(/^gap-y-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"row-gap":e}}if(u=e.match(/^w-(.+)$/)){const e=u[1],t=at[e]??st[e]??$t(e);if(t)return{width:t}}if(u=e.match(/^min-w-(.+)$/)){const e=at[u[1]]??$t(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]]??at[u[1]]??$t(u[1]);if(e)return{"max-width":e}}if(u=e.match(/^h-(.+)$/)){const e=u[1],t=lt[e]??st[e]??$t(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]]??at[u[1]]??$t(u[1]);if(e)return{"min-height":e}}if(u=e.match(/^max-h-(.+)$/)){const e=lt[u[1]]??$t(u[1]);if(e)return{"max-height":e}}if(u=e.match(/^size-(.+)$/)){const e=at[u[1]]??st[u[1]]??$t(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]=ut[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":pt[u[1]]??u[1]};if(u=e.match(/^leading-(.+)$/)){const e=ht[u[1]]??$t(u[1]);if(e)return{"line-height":e}}if(u=e.match(/^tracking-(.+)$/)){const e=ft[u[1]]??$t(u[1]);if(e)return{"letter-spacing":e}}const p={"text-left":"left","text-center":"center","text-right":"right","text-justify":"justify","text-start":"start","text-end":"end"};if(p[e])return{"text-align":p[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=at[u[1]]??$t(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("/"),n=St(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:n,opacity:String(e)}}return{color:n}}}if(u=e.match(/^bg-(.+)$/)){const[e,t]=u[1].split("/"),n=St(e);return t?{"background-color":n,opacity:String(parseInt(t)/100)}:"none"===e?{background:"none"}:{"background-color":n}}if(u=e.match(/^border-color-(.+)$/))return{"border-color":St(u[1])};if(u=e.match(/^fill-(.+)$/))return{fill:St(u[1])};if(u=e.match(/^stroke-(.+)$/))return{stroke:St(u[1])};if(u=e.match(/^shadow-color-(.+)$/))return{"--tkx-shadow-color":St(u[1])};if(u=e.match(/^ring-color-(.+)$/))return{"--tkx-ring-color":St(u[1])};if(u=e.match(/^accent-(.+)$/))return{"accent-color":St(u[1])};if(u=e.match(/^caret-(.+)$/))return{"caret-color":St(u[1])};if(u=e.match(/^outline-color-(.+)$/))return{"outline-color":St(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].*)$/))&&xt.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":dt[""]};if(u=e.match(/^rounded-(none|sm|md|lg|xl|2xl|3xl|full|\[.+])$/))return{"border-radius":dt[u[1]]??$t(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=dt[u[2]??""]??dt[""];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 h={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+)$/))&&h[u[1]])return{"box-shadow":`0 0 0 ${h[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":ct[""]};if(u=e.match(/^shadow-(sm|md|lg|xl|2xl|inner|none)$/))return{"box-shadow":ct[u[1]]};if(u=e.match(/^opacity-(\d+)$/)){const e=gt[u[1]];if(void 0!==e)return{opacity:e}}if("bg-none"===e)return{background:"none"};const f={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"};if(f[e])return{"background-size":f[e]};const m={"bg-center":"center","bg-top":"top","bg-bottom":"bottom","bg-left":"left","bg-right":"right"};if(m[e])return{"background-position":m[e]};const g={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y"};if(g[e])return{"background-repeat":g[e]};if("backdrop-blur"===e)return{"backdrop-filter":`blur(${mt[""]})`};if(u=e.match(/^backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{"backdrop-filter":`blur(${mt[u[1]]})`};if("blur"===e)return{filter:`blur(${mt[""]})`};if(u=e.match(/^blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{filter:`blur(${mt[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 x={static:"static",relative:"relative",absolute:"absolute",fixed:"fixed",sticky:"sticky"};if(x[e])return{position:x[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("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{top:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?right-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{right:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?bottom-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{bottom:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?left-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{left:t&&"0"!==n?`-${n}`:n}}const b={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=b[u[1]]??$t(u[1]);if(e)return{"z-index":e}}const y={"overflow-auto":"auto","overflow-hidden":"hidden","overflow-visible":"visible","overflow-scroll":"scroll","overflow-clip":"clip"};if(y[e])return{overflow:y[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 v={"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(v[e])return{cursor:v[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 w={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=w[u[1]]??$t(u[1]);if(e)return{transform:`scale(${e})`}}if(u=e.match(/^scale-x-(.+)$/)){const e=w[u[1]]??$t(u[1]);if(e)return{transform:`scaleX(${e})`}}if(u=e.match(/^scale-y-(.+)$/)){const e=w[u[1]]??$t(u[1]);if(e)return{transform:`scaleY(${e})`}}const k={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("-"),n=k[u[1]]??$t(u[1]);if(n)return{transform:t?`rotate(-${n})`:`rotate(${n})`}}if(u=e.match(/^-?translate-x-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{transform:`translateX(${t&&"0"!==n?`-${n}`:n})`}}if(u=e.match(/^-?translate-y-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{transform:`translateY(${t&&"0"!==n?`-${n}`:n})`}}if(u=e.match(/^-?skew-x-(.+)$/)){const t=e.startsWith("-"),n=$t(u[1])??`${u[1]}deg`;return{transform:t?`skewX(-${n})`:`skewX(${n})`}}if(u=e.match(/^-?skew-y-(.+)$/)){const t=e.startsWith("-"),n=$t(u[1])??`${u[1]}deg`;return{transform:t?`skewY(-${n})`:`skewY(${n})`}}const $={"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($[e])return{"transform-origin":$[e]};const S={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(S[e])return{"transition-property":S[e],"transition-timing-function":"cubic-bezier(0.4,0,0.2,1)","transition-duration":"150ms"};const C={75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"};if(u=e.match(/^duration-(.+)$/)){const e=C[u[1]]??$t(u[1]);if(e)return{"transition-duration":e}}if(u=e.match(/^delay-(.+)$/)){const e=C[u[1]]??$t(u[1]);if(e)return{"transition-delay":e}}const z={"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(z[e])return{"transition-timing-function":z[e]};const M={"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(M[e])return{animation:M[e]};const N={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"};return N[e]?{"object-fit":N[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]}:Ot(e)||null}function zt(e){let t=0,n=-1;for(let r=0;r<e.length;r++)if("["===e[r])t++;else if("]"===e[r])t--;else if(":"===e[r]&&0===t){n=r;break}return-1===n?{variant:null,utility:e}:{variant:e.slice(0,n),utility:e.slice(n+1)}}function Mt(e,t){for(const[n,r]of Object.entries(t))e[n]=r}function Nt(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}var Dt=/* @__PURE__ */new Map,Pt=null,Rt=null;function Ft(){return Pt&&Pt.isConnected||(Pt=document.getElementById("tkx-atomic"))||((Pt=document.createElement("style")).id="tkx-atomic",document.head.appendChild(Pt)),Pt}function It(e){const t=[];for(const n of e)if(n)if("string"==typeof n)t.push(...n.split(/\s+/).filter(Boolean));else if(Array.isArray(n))t.push(...It(n));else if("object"==typeof n)for(const[e,r]of Object.entries(n))r&&t.push(e);return t}function At(...e){const t=It(e);if(0===t.length)return"";const n={base:{},variants:{}};for(const l of t){const{variant:e,utility:t}=zt(l),r=Ct(t);r&&(e?(n.variants[e]||(n.variants[e]={}),Mt(n.variants[e],r)):Mt(n.base,r))}const r=[],o=Nt(n.base),i=v([o,...Object.entries(n.variants).map(([e,t])=>`${e}{${Nt(t)}}`)].join("|")),a=`tkx-${i}`;o&&r.push(`.${a}{${o}}`);for(const[l,s]of Object.entries(n.variants)){const e=Nt(s);if(e)if(l.startsWith("@")){const t=bt[l.slice(1)];t&&r.push(`@media(min-width:${t}){.${a}{${e}}}`)}else if("motion-safe"===l)r.push(`@media(prefers-reduced-motion:no-preference){.${a}{${e}}}`);else if("motion-reduce"===l)r.push(`@media(prefers-reduced-motion:reduce){.${a}{${e}}}`);else if("contrast-more"===l)r.push(`@media(prefers-contrast:more){.${a}{${e}}}`);else if("forced-colors"===l)r.push(`@media(forced-colors:active){.${a}{${e}}}`);else if("dark"===l)r.push(`@media(prefers-color-scheme:dark){.${a}{${e}}}`);else if("print"===l)r.push(`@media print{.${a}{${e}}}`);else if("group-hover"===l)r.push(`.group:hover .${a}{${e}}`);else if("group-focus"===l)r.push(`.group:focus-within .${a}{${e}}`);else if("peer-hover"===l)r.push(`.peer:hover~.${a}{${e}}`);else{const t={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"}[l]??`:${l}`;r.push(`.${a}${t}{${e}}`)}}return r.length>0&&function(e,t){if(Dt.has(e))return;if(Dt.set(e,t),"undefined"==typeof document)return;const n=function(){if(Rt)return Rt;try{const e=new CSSStyleSheet;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],Rt=e,e}catch{return null}}();if(n){const e=function(e){const t=[];let n=0,r=0;for(let o=0;o<e.length;o++)if("{"===e[o])n++;else if("}"===e[o]&&(n--,0===n)){const n=e.slice(r,o+1).trim();n&&t.push(n),r=o+1}return t}(t);for(const t of e)try{n.insertRule(t,n.cssRules.length)}catch{Ft().textContent+=t+"\n"}}else Ft().textContent+=t+"\n"}(i,r.join("")),a}var Lt=At;function Tt(){return Array.from(Dt.values()).join("\n")}function Wt(){Dt.clear(),Pt=null,Rt&&"undefined"!=typeof document&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==Rt),Rt=null)}function jt(...e){return e.filter(Boolean).join(" ")}var Et=/* @__PURE__ */new Map;function Bt(e){Et.set(e.name,e.utilities)}function Vt(e){Et.delete(e)}function Ht(){return Array.from(Et.keys())}function Ot(e){for(const t of Et.values())if(t[e])return t[e];return null}var qt={sm:"text-xs font-semibold",md:"text-sm font-semibold",lg:"text-base font-semibold",xl:"text-lg font-semibold"},Ut={sm:"py-1.5 px-3",md:"py-2 px-4",lg:"py-2.5 px-5",xl:"py-3 px-6"},Kt={sm:"min-h-[32px]",md:"min-h-[40px]",lg:"min-h-[48px]",xl:"min-h-[56px]"},Yt={sm:14,md:16,lg:18,xl:20};function Xt({size:e}){const t=Yt[e];/* @__PURE__ */
1
+ import*as e from"react";import{Children as t,cloneElement as n,createContext as r,createElement as o,forwardRef as i,useCallback as a,useContext as l,useEffect as s,useId as d,useImperativeHandle as c,useLayoutEffect as u,useMemo as p,useReducer as h,useRef as f,useState as m}from"react";import{Fragment as g,jsx as x,jsxs as b}from"react/jsx-runtime";import{createPortal as y}from"react-dom";function v(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}var w=class{constructor(e=512){this.cache=/* @__PURE__ */new Map,this.hits=0,this.misses=0,this.ceiling=Math.min(e,512)}get(e){if(!this.cache.has(e))return void this.misses++;this.hits++;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size>=this.ceiling&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}has(e){return this.cache.has(e)}invalidate(e){void 0!==e?this.cache.delete(e):this.cache.clear()}get size(){return this.cache.size}get cacheHitRate(){const e=this.hits+this.misses;return 0===e?0:this.hits/e*100}},k=new w(512);function $(e,t){const n=k.get(e);if(void 0!==n)return n;const r=t();return k.set(e,r),r}var S=[],C=!1,z=[],M=0,N=0;function D(e){S.push(e),C||(C=!0,queueMicrotask(()=>{!function(){const e=S.splice(0),t=performance.now();for(const r of e)try{r()}catch{}const n=performance.now()-t;M+=n,N++,z.push({duration:n,timestamp:Date.now()}),z.length>100&&z.shift()}(),C=!1}))}var R={hash:v,memoize:$,batchUpdate:D,invalidate:function(e){void 0!==e?k.invalidate(e):k.invalidate()},get avgRenderTime(){return 0===N?0:M/N},get cacheHitRate(){return k.cacheHitRate},getMetrics:function(e){const t=void 0!==e?z.slice(-e):z.slice();return{avgRenderTime:0===N?0:M/N,cacheHitRate:k.cacheHitRate,renderCount:N,recent:t}}},P=/* @__PURE__ */new Map;function F(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function I(e){const t=function(e){return"tkx-"+v(e)}(e);return P.has(t)||P.set(t,e),t}function A(e,...t){const n=e.reduce((e,n,r)=>e+n+(void 0!==t[r]?String(t[r]):""),"");return{className:I(n.trim()),styles:n.trim()}}function L(e){const t=Object.entries(e).map(([e,t])=>`${F(e)}: ${t};`).join(" ");return{className:I(t),styles:t}}var T={xs:"480px",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function W(e,t){return`@media (min-width: ${T[e]}) { ${t} }`}function j(e,t){return`@keyframes ${e} { ${Object.entries(t).map(([e,t])=>`${e} { ${Object.entries(t).map(([e,t])=>`${F(e)}: ${t};`).join(" ")} }`).join(" ")} }`}function E(e,t){return void 0!==t?`--tkx-${e}: ${t};`:`var(--tkx-${e})`}function B(){return Array.from(P.entries()).map(([e,t])=>`.${e} { ${t} }`).join("\n")}function V(){if("undefined"==typeof document)return;let e=document.getElementById("tkx-styles");e||(e=document.createElement("style"),e.id="tkx-styles",document.head.appendChild(e)),e.textContent=B()}var H={css:A,fromObject:L,responsive:W,keyframes:j,cssVar:E,extractCSS:B,injectStyles:V,resetStyles:function(){P.clear()}};function O(e){const[t,n,r]=function(e){if(!e||"string"!=typeof e)return[0,0,0];const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t,r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return[isNaN(r)?0:r,isNaN(o)?0:o,isNaN(i)?0:i]}(e).map(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*r}function q(e,t){const n=O(e),r=O(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function U(e,t,n=!1){return q(e,t)>=(n?3:4.5)}function K(e,t,n=!1){return q(e,t)>=(n?4.5:7)}function Y(e,t){const n=t??["#ffffff","#000000"];return n.reduce((t,n)=>q(n,e)>q(t,e)?n:t,n[0])}function X(){const e=document.createElement("div"),t=document.createElement("div");for(const n of[e,t])n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",document.body.appendChild(n);return e.setAttribute("aria-live","polite"),t.setAttribute("aria-live","assertive"),{announce(n,r="polite"){const o="assertive"===r?t:e;o.textContent="",setTimeout(()=>{o.textContent=n},0)},destroy(){e.remove(),t.remove()}}}var Z=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])',"details > summary"].join(", ");function G(e){let t=null,n=null;function r(){return Array.from(e.querySelectorAll(Z)).filter(e=>!e.closest("[hidden]")&&!e.closest('[aria-hidden="true"]'))}return{activate(){t=document.activeElement;const o=r();o.length>0&&o[0].focus(),n=e=>{if("Tab"!==e.key)return;const t=r();if(0===t.length)return;const n=t[0],o=t[t.length-1];e.shiftKey?document.activeElement===n&&(e.preventDefault(),o.focus()):document.activeElement===o&&(e.preventDefault(),n.focus())},e.addEventListener("keydown",n)},deactivate(){n&&e.removeEventListener("keydown",n),t instanceof HTMLElement&&t.focus(),t=null,n=null}}}function _(e,t,n,r){let o=t;switch(e.key){case"ArrowLeft":case"ArrowUp":e.preventDefault(),o=0===t?n-1:t-1;break;case"ArrowRight":case"ArrowDown":e.preventDefault(),o=t===n-1?0:t+1;break;case"Home":e.preventDefault(),o=0;break;case"End":e.preventDefault(),o=n-1;break;case"Enter":case" ":return e.preventDefault(),void r(t);default:return}r(o)}function J(){return"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Q(){return"undefined"!=typeof window&&window.matchMedia("(forced-colors: active)").matches}var ee={contrastRatio:q,meetsAA:U,meetsAAA:K,getAccessibleForeground:Y,createAnnouncer:X,createFocusTrap:G,handleTabsKeyboard:_,handleMenuKeyboard:function(e,t,n,r,o){let i=t;switch(e.key){case"ArrowUp":e.preventDefault(),i=0===t?n-1:t-1;break;case"ArrowDown":e.preventDefault(),i=t===n-1?0:t+1;break;case"Home":e.preventDefault(),i=0;break;case"End":e.preventDefault(),i=n-1;break;case"Enter":case" ":return e.preventDefault(),void r(t);case"Escape":return e.preventDefault(),void o?.();default:return}r(i)},prefersReducedMotion:J,prefersHighContrast:Q,announce:function(e,t="polite"){if("undefined"==typeof document)return;let n=document.getElementById("tkx-live-region");n||(n=document.createElement("div"),n.id="tkx-live-region",n.setAttribute("aria-live",t),n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",document.body.appendChild(n)),n.textContent="",setTimeout(()=>{n&&(n.textContent=e)},0)}},te="undefined"!=typeof window?u:s,ne={bg:"#0a0a0f",surface:"#12121a",surfaceAlt:"#1a1a2e",border:"#2a2a3e",text:"#e8e8f4",textMuted:"#8888aa",primary:"#00f5d4",secondary:"#7b2ff7",danger:"#f72585",warning:"#ffbe0b",success:"#06d6a0",info:"#3a86ff"},re={bg:"#f8f6f1",surface:"#ffffff",surfaceAlt:"#f0ede6",border:"#ddd8cc",text:"#1a1815",textMuted:"#6b6560",primary:"#0d7c5f",secondary:"#6930c3",danger:"#c1121f",warning:"#d4a017",success:"#0d7c5f",info:"#1d4ed8"},oe=/^#[0-9a-fA-F]{3,8}$/;function ie(e,t){const n={...e,...t};for(const[r,o]of Object.entries(n))if(!oe.test(o))throw new Error(`Invalid hex color for theme token '${r}': ${o}`);return U(n.text,n.bg),U(n.primary,n.bg),K(n.text,n.bg),n}var ae=r(ne);function le({theme:e,mode:t,lightTheme:n=re,darkTheme:r=ne,defaultMode:i="light",suppressHydrationWarning:a=!1,children:l}){const d=void 0!==e,c=function(e){const[t,n]=m(null);return s(()=>{if(!e||"undefined"==typeof window||!window.matchMedia)return;const t=window.matchMedia("(prefers-color-scheme: dark)");n(t.matches);const r=e=>n(e.matches);return t.addEventListener?(t.addEventListener("change",r),()=>t.removeEventListener("change",r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}(!d&&("auto"===t||void 0===t)),u=function(){const[e,t]=m(!1);return s(()=>t(!0),[]),e}();let p;p=d?e:"light"===t?n:"dark"===t?r:null===c?"dark"===i?r:n:c?r:n;const h=a&&!u;te(()=>{if(h)return;const e=Object.entries(p).map(([e,t])=>E(e,t)).join(" ");let t=document.getElementById("tkx-theme");if(!t){t=document.createElement("style"),t.id="tkx-theme";const e=document.head.querySelector("style");e?document.head.insertBefore(t,e):document.head.appendChild(t)}t.textContent=`:root { ${e} }`,document.documentElement.setAttribute("data-tkx-scheme",p===r?"dark":p===n?"light":"custom")},[p,r,n,h]);const f=h?{}:Object.fromEntries(Object.entries(p).map(([e,t])=>[`--tkx-${e}`,t]));return o(ae.Provider,{value:p},o("div",{style:{display:"contents",...f}},l))}function se(){return l(ae)}function de(){const[e,t]=m(()=>"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":"dark");return s(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),n=e=>t(e.matches?"dark":"light");return e.addEventListener?(e.addEventListener("change",n),()=>e.removeEventListener("change",n)):(e.addListener(n),()=>e.removeListener(n))},[]),e}function ce(e,t,n){n/=100;const r=(t/=100)*Math.min(n,1-n),o=t=>{const o=(t+e/30)%12,i=n-r*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}function ue(e){const[t,n]=function(e){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,o=parseInt(t.slice(4,6),16)/255,i=Math.max(n,r,o),a=Math.min(n,r,o);let l=0,s=0;const d=(i+a)/2;if(i!==a){const e=i-a;switch(s=d>.5?e/(2-i-a):e/(i+a),i){case n:l=((r-o)/e+(r<o?6:0))/6;break;case r:l=((o-n)/e+2)/6;break;case o:l=((n-r)/e+4)/6}}return[Math.round(360*l),Math.round(100*s),Math.round(100*d)]}(e);return{50:ce(t,Math.min(n,30),96),100:ce(t,Math.min(n,40),90),200:ce(t,Math.min(n,50),80),300:ce(t,n,70),400:ce(t,n,60),500:e,600:ce(t,n,45),700:ce(t,n,35),800:ce(t,n,25),900:ce(t,n,15)}}var pe={xs:{fontSize:"0.75rem",lineHeight:"1rem"},sm:{fontSize:"0.875rem",lineHeight:"1.25rem"},base:{fontSize:"1rem",lineHeight:"1.5rem"},lg:{fontSize:"1.125rem",lineHeight:"1.75rem"},xl:{fontSize:"1.25rem",lineHeight:"1.75rem"},"2xl":{fontSize:"1.5rem",lineHeight:"2rem"},"3xl":{fontSize:"1.875rem",lineHeight:"2.25rem"},"4xl":{fontSize:"2.25rem",lineHeight:"2.5rem"},"5xl":{fontSize:"3rem",lineHeight:"1.15"}},he={0:"0px",.5:"2px",1:"4px",1.5:"6px",2:"8px",2.5:"10px",3:"12px",4:"16px",5:"20px",6:"24px",8:"32px",10:"40px",12:"48px",16:"64px",20:"80px",24:"96px"},fe={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},me={none:"none",xs:"0 1px 2px 0 rgba(0,0,0,0.05)",sm:"0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)",md:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",lg:"0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",xl:"0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)","2xl":"0 25px 50px -12px rgba(0,0,0,0.25)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)"},ge={hide:-1,base:0,dropdown:1e3,sticky:1100,fixed:1200,overlay:1300,modal:1400,popover:1500,tooltip:1600,toast:1700,max:9999},xe={none:"0",sm:"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px",full:"9999px"},be=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function ye(e,t){return e>>>t|e<<32-t}function ve(e){const t=[];for(let a=0;a<e.length;a++){let n=e.charCodeAt(a);n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(a++,n=65536+((1023&n)<<10|1023&e.charCodeAt(a)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}const n=8*t.length;for(t.push(128);t.length%64!=56;)t.push(0);for(let a=0;a<4;a++)t.push(0);t.push(n>>>24&255,n>>>16&255,n>>>8&255,255&n);const r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),o=new Uint32Array(64);for(let a=0;a<t.length;a+=64){for(let r=0;r<16;r++)o[r]=t[a+4*r]<<24|t[a+4*r+1]<<16|t[a+4*r+2]<<8|t[a+4*r+3];for(let t=16;t<64;t++){const e=ye(o[t-15],7)^ye(o[t-15],18)^o[t-15]>>>3,n=ye(o[t-2],17)^ye(o[t-2],19)^o[t-2]>>>10;o[t]=o[t-16]+e+o[t-7]+n|0}let[e,n,i,l,s,d,c,u]=r;for(let t=0;t<64;t++){const r=u+(ye(s,6)^ye(s,11)^ye(s,25))+(s&d^~s&c)+be[t]+o[t]|0,a=(ye(e,2)^ye(e,13)^ye(e,22))+(e&n^e&i^n&i)|0;u=c,c=d,d=s,s=l+r|0,l=i,i=n,n=e,e=r+a|0}r[0]=r[0]+e|0,r[1]=r[1]+n|0,r[2]=r[2]+i|0,r[3]=r[3]+l|0,r[4]=r[4]+s|0,r[5]=r[5]+d|0,r[6]=r[6]+c|0,r[7]=r[7]+u|0}let i="";for(let a=0;a<8;a++)i+=(r[a]>>>0).toString(16).padStart(8,"0");return i}var we={"<":"&lt;",">":"&gt;","&":"&amp;","'":"&#39;",'"':"&quot;","`":"&#96;"};function ke(e){if(null==e)return"";let t=String(e);return t=t.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,""),t.replace(/[<>&'"`]/g,e=>we[e]??e)}function $e(e){const t={};for(const n of Object.keys(e))t[n]=Se(e[n]);return t}function Se(e){return"string"==typeof e?ke(e):Array.isArray(e)?e.map(Se):null===e||"object"!=typeof e||function(e){return"object"==typeof e&&null!==e&&"$$typeof"in e}(e)?e:$e(e)}function Ce(e,t){const n=[];for(const[r,o]of Object.entries(t)){const t=e[r],i=null==t;o.required&&i?n.push(`prop '${r}' is required`):i||(typeof t===o.type?("number"===o.type&&"number"==typeof t&&(void 0!==o.min&&t<o.min&&n.push(`prop '${r}' must be >= ${o.min}`),void 0!==o.max&&t>o.max&&n.push(`prop '${r}' must be <= ${o.max}`)),"string"===o.type&&"string"==typeof t&&o.pattern&&!o.pattern.test(t)&&n.push(`prop '${r}' does not match pattern ${o.pattern}`),o.enum&&!o.enum.includes(t)&&n.push(`prop '${r}' must be one of: ${o.enum.join(", ")}`)):n.push(`prop '${r}' must be of type ${o.type}, got ${typeof t}`))}return{valid:0===n.length,errors:n}}var ze=/* @__PURE__ */new Map,Me=[];function Ne(e,t,n){const r=ve(JSON.stringify(n??{})),o=ve((Me.length>0?Me[Me.length-1].chainHash:"0000000000000000000000000000000000000000000000000000000000000000")+r+t+e),i=Object.freeze({timestamp:Date.now(),component:t,action:e,propsHash:r,chainHash:o});return Me=Object.freeze([...Me,i]),i}function De(e){let t=Me;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 Re(){let e="0000000000000000000000000000000000000000000000000000000000000000";for(const t of Me){if(ve(e+t.propsHash+t.component+t.action)!==t.chainHash)return!1;e=t.chainHash}return!0}function Pe(e){if("string"!=typeof e)return null;const t=e.trim();if(!t)return null;const n=t.replace(/[\u0000-\u001F\u007F]/g,"");return/^javascript:/i.test(n)||/^vbscript:/i.test(n)||/^data:/i.test(n)&&!/^data:image\//i.test(n)||/^file:/i.test(n)?null:n}var Fe=new Set(["a","abbr","b","blockquote","br","code","del","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","mark","ol","p","pre","q","s","samp","small","span","strong","sub","sup","table","tbody","td","tfoot","th","thead","tr","u","ul"]),Ie={a:new Set(["href","title","target","rel"]),img:new Set(["src","alt","title","width","height","loading","decoding"]),th:new Set(["scope","colspan","rowspan","align"]),td:new Set(["colspan","rowspan","align"]),"*":new Set(["id","class","lang","dir","title"])},Ae=new Set(["constructor","prototype","__proto__","submit","reset","action","method","enctype","target","elements","children","firstChild","nextSibling","parentNode","ownerDocument","cookie","domain","location","documentElement","body","head","title","contentWindow","contentDocument"]);function Le(e){if("string"!=typeof e)return"";if("undefined"==typeof DOMParser)return ke(e);const t=(new DOMParser).parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;return t?(Te(t),t.innerHTML):""}function Te(e){const t=Array.from(e.children);for(const n of t){const e=n.tagName.toLowerCase();if(Fe.has(e)){for(const t of Array.from(n.attributes)){const r=t.name.toLowerCase();if(r.startsWith("on"))n.removeAttribute(t.name);else if(Ae.has(r))n.removeAttribute(t.name);else if("style"!==r)if((Ie[e]??/* @__PURE__ */new Set).has(r)||Ie["*"].has(r)){if(("href"===r||"src"===r)&&"string"==typeof t.value){const e=Pe(t.value);null===e?n.removeAttribute(t.name):n.setAttribute(t.name,e)}"name"!==r&&"id"!==r||!Ae.has(t.value.toLowerCase())||n.removeAttribute(t.name)}else n.removeAttribute(t.name);else n.setAttribute("style",We(t.value))}Te(n)}else n.remove()}}function We(e){if("string"!=typeof e)return"";let t=e;return t=t.replace(/expression\s*\([^)]*\)/gi,""),t=t.replace(/url\s*\(\s*['"]?\s*(javascript|vbscript|data)\s*:[^)]*\)/gi,"url(#)"),t=t.replace(/@import[^;]*;?/gi,""),t=t.replace(/behavior\s*:[^;]*;?/gi,""),t=t.replace(/-moz-binding[^;]*;?/gi,""),t=t.replace(/[<>]/g,""),t=t.replace(/[\u0000-\u001F\u007F]/g,""),t.trim()}var je=new Set(["__proto__","constructor","prototype"]);function Ee(e){try{return Be(JSON.parse(e,(e,t)=>{if(!je.has(e))return t}))}catch{return null}}function Be(e){if(Array.isArray(e))return e.map(Be);if(e&&"object"==typeof e){const t={};for(const[n,r]of Object.entries(e))je.has(n)||(t[n]=Be(r));return t}return e}function Ve(e){return!("string"!=typeof e||!e||/[\u0000-\u001F\u007F<>"]/.test(e)||Ae.has(e.toLowerCase()))}function He(e){return"string"!=typeof e?"":e.replace(/[\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFEFF\u00AD]/g,"")}function Oe(e={}){const{allowInlineStyles:t=!0,imgHosts:n=[],connectHosts:r=[],fontHosts:o=[],scriptNonce:i,reportUri:a}=e,l=["default-src 'self'","script-src "+(i?`'self' 'nonce-${i}'`:"'self'"),"style-src "+(t?"'self' 'unsafe-inline'":"'self'"),`img-src ${["'self'","data:","https:",...n].join(" ")}`,`font-src ${["'self'","https:","data:",...o].join(" ")}`,`connect-src ${["'self'",...r].join(" ")}`,"frame-ancestors 'none'","form-action 'self'","base-uri 'self'","object-src 'none'","upgrade-insecure-requests"];return a&&l.push(`report-uri ${a}`),l.join("; ")}function qe(){if("undefined"==typeof window)return;const e=window.trustedTypes;if(e)try{e.createPolicy("tkx",{createHTML:Le,createScriptURL:e=>Pe(e)??"",createScript:()=>{throw new Error("TekiVex: inline script creation forbidden")}})}catch{}}function Ue(){if("undefined"==typeof window)return!1;try{return window.top!==window.self}catch{return!0}}function Ke(e){if("undefined"!=typeof window&&Ue())if(e)e();else try{window.top.location.href=window.self.location.href}catch{}}function Ye(e,t){let n=e,r=Date.now();return{check(){const o=Date.now(),i=o-r,a=Math.floor(i/t);return a>0&&(n=Math.min(e,n+a),r=o),!(n<=0||(n-=1,0))},reset(){n=e,r=Date.now()}}}async function Xe(e){const t=new Uint8Array(await e.slice(0,12).arrayBuffer()),n=(...e)=>e.every((e,n)=>t[n]===e);return n(137,80,78,71)?"image/png":n(255,216,255)?"image/jpeg":n(71,73,70,56)?"image/gif":n(66,77)?"image/bmp":n(82,73,70,70)&&87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?"image/webp":n(37,80,68,70)?"application/pdf":n(80,75,3,4)?"application/zip":123===t[0]||91===t[0]?"application/json":[...t].includes(0)?null:"text/plain"}var Ze=[{name:"ssn",re:/\b\d{3}-\d{2}-\d{4}\b/g,repl:"[redacted-ssn]"},{name:"credit",re:/\b(?:\d[ -]?){13,19}\b/g,repl:e=>{const t=e.replace(/[ -]/g,"");return t.length<13||t.length>19?e:function(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let o=e.charCodeAt(r)-48;if(o<0||o>9)return!1;n&&(o*=2,o>9&&(o-=9)),t+=o,n=!n}return t>0&&t%10==0}(t)?"[redacted-card]":e}},{name:"email",re:/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,repl:"[redacted-email]"},{name:"phone",re:/\b(\+?\d{1,3}[ -])?\(?\d{3}\)?[ -]?\d{3}[ -]?\d{4}\b/g,repl:"[redacted-phone]"},{name:"apikey",re:/\b(sk|pk|rk)-[A-Za-z0-9]{20,}\b/g,repl:"[redacted-key]"}];function Ge(e){if("string"!=typeof e)return"";let t=e;for(const{re:n,repl:r}of Ze)t=t.replace(n,r);return t}function _e(e){if(e&&"object"==typeof e&&!Object.isFrozen(e)){for(const t of Object.keys(e))_e(e[t]);Object.freeze(e)}return e}var Je=Object.freeze({sanitizeString:ke,sanitizeHref:Pe,sanitizeHTML:Le,sanitizeCSS:We,sanitizeJSON:Ee,sanitizeUnicode:He,isSafeAttrName:Ve,buildTkxCSP:Oe,installTrustedTypes:qe,isFramed:Ue,installFrameBuster:Ke,createRateLimiter:Ye,sniffMimeType:Xe,scrubPII:Ge,deepFreeze:_e,__brand:"TekiVex SecurityCore v2.6.0 © 007krcs"}),Qe={sanitize:ke,sanitizeProps:$e,validateProps:Ce,createCSP:function(e,t){const n={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 ze.set(e,n),n},hasPermission:function(e,t){return!0===ze.get(e)?.permissions[t]},audit:Ne,getAuditLog:De,verifyAuditIntegrity:Re};function et(){const[e,t]=m(()=>"undefined"!=typeof window&&J());return s(()=>{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}function tt(){const[e,t]=m(()=>"undefined"!=typeof window&&Q());return s(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(forced-colors: active)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}function nt(e){const t=f(null);return s(()=>{if(!e||!t.current)return;const n=G(t.current);return n.activate(),()=>n.deactivate()},[e]),t}function rt(){const e=f(null);return s(()=>{if("undefined"!=typeof document)return e.current=X(),()=>{e.current?.destroy()}},[]),a((t,n="polite")=>{e.current?.announce(t,n)},[])}function ot(e,t=!0){const n=f(e);n.current=e,s(()=>{if(!t||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&n.current()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t])}function it(e,t){const n=f(t);n.current=t,s(()=>{const t=t=>{e.current&&!e.current.contains(t.target)&&n.current()};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[e])}var at={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"},lt={...at,screen:"100vh"},st={"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%"},dt={none:"0",sm:"2px","":"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px","3xl":"24px",full:"9999px"},ct={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"},ut={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"]},pt={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},ht={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"},ft={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},mt={none:"0",sm:"4px","":"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},gt=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)])),xt=new Set(["bg","surface","surfaceAlt","border","text","textMuted","primary","secondary","danger","warning","success","info"]),bt={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},yt=/javascript\s*:|vbscript\s*:|data\s*:\s*text\/html|data\s*:\s*text\/javascript|expression\s*\(|[\r\n\x00]/i,vt=new Set(["behavior","-moz-binding","-webkit-binding","src"]),wt=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 kt(e){return yt.test(e)||e.includes("}")||e.includes("{")||e.includes("<")||e.includes(">")?null:e}function $t(e){const t=e.match(/^\[(.+)]$/);return t?kt(t[1]):null}function St(e){return xt.has(e)?`var(--tkx-${e})`:"transparent"===e?"transparent":"current"===e?"currentColor":"white"===e?"#ffffff":"black"===e?"#000000":"inherit"===e?"inherit":$t(e)||(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),e)}function Ct(e){const t=e.match(/^\[(--[a-zA-Z0-9_-]+):(.+)]$/);if(t){const e=kt(t[2]);return e?{[t[1]]:e}:null}const n=e.match(/^\[([a-zA-Z-]+):(.+)]$/);if(n){const e=function(e){const t=e.toLowerCase().trim();return vt.has(t)?null:wt.has(t)?t:null}(n[1]),t=kt(n[2]);return e&&t?{[e]:t}: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 i={"flex-wrap":"wrap","flex-nowrap":"nowrap","flex-wrap-reverse":"wrap-reverse"};if(i[e])return{"flex-wrap":i[e]};const a={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-none":"none","flex-initial":"0 1 auto"};if(a[e])return{flex:a[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 d={"self-auto":"auto","self-start":"flex-start","self-end":"flex-end","self-center":"center","self-stretch":"stretch","self-baseline":"baseline"};if(d[e])return{"align-self":d[e]};const c={"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(c[e])return{"align-content":c[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=at[u[1]]??$t(u[1]);if(e)return{padding:e}}if(u=e.match(/^px-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-left":e,"padding-right":e}}if(u=e.match(/^py-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-top":e,"padding-bottom":e}}if(u=e.match(/^pt-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-top":e}}if(u=e.match(/^pr-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-right":e}}if(u=e.match(/^pb-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-bottom":e}}if(u=e.match(/^pl-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"padding-left":e}}if(u=e.match(/^-?m-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n)return{margin:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mx-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n){const e=t&&"0"!==n?`-${n}`:n;return{"margin-left":e,"margin-right":e}}}if(u=e.match(/^-?my-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n){const e=t&&"0"!==n?`-${n}`:n;return{"margin-top":e,"margin-bottom":e}}}if(u=e.match(/^-?mt-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n)return{"margin-top":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mr-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n)return{"margin-right":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mb-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n)return{"margin-bottom":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?ml-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??$t(u[1]);if(n)return{"margin-left":t&&"0"!==n?`-${n}`:n}}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=at[u[1]]??$t(u[1]);if(e)return{gap:e}}if(u=e.match(/^gap-x-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"column-gap":e}}if(u=e.match(/^gap-y-(.+)$/)){const e=at[u[1]]??$t(u[1]);if(e)return{"row-gap":e}}if(u=e.match(/^w-(.+)$/)){const e=u[1],t=at[e]??st[e]??$t(e);if(t)return{width:t}}if(u=e.match(/^min-w-(.+)$/)){const e=at[u[1]]??$t(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]]??at[u[1]]??$t(u[1]);if(e)return{"max-width":e}}if(u=e.match(/^h-(.+)$/)){const e=u[1],t=lt[e]??st[e]??$t(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]]??at[u[1]]??$t(u[1]);if(e)return{"min-height":e}}if(u=e.match(/^max-h-(.+)$/)){const e=lt[u[1]]??$t(u[1]);if(e)return{"max-height":e}}if(u=e.match(/^size-(.+)$/)){const e=at[u[1]]??st[u[1]]??$t(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]=ut[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":pt[u[1]]??u[1]};if(u=e.match(/^leading-(.+)$/)){const e=ht[u[1]]??$t(u[1]);if(e)return{"line-height":e}}if(u=e.match(/^tracking-(.+)$/)){const e=ft[u[1]]??$t(u[1]);if(e)return{"letter-spacing":e}}const p={"text-left":"left","text-center":"center","text-right":"right","text-justify":"justify","text-start":"start","text-end":"end"};if(p[e])return{"text-align":p[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=at[u[1]]??$t(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("/"),n=St(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:n,opacity:String(e)}}return{color:n}}}if(u=e.match(/^bg-(.+)$/)){const[e,t]=u[1].split("/"),n=St(e);return t?{"background-color":n,opacity:String(parseInt(t)/100)}:"none"===e?{background:"none"}:{"background-color":n}}if(u=e.match(/^border-color-(.+)$/))return{"border-color":St(u[1])};if(u=e.match(/^fill-(.+)$/))return{fill:St(u[1])};if(u=e.match(/^stroke-(.+)$/))return{stroke:St(u[1])};if(u=e.match(/^shadow-color-(.+)$/))return{"--tkx-shadow-color":St(u[1])};if(u=e.match(/^ring-color-(.+)$/))return{"--tkx-ring-color":St(u[1])};if(u=e.match(/^accent-(.+)$/))return{"accent-color":St(u[1])};if(u=e.match(/^caret-(.+)$/))return{"caret-color":St(u[1])};if(u=e.match(/^outline-color-(.+)$/))return{"outline-color":St(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].*)$/))&&xt.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":dt[""]};if(u=e.match(/^rounded-(none|sm|md|lg|xl|2xl|3xl|full|\[.+])$/))return{"border-radius":dt[u[1]]??$t(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=dt[u[2]??""]??dt[""];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 h={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+)$/))&&h[u[1]])return{"box-shadow":`0 0 0 ${h[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":ct[""]};if(u=e.match(/^shadow-(sm|md|lg|xl|2xl|inner|none)$/))return{"box-shadow":ct[u[1]]};if(u=e.match(/^opacity-(\d+)$/)){const e=gt[u[1]];if(void 0!==e)return{opacity:e}}if("bg-none"===e)return{background:"none"};const f={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"};if(f[e])return{"background-size":f[e]};const m={"bg-center":"center","bg-top":"top","bg-bottom":"bottom","bg-left":"left","bg-right":"right"};if(m[e])return{"background-position":m[e]};const g={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y"};if(g[e])return{"background-repeat":g[e]};if("backdrop-blur"===e)return{"backdrop-filter":`blur(${mt[""]})`};if(u=e.match(/^backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{"backdrop-filter":`blur(${mt[u[1]]})`};if("blur"===e)return{filter:`blur(${mt[""]})`};if(u=e.match(/^blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{filter:`blur(${mt[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 x={static:"static",relative:"relative",absolute:"absolute",fixed:"fixed",sticky:"sticky"};if(x[e])return{position:x[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("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{top:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?right-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{right:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?bottom-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{bottom:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?left-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{left:t&&"0"!==n?`-${n}`:n}}const b={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=b[u[1]]??$t(u[1]);if(e)return{"z-index":e}}const y={"overflow-auto":"auto","overflow-hidden":"hidden","overflow-visible":"visible","overflow-scroll":"scroll","overflow-clip":"clip"};if(y[e])return{overflow:y[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 v={"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(v[e])return{cursor:v[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 w={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=w[u[1]]??$t(u[1]);if(e)return{transform:`scale(${e})`}}if(u=e.match(/^scale-x-(.+)$/)){const e=w[u[1]]??$t(u[1]);if(e)return{transform:`scaleX(${e})`}}if(u=e.match(/^scale-y-(.+)$/)){const e=w[u[1]]??$t(u[1]);if(e)return{transform:`scaleY(${e})`}}const k={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("-"),n=k[u[1]]??$t(u[1]);if(n)return{transform:t?`rotate(-${n})`:`rotate(${n})`}}if(u=e.match(/^-?translate-x-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{transform:`translateX(${t&&"0"!==n?`-${n}`:n})`}}if(u=e.match(/^-?translate-y-(.+)$/)){const t=e.startsWith("-"),n=at[u[1]]??st[u[1]]??$t(u[1]);if(n)return{transform:`translateY(${t&&"0"!==n?`-${n}`:n})`}}if(u=e.match(/^-?skew-x-(.+)$/)){const t=e.startsWith("-"),n=$t(u[1])??`${u[1]}deg`;return{transform:t?`skewX(-${n})`:`skewX(${n})`}}if(u=e.match(/^-?skew-y-(.+)$/)){const t=e.startsWith("-"),n=$t(u[1])??`${u[1]}deg`;return{transform:t?`skewY(-${n})`:`skewY(${n})`}}const $={"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($[e])return{"transform-origin":$[e]};const S={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(S[e])return{"transition-property":S[e],"transition-timing-function":"cubic-bezier(0.4,0,0.2,1)","transition-duration":"150ms"};const C={75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"};if(u=e.match(/^duration-(.+)$/)){const e=C[u[1]]??$t(u[1]);if(e)return{"transition-duration":e}}if(u=e.match(/^delay-(.+)$/)){const e=C[u[1]]??$t(u[1]);if(e)return{"transition-delay":e}}const z={"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(z[e])return{"transition-timing-function":z[e]};const M={"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(M[e])return{animation:M[e]};const N={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"};return N[e]?{"object-fit":N[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]}:Ot(e)||null}function zt(e){let t=0,n=-1;for(let r=0;r<e.length;r++)if("["===e[r])t++;else if("]"===e[r])t--;else if(":"===e[r]&&0===t){n=r;break}return-1===n?{variant:null,utility:e}:{variant:e.slice(0,n),utility:e.slice(n+1)}}function Mt(e,t){for(const[n,r]of Object.entries(t))e[n]=r}function Nt(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}var Dt=/* @__PURE__ */new Map,Rt=null,Pt=null;function Ft(){return Rt&&Rt.isConnected||(Rt=document.getElementById("tkx-atomic"))||((Rt=document.createElement("style")).id="tkx-atomic",document.head.appendChild(Rt)),Rt}function It(e){const t=[];for(const n of e)if(n)if("string"==typeof n)t.push(...n.split(/\s+/).filter(Boolean));else if(Array.isArray(n))t.push(...It(n));else if("object"==typeof n)for(const[e,r]of Object.entries(n))r&&t.push(e);return t}function At(...e){const t=It(e);if(0===t.length)return"";const n={base:{},variants:{}};for(const l of t){const{variant:e,utility:t}=zt(l),r=Ct(t);r&&(e?(n.variants[e]||(n.variants[e]={}),Mt(n.variants[e],r)):Mt(n.base,r))}const r=[],o=Nt(n.base),i=v([o,...Object.entries(n.variants).map(([e,t])=>`${e}{${Nt(t)}}`)].join("|")),a=`tkx-${i}`;o&&r.push(`.${a}{${o}}`);for(const[l,s]of Object.entries(n.variants)){const e=Nt(s);if(e)if(l.startsWith("@")){const t=bt[l.slice(1)];t&&r.push(`@media(min-width:${t}){.${a}{${e}}}`)}else if("motion-safe"===l)r.push(`@media(prefers-reduced-motion:no-preference){.${a}{${e}}}`);else if("motion-reduce"===l)r.push(`@media(prefers-reduced-motion:reduce){.${a}{${e}}}`);else if("contrast-more"===l)r.push(`@media(prefers-contrast:more){.${a}{${e}}}`);else if("forced-colors"===l)r.push(`@media(forced-colors:active){.${a}{${e}}}`);else if("dark"===l)r.push(`@media(prefers-color-scheme:dark){.${a}{${e}}}`);else if("print"===l)r.push(`@media print{.${a}{${e}}}`);else if("group-hover"===l)r.push(`.group:hover .${a}{${e}}`);else if("group-focus"===l)r.push(`.group:focus-within .${a}{${e}}`);else if("peer-hover"===l)r.push(`.peer:hover~.${a}{${e}}`);else{const t={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"}[l]??`:${l}`;r.push(`.${a}${t}{${e}}`)}}return r.length>0&&function(e,t){if(Dt.has(e))return;if(Dt.set(e,t),"undefined"==typeof document)return;const n=function(){if(Pt)return Pt;try{const e=new CSSStyleSheet;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],Pt=e,e}catch{return null}}();if(n){const e=function(e){const t=[];let n=0,r=0;for(let o=0;o<e.length;o++)if("{"===e[o])n++;else if("}"===e[o]&&(n--,0===n)){const n=e.slice(r,o+1).trim();n&&t.push(n),r=o+1}return t}(t);for(const t of e)try{n.insertRule(t,n.cssRules.length)}catch{Ft().textContent+=t+"\n"}}else Ft().textContent+=t+"\n"}(i,r.join("")),a}var Lt=At;function Tt(){return Array.from(Dt.values()).join("\n")}function Wt(){Dt.clear(),Rt=null,Pt&&"undefined"!=typeof document&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==Pt),Pt=null)}function jt(...e){return e.filter(Boolean).join(" ")}var Et=/* @__PURE__ */new Map;function Bt(e){Et.set(e.name,e.utilities)}function Vt(e){Et.delete(e)}function Ht(){return Array.from(Et.keys())}function Ot(e){for(const t of Et.values())if(t[e])return t[e];return null}var qt={sm:"text-xs font-semibold",md:"text-sm font-semibold",lg:"text-base font-semibold",xl:"text-lg font-semibold"},Ut={sm:"py-1.5 px-3",md:"py-2 px-4",lg:"py-2.5 px-5",xl:"py-3 px-6"},Kt={sm:"min-h-[32px]",md:"min-h-[40px]",lg:"min-h-[48px]",xl:"min-h-[56px]"},Yt={sm:14,md:16,lg:18,xl:20};function Xt({size:e}){const t=Yt[e];/* @__PURE__ */
2
2
  return b("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:At("animate-spin shrink-0"),children:[/* @__PURE__ */x("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeOpacity:"0.25"}),/* @__PURE__ */x("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}var Zt=i(({variant:e="solid",size:t="md",colorScheme:n="primary",isLoading:r=!1,loadingText:o,leftIcon:i,rightIcon:a,isFullWidth:l=!1,glow:s=!1,disabled:d,isDisabled:c,children:u,className:p,style:h,...f},m)=>{globalThis.process;const y=se(),v=et(),w=(d??c??!1)||r,k={primary:y.primary,secondary:y.secondary,danger:y.danger,warning:y.warning,success:y.success}[n],$=Y(k,["#ffffff","#000000",y.bg]),S="string"==typeof u?ke(u):u,C=o?ke(o):void 0,z="solid"===e?{backgroundColor:k,color:$,border:"none",boxShadow:s&&!v?`0 0 20px ${k}55`:void 0}:"outline"===e?{backgroundColor:"transparent",color:k,border:`2px solid ${k}`}:"ghost"===e?{backgroundColor:"transparent",color:k,border:"none"}:{backgroundColor:"transparent",color:k,border:"none",textDecoration:"underline"};/* @__PURE__ */
3
3
  return x("button",{ref:m,"aria-busy":r,"aria-disabled":w,disabled:w,className:jt(At("inline-flex items-center justify-center gap-2","rounded-lg font-sans font-semibold","select-none relative overflow-hidden",qt[t],Ut[t],Kt[t],"link"!==e&&Kt[t],l&&"w-full",w?"cursor-not-allowed opacity-60":"cursor-pointer",!v&&"transition-all duration-200","focus-visible:focus-ring"),p),style:{...z,...h},...f,children:/* @__PURE__ */b(g,r?{children:[/* @__PURE__ */x(Xt,{size:t}),C??S]}:{children:[i&&/* @__PURE__ */x("span",{"aria-hidden":"true",children:i}),S,a&&/* @__PURE__ */x("span",{"aria-hidden":"true",children:a})]})})});Zt.displayName="TkxButton";var Gt={none:"",sm:"p-3",md:"p-5",lg:"p-7"},_t=i(({variant:e="default",isHoverable:t,isClickable:n,padding:r="md",as:o,children:i,className:a,style:l,...s},d)=>{const c=se(),u=et(),p=o??(n?"button":"div"),h={default:{backgroundColor:c.surface,border:`1px solid ${c.border}`},glass:{backgroundColor:`${c.surface}cc`,backdropFilter:"blur(12px)",border:`1px solid ${c.border}55`,boxShadow:`0 4px 24px ${c.bg}40`},quantum:{backgroundColor:c.surfaceAlt,border:`1px solid ${c.primary}33`,boxShadow:`0 0 24px ${c.primary}18`},elevated:{backgroundColor:c.surface,boxShadow:`0 4px 20px ${c.bg}60`},outlined:{backgroundColor:"transparent",border:`2px solid ${c.border}`}}[e];/* @__PURE__ */
4
4
  return x(p,{ref:d,className:jt("tkx-card",At("rounded-xl w-full text-left block font-sans focus-visible:focus-ring",Gt[r],(t||n)&&!u&&"transition-transform duration-150 hover:scale-[1.01]",n?"cursor-pointer":"cursor-default"),a),style:{color:c.text,...h,...l},...s,children:i})});function Jt({title:e,subtitle:t,action:n,children:r,className:o,...i}){const a=se();/* @__PURE__ */
@@ -20,16 +20,16 @@ return b("div",{role:"danger"===e||"warning"===e?"alert":"status",className:At("
20
20
  /* @__PURE__ */x("div",{className:At("flex-1 overflow-y-auto px-6 py-6 font-sans"),style:{color:c.text},children:a}),l&&/* @__PURE__ */x("div",{className:At("flex justify-end gap-2 px-6 py-4 shrink-0"),style:{borderTop:`1px solid ${c.border}`},children:l})]})]}),document.body):null}var Cn=r(null);function zn(){const e=l(Cn);if(!e)throw new Error("TkxTab must be used inside TkxTabs");return e}function Mn({defaultIndex:e=0,activeIndex:t,onChange:n,children:r,tabCount:o=0,style:i,className:a}){const[l,s]=m(e),c=d(),u=void 0!==t?t:l;/* @__PURE__ */
21
21
  return x(Cn.Provider,{value:{activeIndex:u,setActiveIndex:e=>{void 0===t&&s(e),n?.(e)},baseId:c,tabCount:o},children:/* @__PURE__ */x("div",{className:a,style:i,children:r})})}function Nn({children:e,className:t,style:n,...r}){const o=se();/* @__PURE__ */
22
22
  return x("div",{role:"tablist",className:jt(At("flex gap-1"),t),style:{borderBottom:`2px solid ${o.border}`,...n},...r,children:e})}function Dn({index:e,children:t,disabled:n=!1,className:r,style:o}){const i=se(),{activeIndex:a,setActiveIndex:l,baseId:s,tabCount:d}=zn(),c=f(null),u=a===e;/* @__PURE__ */
23
- return x("button",{ref:c,role:"tab",id:`${s}-tab-${e}`,"aria-controls":`${s}-panel-${e}`,"aria-selected":u,tabIndex:u?0:-1,disabled:n,className:jt(At("border-none bg-transparent font-sans text-sm rounded-t cursor-pointer select-none","py-2.5 px-4 transition-colors duration-150 focus-visible:focus-ring",n?"opacity-50 cursor-not-allowed":""),r),style:{color:u?i.primary:i.textMuted,fontWeight:u?600:400,borderBottom:u?`2px solid ${i.primary}`:"2px solid transparent",marginBottom:"-2px",...o},onClick:()=>!n&&l(e),onKeyDown:t=>_(t,e,d,e=>{l(e),document.getElementById(`${s}-tab-${e}`)?.focus()}),children:t})}function Pn({children:e,className:t,...n}){/* @__PURE__ */
24
- return x("div",{className:t,...n,children:e})}function Rn({index:e,children:t,style:n,className:r}){const{activeIndex:o,baseId:i}=zn();return o!==e?null:/* @__PURE__ */x("div",{role:"tabpanel",id:`${i}-panel-${e}`,"aria-labelledby":`${i}-tab-${e}`,tabIndex:0,className:jt(At("pt-4"),r),style:n,children:t})}var Fn={top:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:6},bottom:{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:6},left:{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:6},right:{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:6}};function In({content:e,children:t,placement:r="top",delay:o=300}){const i=se(),[a,l]=m(!1),c=f(null),u=d(),p=f(null),h=et(),g=ke(e),y=Y(i.surfaceAlt,[i.text,"#ffffff","#000000"]);function v(){p.current=setTimeout(()=>l(!0),o)}function w(){p.current&&clearTimeout(p.current),l(!1)}ot(w,a),it(c,w),s(()=>()=>{p.current&&(clearTimeout(p.current),p.current=null)},[]);const k=t,$=n(k,{"aria-describedby":a?u:void 0,onMouseEnter:e=>{k.props.onMouseEnter?.(e),v()},onMouseLeave:e=>{k.props.onMouseLeave?.(e),w()},onFocus:e=>{k.props.onFocus?.(e),v()},onBlur:e=>{k.props.onBlur?.(e),w()}});/* @__PURE__ */
23
+ return x("button",{ref:c,role:"tab",id:`${s}-tab-${e}`,"aria-controls":`${s}-panel-${e}`,"aria-selected":u,tabIndex:u?0:-1,disabled:n,className:jt(At("border-none bg-transparent font-sans text-sm rounded-t cursor-pointer select-none","py-2.5 px-4 transition-colors duration-150 focus-visible:focus-ring",n?"opacity-50 cursor-not-allowed":""),r),style:{color:u?i.primary:i.textMuted,fontWeight:u?600:400,borderBottom:u?`2px solid ${i.primary}`:"2px solid transparent",marginBottom:"-2px",...o},onClick:()=>!n&&l(e),onKeyDown:t=>_(t,e,d,e=>{l(e),document.getElementById(`${s}-tab-${e}`)?.focus()}),children:t})}function Rn({children:e,className:t,...n}){/* @__PURE__ */
24
+ return x("div",{className:t,...n,children:e})}function Pn({index:e,children:t,style:n,className:r}){const{activeIndex:o,baseId:i}=zn();return o!==e?null:/* @__PURE__ */x("div",{role:"tabpanel",id:`${i}-panel-${e}`,"aria-labelledby":`${i}-tab-${e}`,tabIndex:0,className:jt(At("pt-4"),r),style:n,children:t})}var Fn={top:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:6},bottom:{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:6},left:{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:6},right:{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:6}};function In({content:e,children:t,placement:r="top",delay:o=300}){const i=se(),[a,l]=m(!1),c=f(null),u=d(),p=f(null),h=et(),g=ke(e),y=Y(i.surfaceAlt,[i.text,"#ffffff","#000000"]);function v(){p.current=setTimeout(()=>l(!0),o)}function w(){p.current&&clearTimeout(p.current),l(!1)}ot(w,a),it(c,w),s(()=>()=>{p.current&&(clearTimeout(p.current),p.current=null)},[]);const k=t,$=n(k,{"aria-describedby":a?u:void 0,onMouseEnter:e=>{k.props.onMouseEnter?.(e),v()},onMouseLeave:e=>{k.props.onMouseLeave?.(e),w()},onFocus:e=>{k.props.onFocus?.(e),v()},onBlur:e=>{k.props.onBlur?.(e),w()}});/* @__PURE__ */
25
25
  return b("span",{ref:c,className:At("relative inline-flex"),children:[$,a&&/* @__PURE__ */x("span",{id:u,role:"tooltip",className:At("absolute z-[9000] text-xs font-sans py-1.5 px-2.5 rounded-md whitespace-nowrap pointer-events-none",!h&&"animate-fade-in"),style:{backgroundColor:i.surfaceAlt,color:y,border:`1px solid ${i.border}`,boxShadow:`0 4px 12px ${i.bg}40`,maxWidth:280,...Fn[r]},children:g})]})}function An({variant:e,width:t,height:n,animation:r,bgColor:o,accentColor:i}){const a=void 0!==t?"number"==typeof t?`${t}px`:t:"100%",l=void 0!==n?"number"==typeof n?`${n}px`:n:{text:"1em",circular:a,rectangular:"80px"}[e],s=At("circular"===e?"rounded-full":"text"===e?"rounded":"rounded-lg"),d="pulse"===r?At("animate-pulse"):"wave"===r?At("animate-shimmer"):"",c="wave"===r?{background:`linear-gradient(90deg,${o} 25%,${i} 50%,${o} 75%)`,backgroundSize:"200% 100%"}:{backgroundColor:o};/* @__PURE__ */
26
26
  return x("div",{className:jt(s,d),style:{width:a,height:l,...c}})}var Ln=i(({variant:e="rectangular",width:t,height:n,lines:r,animation:o="pulse",className:i,style:a,...l},s)=>{const d=se(),c=!et()&&o;/* @__PURE__ */
27
27
  return x("div","text"===e&&r&&r>1?{ref:s,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:jt(At("flex flex-col gap-2"),i),style:a,...l,children:Array.from({length:r},(e,o)=>/* @__PURE__ */x(An,{variant:"text",width:o===r-1?"75%":t,height:n,animation:c,bgColor:d.surfaceAlt,accentColor:d.border},o))}:{ref:s,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:i,style:a,...l,children:/* @__PURE__ */x(An,{variant:e,width:t,height:n,animation:c,bgColor:d.surfaceAlt,accentColor:d.border})})});Ln.displayName="TkxSkeleton";var Tn={xs:24,sm:32,md:40,lg:56,xl:72},Wn={online:"#06d6a0",offline:"#8888aa",away:"#ffbe0b",busy:"#f72585"},jn=i(({src:e,alt:t,initials:n,size:r="md",shape:o="circle",status:i,className:a,style:l,...s},d)=>{const c=se(),[u,p]=m(!1),h=Tn[r],f="circle"===o,g=c.surfaceAlt,y=Y(g,[c.text,c.textMuted]),v=e&&!u,w=!v&&n,k=Math.max(8,.22*h),$=At("relative inline-flex shrink-0",f?"rounded-full":"rounded-lg"),S=At("block object-cover",f?"rounded-full":"rounded-lg"),C=At("flex items-center justify-center font-semibold font-sans select-none",f?"rounded-full":"rounded-lg");/* @__PURE__ */
28
28
  return b("div",{ref:d,className:jt($,a),style:{width:h,height:h,...l},...s,children:[v?/* @__PURE__ */x("img",{src:ke(e),alt:ke(t),onError:()=>p(!0),className:S,style:{width:h,height:h}}):/* @__PURE__ */x("div",{role:"img","aria-label":ke(t),className:C,style:{width:h,height:h,backgroundColor:g,color:y,fontSize:.38*h},children:w?ke(n).slice(0,2).toUpperCase():/* @__PURE__ */b("svg",{width:.5*h,height:.5*h,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[/* @__PURE__ */x("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),/* @__PURE__ */x("circle",{cx:"12",cy:"7",r:"4"})]})}),i&&/* @__PURE__ */x("span",{"aria-label":`Status: ${i}`,className:At("absolute bottom-0 right-0 rounded-full"),style:{width:k,height:k,backgroundColor:Wn[i],border:`2px solid ${c.bg}`}})]})});function En({dir:e}){/* @__PURE__ */
29
- return x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:At("shrink-0"),children:/* @__PURE__ */x("path","asc"===e?{d:"M7 14l5-5 5 5H7z"}:"desc"===e?{d:"M7 10l5 5 5-5H7z"}:{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.4"})})}function Bn({columns:e,data:t,caption:n,sortable:r,stickyHeader:o,isLoading:i,emptyState:l,style:d,className:c,striped:u,maxHeight:h,rowHeight:y=44,virtualScroll:v,onLoadMore:w,hasMore:k,loadingMore:$=!1,onRowClick:S,selectedRows:C,bordered:z,compact:M}){const N=se(),[D,P]=m(null),[R,F]=m("asc"),I=p(()=>D&&r?[...t].sort((e,t)=>{const n=e[D],r=t[D];let o=0;return"string"==typeof n&&"string"==typeof r?o=n.localeCompare(r):"number"==typeof n&&"number"==typeof r&&(o=n-r),"asc"===R?o:-o}):t,[t,D,R,r]),A=a(e=>{D===e?F(e=>"asc"===e?"desc":"asc"):(P(e),F("asc"))},[D]),L=void 0!==v?v:void 0!==h&&I.length>=50,T=f(null),[W,j]=m(0),[E,B]=m(400),V=a(()=>{T.current&&j(T.current.scrollTop)},[]);s(()=>{if(!L||!T.current)return;const e=T.current;B(e.clientHeight);const t=new ResizeObserver(()=>B(e.clientHeight));return t.observe(e),()=>t.disconnect()},[L]);const H=L?Math.max(0,Math.floor(W/y)-5):0,O=L?Math.min(I.length,Math.ceil((W+E)/y)+5):I.length,q=L?I.slice(H,O):I,U=f(null),K=f(!1);s(()=>{K.current=!1},[t.length]),s(()=>{if(!w)return;const e=U.current;if(!e)return;const t=new IntersectionObserver(e=>{e[0].isIntersecting&&!K.current&&!1!==k&&(K.current=!0,w())},{root:T.current,rootMargin:"0px 0px 200px 0px",threshold:0});return t.observe(e),()=>t.disconnect()},[w,k]);const Y=M?"4px":"12px",X=M?"8px":"16px",Z=z?`1px solid ${N.border}`:"none",G=p(()=>new Set(C??[]),[C]);/* @__PURE__ */
29
+ return x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:At("shrink-0"),children:/* @__PURE__ */x("path","asc"===e?{d:"M7 14l5-5 5 5H7z"}:"desc"===e?{d:"M7 10l5 5 5-5H7z"}:{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.4"})})}function Bn({columns:e,data:t,caption:n,sortable:r,stickyHeader:o,isLoading:i,emptyState:l,style:d,className:c,striped:u,maxHeight:h,rowHeight:y=44,virtualScroll:v,onLoadMore:w,hasMore:k,loadingMore:$=!1,onRowClick:S,selectedRows:C,bordered:z,compact:M}){const N=se(),[D,R]=m(null),[P,F]=m("asc"),I=p(()=>D&&r?[...t].sort((e,t)=>{const n=e[D],r=t[D];let o=0;return"string"==typeof n&&"string"==typeof r?o=n.localeCompare(r):"number"==typeof n&&"number"==typeof r&&(o=n-r),"asc"===P?o:-o}):t,[t,D,P,r]),A=a(e=>{D===e?F(e=>"asc"===e?"desc":"asc"):(R(e),F("asc"))},[D]),L=void 0!==v?v:void 0!==h&&I.length>=50,T=f(null),[W,j]=m(0),[E,B]=m(400),V=a(()=>{T.current&&j(T.current.scrollTop)},[]);s(()=>{if(!L||!T.current)return;const e=T.current;B(e.clientHeight);const t=new ResizeObserver(()=>B(e.clientHeight));return t.observe(e),()=>t.disconnect()},[L]);const H=L?Math.max(0,Math.floor(W/y)-5):0,O=L?Math.min(I.length,Math.ceil((W+E)/y)+5):I.length,q=L?I.slice(H,O):I,U=f(null),K=f(!1);s(()=>{K.current=!1},[t.length]),s(()=>{if(!w)return;const e=U.current;if(!e)return;const t=new IntersectionObserver(e=>{e[0].isIntersecting&&!K.current&&!1!==k&&(K.current=!0,w())},{root:T.current,rootMargin:"0px 0px 200px 0px",threshold:0});return t.observe(e),()=>t.disconnect()},[w,k]);const Y=M?"4px":"12px",X=M?"8px":"16px",Z=z?`1px solid ${N.border}`:"none",G=p(()=>new Set(C??[]),[C]);/* @__PURE__ */
30
30
  return x("div",{className:At("w-full rounded-lg",c??""),style:{border:`1px solid ${N.border}`,overflow:"hidden",...d},children:/* @__PURE__ */b("div",{ref:T,onScroll:L?V:void 0,style:{overflowX:"auto",overflowY:h?"auto":"visible",maxHeight:h??"none"},children:[
31
31
  /* @__PURE__ */b("table",{className:At("w-full font-sans text-sm"),style:{borderCollapse:"collapse",color:N.text},children:[n&&/* @__PURE__ */x("caption",{className:At("text-sm text-left p-2"),style:{color:N.textMuted},children:ke(n)}),
32
- /* @__PURE__ */x("thead",{style:o?{position:"sticky",top:0,backgroundColor:N.surfaceAlt,zIndex:1}:{backgroundColor:N.surfaceAlt},children:/* @__PURE__ */x("tr",{children:e.map(e=>{const t=r&&!1!==e.sortable,n=(o=e.key,D!==o?"none":R);var o;/* @__PURE__ */
32
+ /* @__PURE__ */x("thead",{style:o?{position:"sticky",top:0,backgroundColor:N.surfaceAlt,zIndex:1}:{backgroundColor:N.surfaceAlt},children:/* @__PURE__ */x("tr",{children:e.map(e=>{const t=r&&!1!==e.sortable,n=(o=e.key,D!==o?"none":P);var o;/* @__PURE__ */
33
33
  return x("th",{scope:"col","aria-sort":t?"none"===n?"none":"asc"===n?"ascending":"descending":void 0,className:At("text-left font-semibold whitespace-nowrap",t?"cursor-pointer select-none":""),style:{padding:`${Y} ${X}`,color:N.textMuted,borderBottom:`2px solid ${N.border}`,borderRight:Z,width:e.width},onClick:()=>t&&A(e.key),onKeyDown:n=>{!t||"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),A(e.key))},tabIndex:t?0:void 0,children:/* @__PURE__ */b("span",{className:At("inline-flex items-center gap-1.5"),children:[ke(e.header),t&&/* @__PURE__ */x(En,{dir:n})]})},String(e.key))})})}),
34
34
  /* @__PURE__ */x("tbody",{children:i?Array.from({length:5},(t,n)=>/* @__PURE__ */x("tr",{children:e.map(e=>/* @__PURE__ */x("td",{style:{padding:`${Y} ${X}`},children:/* @__PURE__ */x(Ln,{variant:"text",height:"16px"})},String(e.key)))},n)):0===I.length?/* @__PURE__ */x("tr",{children:/* @__PURE__ */x("td",{colSpan:e.length,className:At("text-center"),style:{padding:"32px 16px",color:N.textMuted},children:l??"No data available"})}):/* @__PURE__ */b(g,{children:[L&&H>0&&/* @__PURE__ */x("tr",{"aria-hidden":"true",style:{height:H*y},children:/* @__PURE__ */x("td",{colSpan:e.length,style:{padding:0,border:"none"}})}),q.map((t,n)=>{const r=H+n,o=G.has(r);/* @__PURE__ */
35
35
  return x("tr",{"aria-rowindex":r+1,"aria-selected":o||void 0,onClick:S?()=>S(t,r):void 0,onKeyDown:S?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S(t,r))}:void 0,tabIndex:S?0:void 0,className:At(S?"cursor-pointer":""),style:{backgroundColor:o?`${N.primary}22`:u&&r%2==1?N.surfaceAlt:"transparent",borderBottom:`1px solid ${N.border}`,...L?{height:y,boxSizing:"border-box"}:{}},children:e.map(e=>{const n=t[e.key],r=e.render?e.render(n,t):"string"==typeof n?ke(n):String(n??"");/* @__PURE__ */
@@ -37,18 +37,18 @@ return x("td",{style:{padding:`${Y} ${X}`,color:N.text,borderRight:Z},children:r
37
37
  /* @__PURE__ */x("hr",{className:At("flex-1 m-0 border-none"),style:{[c]:u}}),
38
38
  /* @__PURE__ */x("span",{children:s}),
39
39
  /* @__PURE__ */x("hr",{className:At("flex-1 m-0 border-none"),style:{[c]:u}})]}):/* @__PURE__ */x("hr",{ref:a,role:"separator","aria-orientation":e,className:jt(At(d?"inline-block self-stretch border-none w-0 h-full":"w-full border-none m-0"),r),style:{[c]:u,...o},...i})});Vn.displayName="TkxDivider";var Hn={sm:{py:"6px",px:"10px",fontSize:"13px",iconSize:14,tagPy:"1px",tagPx:"6px"},md:{py:"9px",px:"12px",fontSize:"14px",iconSize:16,tagPy:"2px",tagPx:"8px"},lg:{py:"12px",px:"14px",fontSize:"15px",iconSize:18,tagPy:"3px",tagPx:"10px"}};function On(e){return void 0===e?[]:Array.isArray(e)?e:[e]}function qn({size:e,color:t}){/* @__PURE__ */
40
- return b("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",style:{animation:"tkx-spin 0.7s linear infinite"},children:[/* @__PURE__ */x("style",{children:"@keyframes tkx-spin{to{transform:rotate(360deg)}}"}),/* @__PURE__ */x("path",{d:"M12 2a10 10 0 0 1 10 10"})]})}function Un({options:e,value:t,defaultValue:n,placeholder:r,size:o="md",isDisabled:i=!1,isInvalid:l=!1,label:c,hint:u,errorMessage:p,multiple:h=!1,searchable:v=!1,clearable:w=!1,isLoading:k=!1,onChange:$,renderOption:S,maxMenuHeight:C=280,virtualScroll:z,optionHeight:M=36,id:N,className:D,style:P}){const R=se(),F=yn(),I=r??F.selectPlaceholder,A=d(),L=N??A,T=`${L}-listbox`,W=`${L}-hint`,j=`${L}-error`,E=void 0!==t,[B,V]=m(On(n)),H=E?On(t):B,[O,q]=m(!1),[U,K]=m(""),[Y,X]=m(-1),[Z,G]=m(null),[_,J]=m(""),Q=f(null),ee=f(null),te=f(null),ne=f(null),re=f(null),oe=Hn[o],ie=l||!!p,ae=f(null),[le,de]=m(0),[ce,ue]=m(0),pe=a(()=>{ae.current&&de(ae.current.scrollTop)},[]);s(()=>{if(!O)return void de(0);const e=ae.current;if(!e)return;ue(e.clientHeight);const t=new ResizeObserver(()=>{ue(e.clientHeight)});return t.observe(e),()=>t.disconnect()},[O]);const he=v&&U?e.filter(e=>e.label.toLowerCase().includes(U.toLowerCase())):e,fe=he.filter(e=>!e.disabled),me=he.some(e=>!!e.group),ge=(void 0!==z?z:he.length>=100)&&!me,xe=he.length*M,be=ge?Math.max(0,Math.floor(le/M)-8):0,ye=ge?Math.min(he.length,Math.ceil((le+ce)/M)+8):he.length,ve=ge?he.slice(be,ye):he,we=be*M,$e=he.reduce((e,t)=>{const n=t.group??"";return e[n]||(e[n]=[]),e[n].push(t),e},{}),Se=a(e=>{let t;t=h?H.includes(e)?H.filter(t=>t!==e):[...H,e]:[e],E||V(t),$?.(h?t:t[0]??""),h||(q(!1),K(""),X(-1),ee.current?.focus())},[E,h,$,H]),Ce=a((e,t)=>{t.stopPropagation();const n=H.filter(t=>t!==e);E||V(n),$?.(h?n:n[0]??"")},[E,h,$,H]),ze=a(e=>{e.stopPropagation(),E||V([]),$?.(h?[]:"")},[E,h,$]),Me=a(()=>{ee.current&&O&&G(function(e,t){const n=e.getBoundingClientRect(),r=window.innerHeight-n.bottom-6,o=n.top-6,i=r>=Math.min(t,200)||r>=o?"below":"above";return{top:"below"===i?n.bottom+window.scrollY+6:n.top+window.scrollY-6-Math.min(t,280),left:n.left+window.scrollX,width:n.width,placement:i}}(ee.current,C))},[O,C]);function Ne(){if(i||k)return;q(!0);const e=fe.findIndex(e=>H.includes(e.value));X(e>=0?e:0)}s(()=>{if(O)return Me(),window.addEventListener("scroll",Me,!0),window.addEventListener("resize",Me),()=>{window.removeEventListener("scroll",Me,!0),window.removeEventListener("resize",Me)}},[O,Me]),s(()=>{if(!O)return;const e=e=>{const t=e.target;ee.current?.contains(t)||ne.current?.contains(t)||(q(!1),K(""))};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[O]),s(()=>{O&&v&&setTimeout(()=>te.current?.focus(),0)},[O,v]),s(()=>{if(O&&!(Y<0))if(ge&&ae.current){const e=Y*M,t=e+M,n=ae.current;e<n.scrollTop?n.scrollTop=e:t>n.scrollTop+n.clientHeight&&(n.scrollTop=t-n.clientHeight)}else(re.current?.querySelector(`[data-idx="${Y}"]`))?.scrollIntoView({block:"nearest"})},[Y,O,ge,M]);const De=ie?R.danger:O?R.primary:R.border,Pe=Y>=0&&fe[Y]?`${L}-opt-${fe[Y].value}`:void 0,Re=[u&&W,ie&&j].filter(Boolean).join(" ")||void 0,Fe=H.map(t=>e.find(e=>e.value===t)).filter(Boolean),Ie=O&&Z?y(/* @__PURE__ */b("div",{ref:ne,role:"listbox",id:T,"aria-label":c?ke(c):"Options","aria-multiselectable":h,style:{position:"absolute",top:Z.top,left:Z.left,width:Z.width,zIndex:9999,backgroundColor:R.surface,border:`1.5px solid ${R.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",overflow:"hidden",minWidth:Z.width,maxHeight:C,display:"flex",flexDirection:"column"},children:[v&&/* @__PURE__ */b("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${R.border}`,flexShrink:0,display:"flex",alignItems:"center",gap:6},children:[/* @__PURE__ */b("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:R.textMuted,strokeWidth:"2","aria-hidden":"true",style:{flexShrink:0},children:[/* @__PURE__ */x("circle",{cx:"11",cy:"11",r:"8"}),/* @__PURE__ */x("path",{d:"M21 21l-4.35-4.35"})]}),/* @__PURE__ */x("input",{ref:te,type:"text",value:U,onChange:e=>{K(e.target.value),X(0)},onKeyDown:e=>{switch(e.key){case"Escape":e.preventDefault(),q(!1),K(""),ee.current?.focus();break;case"ArrowDown":e.preventDefault(),X(e=>Math.min(e+1,fe.length-1));break;case"ArrowUp":e.preventDefault(),X(e=>Math.max(e-1,0));break;case"Home":e.preventDefault(),X(0);break;case"End":e.preventDefault(),X(fe.length-1);break;case"Enter":e.preventDefault(),Y>=0&&fe[Y]&&Se(fe[Y].value)}},placeholder:`${F.search}…`,"aria-label":`${F.search} options`,style:{border:"none",outline:"none",background:"transparent",color:R.text,fontSize:oe.fontSize,fontFamily:"inherit",width:"100%"}})]}),/* @__PURE__ */x("div",{ref:e=>{re.current=e,ae.current=e},onScroll:ge?pe:void 0,style:{overflowY:"auto",flexGrow:1,maxHeight:C-(v?48:0)},children:ge?/* @__PURE__ */b("div",{style:{height:xe,position:"relative"},children:[/* @__PURE__ */x("div",{style:{position:"absolute",top:we,left:0,right:0},children:ve.map(e=>{const t=fe.indexOf(e),n=t===Y,r=H.includes(e.value),o=S?S(e,r):/* @__PURE__ */b("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[/* @__PURE__ */b("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.icon&&/* @__PURE__ */x("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),/* @__PURE__ */x("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.label)})]}),e.description&&/* @__PURE__ */x("span",{style:{fontSize:"12px",color:R.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.description)})]});/* @__PURE__ */
41
- return b("div",{id:`${L}-opt-${e.value}`,"data-idx":t>=0?t:void 0,role:"option","aria-selected":r,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&Se(e.value),onMouseEnter:()=>!e.disabled&&t>=0&&X(t),style:{height:M,boxSizing:"border-box",padding:`0 ${oe.px}`,fontSize:oe.fontSize,fontFamily:"inherit",color:e.disabled?R.textMuted:R.text,backgroundColor:n?`${R.primary}22`:r?`${R.primary}12`:"transparent",cursor:e.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:e.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[o,r&&!S&&/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:R.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:/* @__PURE__ */x("path",{d:"M20 6L9 17l-5-5"})})]},e.value)})}),0===he.length&&/* @__PURE__ */x("div",{style:{padding:`${oe.py} ${oe.px}`,fontSize:oe.fontSize,fontFamily:"inherit",color:R.textMuted,textAlign:"center",position:"absolute",top:0,left:0,right:0},children:k?"Loading…":"No options found"})]}):/* @__PURE__ */b(g,{children:[Object.entries($e).map(([e,t])=>/* @__PURE__ */b("div",{children:[e&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{padding:"8px 12px 4px",fontSize:"11px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:R.textMuted,fontFamily:"inherit",position:"sticky",top:0,backgroundColor:R.surface,zIndex:1,borderBottom:`1px solid ${R.border}`},children:ke(e)}),t.map(e=>{const t=fe.indexOf(e),n=t===Y,r=H.includes(e.value),o=S?S(e,r):/* @__PURE__ */b("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[/* @__PURE__ */b("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.icon&&/* @__PURE__ */x("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),/* @__PURE__ */x("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.label)})]}),e.description&&/* @__PURE__ */x("span",{style:{fontSize:"12px",color:R.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.description)})]});/* @__PURE__ */
42
- return b("div",{id:`${L}-opt-${e.value}`,"data-idx":t>=0?t:void 0,role:"option","aria-selected":r,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&Se(e.value),onMouseEnter:()=>!e.disabled&&t>=0&&X(t),style:{padding:`${oe.py} ${oe.px}`,fontSize:oe.fontSize,fontFamily:"inherit",color:e.disabled?R.textMuted:R.text,backgroundColor:n?`${R.primary}22`:r?`${R.primary}12`:"transparent",cursor:e.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:e.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[o,r&&!S&&/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:R.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:/* @__PURE__ */x("path",{d:"M20 6L9 17l-5-5"})})]},e.value)})]},e)),0===he.length&&/* @__PURE__ */x("div",{style:{padding:`${oe.py} ${oe.px}`,fontSize:oe.fontSize,fontFamily:"inherit",color:R.textMuted,textAlign:"center"},children:k?"Loading…":"No options found"})]})})]}),document.body):null,Ae=w&&H.length>0&&!i&&!k;/* @__PURE__ */
43
- return b("div",{className:jt(At("flex flex-col gap-1 w-full"),D),style:P,children:[c&&/* @__PURE__ */x("label",{htmlFor:L,style:{fontSize:"14px",fontWeight:500,fontFamily:"inherit",color:R.text,userSelect:"none"},children:ke(c)}),
44
- /* @__PURE__ */x("div",{style:{position:"relative",width:"100%",opacity:i?.55:1},children:/* @__PURE__ */b("button",{ref:ee,id:L,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":O,"aria-controls":T,"aria-activedescendant":Pe,"aria-invalid":ie||void 0,"aria-describedby":Re,"aria-multiselectable":h,disabled:i,onClick:()=>O?q(!1):Ne(),onKeyDown:e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),O?Y>=0&&fe[Y]&&Se(fe[Y].value):Ne();break;case"Escape":e.preventDefault(),q(!1),K("");break;case"ArrowDown":e.preventDefault(),O?X(e=>Math.min(e+1,fe.length-1)):Ne();break;case"ArrowUp":e.preventDefault(),O?X(e=>Math.max(e-1,0)):Ne();break;case"Home":e.preventDefault(),O&&X(0);break;case"End":e.preventDefault(),O&&X(fe.length-1);break;default:1!==e.key.length||e.ctrlKey||e.metaKey||(O||Ne(),function(e){Q.current&&clearTimeout(Q.current);const t=_+e.toLowerCase();J(t);const n=fe.findIndex(e=>e.label.toLowerCase().startsWith(t));n>=0&&X(n),Q.current=setTimeout(()=>J(""),800)}(e.key))}},style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:h&&H.length>0?`4px ${oe.px}`:`${oe.py} ${oe.px}`,fontSize:oe.fontSize,fontFamily:"inherit",backgroundColor:R.surface,color:H.length>0?R.text:R.textMuted,border:`1.5px solid ${De}`,borderRadius:8,boxSizing:"border-box",transition:"border-color 150ms",textAlign:"left",cursor:i?"not-allowed":"pointer",outline:"none",minHeight:"sm"===o?34:"lg"===o?50:42,flexWrap:"wrap",touchAction:"manipulation"},children:[/* @__PURE__ */x("span",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4,flex:1,minWidth:0},children:h&&Fe.length>0?Fe.map(e=>/* @__PURE__ */b("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:`${oe.tagPy} ${oe.tagPx}`,fontSize:`calc(${oe.fontSize} - 1px)`,fontFamily:"inherit",backgroundColor:`${R.primary}22`,color:R.primary,borderRadius:6,border:`1px solid ${R.primary}44`,lineHeight:1.4,maxWidth:150,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[/* @__PURE__ */x("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},children:ke(e.label)}),/* @__PURE__ */x("span",{role:"button","aria-label":`Remove ${ke(e.label)}`,tabIndex:-1,onClick:t=>Ce(e.value,t),style:{cursor:"pointer",flexShrink:0,display:"flex",alignItems:"center",opacity:.8},children:/* @__PURE__ */x("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M18 6L6 18M6 6l12 12"})})})]},e.value)):!h&&H.length>0?(()=>{const t=e.find(e=>e.value===H[0]);/* @__PURE__ */
45
- return b("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},children:[t?.icon&&/* @__PURE__ */x("span",{style:{flexShrink:0,display:"flex"},children:t.icon}),t?ke(t.label):""]})})():/* @__PURE__ */x("span",{style:{opacity:.6},children:ke(I)})}),/* @__PURE__ */b("span",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,color:R.textMuted},children:[k&&/* @__PURE__ */x(qn,{size:oe.iconSize,color:R.primary}),Ae&&!k&&/* @__PURE__ */x("span",{role:"button","aria-label":F.clearSelection,tabIndex:-1,onClick:ze,style:{cursor:"pointer",display:"flex",alignItems:"center",lineHeight:1,opacity:.7,transition:"opacity 120ms"},onMouseEnter:e=>e.currentTarget.style.opacity="1",onMouseLeave:e=>e.currentTarget.style.opacity="0.7",children:/* @__PURE__ */x("svg",{width:oe.iconSize,height:oe.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M18 6L6 18M6 6l12 12"})})}),
46
- /* @__PURE__ */x("svg",{width:oe.iconSize,height:oe.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",style:{transform:O?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms",flexShrink:0},children:/* @__PURE__ */x("path",{d:"M6 9l6 6 6-6"})})]})]})}),u&&!ie&&/* @__PURE__ */x("span",{id:W,style:{fontSize:"12px",color:R.textMuted,fontFamily:"inherit"},children:ke(u)}),ie&&p&&/* @__PURE__ */b("span",{id:j,role:"alert",style:{fontSize:"12px",color:R.danger,display:"flex",alignItems:"center",gap:4,fontFamily:"inherit"},children:[/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),ke(p)]}),Ie]})}Un.displayName="TkxSelect";var Kn={sm:{box:16,fontSize:"13px",iconStroke:2.5},md:{box:20,fontSize:"14px",iconStroke:2.5},lg:{box:24,fontSize:"15px",iconStroke:2}},Yn=i(({label:e,hint:t,isInvalid:n,errorMessage:r,isIndeterminate:o=!1,size:i="md",colorScheme:a="primary",checked:l,defaultChecked:c,onChange:u,disabled:p,className:h,style:g,id:y,...v},w)=>{const k=se(),$=et(),S=d(),C=y??S,z=`${C}-hint`,M=`${C}-error`,N=f(null),[D,P]=m(!1),R=Kn[i],F=n||!!r,I={primary:k.primary,success:k.success,danger:k.danger,warning:k.warning}[a]??k.primary,A=void 0!==l?l:void 0;s(()=>{const e=w?.current??N.current;e&&(e.indeterminate=o)},[o,w]);const L=o||(A??!1),T=L?I:k.surface,W=F?k.danger:L?I:k.border,j=Y(I),E=D?{outline:`2px solid ${I}`,outlineOffset:"2px"}:{},B=[t&&z,F&&M].filter(Boolean).join(" ")||void 0,V=!$&&L?{animation:"tkx-check-scale-in 120ms ease forwards"}:{};/* @__PURE__ */
40
+ return b("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",style:{animation:"tkx-spin 0.7s linear infinite"},children:[/* @__PURE__ */x("style",{children:"@keyframes tkx-spin{to{transform:rotate(360deg)}}"}),/* @__PURE__ */x("path",{d:"M12 2a10 10 0 0 1 10 10"})]})}function Un({options:e,value:t,defaultValue:n,placeholder:r,size:o="md",isDisabled:i=!1,isInvalid:l=!1,label:c,hint:u,errorMessage:p,multiple:h=!1,searchable:v=!1,clearable:w=!1,isLoading:k=!1,onChange:$,renderOption:S,maxMenuHeight:C=280,virtualScroll:z,optionHeight:M=36,id:N,className:D,style:R}){const P=se(),F=yn(),I=r??F.selectPlaceholder,A=d(),L=N??A,T=`${L}-listbox`,W=`${L}-hint`,j=`${L}-error`,E=void 0!==t,[B,V]=m(On(n)),H=E?On(t):B,[O,q]=m(!1),[U,K]=m(""),[Y,X]=m(-1),[Z,G]=m(null),[_,J]=m(""),Q=f(null),ee=f(null),te=f(null),ne=f(null),re=f(null),oe=Hn[o],ie=l||!!p,ae=f(null),[le,de]=m(0),[ce,ue]=m(0),pe=a(()=>{ae.current&&de(ae.current.scrollTop)},[]);s(()=>{if(!O)return void de(0);const e=ae.current;if(!e)return;ue(e.clientHeight);const t=new ResizeObserver(()=>{ue(e.clientHeight)});return t.observe(e),()=>t.disconnect()},[O]);const he=v&&U?e.filter(e=>e.label.toLowerCase().includes(U.toLowerCase())):e,fe=he.filter(e=>!e.disabled),me=he.some(e=>!!e.group),ge=(void 0!==z?z:he.length>=100)&&!me,xe=he.length*M,be=ge?Math.max(0,Math.floor(le/M)-8):0,ye=ge?Math.min(he.length,Math.ceil((le+ce)/M)+8):he.length,ve=ge?he.slice(be,ye):he,we=be*M,$e=he.reduce((e,t)=>{const n=t.group??"";return e[n]||(e[n]=[]),e[n].push(t),e},{}),Se=a(e=>{let t;t=h?H.includes(e)?H.filter(t=>t!==e):[...H,e]:[e],E||V(t),$?.(h?t:t[0]??""),h||(q(!1),K(""),X(-1),ee.current?.focus())},[E,h,$,H]),Ce=a((e,t)=>{t.stopPropagation();const n=H.filter(t=>t!==e);E||V(n),$?.(h?n:n[0]??"")},[E,h,$,H]),ze=a(e=>{e.stopPropagation(),E||V([]),$?.(h?[]:"")},[E,h,$]),Me=a(()=>{ee.current&&O&&G(function(e,t){const n=e.getBoundingClientRect(),r=window.innerHeight-n.bottom-6,o=n.top-6,i=r>=Math.min(t,200)||r>=o?"below":"above";return{top:"below"===i?n.bottom+window.scrollY+6:n.top+window.scrollY-6-Math.min(t,280),left:n.left+window.scrollX,width:n.width,placement:i}}(ee.current,C))},[O,C]);function Ne(){if(i||k)return;q(!0);const e=fe.findIndex(e=>H.includes(e.value));X(e>=0?e:0)}s(()=>{if(O)return Me(),window.addEventListener("scroll",Me,!0),window.addEventListener("resize",Me),()=>{window.removeEventListener("scroll",Me,!0),window.removeEventListener("resize",Me)}},[O,Me]),s(()=>{if(!O)return;const e=e=>{const t=e.target;ee.current?.contains(t)||ne.current?.contains(t)||(q(!1),K(""))};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[O]),s(()=>{O&&v&&setTimeout(()=>te.current?.focus(),0)},[O,v]),s(()=>{if(O&&!(Y<0))if(ge&&ae.current){const e=Y*M,t=e+M,n=ae.current;e<n.scrollTop?n.scrollTop=e:t>n.scrollTop+n.clientHeight&&(n.scrollTop=t-n.clientHeight)}else(re.current?.querySelector(`[data-idx="${Y}"]`))?.scrollIntoView({block:"nearest"})},[Y,O,ge,M]);const De=ie?P.danger:O?P.primary:P.border,Re=Y>=0&&fe[Y]?`${L}-opt-${fe[Y].value}`:void 0,Pe=[u&&W,ie&&j].filter(Boolean).join(" ")||void 0,Fe=H.map(t=>e.find(e=>e.value===t)).filter(Boolean),Ie=O&&Z?y(/* @__PURE__ */b("div",{ref:ne,role:"listbox",id:T,"aria-label":c?ke(c):"Options","aria-multiselectable":h,style:{position:"absolute",top:Z.top,left:Z.left,width:Z.width,zIndex:9999,backgroundColor:P.surface,border:`1.5px solid ${P.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",overflow:"hidden",minWidth:Z.width,maxHeight:C,display:"flex",flexDirection:"column"},children:[v&&/* @__PURE__ */b("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${P.border}`,flexShrink:0,display:"flex",alignItems:"center",gap:6},children:[/* @__PURE__ */b("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:P.textMuted,strokeWidth:"2","aria-hidden":"true",style:{flexShrink:0},children:[/* @__PURE__ */x("circle",{cx:"11",cy:"11",r:"8"}),/* @__PURE__ */x("path",{d:"M21 21l-4.35-4.35"})]}),/* @__PURE__ */x("input",{ref:te,type:"text",value:U,onChange:e=>{K(e.target.value),X(0)},onKeyDown:e=>{switch(e.key){case"Escape":e.preventDefault(),q(!1),K(""),ee.current?.focus();break;case"ArrowDown":e.preventDefault(),X(e=>Math.min(e+1,fe.length-1));break;case"ArrowUp":e.preventDefault(),X(e=>Math.max(e-1,0));break;case"Home":e.preventDefault(),X(0);break;case"End":e.preventDefault(),X(fe.length-1);break;case"Enter":e.preventDefault(),Y>=0&&fe[Y]&&Se(fe[Y].value)}},placeholder:`${F.search}…`,"aria-label":`${F.search} options`,style:{border:"none",outline:"none",background:"transparent",color:P.text,fontSize:oe.fontSize,fontFamily:"inherit",width:"100%"}})]}),/* @__PURE__ */x("div",{ref:e=>{re.current=e,ae.current=e},onScroll:ge?pe:void 0,style:{overflowY:"auto",flexGrow:1,maxHeight:C-(v?48:0)},children:ge?/* @__PURE__ */b("div",{style:{height:xe,position:"relative"},children:[/* @__PURE__ */x("div",{style:{position:"absolute",top:we,left:0,right:0},children:ve.map(e=>{const t=fe.indexOf(e),n=t===Y,r=H.includes(e.value),o=S?S(e,r):/* @__PURE__ */b("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[/* @__PURE__ */b("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.icon&&/* @__PURE__ */x("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),/* @__PURE__ */x("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.label)})]}),e.description&&/* @__PURE__ */x("span",{style:{fontSize:"12px",color:P.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.description)})]});/* @__PURE__ */
41
+ return b("div",{id:`${L}-opt-${e.value}`,"data-idx":t>=0?t:void 0,role:"option","aria-selected":r,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&Se(e.value),onMouseEnter:()=>!e.disabled&&t>=0&&X(t),style:{height:M,boxSizing:"border-box",padding:`0 ${oe.px}`,fontSize:oe.fontSize,fontFamily:"inherit",color:e.disabled?P.textMuted:P.text,backgroundColor:n?`${P.primary}22`:r?`${P.primary}12`:"transparent",cursor:e.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:e.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[o,r&&!S&&/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:P.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:/* @__PURE__ */x("path",{d:"M20 6L9 17l-5-5"})})]},e.value)})}),0===he.length&&/* @__PURE__ */x("div",{style:{padding:`${oe.py} ${oe.px}`,fontSize:oe.fontSize,fontFamily:"inherit",color:P.textMuted,textAlign:"center",position:"absolute",top:0,left:0,right:0},children:k?"Loading…":"No options found"})]}):/* @__PURE__ */b(g,{children:[Object.entries($e).map(([e,t])=>/* @__PURE__ */b("div",{children:[e&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{padding:"8px 12px 4px",fontSize:"11px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:P.textMuted,fontFamily:"inherit",position:"sticky",top:0,backgroundColor:P.surface,zIndex:1,borderBottom:`1px solid ${P.border}`},children:ke(e)}),t.map(e=>{const t=fe.indexOf(e),n=t===Y,r=H.includes(e.value),o=S?S(e,r):/* @__PURE__ */b("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[/* @__PURE__ */b("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.icon&&/* @__PURE__ */x("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),/* @__PURE__ */x("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.label)})]}),e.description&&/* @__PURE__ */x("span",{style:{fontSize:"12px",color:P.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.description)})]});/* @__PURE__ */
42
+ return b("div",{id:`${L}-opt-${e.value}`,"data-idx":t>=0?t:void 0,role:"option","aria-selected":r,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&Se(e.value),onMouseEnter:()=>!e.disabled&&t>=0&&X(t),style:{padding:`${oe.py} ${oe.px}`,fontSize:oe.fontSize,fontFamily:"inherit",color:e.disabled?P.textMuted:P.text,backgroundColor:n?`${P.primary}22`:r?`${P.primary}12`:"transparent",cursor:e.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:e.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[o,r&&!S&&/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:P.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:/* @__PURE__ */x("path",{d:"M20 6L9 17l-5-5"})})]},e.value)})]},e)),0===he.length&&/* @__PURE__ */x("div",{style:{padding:`${oe.py} ${oe.px}`,fontSize:oe.fontSize,fontFamily:"inherit",color:P.textMuted,textAlign:"center"},children:k?"Loading…":"No options found"})]})})]}),document.body):null,Ae=w&&H.length>0&&!i&&!k;/* @__PURE__ */
43
+ return b("div",{className:jt(At("flex flex-col gap-1 w-full"),D),style:R,children:[c&&/* @__PURE__ */x("label",{htmlFor:L,style:{fontSize:"14px",fontWeight:500,fontFamily:"inherit",color:P.text,userSelect:"none"},children:ke(c)}),
44
+ /* @__PURE__ */x("div",{style:{position:"relative",width:"100%",opacity:i?.55:1},children:/* @__PURE__ */b("button",{ref:ee,id:L,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":O,"aria-controls":T,"aria-activedescendant":Re,"aria-invalid":ie||void 0,"aria-describedby":Pe,"aria-multiselectable":h,disabled:i,onClick:()=>O?q(!1):Ne(),onKeyDown:e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),O?Y>=0&&fe[Y]&&Se(fe[Y].value):Ne();break;case"Escape":e.preventDefault(),q(!1),K("");break;case"ArrowDown":e.preventDefault(),O?X(e=>Math.min(e+1,fe.length-1)):Ne();break;case"ArrowUp":e.preventDefault(),O?X(e=>Math.max(e-1,0)):Ne();break;case"Home":e.preventDefault(),O&&X(0);break;case"End":e.preventDefault(),O&&X(fe.length-1);break;default:1!==e.key.length||e.ctrlKey||e.metaKey||(O||Ne(),function(e){Q.current&&clearTimeout(Q.current);const t=_+e.toLowerCase();J(t);const n=fe.findIndex(e=>e.label.toLowerCase().startsWith(t));n>=0&&X(n),Q.current=setTimeout(()=>J(""),800)}(e.key))}},style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:h&&H.length>0?`4px ${oe.px}`:`${oe.py} ${oe.px}`,fontSize:oe.fontSize,fontFamily:"inherit",backgroundColor:P.surface,color:H.length>0?P.text:P.textMuted,border:`1.5px solid ${De}`,borderRadius:8,boxSizing:"border-box",transition:"border-color 150ms",textAlign:"left",cursor:i?"not-allowed":"pointer",outline:"none",minHeight:"sm"===o?34:"lg"===o?50:42,flexWrap:"wrap",touchAction:"manipulation"},children:[/* @__PURE__ */x("span",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4,flex:1,minWidth:0},children:h&&Fe.length>0?Fe.map(e=>/* @__PURE__ */b("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:`${oe.tagPy} ${oe.tagPx}`,fontSize:`calc(${oe.fontSize} - 1px)`,fontFamily:"inherit",backgroundColor:`${P.primary}22`,color:P.primary,borderRadius:6,border:`1px solid ${P.primary}44`,lineHeight:1.4,maxWidth:150,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[/* @__PURE__ */x("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},children:ke(e.label)}),/* @__PURE__ */x("span",{role:"button","aria-label":`Remove ${ke(e.label)}`,tabIndex:-1,onClick:t=>Ce(e.value,t),style:{cursor:"pointer",flexShrink:0,display:"flex",alignItems:"center",opacity:.8},children:/* @__PURE__ */x("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M18 6L6 18M6 6l12 12"})})})]},e.value)):!h&&H.length>0?(()=>{const t=e.find(e=>e.value===H[0]);/* @__PURE__ */
45
+ return b("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},children:[t?.icon&&/* @__PURE__ */x("span",{style:{flexShrink:0,display:"flex"},children:t.icon}),t?ke(t.label):""]})})():/* @__PURE__ */x("span",{style:{opacity:.6},children:ke(I)})}),/* @__PURE__ */b("span",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,color:P.textMuted},children:[k&&/* @__PURE__ */x(qn,{size:oe.iconSize,color:P.primary}),Ae&&!k&&/* @__PURE__ */x("span",{role:"button","aria-label":F.clearSelection,tabIndex:-1,onClick:ze,style:{cursor:"pointer",display:"flex",alignItems:"center",lineHeight:1,opacity:.7,transition:"opacity 120ms"},onMouseEnter:e=>e.currentTarget.style.opacity="1",onMouseLeave:e=>e.currentTarget.style.opacity="0.7",children:/* @__PURE__ */x("svg",{width:oe.iconSize,height:oe.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M18 6L6 18M6 6l12 12"})})}),
46
+ /* @__PURE__ */x("svg",{width:oe.iconSize,height:oe.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",style:{transform:O?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms",flexShrink:0},children:/* @__PURE__ */x("path",{d:"M6 9l6 6 6-6"})})]})]})}),u&&!ie&&/* @__PURE__ */x("span",{id:W,style:{fontSize:"12px",color:P.textMuted,fontFamily:"inherit"},children:ke(u)}),ie&&p&&/* @__PURE__ */b("span",{id:j,role:"alert",style:{fontSize:"12px",color:P.danger,display:"flex",alignItems:"center",gap:4,fontFamily:"inherit"},children:[/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),ke(p)]}),Ie]})}Un.displayName="TkxSelect";var Kn={sm:{box:16,fontSize:"13px",iconStroke:2.5},md:{box:20,fontSize:"14px",iconStroke:2.5},lg:{box:24,fontSize:"15px",iconStroke:2}},Yn=i(({label:e,hint:t,isInvalid:n,errorMessage:r,isIndeterminate:o=!1,size:i="md",colorScheme:a="primary",checked:l,defaultChecked:c,onChange:u,disabled:p,className:h,style:g,id:y,...v},w)=>{const k=se(),$=et(),S=d(),C=y??S,z=`${C}-hint`,M=`${C}-error`,N=f(null),[D,R]=m(!1),P=Kn[i],F=n||!!r,I={primary:k.primary,success:k.success,danger:k.danger,warning:k.warning}[a]??k.primary,A=void 0!==l?l:void 0;s(()=>{const e=w?.current??N.current;e&&(e.indeterminate=o)},[o,w]);const L=o||(A??!1),T=L?I:k.surface,W=F?k.danger:L?I:k.border,j=Y(I),E=D?{outline:`2px solid ${I}`,outlineOffset:"2px"}:{},B=[t&&z,F&&M].filter(Boolean).join(" ")||void 0,V=!$&&L?{animation:"tkx-check-scale-in 120ms ease forwards"}:{};/* @__PURE__ */
47
47
  return b("div",{className:jt(At("flex flex-col gap-1"),h),style:{opacity:p?.5:1,...g},children:[
48
48
  /* @__PURE__ */x("style",{children:"\n @keyframes tkx-check-scale-in {\n from { transform: scale(0.4); opacity: 0; }\n to { transform: scale(1); opacity: 1; }\n }\n "}),
49
49
  /* @__PURE__ */b("label",{htmlFor:C,className:At("flex items-center gap-2 select-none"),style:{cursor:p?"not-allowed":"pointer",fontFamily:"inherit"},children:[
50
- /* @__PURE__ */x("input",{ref:e=>{N.current=e,"function"==typeof w?w(e):w&&(w.current=e)},id:C,type:"checkbox",checked:l,defaultChecked:c,onChange:u,disabled:p,"aria-invalid":F,"aria-describedby":B,onFocus:e=>{e.target.matches(":focus-visible")&&P(!0)},onBlur:()=>P(!1),className:At("sr-only"),...v}),
51
- /* @__PURE__ */x("span",{"aria-hidden":"true",style:{width:R.box,height:R.box,minWidth:R.box,borderRadius:"4px",border:`2px solid ${W}`,backgroundColor:T,display:"flex",alignItems:"center",justifyContent:"center",transition:$?"none":"background-color 120ms, border-color 120ms",boxSizing:"border-box",...E},children:o?/* @__PURE__ */x("span",{"aria-hidden":"true",style:{display:"block",width:.5*R.box,height:2,backgroundColor:j,borderRadius:"1px",...V}}):L?/* @__PURE__ */x("svg",{width:.6*R.box,height:.6*R.box,viewBox:"0 0 24 24",fill:"none",stroke:j,strokeWidth:R.iconStroke,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:V,children:/* @__PURE__ */x("path",{d:"M20 6L9 17l-5-5"})}):null}),e&&/* @__PURE__ */x("span",{style:{fontSize:R.fontSize,color:k.text,lineHeight:1.4},children:"string"==typeof e?ke(e):e})]}),t&&!F&&/* @__PURE__ */x("span",{id:z,className:At("text-xs ml-7"),style:{color:k.textMuted,marginLeft:R.box+8},children:ke(t)}),F&&r&&/* @__PURE__ */b("span",{id:M,role:"alert",className:At("text-xs flex items-center gap-1"),style:{color:k.danger,marginLeft:R.box+8},children:[/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),ke(r)]})]})});Yn.displayName="TkxCheckbox";var Xn=r(null),Zn={sm:{outer:16,inner:7,fontSize:"13px"},md:{outer:20,inner:9,fontSize:"14px"},lg:{outer:24,inner:11,fontSize:"15px"}},Gn=i(({label:e,hint:t,size:n="md",colorScheme:r="primary",value:o,checked:i,onChange:a,disabled:s,name:c,className:u,style:p,id:h,...f},m)=>{const g=se(),y=et(),v=d(),w=h??v,k=l(Xn),$=k?k.value===String(o??""):i??!1,S=s??k?.isDisabled??!1,C=c??k?.name??"",z=Zn[n],M={primary:g.primary,success:g.success,danger:g.danger}[r]??g.primary;Y(M);const N=$?M:g.border,D=g.surface;/* @__PURE__ */
50
+ /* @__PURE__ */x("input",{ref:e=>{N.current=e,"function"==typeof w?w(e):w&&(w.current=e)},id:C,type:"checkbox",checked:l,defaultChecked:c,onChange:u,disabled:p,"aria-invalid":F,"aria-describedby":B,onFocus:e=>{e.target.matches(":focus-visible")&&R(!0)},onBlur:()=>R(!1),className:At("sr-only"),...v}),
51
+ /* @__PURE__ */x("span",{"aria-hidden":"true",style:{width:P.box,height:P.box,minWidth:P.box,borderRadius:"4px",border:`2px solid ${W}`,backgroundColor:T,display:"flex",alignItems:"center",justifyContent:"center",transition:$?"none":"background-color 120ms, border-color 120ms",boxSizing:"border-box",...E},children:o?/* @__PURE__ */x("span",{"aria-hidden":"true",style:{display:"block",width:.5*P.box,height:2,backgroundColor:j,borderRadius:"1px",...V}}):L?/* @__PURE__ */x("svg",{width:.6*P.box,height:.6*P.box,viewBox:"0 0 24 24",fill:"none",stroke:j,strokeWidth:P.iconStroke,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:V,children:/* @__PURE__ */x("path",{d:"M20 6L9 17l-5-5"})}):null}),e&&/* @__PURE__ */x("span",{style:{fontSize:P.fontSize,color:k.text,lineHeight:1.4},children:"string"==typeof e?ke(e):e})]}),t&&!F&&/* @__PURE__ */x("span",{id:z,className:At("text-xs ml-7"),style:{color:k.textMuted,marginLeft:P.box+8},children:ke(t)}),F&&r&&/* @__PURE__ */b("span",{id:M,role:"alert",className:At("text-xs flex items-center gap-1"),style:{color:k.danger,marginLeft:P.box+8},children:[/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),ke(r)]})]})});Yn.displayName="TkxCheckbox";var Xn=r(null),Zn={sm:{outer:16,inner:7,fontSize:"13px"},md:{outer:20,inner:9,fontSize:"14px"},lg:{outer:24,inner:11,fontSize:"15px"}},Gn=i(({label:e,hint:t,size:n="md",colorScheme:r="primary",value:o,checked:i,onChange:a,disabled:s,name:c,className:u,style:p,id:h,...f},m)=>{const g=se(),y=et(),v=d(),w=h??v,k=l(Xn),$=k?k.value===String(o??""):i??!1,S=s??k?.isDisabled??!1,C=c??k?.name??"",z=Zn[n],M={primary:g.primary,success:g.success,danger:g.danger}[r]??g.primary;Y(M);const N=$?M:g.border,D=g.surface;/* @__PURE__ */
52
52
  return b("div",{className:jt(At("flex flex-col gap-0.5"),u),style:{opacity:S?.5:1,...p},children:[
53
53
  /* @__PURE__ */x("style",{children:"\n @keyframes tkx-radio-dot-in {\n from { transform: scale(0) translate(-50%, -50%); opacity: 0; }\n to { transform: scale(1) translate(-50%, -50%); opacity: 1; }\n }\n "}),
54
54
  /* @__PURE__ */b("label",{htmlFor:w,className:At("flex items-center gap-2 select-none"),style:{cursor:S?"not-allowed":"pointer",fontFamily:"inherit"},children:[
@@ -67,15 +67,15 @@ return b("div",{className:t.className,style:M(0,0,o),children:[/* @__PURE__ */b(
67
67
  return b("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[/* @__PURE__ */x("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),/* @__PURE__ */x("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function yr({isOpen:e,onClose:t,placement:n="right",size:r="md",title:o,children:i,footer:a,closeOnOverlayClick:l=!0,closeOnEsc:c=!0}){const u=se(),p=et(),h=d(),f=nt(e);if(ot(t,c&&e),s(()=>{if(e){if(1===++gr&&(document.body.style.overflow="hidden"),Ue())try{window.dispatchEvent(new CustomEvent("tkx:framed-drawer",{detail:{placement:n,at:Date.now()}}))}catch{}}else xr();return()=>{e&&xr()}},[e,n]),"undefined"==typeof document)return null;const m=function(e,t){const n=mr[t],r={position:"absolute"};return"left"===e||"right"===e?{...r,top:0,bottom:0,[e]:0,width:n,maxWidth:"100vw",height:"100%"}:{...r,left:0,right:0,[e]:0,height:n,maxHeight:"100vh",width:"100%"}}(n,r),g=function(e){switch(e){case"left":return"translateX(-100%)";case"right":return"translateX(100%)";case"top":return"translateY(-100%)";case"bottom":return"translateY(100%)"}}(n),v=p?"none":"transform 280ms cubic-bezier(0.4,0,0.2,1), opacity 280ms ease",w="string"==typeof o?ke(o):o;return y(/* @__PURE__ */b("div",{role:"presentation",className:At("fixed inset-0 z-[9000]"),style:{pointerEvents:e?"auto":"none",visibility:e?"visible":"hidden"},children:[/* @__PURE__ */x("div",{"aria-hidden":"true",onClick:l?t:void 0,className:At("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(3px)",opacity:e?1:0,transition:p?"none":"opacity 280ms ease",cursor:l?"pointer":"default"}}),/* @__PURE__ */b("div",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":o?h:void 0,className:At("absolute flex flex-col font-sans"),style:{...m,backgroundColor:u.surface,borderLeft:"right"===n?`1px solid ${u.border}`:void 0,borderRight:"left"===n?`1px solid ${u.border}`:void 0,borderTop:"bottom"===n?`1px solid ${u.border}`:void 0,borderBottom:"top"===n?`1px solid ${u.border}`:void 0,boxShadow:`0 20px 60px ${u.bg}99`,transform:e?"translate(0,0)":g,opacity:e?1:0,transition:v,willChange:"transform"},children:[void 0!==o&&/* @__PURE__ */b("div",{className:At("flex items-center justify-between px-5 py-4 shrink-0"),style:{borderBottom:`1px solid ${u.border}`},children:[/* @__PURE__ */x("h2",{id:h,className:At("m-0 text-base font-semibold leading-snug"),style:{color:u.text},children:w}),/* @__PURE__ */x("button",{onClick:t,"aria-label":"Close drawer",className:At("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:u.textMuted},children:/* @__PURE__ */x(br,{})})]}),void 0===o&&/* @__PURE__ */x("div",{className:At("flex justify-end px-3 pt-3 shrink-0"),children:/* @__PURE__ */x("button",{onClick:t,"aria-label":"Close drawer",className:At("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:u.textMuted},children:/* @__PURE__ */x(br,{})})}),
68
68
  /* @__PURE__ */x("div",{className:At("flex-1 overflow-y-auto px-5 py-4"),style:{color:u.text},children:i}),a&&/* @__PURE__ */x("div",{className:At("flex items-center justify-end gap-2 px-5 py-4 shrink-0"),style:{borderTop:`1px solid ${u.border}`},children:a})]})]}),document.body)}var vr=["Su","Mo","Tu","We","Th","Fr","Sa"],wr=["January","February","March","April","May","June","July","August","September","October","November","December"],kr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function $r(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Sr(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function Cr(e,t,n){return!(!t||!$r(e,t))||!(!n||!$r(e,n))}function zr(e,t="en-US",n){if(!e)return"";if(n){const t=String(e.getFullYear()),r=t.slice(-2),o=e.getMonth()+1,i=String(o).padStart(2,"0"),a=kr[e.getMonth()],l=wr[e.getMonth()],s=e.getDate(),d=String(s).padStart(2,"0");return n.replace(/YYYY/g,t).replace(/YY/g,r).replace(/MMMM/g,l).replace(/MMM/g,a).replace(/MM/g,i).replace(/\bM\b/g,String(o)).replace(/DD/g,d).replace(/\bD\b/g,String(s))}return e.toLocaleDateString(t,{month:"2-digit",day:"2-digit",year:"numeric"})}function Mr(e,t){return new Date(e,t+1,0).getDate()}function Nr(e){return 10*Math.floor(e/10)}function Dr({values:e,selected:t,onSelect:n,label:r,theme:o,format:i}){const a=f([]),l=f(null);s(()=>{const e=a.current[t];e&&l.current&&e.scrollIntoView({block:"nearest"})},[t]);const d=i??(e=>String(e).padStart(2,"0"));/* @__PURE__ */
69
69
  return b("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[/* @__PURE__ */x("div",{style:{fontSize:"11px",fontWeight:600,color:o.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:r}),/* @__PURE__ */x("div",{ref:l,style:{height:"160px",overflowY:"auto",width:"52px",scrollbarWidth:"thin",border:`1px solid ${o.border}`,borderRadius:"8px",padding:"4px"},children:e.map(e=>{const r=e===t;/* @__PURE__ */
70
- return x("button",{ref:t=>{a.current[e]=t},type:"button",onClick:()=>n(e),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"32px",borderRadius:"6px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:r?600:400,backgroundColor:r?o.primary:"transparent",color:r?o.bg:o.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:d(e)},e)})})]})}function Pr({year:e,month:t,today:n,mode:r,selectedDate:o,selectedRange:i,multiDates:a,hoverDate:l,focusedDate:s,isDateDisabled:d,onSelectDate:c,onHoverDate:u,onSetFocused:p,theme:h,locale:f}){const m=function(e,t){const n=new Date(e,t,1).getDay(),r=Mr(e,t),o=[],i=Mr(e,t-1);for(let l=n-1;l>=0;l--)o.push(new Date(e,t-1,i-l));for(let l=1;l<=r;l++)o.push(new Date(e,t,l));let a=1;for(;o.length<42;)o.push(new Date(e,t+1,a++));return o}(e,t);/* @__PURE__ */
71
- return b("div",{children:[/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:vr.map(e=>/* @__PURE__ */x("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:h.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:e},e))}),/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:m.map((e,m)=>{const g=e.getMonth()===t,b=$r(e,n),y=0===e.getDay()||6===e.getDay(),v=d(e),w="single"===r&&null!=o&&$r(e,o),k="multiple"===r&&a.some(t=>$r(t,e)),$="range"===r&&Cr(e,i[0],null),S="range"===r&&Cr(e,null,i[1]),C=$||S,z="range"===r&&i[0]&&!i[1]&&l?l:i[1],M="range"===r&&function(e,t,n){if(!t||!n)return!1;const r=Sr(e).getTime(),o=Sr(t).getTime(),i=Sr(n).getTime();return r>Math.min(o,i)&&r<Math.max(o,i)}(e,i[0],z),N="range"===r&&i[0]&&!i[1]&&l&&$r(e,l),D=w||k||C,P=null!=s&&$r(e,s);let R="transparent",F=g?y?`${h.text}cc`:h.text:`${h.textMuted}60`,I="none",A=400;return D||N?(R=h.primary,F=h.bg,A=600):M&&(R=`${h.primary}18`),b&&!D&&(I=`2px solid ${h.primary}`,A=600),v&&(F=`${h.textMuted}50`),P&&!D&&(I=`2px solid ${h.secondary}`),/* @__PURE__ */x("button",{type:"button","aria-label":e.toLocaleDateString(f,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),"aria-pressed":D,"aria-disabled":v,disabled:v,onClick:()=>!v&&c(e),onMouseEnter:()=>u(e),onMouseLeave:()=>u(null),onFocus:()=>p(e),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:R,color:F,border:I,fontSize:"13px",fontWeight:A,cursor:v?"not-allowed":"pointer",opacity:v?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:v?"line-through":"none",transition:"background-color 80ms ease"},children:e.getDate()},m)})})]})}function Rr({value:e,onChange:t,rangeValue:n,onRangeChange:r,multiValue:o,onMultiChange:i,mode:l="single",minDate:c,maxDate:u,disabledDates:p,locale:v="en-US",dateFormat:w,showTime:k=!1,timeValue:$,onTimeChange:S,showPresets:C=!1,customPresets:z,label:M,placeholder:N="MM/DD/YYYY",hint:D,isDisabled:P=!1,isInvalid:R=!1,errorMessage:F,numberOfMonths:I=1,id:A,className:L,style:T}){const W=se(),j=yn(),E=d(),B=A??E,V=et(),H=Sr(/* @__PURE__ */new Date),O=void 0!==e,[q,U]=m(null),K=O?e??null:q,Y=void 0!==n,[X,Z]=m([null,null]),G=Y?n:X,_=void 0!==o,[J,Q]=m([]),ee=_?o:J,[te,ne]=m("start"),re="range"===l||"single"===l&&k,[oe,ie]=m([null,null]),[ae,le]=m(null),de=K??G[0]??H,[ce,ue]=m(de.getFullYear()),[pe,he]=m(de.getMonth()),[fe,me]=m("day"),[ge,xe]=m({h:0,m:0}),be=$??ge,[ye,ve]=m(!1),[we,$e]=m(()=>{if("single"===l)return zr(K,v,w);if("range"===l){const[e,t]=G;if(e&&t)return`${zr(e,v,w)} – ${zr(t,v,w)}`}return""}),[Se,Ce]=m(null),[ze,Me]=m(null),[Ne,De]=m({top:0,left:0,flipUp:!1}),[,Pe]=h(e=>e+1,0),Re=f(null),Fe=f(null),Ie=f(null),Ae=f(!1),Le=C?420:k?480:360;s(()=>{if("single"===l)$e(zr(K,v,w));else if("range"===l){const[e,t]=G;$e(e&&t?`${zr(e,v,w)} – ${zr(t,v,w)}`:e?zr(e,v,w):"")}else"multiple"===l&&$e(ee.length>0?`${ee.length} date${1!==ee.length?"s":""} selected`:"")},[K,G,ee,l,v,w]);const Te=a(()=>{Re.current&&De(function(e,t){const n=e.getBoundingClientRect(),r=window.innerHeight,o=window.scrollY,i=window.scrollX,a=r-n.bottom<t+8&&n.top>t+8;return{top:a?o+n.top-t-4:o+n.bottom+4,left:i+n.left,flipUp:a}}(Re.current,Le))},[Le]);s(()=>{if(ye)return Te(),window.addEventListener("scroll",Te,!0),window.addEventListener("resize",Te),()=>{window.removeEventListener("scroll",Te,!0),window.removeEventListener("resize",Te)}},[ye,Te]),s(()=>{if(!ye)return;const e=e=>{Re.current?.contains(e.target)||Fe.current?.contains(e.target)||ve(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[ye]),s(()=>{if(!ye)return;const e=e=>{"Escape"===e.key&&(ve(!1),Ae.current=!0,Ie.current?.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ye]);const We=a(e=>!!(c&&Sr(e)<Sr(c))||!!(u&&Sr(e)>Sr(u))||!!p&&("function"==typeof p?p(e):p.some(t=>$r(t,e))),[c,u,p]),je=a(e=>{if(!We(e)){if("single"===l)re?le(e):(O||U(e),t?.(e),$e(zr(e,v,w)),ve(!1));else if("range"===l)if("start"===te){const t=[e,null];ie(t),Y||Z(t),r?.(t),ne("end")}else{const t=oe[0]??G[0],n=t&&e<t?[e,t]:[t,e];ie(n),re?ne("start"):(Y||Z(n),r?.(n),ne("start"),ve(!1))}else if("multiple"===l){const t=ee.some(t=>$r(t,e))?ee.filter(t=>!$r(t,e)):[...ee,e];_||Q(t),i?.(t)}Pe()}},[l,We,O,Y,_,t,r,i,te,oe,G,ee,re,v]),Ee=a(()=>{if("single"===l){const e=ae??K;O||U(e),t?.(e)}else"range"===l&&(Y||Z(oe),r?.(oe));ve(!1),ne("start")},[l,ae,oe,K,O,Y,t,r]),Be=a(()=>{le(null),ie([null,null]),ne("start"),ve(!1)},[]),Ve=z??function(e){const t={today:e?.today??"Today",yesterday:e?.yesterday??"Yesterday",last7:e?.last7Days??"Last 7 days",last30:e?.last30Days??"Last 30 days",last90:"Last 90 days",thisWeek:"This week",lastWeek:"Last week",thisMonth:e?.thisMonth??"This month",lastMonth:e?.lastMonth??"Last month"};return[{label:t.today,getValue:()=>{const e=Sr(/* @__PURE__ */new Date);return[e,e]}},{label:t.yesterday,getValue:()=>{const e=Sr(/* @__PURE__ */new Date);return e.setDate(e.getDate()-1),[e,e]}},{label:t.last7,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);return t.setDate(t.getDate()-6),[t,e]}},{label:t.last30,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);return t.setDate(t.getDate()-29),[t,e]}},{label:t.last90,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);return t.setDate(t.getDate()-89),[t,e]}},{label:t.thisWeek,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay());const n=new Date(t);return n.setDate(n.getDate()+6),[t,n]}},{label:t.lastWeek,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay()-1);const n=new Date(t);return n.setDate(n.getDate()-6),[n,t]}},{label:t.thisMonth,getValue:()=>{const e=/* @__PURE__ */new Date;return[new Date(e.getFullYear(),e.getMonth(),1),new Date(e.getFullYear(),e.getMonth()+1,0)]}},{label:t.lastMonth,getValue:()=>{const e=/* @__PURE__ */new Date;return[new Date(e.getFullYear(),e.getMonth()-1,1),new Date(e.getFullYear(),e.getMonth(),0)]}},{label:"This quarter",getValue:()=>{const e=/* @__PURE__ */new Date,t=Math.floor(e.getMonth()/3);return[new Date(e.getFullYear(),3*t,1),new Date(e.getFullYear(),3*t+3,0)]}},{label:"Last quarter",getValue:()=>{const e=/* @__PURE__ */new Date,t=Math.floor(e.getMonth()/3),n=0===t?3:t-1,r=0===t?e.getFullYear()-1:e.getFullYear();return[new Date(r,3*n,1),new Date(r,3*n+3,0)]}},{label:"This year",getValue:()=>{const e=/* @__PURE__ */(new Date).getFullYear();return[new Date(e,0,1),new Date(e,11,31)]}},{label:"Last year",getValue:()=>{const e=/* @__PURE__ */(new Date).getFullYear()-1;return[new Date(e,0,1),new Date(e,11,31)]}}]}(j),He=11===pe?0:pe+1,Oe=11===pe?ce+1:ce,qe=I>=2,Ue=M?ke(M):void 0,Ke=D?ke(D):void 0,Ye=F?ke(F):void 0,Xe=ke(N),Ze="single"===l&&null!=K||"range"===l&&(null!=G[0]||null!=G[1])||"multiple"===l&&ee.length>0,Ge="range"===l?re?oe:G:[null,null],_e=R?W.danger:ye?W.primary:W.border,Je=Array.from({length:24},(e,t)=>t),Qe=Array.from({length:60},(e,t)=>t),tt=/* @__PURE__ */b("div",{ref:Fe,role:"dialog","aria-label":"Date picker","aria-modal":"false",onKeyDown:e=>{if("day"!==fe)return;const t=Se??K??H;let n=null;if("ArrowRight"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1);else if("ArrowLeft"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1);else if("ArrowDown"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+7);else if("ArrowUp"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-7);else if("Enter"===e.key&&Se)return void je(Se);n&&(e.preventDefault(),Ce(n),n.getMonth()===pe&&n.getFullYear()===ce||(he(n.getMonth()),ue(n.getFullYear())))},style:{position:"absolute",top:Ne.top,left:Ne.left,zIndex:9999,backgroundColor:W.surface,border:`1px solid ${W.border}`,borderRadius:"14px",boxShadow:"0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",display:"flex",overflow:"hidden",minWidth:qe?"580px":"300px",maxWidth:qe&&C?"780px":qe?"620px":C?"520px":"300px",opacity:ye?1:0,transform:ye?"translateY(0) scale(1)":Ne.flipUp?"translateY(4px) scale(0.98)":"translateY(-4px) scale(0.98)",transition:V?"none":"opacity 120ms ease, transform 120ms ease",fontFamily:"inherit"},children:[C&&"range"===l&&/* @__PURE__ */b("div",{style:{width:"148px",flexShrink:0,borderRight:`1px solid ${W.border}`,padding:"8px 6px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"1px"},children:[/* @__PURE__ */x("div",{style:{fontSize:"11px",fontWeight:600,color:W.textMuted,textTransform:"uppercase",letterSpacing:"0.07em",padding:"4px 8px 8px"},children:"Quick select"}),Ve.map(e=>{const[t,n]=e.getValue(),o=Ge[0]&&Ge[1]&&$r(Ge[0],t)&&$r(Ge[1],n);/* @__PURE__ */
70
+ return x("button",{ref:t=>{a.current[e]=t},type:"button",onClick:()=>n(e),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"32px",borderRadius:"6px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:r?600:400,backgroundColor:r?o.primary:"transparent",color:r?o.bg:o.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:d(e)},e)})})]})}function Rr({year:e,month:t,today:n,mode:r,selectedDate:o,selectedRange:i,multiDates:a,hoverDate:l,focusedDate:s,isDateDisabled:d,onSelectDate:c,onHoverDate:u,onSetFocused:p,theme:h,locale:f}){const m=function(e,t){const n=new Date(e,t,1).getDay(),r=Mr(e,t),o=[],i=Mr(e,t-1);for(let l=n-1;l>=0;l--)o.push(new Date(e,t-1,i-l));for(let l=1;l<=r;l++)o.push(new Date(e,t,l));let a=1;for(;o.length<42;)o.push(new Date(e,t+1,a++));return o}(e,t);/* @__PURE__ */
71
+ return b("div",{children:[/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:vr.map(e=>/* @__PURE__ */x("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:h.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:e},e))}),/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:m.map((e,m)=>{const g=e.getMonth()===t,b=$r(e,n),y=0===e.getDay()||6===e.getDay(),v=d(e),w="single"===r&&null!=o&&$r(e,o),k="multiple"===r&&a.some(t=>$r(t,e)),$="range"===r&&Cr(e,i[0],null),S="range"===r&&Cr(e,null,i[1]),C=$||S,z="range"===r&&i[0]&&!i[1]&&l?l:i[1],M="range"===r&&function(e,t,n){if(!t||!n)return!1;const r=Sr(e).getTime(),o=Sr(t).getTime(),i=Sr(n).getTime();return r>Math.min(o,i)&&r<Math.max(o,i)}(e,i[0],z),N="range"===r&&i[0]&&!i[1]&&l&&$r(e,l),D=w||k||C,R=null!=s&&$r(e,s);let P="transparent",F=g?y?`${h.text}cc`:h.text:`${h.textMuted}60`,I="none",A=400;return D||N?(P=h.primary,F=h.bg,A=600):M&&(P=`${h.primary}18`),b&&!D&&(I=`2px solid ${h.primary}`,A=600),v&&(F=`${h.textMuted}50`),R&&!D&&(I=`2px solid ${h.secondary}`),/* @__PURE__ */x("button",{type:"button","aria-label":e.toLocaleDateString(f,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),"aria-pressed":D,"aria-disabled":v,disabled:v,onClick:()=>!v&&c(e),onMouseEnter:()=>u(e),onMouseLeave:()=>u(null),onFocus:()=>p(e),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:P,color:F,border:I,fontSize:"13px",fontWeight:A,cursor:v?"not-allowed":"pointer",opacity:v?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:v?"line-through":"none",transition:"background-color 80ms ease"},children:e.getDate()},m)})})]})}function Pr({value:e,onChange:t,rangeValue:n,onRangeChange:r,multiValue:o,onMultiChange:i,mode:l="single",minDate:c,maxDate:u,disabledDates:p,locale:v="en-US",dateFormat:w,showTime:k=!1,timeValue:$,onTimeChange:S,showPresets:C=!1,customPresets:z,label:M,placeholder:N="MM/DD/YYYY",hint:D,isDisabled:R=!1,isInvalid:P=!1,errorMessage:F,numberOfMonths:I=1,id:A,className:L,style:T}){const W=se(),j=yn(),E=d(),B=A??E,V=et(),H=Sr(/* @__PURE__ */new Date),O=void 0!==e,[q,U]=m(null),K=O?e??null:q,Y=void 0!==n,[X,Z]=m([null,null]),G=Y?n:X,_=void 0!==o,[J,Q]=m([]),ee=_?o:J,[te,ne]=m("start"),re="range"===l||"single"===l&&k,[oe,ie]=m([null,null]),[ae,le]=m(null),de=K??G[0]??H,[ce,ue]=m(de.getFullYear()),[pe,he]=m(de.getMonth()),[fe,me]=m("day"),[ge,xe]=m({h:0,m:0}),be=$??ge,[ye,ve]=m(!1),[we,$e]=m(()=>{if("single"===l)return zr(K,v,w);if("range"===l){const[e,t]=G;if(e&&t)return`${zr(e,v,w)} – ${zr(t,v,w)}`}return""}),[Se,Ce]=m(null),[ze,Me]=m(null),[Ne,De]=m({top:0,left:0,flipUp:!1}),[,Re]=h(e=>e+1,0),Pe=f(null),Fe=f(null),Ie=f(null),Ae=f(!1),Le=C?420:k?480:360;s(()=>{if("single"===l)$e(zr(K,v,w));else if("range"===l){const[e,t]=G;$e(e&&t?`${zr(e,v,w)} – ${zr(t,v,w)}`:e?zr(e,v,w):"")}else"multiple"===l&&$e(ee.length>0?`${ee.length} date${1!==ee.length?"s":""} selected`:"")},[K,G,ee,l,v,w]);const Te=a(()=>{Pe.current&&De(function(e,t){const n=e.getBoundingClientRect(),r=window.innerHeight,o=window.scrollY,i=window.scrollX,a=r-n.bottom<t+8&&n.top>t+8;return{top:a?o+n.top-t-4:o+n.bottom+4,left:i+n.left,flipUp:a}}(Pe.current,Le))},[Le]);s(()=>{if(ye)return Te(),window.addEventListener("scroll",Te,!0),window.addEventListener("resize",Te),()=>{window.removeEventListener("scroll",Te,!0),window.removeEventListener("resize",Te)}},[ye,Te]),s(()=>{if(!ye)return;const e=e=>{Pe.current?.contains(e.target)||Fe.current?.contains(e.target)||ve(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[ye]),s(()=>{if(!ye)return;const e=e=>{"Escape"===e.key&&(ve(!1),Ae.current=!0,Ie.current?.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ye]);const We=a(e=>!!(c&&Sr(e)<Sr(c))||!!(u&&Sr(e)>Sr(u))||!!p&&("function"==typeof p?p(e):p.some(t=>$r(t,e))),[c,u,p]),je=a(e=>{if(!We(e)){if("single"===l)re?le(e):(O||U(e),t?.(e),$e(zr(e,v,w)),ve(!1));else if("range"===l)if("start"===te){const t=[e,null];ie(t),Y||Z(t),r?.(t),ne("end")}else{const t=oe[0]??G[0],n=t&&e<t?[e,t]:[t,e];ie(n),re?ne("start"):(Y||Z(n),r?.(n),ne("start"),ve(!1))}else if("multiple"===l){const t=ee.some(t=>$r(t,e))?ee.filter(t=>!$r(t,e)):[...ee,e];_||Q(t),i?.(t)}Re()}},[l,We,O,Y,_,t,r,i,te,oe,G,ee,re,v]),Ee=a(()=>{if("single"===l){const e=ae??K;O||U(e),t?.(e)}else"range"===l&&(Y||Z(oe),r?.(oe));ve(!1),ne("start")},[l,ae,oe,K,O,Y,t,r]),Be=a(()=>{le(null),ie([null,null]),ne("start"),ve(!1)},[]),Ve=z??function(e){const t={today:e?.today??"Today",yesterday:e?.yesterday??"Yesterday",last7:e?.last7Days??"Last 7 days",last30:e?.last30Days??"Last 30 days",last90:"Last 90 days",thisWeek:"This week",lastWeek:"Last week",thisMonth:e?.thisMonth??"This month",lastMonth:e?.lastMonth??"Last month"};return[{label:t.today,getValue:()=>{const e=Sr(/* @__PURE__ */new Date);return[e,e]}},{label:t.yesterday,getValue:()=>{const e=Sr(/* @__PURE__ */new Date);return e.setDate(e.getDate()-1),[e,e]}},{label:t.last7,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);return t.setDate(t.getDate()-6),[t,e]}},{label:t.last30,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);return t.setDate(t.getDate()-29),[t,e]}},{label:t.last90,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);return t.setDate(t.getDate()-89),[t,e]}},{label:t.thisWeek,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay());const n=new Date(t);return n.setDate(n.getDate()+6),[t,n]}},{label:t.lastWeek,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay()-1);const n=new Date(t);return n.setDate(n.getDate()-6),[n,t]}},{label:t.thisMonth,getValue:()=>{const e=/* @__PURE__ */new Date;return[new Date(e.getFullYear(),e.getMonth(),1),new Date(e.getFullYear(),e.getMonth()+1,0)]}},{label:t.lastMonth,getValue:()=>{const e=/* @__PURE__ */new Date;return[new Date(e.getFullYear(),e.getMonth()-1,1),new Date(e.getFullYear(),e.getMonth(),0)]}},{label:"This quarter",getValue:()=>{const e=/* @__PURE__ */new Date,t=Math.floor(e.getMonth()/3);return[new Date(e.getFullYear(),3*t,1),new Date(e.getFullYear(),3*t+3,0)]}},{label:"Last quarter",getValue:()=>{const e=/* @__PURE__ */new Date,t=Math.floor(e.getMonth()/3),n=0===t?3:t-1,r=0===t?e.getFullYear()-1:e.getFullYear();return[new Date(r,3*n,1),new Date(r,3*n+3,0)]}},{label:"This year",getValue:()=>{const e=/* @__PURE__ */(new Date).getFullYear();return[new Date(e,0,1),new Date(e,11,31)]}},{label:"Last year",getValue:()=>{const e=/* @__PURE__ */(new Date).getFullYear()-1;return[new Date(e,0,1),new Date(e,11,31)]}}]}(j),He=11===pe?0:pe+1,Oe=11===pe?ce+1:ce,qe=I>=2,Ue=M?ke(M):void 0,Ke=D?ke(D):void 0,Ye=F?ke(F):void 0,Xe=ke(N),Ze="single"===l&&null!=K||"range"===l&&(null!=G[0]||null!=G[1])||"multiple"===l&&ee.length>0,Ge="range"===l?re?oe:G:[null,null],_e=P?W.danger:ye?W.primary:W.border,Je=Array.from({length:24},(e,t)=>t),Qe=Array.from({length:60},(e,t)=>t),tt=/* @__PURE__ */b("div",{ref:Fe,role:"dialog","aria-label":"Date picker","aria-modal":"false",onKeyDown:e=>{if("day"!==fe)return;const t=Se??K??H;let n=null;if("ArrowRight"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1);else if("ArrowLeft"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1);else if("ArrowDown"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+7);else if("ArrowUp"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-7);else if("Enter"===e.key&&Se)return void je(Se);n&&(e.preventDefault(),Ce(n),n.getMonth()===pe&&n.getFullYear()===ce||(he(n.getMonth()),ue(n.getFullYear())))},style:{position:"absolute",top:Ne.top,left:Ne.left,zIndex:9999,backgroundColor:W.surface,border:`1px solid ${W.border}`,borderRadius:"14px",boxShadow:"0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",display:"flex",overflow:"hidden",minWidth:qe?"580px":"300px",maxWidth:qe&&C?"780px":qe?"620px":C?"520px":"300px",opacity:ye?1:0,transform:ye?"translateY(0) scale(1)":Ne.flipUp?"translateY(4px) scale(0.98)":"translateY(-4px) scale(0.98)",transition:V?"none":"opacity 120ms ease, transform 120ms ease",fontFamily:"inherit"},children:[C&&"range"===l&&/* @__PURE__ */b("div",{style:{width:"148px",flexShrink:0,borderRight:`1px solid ${W.border}`,padding:"8px 6px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"1px"},children:[/* @__PURE__ */x("div",{style:{fontSize:"11px",fontWeight:600,color:W.textMuted,textTransform:"uppercase",letterSpacing:"0.07em",padding:"4px 8px 8px"},children:"Quick select"}),Ve.map(e=>{const[t,n]=e.getValue(),o=Ge[0]&&Ge[1]&&$r(Ge[0],t)&&$r(Ge[1],n);/* @__PURE__ */
72
72
  return x("button",{type:"button",onClick:()=>(e=>{const[t,n]=e.getValue(),o=[t,n];ie(o),Y||Z(o),r?.(o),ue(t.getFullYear()),he(t.getMonth()),ne("start"),re||ve(!1)})(e),style:{width:"100%",textAlign:"left",padding:"7px 10px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",backgroundColor:o?`${W.primary}20`:"transparent",color:o?W.primary:W.text,fontWeight:o?600:400,fontFamily:"inherit",transition:"background-color 80ms ease"},onMouseEnter:e=>{o||(e.currentTarget.style.backgroundColor=`${W.surfaceAlt}`)},onMouseLeave:e=>{o||(e.currentTarget.style.backgroundColor="transparent")},children:e.label},e.label)})]}),/* @__PURE__ */b("div",{style:{flex:1,padding:"16px",display:"flex",flexDirection:"column",gap:"12px",minWidth:0},children:[
73
73
  /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[
74
74
  /* @__PURE__ */x("button",{type:"button","aria-label":"day"===fe?"Previous month":"month"===fe?"Previous year":"Previous decade",onClick:()=>{"day"===fe?(0===pe?(he(11),ue(e=>e-1)):he(e=>e-1),me("day")):ue("month"===fe?e=>e-1:e=>e-10)},style:{border:"none",background:"transparent",cursor:"pointer",color:W.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"15 18 9 12 15 6"})})}),
75
75
  /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:["day"===fe&&/* @__PURE__ */b(g,{children:[
76
76
  /* @__PURE__ */x("button",{type:"button",onClick:()=>me("month"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:W.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:wr[pe]}),
77
77
  /* @__PURE__ */x("button",{type:"button",onClick:()=>me("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:W.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:ce}),qe&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("span",{style:{color:W.textMuted,fontSize:"14px"},children:"–"}),/* @__PURE__ */b("span",{style:{fontSize:"14px",fontWeight:600,color:W.text},children:[wr[He]," ",Oe]})]})]}),"month"===fe&&/* @__PURE__ */x("button",{type:"button",onClick:()=>me("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:W.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:ce}),"year"===fe&&/* @__PURE__ */b("span",{style:{fontSize:"14px",fontWeight:600,color:W.text},children:[Nr(ce),"–",Nr(ce)+9]})]}),
78
- /* @__PURE__ */x("button",{type:"button","aria-label":"day"===fe?"Next month":"month"===fe?"Next year":"Next decade",onClick:()=>{"day"===fe?(11===pe?(he(0),ue(e=>e+1)):he(e=>e+1),me("day")):ue("month"===fe?e=>e+1:e=>e+10)},style:{border:"none",background:"transparent",cursor:"pointer",color:W.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"9 18 15 12 9 6"})})})]}),"day"===fe&&/* @__PURE__ */b("div",{style:{display:"flex",gap:"20px"},children:[/* @__PURE__ */x(Pr,{year:ce,month:pe,today:H,mode:l,selectedDate:K,selectedRange:Ge,multiDates:ee,hoverDate:ze,focusedDate:Se,isDateDisabled:We,onSelectDate:je,onHoverDate:Me,onSetFocused:Ce,theme:W,locale:v}),qe&&/* @__PURE__ */x(Pr,{year:Oe,month:He,today:H,mode:l,selectedDate:K,selectedRange:Ge,multiDates:ee,hoverDate:ze,focusedDate:Se,isDateDisabled:We,onSelectDate:je,onHoverDate:Me,onSetFocused:Ce,theme:W,locale:v})]}),"month"===fe&&/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"6px"},children:kr.map((e,t)=>{const n=t===pe;/* @__PURE__ */
78
+ /* @__PURE__ */x("button",{type:"button","aria-label":"day"===fe?"Next month":"month"===fe?"Next year":"Next decade",onClick:()=>{"day"===fe?(11===pe?(he(0),ue(e=>e+1)):he(e=>e+1),me("day")):ue("month"===fe?e=>e+1:e=>e+10)},style:{border:"none",background:"transparent",cursor:"pointer",color:W.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"9 18 15 12 9 6"})})})]}),"day"===fe&&/* @__PURE__ */b("div",{style:{display:"flex",gap:"20px"},children:[/* @__PURE__ */x(Rr,{year:ce,month:pe,today:H,mode:l,selectedDate:K,selectedRange:Ge,multiDates:ee,hoverDate:ze,focusedDate:Se,isDateDisabled:We,onSelectDate:je,onHoverDate:Me,onSetFocused:Ce,theme:W,locale:v}),qe&&/* @__PURE__ */x(Rr,{year:Oe,month:He,today:H,mode:l,selectedDate:K,selectedRange:Ge,multiDates:ee,hoverDate:ze,focusedDate:Se,isDateDisabled:We,onSelectDate:je,onHoverDate:Me,onSetFocused:Ce,theme:W,locale:v})]}),"month"===fe&&/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"6px"},children:kr.map((e,t)=>{const n=t===pe;/* @__PURE__ */
79
79
  return x("button",{type:"button",onClick:()=>{he(t),me("day")},style:{padding:"10px",borderRadius:"8px",border:t!==H.getMonth()||ce!==H.getFullYear()||n?"none":`2px solid ${W.primary}`,cursor:"pointer",fontSize:"13px",fontWeight:n?600:400,backgroundColor:n?W.primary:"transparent",color:n?W.bg:W.text,fontFamily:"inherit",transition:"background-color 80ms ease"},children:e},e)})}),"year"===fe&&/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"6px"},children:Array.from({length:12},(e,t)=>{const n=Nr(ce)-1+t,r=n===ce,o=n===H.getFullYear(),i=0===t||11===t;/* @__PURE__ */
80
80
  return x("button",{type:"button",onClick:()=>{ue(n),me("month")},style:{padding:"10px 6px",borderRadius:"8px",border:o&&!r?`2px solid ${W.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:r?600:400,backgroundColor:r?W.primary:"transparent",color:r?W.bg:i?W.textMuted:W.text,fontFamily:"inherit",transition:"background-color 80ms ease",opacity:i?.5:1},children:n},n)})}),k&&"day"===fe&&/* @__PURE__ */b("div",{style:{borderTop:`1px solid ${W.border}`,paddingTop:"12px",display:"flex",alignItems:"flex-start",gap:"8px",justifyContent:"center"},children:[
81
81
  /* @__PURE__ */x(Dr,{values:Je,selected:be.h,onSelect:e=>{$||xe(t=>({...t,h:e})),S?.({...be,h:e})},label:"Hour",theme:W}),
@@ -83,29 +83,29 @@ return x("button",{type:"button",onClick:()=>{ue(n),me("month")},style:{padding:
83
83
  /* @__PURE__ */x(Dr,{values:Qe,selected:be.m,onSelect:e=>{$||xe(t=>({...t,m:e})),S?.({...be,m:e})},label:"Min",theme:W})]}),"multiple"===l&&"day"===fe&&ee.length>0&&/* @__PURE__ */b("div",{style:{borderTop:`1px solid ${W.border}`,paddingTop:"8px",fontSize:"12px",color:W.textMuted,textAlign:"center"},children:[ee.length," date",1!==ee.length?"s":""," selected"]}),
84
84
  /* @__PURE__ */b("div",{style:{borderTop:`1px solid ${W.border}`,paddingTop:"10px",display:"flex",alignItems:"center",justifyContent:re?"space-between":"flex-start",gap:"8px"},children:[/* @__PURE__ */x("button",{type:"button",onClick:()=>{ue(H.getFullYear()),he(H.getMonth()),me("day"),je(H)},style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"13px",color:W.primary,fontWeight:500,padding:"6px 10px",borderRadius:"6px",fontFamily:"inherit"},children:"Today"}),re&&/* @__PURE__ */b("div",{style:{display:"flex",gap:"6px"},children:[/* @__PURE__ */x("button",{type:"button",onClick:Be,style:{padding:"6px 14px",borderRadius:"7px",border:`1px solid ${W.border}`,cursor:"pointer",fontSize:"13px",fontWeight:500,backgroundColor:"transparent",color:W.text,fontFamily:"inherit"},children:"Cancel"}),/* @__PURE__ */x("button",{type:"button",onClick:Ee,style:{padding:"6px 14px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:600,backgroundColor:W.primary,color:W.bg,fontFamily:"inherit"},children:"Apply"})]})]})]})]});/* @__PURE__ */
85
85
  return b("div",{className:L,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...T},children:[Ue&&/* @__PURE__ */x("label",{htmlFor:B,style:{fontSize:"13px",fontWeight:500,color:W.text,marginBottom:"2px"},children:Ue}),
86
- /* @__PURE__ */b("div",{ref:Re,style:{display:"flex",alignItems:"center",border:`1.5px solid ${_e}`,borderRadius:"8px",backgroundColor:W.surface,overflow:"hidden",transition:V?"none":"border-color 120ms ease",opacity:P?.5:1},children:[
86
+ /* @__PURE__ */b("div",{ref:Pe,style:{display:"flex",alignItems:"center",border:`1.5px solid ${_e}`,borderRadius:"8px",backgroundColor:W.surface,overflow:"hidden",transition:V?"none":"border-color 120ms ease",opacity:R?.5:1},children:[
87
87
  /* @__PURE__ */x("span",{style:{display:"flex",alignItems:"center",paddingLeft:"10px",color:W.textMuted,flexShrink:0},children:/* @__PURE__ */b("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[
88
88
  /* @__PURE__ */x("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),
89
89
  /* @__PURE__ */x("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),
90
90
  /* @__PURE__ */x("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),
91
91
  /* @__PURE__ */x("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),
92
- /* @__PURE__ */x("input",{ref:Ie,id:B,type:"text",value:we,placeholder:Xe,disabled:P,"aria-invalid":R,"aria-haspopup":"dialog","aria-expanded":ye,readOnly:"range"===l||"multiple"===l,onChange:e=>(e=>{if($e(e),"single"===l){const n=function(e,t){const n=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(n){const[,e,t,r]=n.map(Number);if(e>=1&&e<=12&&t>=1&&t<=31){const n=new Date(r,e-1,t);if(n.getMonth()===e-1)return n}}const r=e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);if(r){const[,e,t,n]=r.map(Number),o=new Date(e,t-1,n);if(o.getMonth()===t-1)return o}if(t&&/^DD/.test(t)){const t=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(t){const[,e,n,r]=t.map(Number),o=new Date(r,n-1,e);if(o.getMonth()===n-1)return o}}return null}(e,w);n&&!We(n)&&(O||U(n),t?.(n),ue(n.getFullYear()),he(n.getMonth()))}})(e.target.value),onFocus:()=>{P||(Ae.current?Ae.current=!1:ve(!0))},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:W.text,cursor:"single"!==l?"pointer":"text",fontFamily:"inherit",minWidth:0}}),Ze&&!P&&/* @__PURE__ */x("button",{type:"button","aria-label":"Clear selection",onClick:e=>{if(e.stopPropagation(),"single"===l)O||U(null),t?.(null),$e("");else if("range"===l){const e=[null,null];Y||Z(e),r?.(e),ie(e),$e(""),ne("start")}else"multiple"===l&&(_||Q([]),i?.([]),$e(""))},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",background:"transparent",cursor:"pointer",color:W.textMuted,flexShrink:0,borderRadius:"4px",marginRight:"4px"},children:/* @__PURE__ */b("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[/* @__PURE__ */x("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),/* @__PURE__ */x("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),
93
- /* @__PURE__ */x("button",{type:"button","aria-label":ye?"Close calendar":"Open calendar",tabIndex:-1,disabled:P,onClick:()=>{P||ve(e=>!e)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"34px",height:"36px",border:"none",background:"transparent",cursor:P?"not-allowed":"pointer",color:W.textMuted,flexShrink:0},children:/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:ye?"rotate(180deg)":"rotate(0deg)",transition:V?"none":"transform 160ms ease"},children:/* @__PURE__ */x("polyline",{points:"6 9 12 15 18 9"})})})]}),Ke&&!R&&/* @__PURE__ */x("span",{style:{fontSize:"12px",color:W.textMuted},children:Ke}),R&&Ye&&/* @__PURE__ */x("span",{role:"alert",style:{fontSize:"12px",color:W.danger},children:Ye}),ye&&"undefined"!=typeof document&&y(tt,document.body)]})}Rr.displayName="TkxDatePicker";var Fr={sm:{track:4,thumb:14,fontSize:"0.75rem"},md:{track:6,thumb:18,fontSize:"0.875rem"},lg:{track:8,thumb:22,fontSize:"1rem"}};function Ir(e,t,n){return Math.min(Math.max(e,t),n)}function Ar(e,t,n){return Math.round((e-t)/n)*n+t}function Lr(e,t,n){return(e-t)/(n-t)*100}function Tr({value:e,min:t,max:n,step:r,isDisabled:o,trackColor:i,thumbSize:a,ariaLabel:l,tooltipMode:s,formatValue:d,orientation:c,onChange:u,onChangeEnd:p}){const[h,f]=m(!1),[g,y]=m(!1),[v,w]=m(!1),k="vertical"===c,$=Lr(e,t,n);/* @__PURE__ */
94
- return b("div",{style:k?{position:"absolute",bottom:`${$}%`,transform:"translateY(50%)",left:"50%",marginLeft:`-${a/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"}:{position:"absolute",left:`${$}%`,transform:"translateX(-50%)",top:"50%",marginTop:`-${a/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"},children:[("always"===s||"hover"===s&&(v||g||h))&&/* @__PURE__ */x("div",{style:k?{position:"absolute",left:a+6,top:"50%",transform:"translateY(-50%)",backgroundColor:i,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"}:{position:"absolute",bottom:a+6,left:"50%",transform:"translateX(-50%)",backgroundColor:i,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"},children:d(e)}),/* @__PURE__ */x("div",{role:"slider",tabIndex:o?-1:0,"aria-label":l,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-disabled":o,"aria-orientation":c,onKeyDown:i=>{o||("ArrowRight"===i.key||"ArrowUp"===i.key?(i.preventDefault(),u(Ir(Ar(e+r,t,r),t,n))):"ArrowLeft"===i.key||"ArrowDown"===i.key?(i.preventDefault(),u(Ir(Ar(e-r,t,r),t,n))):"Home"===i.key?(i.preventDefault(),u(t)):"End"===i.key&&(i.preventDefault(),u(n)))},onFocus:()=>f(!0),onBlur:()=>f(!1),onPointerEnter:()=>w(!0),onPointerLeave:()=>w(!1),onPointerDown:e=>{o||(y(!0),e.target.setPointerCapture(e.pointerId))},onPointerUp:()=>{y(!1),p?.()},style:{width:a,height:a,borderRadius:"50%",backgroundColor:o?"#888":i,border:"3px solid #fff",boxShadow:h?`0 0 0 3px ${i}44`:"0 1px 4px rgba(0,0,0,0.3)",outline:"none",display:"block",transition:"box-shadow 150ms ease"}})]})}function Wr({value:e,defaultValue:t=0,onChange:n,rangeValue:r,onRangeChange:o,min:i=0,max:l=100,step:s=1,isRange:c=!1,label:u,showValue:p=!1,showTicks:h=!1,tickCount:y=5,isDisabled:v=!1,colorScheme:w="primary",size:k="md",marks:$,orientation:S="horizontal",showTooltip:C=!1,formatValue:z,onChangeEnd:M,onRangeChangeEnd:N,gradient:D=!1}){const P=se(),R=d(),F=et(),I=void 0!==e,[A,L]=m(t),T=I?e:A,W=void 0!==r,[j,E]=m([i,l]),B=W?r:j,V=f(null),H=f(T);H.current=T;const O=f(B);O.current=B;const q={primary:P.primary,success:P.success,danger:P.danger,warning:P.warning}[w],U=Fr[k],K="vertical"===S,Y=!0===C?"hover":!1!==C&&C,X=z??(e=>String(e)),Z=q+"66",G=a((e,t)=>{const n=V.current;if(!n)return i;const r=n.getBoundingClientRect();let o;return o=Ir(K?(r.bottom-(t??0))/r.height:(e-r.left)/r.width,0,1),Ir(Ar(o*(l-i)+i,i,s),i,l)},[i,l,s,K]),_=a(e=>{if(v)return;const t=G(e.clientX,e.clientY);if(c){const[e,n]=B,r=Math.abs(t-e)<=Math.abs(t-n)?[t,n]:[e,t];W||E(r),o?.(r)}else I||L(t),n?.(t)},[v,c,I,W,G,n,o,B]),J=c?Lr(B[0],i,l):0,Q=Lr(c?B[1]:T,i,l),ee=h?Array.from({length:y},(e,t)=>i+t/(y-1)*(l-i)):[],te=u?ke(u):void 0,ne=F?"none":"background 150ms ease";/* @__PURE__ */
95
- return b("div",{className:At("flex flex-col gap-2"),style:{opacity:v?.55:1,...K?{height:200,width:"auto",display:"inline-flex"}:{width:"100%"}},children:[(te||p)&&/* @__PURE__ */b("div",{className:At("flex items-center justify-between"),children:[te&&/* @__PURE__ */x("label",{htmlFor:R,className:At("text-sm font-medium"),style:{color:P.text,fontSize:U.fontSize},children:te}),p&&!c&&/* @__PURE__ */x("span",{className:At("text-sm tabular-nums"),style:{color:P.textMuted,fontSize:U.fontSize},children:X(T)}),p&&c&&/* @__PURE__ */b("span",{className:At("text-sm tabular-nums"),style:{color:P.textMuted,fontSize:U.fontSize},children:[X(B[0])," – ",X(B[1])]})]}),
96
- /* @__PURE__ */b("div",{style:{position:"relative",...K?{paddingLeft:U.thumb/2,paddingRight:U.thumb/2,flex:1}:{paddingTop:U.thumb/2,paddingBottom:U.thumb/2}},children:[/* @__PURE__ */b("div",{ref:V,onPointerDown:_,style:{position:"relative",...K?{width:U.track,height:"100%"}:{height:U.track},borderRadius:9999,backgroundColor:P.border,cursor:v?"not-allowed":"pointer",userSelect:"none",touchAction:"none"},children:[
97
- /* @__PURE__ */x("div",{style:{position:"absolute",...K?{left:0,bottom:`${J}%`,height:Q-J+"%",width:"100%"}:{top:0,left:`${J}%`,width:Q-J+"%",height:"100%"},borderRadius:9999,...v?{backgroundColor:P.textMuted}:D?{background:K?`linear-gradient(to top, ${Z}, ${q})`:`linear-gradient(to right, ${Z}, ${q})`}:{backgroundColor:q},transition:ne}}),ee.map((e,t)=>/* @__PURE__ */x("div",{style:{position:"absolute",...K?{bottom:`${Lr(e,i,l)}%`,left:"50%",transform:"translate(-50%, 50%)",height:3,width:U.track+4}:{left:`${Lr(e,i,l)}%`,top:"50%",transform:"translate(-50%, -50%)",width:3,height:U.track+4},backgroundColor:P.surface,borderRadius:9999,pointerEvents:"none"}},t)),c?/* @__PURE__ */b(g,{children:[/* @__PURE__ */x(Tr,{value:B[0],min:i,max:B[1],step:s,isDisabled:v,trackColor:q,trackHeight:U.track,thumbSize:U.thumb,ariaLabel:`${te??"Range"} start`,tooltipMode:Y,formatValue:X,orientation:S,onChange:e=>{const t=[Ir(e,i,B[1]),B[1]];W||E(t),o?.(t)},onChangeEnd:N?()=>N(O.current):void 0}),/* @__PURE__ */x(Tr,{value:B[1],min:B[0],max:l,step:s,isDisabled:v,trackColor:q,trackHeight:U.track,thumbSize:U.thumb,ariaLabel:`${te??"Range"} end`,tooltipMode:Y,formatValue:X,orientation:S,onChange:e=>{const t=[B[0],Ir(e,B[0],l)];W||E(t),o?.(t)},onChangeEnd:N?()=>N(O.current):void 0})]}):/* @__PURE__ */x(Tr,{value:T,min:i,max:l,step:s,isDisabled:v,trackColor:q,trackHeight:U.track,thumbSize:U.thumb,ariaLabel:te??"Slider",tooltipMode:Y,formatValue:X,orientation:S,onChange:e=>{I||L(e),n?.(e)},onChangeEnd:M?()=>M(H.current):void 0})]}),$&&$.length>0&&/* @__PURE__ */x("div",{style:{position:K?"absolute":"relative",...K?{left:"100%",top:0,bottom:0,marginLeft:8}:{marginTop:8}},children:$.map((e,t)=>/* @__PURE__ */x("div",{style:{position:"absolute",...K?{bottom:`${Lr(e.value,i,l)}%`,transform:"translateY(50%)",left:0}:{left:`${Lr(e.value,i,l)}%`,transform:"translateX(-50%)"},fontSize:"0.6875rem",color:P.textMuted,whiteSpace:"nowrap"},children:ke(e.label)},t))})]}),h&&!$&&!K&&/* @__PURE__ */x("div",{style:{position:"relative",height:"1rem"},children:ee.map((e,t)=>/* @__PURE__ */x("span",{style:{position:"absolute",left:`${Lr(e,i,l)}%`,transform:"translateX(-50%)",fontSize:"0.6875rem",color:P.textMuted},children:X(Math.round(e))},t))})]})}Wr.displayName="TkxSlider";var jr={sm:{height:28,minWidth:28,fontSize:"0.75rem",px:8},md:{height:36,minWidth:36,fontSize:"0.875rem",px:10},lg:{height:44,minWidth:44,fontSize:"1rem",px:12}};function Er({total:e,pageSize:t=10,page:n,defaultPage:r=1,onChange:o,siblingCount:i=1,showEdges:a=!0,showPageSize:l=!1,onPageSizeChange:s,pageSizeOptions:c=[10,25,50,100],size:u="md",variant:p="default"}){const h=se(),f=yn(),g=d(),y={pagination:"Pagination",firstPage:f.firstPage??"First page",lastPage:f.lastPage??"Last page",previousPage:f.previousPage??"Previous page",nextPage:f.nextPage??"Next page",pageN:e=>`Page ${e}`,showing:(e,t,n)=>f.showingRange?f.showingRange(e,t,n):`Showing ${e}–${t} of ${n} items`},v=void 0!==n,[w,k]=m(r),$=v?n:w,[S,C]=m(t),z=t,M=Math.max(1,Math.ceil(e/z)),N=e=>{const t=Math.min(Math.max(e,1),M);t!==$&&(v||k(t),o?.(t))},D=function(e,t,n,r){if(t<=1)return[1];const o=(e,t)=>Array.from({length:Math.max(0,t-e+1)},(t,n)=>e+n),i=Math.max(e-n,1),a=Math.min(e+n,t);if(!r){const e=[];return i>1&&e.push("..."),e.push(...o(i,a)),a<t&&e.push("..."),e}const l=i>3,s=a<t-2,d=[];d.push(1),l?d.push("left-ellipsis"):d.push(...o(2,i-1)),d.push(...o(Math.max(i,2),Math.min(a,t-1))),s?d.push("right-ellipsis"):d.push(...o(a+1,t-1)),t>1&&d.push(t);const c=/* @__PURE__ */new Set,u=[];for(const p of d)"number"==typeof p?c.has(p)||(c.add(p),u.push(p)):u.push(p);return u}($,M,i,a),P=jr[u],R=Math.min(($-1)*z+1,e),F=Math.min($*z,e),I=(e,t)=>{const n={height:P.height,minWidth:P.minWidth,paddingLeft:P.px,paddingRight:P.px,fontSize:P.fontSize,borderRadius:"8px",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:t?"not-allowed":"pointer",border:"none",outline:"none",fontFamily:"inherit",transition:"background 120ms ease, color 120ms ease",opacity:t?.4:1};return e?{...n,backgroundColor:h.primary,color:h.bg,fontWeight:600,boxShadow:`0 0 0 2px ${h.primary}44`}:"default"===p?{...n,backgroundColor:h.surface,color:h.text,border:`1px solid ${h.border}`}:"outline"===p?{...n,backgroundColor:"transparent",color:h.text,border:`1px solid ${h.border}`}:{...n,backgroundColor:"transparent",color:h.text}},A=({d:e})=>/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:e})});/* @__PURE__ */
98
- return b("nav",{"aria-label":y.pagination,className:At("flex flex-col gap-2"),children:[e>0&&/* @__PURE__ */x("p",{className:At("text-sm"),style:{color:h.textMuted,fontSize:P.fontSize},children:ke(y.showing(R,F,e))}),/* @__PURE__ */b("div",{className:At("flex items-center gap-1 flex-wrap"),children:[a&&/* @__PURE__ */b("button",{type:"button","aria-label":y.firstPage,disabled:1===$,onClick:()=>N(1),style:I(!1,1===$),children:[/* @__PURE__ */x(A,{d:"15 18 9 12 15 6"}),/* @__PURE__ */x(A,{d:"20 18 14 12 20 6"})]}),
99
- /* @__PURE__ */x("button",{type:"button","aria-label":y.previousPage,disabled:1===$,onClick:()=>N($-1),style:I(!1,1===$),children:/* @__PURE__ */x(A,{d:"15 18 9 12 15 6"})}),D.map((e,t)=>{if("string"==typeof e)/* @__PURE__ */return x("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:P.minWidth,height:P.height,fontSize:P.fontSize,color:h.textMuted,userSelect:"none"},children:"…"},`${e}-${t}`);const n=e,r=n===$;/* @__PURE__ */
92
+ /* @__PURE__ */x("input",{ref:Ie,id:B,type:"text",value:we,placeholder:Xe,disabled:R,"aria-invalid":P,"aria-haspopup":"dialog","aria-expanded":ye,readOnly:"range"===l||"multiple"===l,onChange:e=>(e=>{if($e(e),"single"===l){const n=function(e,t){const n=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(n){const[,e,t,r]=n.map(Number);if(e>=1&&e<=12&&t>=1&&t<=31){const n=new Date(r,e-1,t);if(n.getMonth()===e-1)return n}}const r=e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);if(r){const[,e,t,n]=r.map(Number),o=new Date(e,t-1,n);if(o.getMonth()===t-1)return o}if(t&&/^DD/.test(t)){const t=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(t){const[,e,n,r]=t.map(Number),o=new Date(r,n-1,e);if(o.getMonth()===n-1)return o}}return null}(e,w);n&&!We(n)&&(O||U(n),t?.(n),ue(n.getFullYear()),he(n.getMonth()))}})(e.target.value),onFocus:()=>{R||(Ae.current?Ae.current=!1:ve(!0))},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:W.text,cursor:"single"!==l?"pointer":"text",fontFamily:"inherit",minWidth:0}}),Ze&&!R&&/* @__PURE__ */x("button",{type:"button","aria-label":"Clear selection",onClick:e=>{if(e.stopPropagation(),"single"===l)O||U(null),t?.(null),$e("");else if("range"===l){const e=[null,null];Y||Z(e),r?.(e),ie(e),$e(""),ne("start")}else"multiple"===l&&(_||Q([]),i?.([]),$e(""))},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",background:"transparent",cursor:"pointer",color:W.textMuted,flexShrink:0,borderRadius:"4px",marginRight:"4px"},children:/* @__PURE__ */b("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[/* @__PURE__ */x("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),/* @__PURE__ */x("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),
93
+ /* @__PURE__ */x("button",{type:"button","aria-label":ye?"Close calendar":"Open calendar",tabIndex:-1,disabled:R,onClick:()=>{R||ve(e=>!e)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"34px",height:"36px",border:"none",background:"transparent",cursor:R?"not-allowed":"pointer",color:W.textMuted,flexShrink:0},children:/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:ye?"rotate(180deg)":"rotate(0deg)",transition:V?"none":"transform 160ms ease"},children:/* @__PURE__ */x("polyline",{points:"6 9 12 15 18 9"})})})]}),Ke&&!P&&/* @__PURE__ */x("span",{style:{fontSize:"12px",color:W.textMuted},children:Ke}),P&&Ye&&/* @__PURE__ */x("span",{role:"alert",style:{fontSize:"12px",color:W.danger},children:Ye}),ye&&"undefined"!=typeof document&&y(tt,document.body)]})}Pr.displayName="TkxDatePicker";var Fr={sm:{track:4,thumb:14,fontSize:"0.75rem"},md:{track:6,thumb:18,fontSize:"0.875rem"},lg:{track:8,thumb:22,fontSize:"1rem"}};function Ir(e,t,n){return Math.min(Math.max(e,t),n)}function Ar(e,t,n){return Math.round((e-t)/n)*n+t}function Lr(e,t,n){return(e-t)/(n-t)*100}function Tr({value:e,min:t,max:n,step:r,isDisabled:o,trackColor:i,thumbSize:a,ariaLabel:l,tooltipMode:s,formatValue:d,orientation:c,onChange:u,onChangeEnd:p}){const[h,f]=m(!1),[g,y]=m(!1),[v,w]=m(!1),k="vertical"===c,$=Lr(e,t,n);/* @__PURE__ */
94
+ return b("div",{style:k?{position:"absolute",bottom:`${$}%`,transform:"translateY(50%)",left:"50%",marginLeft:`-${a/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"}:{position:"absolute",left:`${$}%`,transform:"translateX(-50%)",top:"50%",marginTop:`-${a/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"},children:[("always"===s||"hover"===s&&(v||g||h))&&/* @__PURE__ */x("div",{style:k?{position:"absolute",left:a+6,top:"50%",transform:"translateY(-50%)",backgroundColor:i,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"}:{position:"absolute",bottom:a+6,left:"50%",transform:"translateX(-50%)",backgroundColor:i,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"},children:d(e)}),/* @__PURE__ */x("div",{role:"slider",tabIndex:o?-1:0,"aria-label":l,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-disabled":o,"aria-orientation":c,onKeyDown:i=>{o||("ArrowRight"===i.key||"ArrowUp"===i.key?(i.preventDefault(),u(Ir(Ar(e+r,t,r),t,n))):"ArrowLeft"===i.key||"ArrowDown"===i.key?(i.preventDefault(),u(Ir(Ar(e-r,t,r),t,n))):"Home"===i.key?(i.preventDefault(),u(t)):"End"===i.key&&(i.preventDefault(),u(n)))},onFocus:()=>f(!0),onBlur:()=>f(!1),onPointerEnter:()=>w(!0),onPointerLeave:()=>w(!1),onPointerDown:e=>{o||(y(!0),e.target.setPointerCapture(e.pointerId))},onPointerUp:()=>{y(!1),p?.()},style:{width:a,height:a,borderRadius:"50%",backgroundColor:o?"#888":i,border:"3px solid #fff",boxShadow:h?`0 0 0 3px ${i}44`:"0 1px 4px rgba(0,0,0,0.3)",outline:"none",display:"block",transition:"box-shadow 150ms ease"}})]})}function Wr({value:e,defaultValue:t=0,onChange:n,rangeValue:r,onRangeChange:o,min:i=0,max:l=100,step:s=1,isRange:c=!1,label:u,showValue:p=!1,showTicks:h=!1,tickCount:y=5,isDisabled:v=!1,colorScheme:w="primary",size:k="md",marks:$,orientation:S="horizontal",showTooltip:C=!1,formatValue:z,onChangeEnd:M,onRangeChangeEnd:N,gradient:D=!1}){const R=se(),P=d(),F=et(),I=void 0!==e,[A,L]=m(t),T=I?e:A,W=void 0!==r,[j,E]=m([i,l]),B=W?r:j,V=f(null),H=f(T);H.current=T;const O=f(B);O.current=B;const q={primary:R.primary,success:R.success,danger:R.danger,warning:R.warning}[w],U=Fr[k],K="vertical"===S,Y=!0===C?"hover":!1!==C&&C,X=z??(e=>String(e)),Z=q+"66",G=a((e,t)=>{const n=V.current;if(!n)return i;const r=n.getBoundingClientRect();let o;return o=Ir(K?(r.bottom-(t??0))/r.height:(e-r.left)/r.width,0,1),Ir(Ar(o*(l-i)+i,i,s),i,l)},[i,l,s,K]),_=a(e=>{if(v)return;const t=G(e.clientX,e.clientY);if(c){const[e,n]=B,r=Math.abs(t-e)<=Math.abs(t-n)?[t,n]:[e,t];W||E(r),o?.(r)}else I||L(t),n?.(t)},[v,c,I,W,G,n,o,B]),J=c?Lr(B[0],i,l):0,Q=Lr(c?B[1]:T,i,l),ee=h?Array.from({length:y},(e,t)=>i+t/(y-1)*(l-i)):[],te=u?ke(u):void 0,ne=F?"none":"background 150ms ease";/* @__PURE__ */
95
+ return b("div",{className:At("flex flex-col gap-2"),style:{opacity:v?.55:1,...K?{height:200,width:"auto",display:"inline-flex"}:{width:"100%"}},children:[(te||p)&&/* @__PURE__ */b("div",{className:At("flex items-center justify-between"),children:[te&&/* @__PURE__ */x("label",{htmlFor:P,className:At("text-sm font-medium"),style:{color:R.text,fontSize:U.fontSize},children:te}),p&&!c&&/* @__PURE__ */x("span",{className:At("text-sm tabular-nums"),style:{color:R.textMuted,fontSize:U.fontSize},children:X(T)}),p&&c&&/* @__PURE__ */b("span",{className:At("text-sm tabular-nums"),style:{color:R.textMuted,fontSize:U.fontSize},children:[X(B[0])," – ",X(B[1])]})]}),
96
+ /* @__PURE__ */b("div",{style:{position:"relative",...K?{paddingLeft:U.thumb/2,paddingRight:U.thumb/2,flex:1}:{paddingTop:U.thumb/2,paddingBottom:U.thumb/2}},children:[/* @__PURE__ */b("div",{ref:V,onPointerDown:_,style:{position:"relative",...K?{width:U.track,height:"100%"}:{height:U.track},borderRadius:9999,backgroundColor:R.border,cursor:v?"not-allowed":"pointer",userSelect:"none",touchAction:"none"},children:[
97
+ /* @__PURE__ */x("div",{style:{position:"absolute",...K?{left:0,bottom:`${J}%`,height:Q-J+"%",width:"100%"}:{top:0,left:`${J}%`,width:Q-J+"%",height:"100%"},borderRadius:9999,...v?{backgroundColor:R.textMuted}:D?{background:K?`linear-gradient(to top, ${Z}, ${q})`:`linear-gradient(to right, ${Z}, ${q})`}:{backgroundColor:q},transition:ne}}),ee.map((e,t)=>/* @__PURE__ */x("div",{style:{position:"absolute",...K?{bottom:`${Lr(e,i,l)}%`,left:"50%",transform:"translate(-50%, 50%)",height:3,width:U.track+4}:{left:`${Lr(e,i,l)}%`,top:"50%",transform:"translate(-50%, -50%)",width:3,height:U.track+4},backgroundColor:R.surface,borderRadius:9999,pointerEvents:"none"}},t)),c?/* @__PURE__ */b(g,{children:[/* @__PURE__ */x(Tr,{value:B[0],min:i,max:B[1],step:s,isDisabled:v,trackColor:q,trackHeight:U.track,thumbSize:U.thumb,ariaLabel:`${te??"Range"} start`,tooltipMode:Y,formatValue:X,orientation:S,onChange:e=>{const t=[Ir(e,i,B[1]),B[1]];W||E(t),o?.(t)},onChangeEnd:N?()=>N(O.current):void 0}),/* @__PURE__ */x(Tr,{value:B[1],min:B[0],max:l,step:s,isDisabled:v,trackColor:q,trackHeight:U.track,thumbSize:U.thumb,ariaLabel:`${te??"Range"} end`,tooltipMode:Y,formatValue:X,orientation:S,onChange:e=>{const t=[B[0],Ir(e,B[0],l)];W||E(t),o?.(t)},onChangeEnd:N?()=>N(O.current):void 0})]}):/* @__PURE__ */x(Tr,{value:T,min:i,max:l,step:s,isDisabled:v,trackColor:q,trackHeight:U.track,thumbSize:U.thumb,ariaLabel:te??"Slider",tooltipMode:Y,formatValue:X,orientation:S,onChange:e=>{I||L(e),n?.(e)},onChangeEnd:M?()=>M(H.current):void 0})]}),$&&$.length>0&&/* @__PURE__ */x("div",{style:{position:K?"absolute":"relative",...K?{left:"100%",top:0,bottom:0,marginLeft:8}:{marginTop:8}},children:$.map((e,t)=>/* @__PURE__ */x("div",{style:{position:"absolute",...K?{bottom:`${Lr(e.value,i,l)}%`,transform:"translateY(50%)",left:0}:{left:`${Lr(e.value,i,l)}%`,transform:"translateX(-50%)"},fontSize:"0.6875rem",color:R.textMuted,whiteSpace:"nowrap"},children:ke(e.label)},t))})]}),h&&!$&&!K&&/* @__PURE__ */x("div",{style:{position:"relative",height:"1rem"},children:ee.map((e,t)=>/* @__PURE__ */x("span",{style:{position:"absolute",left:`${Lr(e,i,l)}%`,transform:"translateX(-50%)",fontSize:"0.6875rem",color:R.textMuted},children:X(Math.round(e))},t))})]})}Wr.displayName="TkxSlider";var jr={sm:{height:28,minWidth:28,fontSize:"0.75rem",px:8},md:{height:36,minWidth:36,fontSize:"0.875rem",px:10},lg:{height:44,minWidth:44,fontSize:"1rem",px:12}};function Er({total:e,pageSize:t=10,page:n,defaultPage:r=1,onChange:o,siblingCount:i=1,showEdges:a=!0,showPageSize:l=!1,onPageSizeChange:s,pageSizeOptions:c=[10,25,50,100],size:u="md",variant:p="default"}){const h=se(),f=yn(),g=d(),y={pagination:"Pagination",firstPage:f.firstPage??"First page",lastPage:f.lastPage??"Last page",previousPage:f.previousPage??"Previous page",nextPage:f.nextPage??"Next page",pageN:e=>`Page ${e}`,showing:(e,t,n)=>f.showingRange?f.showingRange(e,t,n):`Showing ${e}–${t} of ${n} items`},v=void 0!==n,[w,k]=m(r),$=v?n:w,[S,C]=m(t),z=t,M=Math.max(1,Math.ceil(e/z)),N=e=>{const t=Math.min(Math.max(e,1),M);t!==$&&(v||k(t),o?.(t))},D=function(e,t,n,r){if(t<=1)return[1];const o=(e,t)=>Array.from({length:Math.max(0,t-e+1)},(t,n)=>e+n),i=Math.max(e-n,1),a=Math.min(e+n,t);if(!r){const e=[];return i>1&&e.push("..."),e.push(...o(i,a)),a<t&&e.push("..."),e}const l=i>3,s=a<t-2,d=[];d.push(1),l?d.push("left-ellipsis"):d.push(...o(2,i-1)),d.push(...o(Math.max(i,2),Math.min(a,t-1))),s?d.push("right-ellipsis"):d.push(...o(a+1,t-1)),t>1&&d.push(t);const c=/* @__PURE__ */new Set,u=[];for(const p of d)"number"==typeof p?c.has(p)||(c.add(p),u.push(p)):u.push(p);return u}($,M,i,a),R=jr[u],P=Math.min(($-1)*z+1,e),F=Math.min($*z,e),I=(e,t)=>{const n={height:R.height,minWidth:R.minWidth,paddingLeft:R.px,paddingRight:R.px,fontSize:R.fontSize,borderRadius:"8px",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:t?"not-allowed":"pointer",border:"none",outline:"none",fontFamily:"inherit",transition:"background 120ms ease, color 120ms ease",opacity:t?.4:1};return e?{...n,backgroundColor:h.primary,color:h.bg,fontWeight:600,boxShadow:`0 0 0 2px ${h.primary}44`}:"default"===p?{...n,backgroundColor:h.surface,color:h.text,border:`1px solid ${h.border}`}:"outline"===p?{...n,backgroundColor:"transparent",color:h.text,border:`1px solid ${h.border}`}:{...n,backgroundColor:"transparent",color:h.text}},A=({d:e})=>/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:e})});/* @__PURE__ */
98
+ return b("nav",{"aria-label":y.pagination,className:At("flex flex-col gap-2"),children:[e>0&&/* @__PURE__ */x("p",{className:At("text-sm"),style:{color:h.textMuted,fontSize:R.fontSize},children:ke(y.showing(P,F,e))}),/* @__PURE__ */b("div",{className:At("flex items-center gap-1 flex-wrap"),children:[a&&/* @__PURE__ */b("button",{type:"button","aria-label":y.firstPage,disabled:1===$,onClick:()=>N(1),style:I(!1,1===$),children:[/* @__PURE__ */x(A,{d:"15 18 9 12 15 6"}),/* @__PURE__ */x(A,{d:"20 18 14 12 20 6"})]}),
99
+ /* @__PURE__ */x("button",{type:"button","aria-label":y.previousPage,disabled:1===$,onClick:()=>N($-1),style:I(!1,1===$),children:/* @__PURE__ */x(A,{d:"15 18 9 12 15 6"})}),D.map((e,t)=>{if("string"==typeof e)/* @__PURE__ */return x("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:R.minWidth,height:R.height,fontSize:R.fontSize,color:h.textMuted,userSelect:"none"},children:"…"},`${e}-${t}`);const n=e,r=n===$;/* @__PURE__ */
100
100
  return x("button",{type:"button","aria-label":y.pageN(n),"aria-current":r?"page":void 0,onClick:()=>N(n),style:I(r,!1),children:n},n)}),
101
- /* @__PURE__ */x("button",{type:"button","aria-label":y.nextPage,disabled:$===M,onClick:()=>N($+1),style:I(!1,$===M),children:/* @__PURE__ */x(A,{d:"9 18 15 12 9 6"})}),a&&/* @__PURE__ */b("button",{type:"button","aria-label":y.lastPage,disabled:$===M,onClick:()=>N(M),style:I(!1,$===M),children:[/* @__PURE__ */x(A,{d:"4 18 10 12 4 6"}),/* @__PURE__ */x(A,{d:"14 18 20 12 14 6"})]}),l&&/* @__PURE__ */b("div",{className:At("flex items-center gap-2 ml-2"),children:[/* @__PURE__ */x("label",{htmlFor:g,className:At("text-sm"),style:{color:h.textMuted,fontSize:P.fontSize,whiteSpace:"nowrap"},children:"Rows per page"}),/* @__PURE__ */x("select",{id:g,value:S,onChange:e=>{return t=Number(e.target.value),C(t),s?.(t),void N(1);var t},style:{height:P.height,paddingLeft:P.px,paddingRight:P.px,fontSize:P.fontSize,borderRadius:"8px",border:`1px solid ${h.border}`,backgroundColor:h.surface,color:h.text,cursor:"pointer",outline:"none",fontFamily:"inherit"},children:c.map(e=>/* @__PURE__ */x("option",{value:e,children:e},e))})]})]})]})}Er.displayName="TkxPagination";var Br={"1/1":"100%","4/3":"75%","16/9":"56.25%","3/2":"66.666%","9/16":"177.777%"},Vr={none:"0",sm:"4px",md:"8px",lg:"16px",full:"9999px"};function Hr({color:e,size:t}){/* @__PURE__ */
101
+ /* @__PURE__ */x("button",{type:"button","aria-label":y.nextPage,disabled:$===M,onClick:()=>N($+1),style:I(!1,$===M),children:/* @__PURE__ */x(A,{d:"9 18 15 12 9 6"})}),a&&/* @__PURE__ */b("button",{type:"button","aria-label":y.lastPage,disabled:$===M,onClick:()=>N(M),style:I(!1,$===M),children:[/* @__PURE__ */x(A,{d:"4 18 10 12 4 6"}),/* @__PURE__ */x(A,{d:"14 18 20 12 14 6"})]}),l&&/* @__PURE__ */b("div",{className:At("flex items-center gap-2 ml-2"),children:[/* @__PURE__ */x("label",{htmlFor:g,className:At("text-sm"),style:{color:h.textMuted,fontSize:R.fontSize,whiteSpace:"nowrap"},children:"Rows per page"}),/* @__PURE__ */x("select",{id:g,value:S,onChange:e=>{return t=Number(e.target.value),C(t),s?.(t),void N(1);var t},style:{height:R.height,paddingLeft:R.px,paddingRight:R.px,fontSize:R.fontSize,borderRadius:"8px",border:`1px solid ${h.border}`,backgroundColor:h.surface,color:h.text,cursor:"pointer",outline:"none",fontFamily:"inherit"},children:c.map(e=>/* @__PURE__ */x("option",{value:e,children:e},e))})]})]})]})}Er.displayName="TkxPagination";var Br={"1/1":"100%","4/3":"75%","16/9":"56.25%","3/2":"66.666%","9/16":"177.777%"},Vr={none:"0",sm:"4px",md:"8px",lg:"16px",full:"9999px"};function Hr({color:e,size:t}){/* @__PURE__ */
102
102
  return b("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:1.5,"aria-hidden":"true",children:[
103
103
  /* @__PURE__ */x("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),
104
104
  /* @__PURE__ */x("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),
105
- /* @__PURE__ */x("path",{d:"M21 15l-5-5L5 21"})]})}function Or({src:e,alt:t,fallback:n,placeholder:r="skeleton",fit:o="cover",ratio:i="auto",radius:l="none",caption:d,lazy:c=!0,preview:u=!1,className:p,style:h,...v}){const w=se(),k=et(),[$,S]=m(!1),[C,z]=m(!1),[M,N]=m(!1),D=f(null),P=ke(e),R=t?ke(t):"",F=d?ke(d):"",I=Vr[l];s(()=>{D.current?.complete&&S(!0)},[]);const A=a(()=>S(!0),[]),L=a(()=>z(!0),[]),T=a(()=>{u&&!C&&N(!0)},[u,C]),W=a(()=>N(!1),[]);s(()=>{if(!M)return;const e=e=>{"Escape"===e.key&&W()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[M,W]);const j="skeleton"===r&&!$&&!C,E=j&&!k?{animation:"tkx-shimmer 1.5s ease-in-out infinite"}:{},B=C?null:/* @__PURE__ */x("img",{ref:D,src:P,alt:R||void 0,role:R?void 0:"img","aria-label":R?void 0:"Image",loading:c?"lazy":void 0,onLoad:A,onError:L,onClick:u?T:void 0,className:jt(At("block w-full h-full"),u&&!C?At("cursor-pointer"):""),style:{objectFit:o,borderRadius:I,opacity:$?1:0,transition:k?"none":"opacity 200ms ease",position:"auto"===i?void 0:"absolute",inset:"auto"===i?void 0:0},...v}),V=C?n?/* @__PURE__ */x(g,{children:n}):/* @__PURE__ */b("div",{role:"img","aria-label":R||"Image failed to load",className:At("flex flex-col items-center justify-center gap-2 w-full h-full"),style:{backgroundColor:w.surfaceAlt,borderRadius:I,color:w.textMuted,minHeight:"80px"},children:[/* @__PURE__ */x(Hr,{color:w.textMuted,size:32}),/* @__PURE__ */x("span",{className:At("text-xs"),style:{color:w.textMuted},children:"Failed to load"})]}):null,H=j?/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"auto"===i?void 0:"absolute",inset:"auto"===i?void 0:0,width:"100%",height:"auto"===i?"100%":void 0,minHeight:"auto"===i?"80px":void 0,borderRadius:I,backgroundColor:w.surfaceAlt,...E}}):null,O=/* @__PURE__ */b("div","auto"===i?{className:At("relative w-full"),style:{borderRadius:I},children:[H,B,V]}:{className:At("relative w-full overflow-hidden"),style:{paddingBottom:Br[i],borderRadius:I},children:[H,B,V]}),q=F?/* @__PURE__ */b("figure",{className:At("m-0 p-0 flex flex-col gap-2"),style:{borderRadius:I},children:[O,/* @__PURE__ */x("figcaption",{className:At("text-sm text-center"),style:{color:w.textMuted},children:F})]}):O;/* @__PURE__ */
106
- return b(g,{children:[/* @__PURE__ */x("div",{className:jt(At("inline-block w-full"),p),style:h,children:q}),M&&"undefined"!=typeof document?y(/* @__PURE__ */b("div",{role:"dialog","aria-modal":"true","aria-label":R||"Image preview",className:At("fixed inset-0 z-[9500] flex items-center justify-center p-4"),onClick:W,children:[
105
+ /* @__PURE__ */x("path",{d:"M21 15l-5-5L5 21"})]})}function Or({src:e,alt:t,fallback:n,placeholder:r="skeleton",fit:o="cover",ratio:i="auto",radius:l="none",caption:d,lazy:c=!0,preview:u=!1,className:p,style:h,...v}){const w=se(),k=et(),[$,S]=m(!1),[C,z]=m(!1),[M,N]=m(!1),D=f(null),R=ke(e),P=t?ke(t):"",F=d?ke(d):"",I=Vr[l];s(()=>{D.current?.complete&&S(!0)},[]);const A=a(()=>S(!0),[]),L=a(()=>z(!0),[]),T=a(()=>{u&&!C&&N(!0)},[u,C]),W=a(()=>N(!1),[]);s(()=>{if(!M)return;const e=e=>{"Escape"===e.key&&W()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[M,W]);const j="skeleton"===r&&!$&&!C,E=j&&!k?{animation:"tkx-shimmer 1.5s ease-in-out infinite"}:{},B=C?null:/* @__PURE__ */x("img",{ref:D,src:R,alt:P||void 0,role:P?void 0:"img","aria-label":P?void 0:"Image",loading:c?"lazy":void 0,onLoad:A,onError:L,onClick:u?T:void 0,className:jt(At("block w-full h-full"),u&&!C?At("cursor-pointer"):""),style:{objectFit:o,borderRadius:I,opacity:$?1:0,transition:k?"none":"opacity 200ms ease",position:"auto"===i?void 0:"absolute",inset:"auto"===i?void 0:0},...v}),V=C?n?/* @__PURE__ */x(g,{children:n}):/* @__PURE__ */b("div",{role:"img","aria-label":P||"Image failed to load",className:At("flex flex-col items-center justify-center gap-2 w-full h-full"),style:{backgroundColor:w.surfaceAlt,borderRadius:I,color:w.textMuted,minHeight:"80px"},children:[/* @__PURE__ */x(Hr,{color:w.textMuted,size:32}),/* @__PURE__ */x("span",{className:At("text-xs"),style:{color:w.textMuted},children:"Failed to load"})]}):null,H=j?/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"auto"===i?void 0:"absolute",inset:"auto"===i?void 0:0,width:"100%",height:"auto"===i?"100%":void 0,minHeight:"auto"===i?"80px":void 0,borderRadius:I,backgroundColor:w.surfaceAlt,...E}}):null,O=/* @__PURE__ */b("div","auto"===i?{className:At("relative w-full"),style:{borderRadius:I},children:[H,B,V]}:{className:At("relative w-full overflow-hidden"),style:{paddingBottom:Br[i],borderRadius:I},children:[H,B,V]}),q=F?/* @__PURE__ */b("figure",{className:At("m-0 p-0 flex flex-col gap-2"),style:{borderRadius:I},children:[O,/* @__PURE__ */x("figcaption",{className:At("text-sm text-center"),style:{color:w.textMuted},children:F})]}):O;/* @__PURE__ */
106
+ return b(g,{children:[/* @__PURE__ */x("div",{className:jt(At("inline-block w-full"),p),style:h,children:q}),M&&"undefined"!=typeof document?y(/* @__PURE__ */b("div",{role:"dialog","aria-modal":"true","aria-label":P||"Image preview",className:At("fixed inset-0 z-[9500] flex items-center justify-center p-4"),onClick:W,children:[
107
107
  /* @__PURE__ */x("div",{"aria-hidden":"true",className:At("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.85)",backdropFilter:"blur(6px)"}}),
108
- /* @__PURE__ */x("img",{src:P,alt:R||"Full-size preview",onClick:e=>e.stopPropagation(),className:At("relative z-10 max-w-full max-h-full"),style:{objectFit:"contain",borderRadius:"8px",boxShadow:"0 25px 60px rgba(0,0,0,0.5)"}}),
108
+ /* @__PURE__ */x("img",{src:R,alt:P||"Full-size preview",onClick:e=>e.stopPropagation(),className:At("relative z-10 max-w-full max-h-full"),style:{objectFit:"contain",borderRadius:"8px",boxShadow:"0 25px 60px rgba(0,0,0,0.5)"}}),
109
109
  /* @__PURE__ */x("button",{"aria-label":"Close preview",onClick:W,className:At("absolute top-4 right-4 z-10 flex items-center justify-center","bg-transparent border-none cursor-pointer rounded-full p-2"),style:{color:"#fff",backgroundColor:"rgba(255,255,255,0.15)"},children:/* @__PURE__ */b("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[/* @__PURE__ */x("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),/* @__PURE__ */x("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),document.body):null]})}function qr(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Ur({mimeType:e,color:t}){return e.startsWith("image/")?/* @__PURE__ */b("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[
110
110
  /* @__PURE__ */x("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),
111
111
  /* @__PURE__ */x("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),
@@ -113,7 +113,7 @@ return b(g,{children:[/* @__PURE__ */x("div",{className:jt(At("inline-block w-fu
113
113
  /* @__PURE__ */x("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),
114
114
  /* @__PURE__ */x("polyline",{points:"14 2 14 8 20 8"}),
115
115
  /* @__PURE__ */x("line",{x1:"9",y1:"13",x2:"15",y2:"13"}),
116
- /* @__PURE__ */x("line",{x1:"9",y1:"17",x2:"11",y2:"17"})]}:{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[/* @__PURE__ */x("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),/* @__PURE__ */x("polyline",{points:"14 2 14 8 20 8"})]})}var Kr=0;function Yr({accept:e,multiple:t=!1,maxSize:n,maxFiles:r,onChange:o,onError:i,label:l,hint:c,isDisabled:u=!1,preview:p=!0,dragDrop:h=!0,variant:g="dropzone"}){const y=se(),v=yn(),w=l??v.uploadFiles??"Upload files",k=v.dropFiles?.replace(/^.*$/,v.dropFiles)??"Drop files here",$=et(),S=d(),C=f(null),[z,M]=m(!1),[N,D]=m([]);s(()=>()=>{N.forEach(e=>{e.objectUrl&&URL.revokeObjectURL(e.objectUrl)})},[]);const P=a(e=>{let t=0;const n=setInterval(()=>{t+=Math.floor(20*Math.random())+10,t>=100&&(t=100,clearInterval(n)),D(n=>n.map(n=>n.id===e?{...n,progress:t}:n))},100)},[]),R=a(t=>n&&t.size>n?`"${ke(t.name)}" exceeds max size of ${qr(n)}`:/[\u0000-\u001F\u007F]|\.\.\/|\.\.\\/.test(t.name)?`"${ke(t.name)}" contains forbidden characters`:e&&!e.split(",").map(e=>e.trim()).some(e=>e.startsWith(".")?t.name.toLowerCase().endsWith(e.toLowerCase()):e.endsWith("/*")?t.type.startsWith(e.slice(0,-1)):t.type===e)?`"${ke(t.name)}" is not an accepted file type`:void 0,[e,n]),F=a(async e=>{if(!e.error)try{const t=await Xe(e.file);if(t&&e.file.type&&!e.file.type.startsWith(t.split("/")[0])){const t=`"${ke(e.file.name)}" file content does not match its type`;D(n=>n.map(n=>n.id===e.id?{...n,error:t}:n)),i?.(t)}}catch{}},[i]),I=a(e=>{const n=r?r-N.length:1/0;if(n<=0)return void i?.(`Maximum of ${r} file${1===r?"":"s"} allowed`);const a=e.slice(0,n).map(e=>{const t=R(e),n=p&&e.type.startsWith("image/")&&!t?URL.createObjectURL(e):void 0;return{file:e,id:"tkx-file-"+ ++Kr,objectUrl:n,progress:0,error:t}});D(e=>{const n=t?[...e,...a]:a,r=n.filter(e=>!e.error).map(e=>e.file);return o?.(r),n}),a.forEach(e=>{e.error?i?.(e.error):F(e)}),a.forEach(e=>{e.error||P(e.id)})},[N.length,r,t,o,i,p,P,R]),A=a(e=>{const t=Array.from(e.target.files??[]);t.length&&I(t),e.target.value=""},[I]),L=a(e=>{if(e.preventDefault(),M(!1),u)return;const t=Array.from(e.dataTransfer.files);t.length&&I(t)},[u,I]),T=a(e=>{e.preventDefault(),u||M(!0)},[u]),W=a(()=>M(!1),[]),j=a(e=>{D(t=>{const n=t.find(t=>t.id===e);n?.objectUrl&&URL.revokeObjectURL(n.objectUrl);const r=t.filter(t=>t.id!==e);return o?.(r.filter(e=>!e.error).map(e=>e.file)),r})},[o]),E=a(()=>{u||C.current?.click()},[u]),B=z?y.primary:y.border,V=ke(w),H=c?ke(c):"",O=/* @__PURE__ */b("div",{role:"button",tabIndex:u?-1:0,"aria-label":V,"aria-describedby":c?S:void 0,"aria-disabled":u,onClick:E,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),E())},onDrop:h?L:void 0,onDragOver:h?T:void 0,onDragLeave:h?W:void 0,className:At("flex flex-col items-center justify-center gap-3 w-full p-8 rounded-lg"),style:{border:`2px dashed ${B}`,backgroundColor:z?`${y.primary}10`:y.surface,cursor:u?"not-allowed":"pointer",opacity:u?.5:1,transition:$?"none":"border-color 150ms ease, background-color 150ms ease",outline:"none"},children:[/* @__PURE__ */b("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:z?y.primary:y.textMuted,strokeWidth:1.5,"aria-hidden":"true",children:[
116
+ /* @__PURE__ */x("line",{x1:"9",y1:"17",x2:"11",y2:"17"})]}:{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[/* @__PURE__ */x("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),/* @__PURE__ */x("polyline",{points:"14 2 14 8 20 8"})]})}var Kr=0;function Yr({accept:e,multiple:t=!1,maxSize:n,maxFiles:r,onChange:o,onError:i,label:l,hint:c,isDisabled:u=!1,preview:p=!0,dragDrop:h=!0,variant:g="dropzone"}){const y=se(),v=yn(),w=l??v.uploadFiles??"Upload files",k=v.dropFiles?.replace(/^.*$/,v.dropFiles)??"Drop files here",$=et(),S=d(),C=f(null),[z,M]=m(!1),[N,D]=m([]);s(()=>()=>{N.forEach(e=>{e.objectUrl&&URL.revokeObjectURL(e.objectUrl)})},[]);const R=a(e=>{let t=0;const n=setInterval(()=>{t+=Math.floor(20*Math.random())+10,t>=100&&(t=100,clearInterval(n)),D(n=>n.map(n=>n.id===e?{...n,progress:t}:n))},100)},[]),P=a(t=>n&&t.size>n?`"${ke(t.name)}" exceeds max size of ${qr(n)}`:/[\u0000-\u001F\u007F]|\.\.\/|\.\.\\/.test(t.name)?`"${ke(t.name)}" contains forbidden characters`:e&&!e.split(",").map(e=>e.trim()).some(e=>e.startsWith(".")?t.name.toLowerCase().endsWith(e.toLowerCase()):e.endsWith("/*")?t.type.startsWith(e.slice(0,-1)):t.type===e)?`"${ke(t.name)}" is not an accepted file type`:void 0,[e,n]),F=a(async e=>{if(!e.error)try{const t=await Xe(e.file);if(t&&e.file.type&&!e.file.type.startsWith(t.split("/")[0])){const t=`"${ke(e.file.name)}" file content does not match its type`;D(n=>n.map(n=>n.id===e.id?{...n,error:t}:n)),i?.(t)}}catch{}},[i]),I=a(e=>{const n=r?r-N.length:1/0;if(n<=0)return void i?.(`Maximum of ${r} file${1===r?"":"s"} allowed`);const a=e.slice(0,n).map(e=>{const t=P(e),n=p&&e.type.startsWith("image/")&&!t?URL.createObjectURL(e):void 0;return{file:e,id:"tkx-file-"+ ++Kr,objectUrl:n,progress:0,error:t}});D(e=>{const n=t?[...e,...a]:a,r=n.filter(e=>!e.error).map(e=>e.file);return o?.(r),n}),a.forEach(e=>{e.error?i?.(e.error):F(e)}),a.forEach(e=>{e.error||R(e.id)})},[N.length,r,t,o,i,p,R,P]),A=a(e=>{const t=Array.from(e.target.files??[]);t.length&&I(t),e.target.value=""},[I]),L=a(e=>{if(e.preventDefault(),M(!1),u)return;const t=Array.from(e.dataTransfer.files);t.length&&I(t)},[u,I]),T=a(e=>{e.preventDefault(),u||M(!0)},[u]),W=a(()=>M(!1),[]),j=a(e=>{D(t=>{const n=t.find(t=>t.id===e);n?.objectUrl&&URL.revokeObjectURL(n.objectUrl);const r=t.filter(t=>t.id!==e);return o?.(r.filter(e=>!e.error).map(e=>e.file)),r})},[o]),E=a(()=>{u||C.current?.click()},[u]),B=z?y.primary:y.border,V=ke(w),H=c?ke(c):"",O=/* @__PURE__ */b("div",{role:"button",tabIndex:u?-1:0,"aria-label":V,"aria-describedby":c?S:void 0,"aria-disabled":u,onClick:E,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),E())},onDrop:h?L:void 0,onDragOver:h?T:void 0,onDragLeave:h?W:void 0,className:At("flex flex-col items-center justify-center gap-3 w-full p-8 rounded-lg"),style:{border:`2px dashed ${B}`,backgroundColor:z?`${y.primary}10`:y.surface,cursor:u?"not-allowed":"pointer",opacity:u?.5:1,transition:$?"none":"border-color 150ms ease, background-color 150ms ease",outline:"none"},children:[/* @__PURE__ */b("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:z?y.primary:y.textMuted,strokeWidth:1.5,"aria-hidden":"true",children:[
117
117
  /* @__PURE__ */x("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
118
118
  /* @__PURE__ */x("polyline",{points:"17 8 12 3 7 8"}),
119
119
  /* @__PURE__ */x("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),/* @__PURE__ */b("div",{className:At("text-center"),children:[/* @__PURE__ */x("p",{className:At("m-0 text-sm font-medium"),style:{color:y.text},children:z?k:V}),H&&/* @__PURE__ */x("p",{id:S,className:At("m-0 text-xs mt-1"),style:{color:y.textMuted},children:H})]})]}),q=/* @__PURE__ */b("button",{type:"button",disabled:u,onClick:E,"aria-describedby":c?S:void 0,className:At("flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium font-sans border-none cursor-pointer"),style:{backgroundColor:y.primary,color:y.bg,opacity:u?.5:1,cursor:u?"not-allowed":"pointer"},children:[
@@ -128,9 +128,9 @@ return b("div",{className:At("flex flex-col gap-3 w-full font-sans"),children:[
128
128
  return b("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[r&&i&&/* @__PURE__ */x("defs",{children:/* @__PURE__ */b("linearGradient",{id:i,x1:"0",x2:"1",y1:"0",y2:"0",children:[/* @__PURE__ */x("stop",{offset:"50%",stopColor:n}),/* @__PURE__ */x("stop",{offset:"50%",stopColor:"transparent"})]})}),/* @__PURE__ */x("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",fill:r&&i?`url(#${i})`:t?n:"none",stroke:n,strokeWidth:1.5,strokeLinejoin:"round"})]})}function Gr({size:e,filled:t,color:n,halfFilled:r,id:o}){const i=o?`hg-${o}`:void 0;/* @__PURE__ */
129
129
  return b("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[r&&i&&/* @__PURE__ */x("defs",{children:/* @__PURE__ */b("linearGradient",{id:i,x1:"0",x2:"1",y1:"0",y2:"0",children:[/* @__PURE__ */x("stop",{offset:"50%",stopColor:n}),/* @__PURE__ */x("stop",{offset:"50%",stopColor:"transparent"})]})}),/* @__PURE__ */x("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",fill:r&&i?`url(#${i})`:t?n:"none",stroke:n,strokeWidth:1.5,strokeLinejoin:"round"})]})}function _r({size:e,filled:t,color:n,halfFilled:r,id:o}){const i=o?`hg-${o}`:void 0;/* @__PURE__ */
130
130
  return b("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[r&&i&&/* @__PURE__ */x("defs",{children:/* @__PURE__ */b("linearGradient",{id:i,x1:"0",x2:"1",y1:"0",y2:"0",children:[/* @__PURE__ */x("stop",{offset:"50%",stopColor:n}),/* @__PURE__ */x("stop",{offset:"50%",stopColor:"transparent"})]})}),/* @__PURE__ */x("circle",{cx:"12",cy:"12",r:"9",fill:r&&i?`url(#${i})`:t?n:"none",stroke:n,strokeWidth:1.5})]})}function Jr({type:e,size:t,filled:n,color:r,halfFilled:o,uid:i}){/* @__PURE__ */
131
- return x("heart"===e?Gr:"circle"===e?_r:Zr,{size:t,filled:n,color:r,halfFilled:o,id:i})}function Qr(e,t,n){return Math.min(n,Math.max(t,e))}function eo(e,t,n){if(1===n)return t+1;const r=e.currentTarget.getBoundingClientRect(),o=r.left+r.width/2;return e.clientX<o?t+.5:t+1}function to({value:e,defaultValue:t=0,onChange:n,max:r=5,precision:o=1,size:i="md",isReadOnly:l=!1,isDisabled:s=!1,label:c,showValue:u=!1,colorScheme:p="warning",emptyIcon:h="star",filledIcon:g="star"}){const y=se(),v=et(),w=d(),k=void 0!==e,[$,S]=m(t),[C,z]=m(null),M=f(null),N=k?e??0:$,D=C??N,P={warning:y.warning,primary:y.primary,danger:y.danger}[p]??y.warning,R=Xr[i],F=!l&&!s,I=a(e=>{k||S(e),n?.(e)},[k,n]),A=a((e,t)=>{F&&z(eo(e,t,o))},[F,o]),L=a(()=>{F&&z(null)},[F]),T=a((e,t)=>{if(!F)return;const n=eo(e,t,o);I(n===N?0:n)},[F,o,N,I]),W=a(e=>{if(!F)return;const t=o;let n=N;if("ArrowRight"===e.key||"ArrowUp"===e.key)e.preventDefault(),n=Qr(N+t,0,r);else if("ArrowLeft"===e.key||"ArrowDown"===e.key)e.preventDefault(),n=Qr(N-t,0,r);else if("Home"===e.key)e.preventDefault(),n=0;else{if("End"!==e.key)return;e.preventDefault(),n=r}n=function(e,t){return 1===t?Math.round(e):Math.round(2*e)/2}(n,o),I(n)},[F,N,r,o,I]),j=c?ke(c):"Rating";/* @__PURE__ */
131
+ return x("heart"===e?Gr:"circle"===e?_r:Zr,{size:t,filled:n,color:r,halfFilled:o,id:i})}function Qr(e,t,n){return Math.min(n,Math.max(t,e))}function eo(e,t,n){if(1===n)return t+1;const r=e.currentTarget.getBoundingClientRect(),o=r.left+r.width/2;return e.clientX<o?t+.5:t+1}function to({value:e,defaultValue:t=0,onChange:n,max:r=5,precision:o=1,size:i="md",isReadOnly:l=!1,isDisabled:s=!1,label:c,showValue:u=!1,colorScheme:p="warning",emptyIcon:h="star",filledIcon:g="star"}){const y=se(),v=et(),w=d(),k=void 0!==e,[$,S]=m(t),[C,z]=m(null),M=f(null),N=k?e??0:$,D=C??N,R={warning:y.warning,primary:y.primary,danger:y.danger}[p]??y.warning,P=Xr[i],F=!l&&!s,I=a(e=>{k||S(e),n?.(e)},[k,n]),A=a((e,t)=>{F&&z(eo(e,t,o))},[F,o]),L=a(()=>{F&&z(null)},[F]),T=a((e,t)=>{if(!F)return;const n=eo(e,t,o);I(n===N?0:n)},[F,o,N,I]),W=a(e=>{if(!F)return;const t=o;let n=N;if("ArrowRight"===e.key||"ArrowUp"===e.key)e.preventDefault(),n=Qr(N+t,0,r);else if("ArrowLeft"===e.key||"ArrowDown"===e.key)e.preventDefault(),n=Qr(N-t,0,r);else if("Home"===e.key)e.preventDefault(),n=0;else{if("End"!==e.key)return;e.preventDefault(),n=r}n=function(e,t){return 1===t?Math.round(e):Math.round(2*e)/2}(n,o),I(n)},[F,N,r,o,I]),j=c?ke(c):"Rating";/* @__PURE__ */
132
132
  return b("div",{className:jt(At("inline-flex items-center gap-2 font-sans"),s?At("opacity-50"):""),children:[/* @__PURE__ */x("div",{ref:M,role:"radiogroup","aria-label":j,"aria-disabled":s,"aria-readonly":l,tabIndex:F?0:-1,onKeyDown:W,onMouseLeave:L,className:At("flex items-center gap-0.5 outline-none"),style:{cursor:F?"pointer":"default"},children:Array.from({length:r},(e,t)=>{const n=t+1,r=t+.5,i=D>=n,a=!i&&.5===o&&D>=r,l=`${w}-${t}`;/* @__PURE__ */
133
- return x("span",{role:"radio","aria-checked":.5===o&&N===r||N===n,"aria-label":.5===o?`${r} star${1!==r?"s":""} / ${n} star${1!==n?"s":""}`:`${n} star${1!==n?"s":""}`,tabIndex:-1,onMouseMove:e=>A(e,t),onClick:e=>T(e,t),style:{display:"inline-flex",alignItems:"center",lineHeight:0,transition:v?"none":"transform 120ms ease",transform:null!==C&&D>=r&&F?"scale(1.15)":"scale(1)"},children:/* @__PURE__ */x(Jr,{type:i||a?g:h,size:R,filled:i,halfFilled:a,color:i||a?P:y.border,uid:a?l:void 0})},t)})}),u&&/* @__PURE__ */b("span",{className:At("text-sm tabular-nums"),style:{color:y.textMuted},"aria-live":"polite","aria-atomic":"true",children:[N%1==0?N.toFixed(0):N.toFixed(1)," / ",r]})]})}var no=!1;function ro(){/* @__PURE__ */
133
+ return x("span",{role:"radio","aria-checked":.5===o&&N===r||N===n,"aria-label":.5===o?`${r} star${1!==r?"s":""} / ${n} star${1!==n?"s":""}`:`${n} star${1!==n?"s":""}`,tabIndex:-1,onMouseMove:e=>A(e,t),onClick:e=>T(e,t),style:{display:"inline-flex",alignItems:"center",lineHeight:0,transition:v?"none":"transform 120ms ease",transform:null!==C&&D>=r&&F?"scale(1.15)":"scale(1)"},children:/* @__PURE__ */x(Jr,{type:i||a?g:h,size:P,filled:i,halfFilled:a,color:i||a?R:y.border,uid:a?l:void 0})},t)})}),u&&/* @__PURE__ */b("span",{className:At("text-sm tabular-nums"),style:{color:y.textMuted},"aria-live":"polite","aria-atomic":"true",children:[N%1==0?N.toFixed(0):N.toFixed(1)," / ",r]})]})}var no=!1;function ro(){/* @__PURE__ */
134
134
  return b("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none","aria-hidden":"true",children:[
135
135
  /* @__PURE__ */x("circle",{cx:"14",cy:"14",r:"14",fill:"currentColor",fillOpacity:"0.15"}),
136
136
  /* @__PURE__ */x("circle",{cx:"14",cy:"11",r:"4",fill:"currentColor"}),
@@ -140,231 +140,258 @@ return b("div",{className:At("flex items-center gap-1.5 px-4 py-3 rounded-2xl w-
140
140
  /* @__PURE__ */x("span",{className:"tkx-dot1 inline-block w-2 h-2 rounded-full",style:{backgroundColor:e.textMuted}}),
141
141
  /* @__PURE__ */x("span",{className:"tkx-dot2 inline-block w-2 h-2 rounded-full",style:{backgroundColor:e.textMuted}}),
142
142
  /* @__PURE__ */x("span",{className:"tkx-dot3 inline-block w-2 h-2 rounded-full",style:{backgroundColor:e.textMuted}})]})}function ao({message:e,showTimestamp:t,avatarUser:n,avatarAssistant:r}){const o=se(),i=et(),{role:a,content:l,timestamp:s,isStreaming:d,error:c}=e,u=ke(l),p=s?new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}).format(s):null;if("system"===a)/* @__PURE__ */return x("div",{role:"listitem",className:At("flex justify-center my-2"),children:/* @__PURE__ */x("p",{className:At("text-xs italic px-3 py-1 rounded-full"),style:{color:o.textMuted,backgroundColor:o.surfaceAlt},children:u})});const h="user"===a,f=h?n??/* @__PURE__ */x(ro,{}):r??/* @__PURE__ */x(oo,{}),m=h?{backgroundColor:o.primary,color:o.bg}:{backgroundColor:o.surface,color:o.text,border:`1px solid ${c?o.danger:o.border}`};return c&&(m.borderColor=o.danger,m.borderWidth="2px"),/* @__PURE__ */b("div",{role:"listitem",className:At("flex gap-2 mb-4",h?"flex-row-reverse":"flex-row"),children:[/* @__PURE__ */x("div",{className:At("shrink-0 w-8 h-8 rounded-full flex items-center justify-center overflow-hidden"),style:{color:h?o.primary:o.secondary},children:f}),/* @__PURE__ */b("div",{className:At("flex flex-col gap-1 max-w-[75%]",h?"items-end":"items-start"),children:[/* @__PURE__ */b("div",{className:jt(At("px-4 py-2.5 rounded-2xl text-sm leading-relaxed break-words whitespace-pre-wrap"),d&&!i?"tkx-cursor":""),style:m,children:[u,c&&/* @__PURE__ */x("span",{"aria-label":"Error",style:{marginLeft:6,color:o.danger},children:"⚠"})]}),t&&p&&/* @__PURE__ */x("span",{className:At("text-[10px]"),style:{color:o.textMuted},children:p})]})]})}function lo({messages:e,onSend:t,isLoading:n=!1,placeholder:r="Type a message…",maxLength:o,showTimestamps:i=!1,avatarUser:l,avatarAssistant:d,height:c=480,inputPosition:u="bottom"}){const p=se(),h=et(),[g,y]=m(""),v=f(null),w=f(null);s(()=>{!function(){if(no||"undefined"==typeof document)return;no=!0;const e=document.createElement("style");e.textContent="\n @keyframes tkx-blink { 0%,100% { opacity:1 } 50% { opacity:0 } }\n @keyframes tkx-bounce { 0%,100% { transform:translateY(0) } 50% { transform:translateY(-5px) } }\n .tkx-cursor::after { content:'▋'; display:inline-block; animation:tkx-blink 1s step-start infinite; margin-left:1px; }\n .tkx-dot1 { animation:tkx-bounce 1s ease-in-out infinite; }\n .tkx-dot2 { animation:tkx-bounce 1s ease-in-out 0.2s infinite; }\n .tkx-dot3 { animation:tkx-bounce 1s ease-in-out 0.4s infinite; }\n ",document.head.appendChild(e)}()},[]),s(()=>{const e=v.current;e&&e.scrollTo({top:e.scrollHeight,behavior:h?"auto":"smooth"})},[e,n,h]);const k=a(()=>{const e=g.trim();e&&t&&(t(e),y(""),w.current&&(w.current.style.height="auto"))},[g,t]),$=a(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),k())},[k]),S=a(e=>{y(o?e.target.value.slice(0,o):e.target.value);const t=w.current;if(t){t.style.height="auto";const e=120;t.style.height=`${Math.min(t.scrollHeight,e)}px`}},[o]),C=g.trim().length>0&&!n,z="number"==typeof c?`${c}px`:c,M="floating"===u,N=/* @__PURE__ */b("div",{className:At("flex flex-col gap-1 p-3"),style:M?{position:"absolute",bottom:12,left:12,right:12,borderRadius:16,backgroundColor:p.surface,border:`1px solid ${p.border}`,boxShadow:"0 4px 24px rgba(0,0,0,0.18)"}:{borderTop:`1px solid ${p.border}`,backgroundColor:p.surface},children:[/* @__PURE__ */b("div",{className:At("flex items-end gap-2"),children:[/* @__PURE__ */x("textarea",{ref:w,rows:1,value:g,onChange:S,onKeyDown:$,placeholder:ke(r),"aria-label":"Message input","aria-multiline":"true",disabled:n,className:At("flex-1 resize-none text-sm leading-6 bg-transparent outline-none py-1"),style:{color:p.text,caretColor:p.primary,minHeight:32,maxHeight:120}}),/* @__PURE__ */x("button",{onClick:k,disabled:!C,"aria-label":"Send message",className:At("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center",!h&&"transition-opacity duration-150",C?"cursor-pointer opacity-100":"opacity-40 cursor-not-allowed"),style:{backgroundColor:p.primary,color:p.bg},children:/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M2 14L14 8 2 2v4.5l8 1.5-8 1.5V14z",fill:"currentColor"})})})]}),o&&/* @__PURE__ */b("div",{className:At("text-right text-[10px]"),style:{color:p.textMuted},children:[g.length,"/",o]})]});/* @__PURE__ */
143
- return b("div",{className:At("flex flex-col overflow-hidden rounded-2xl"),style:{height:z,backgroundColor:p.bg,border:`1px solid ${p.border}`,position:"relative"},children:[/* @__PURE__ */x("div",{ref:v,role:"log","aria-live":"polite","aria-label":"Chat messages",className:At("flex-1 overflow-y-auto p-4"),style:{paddingBottom:M?80:void 0},children:/* @__PURE__ */b("div",{role:"list",children:[e.map(e=>/* @__PURE__ */x(ao,{message:e,showTimestamp:i,avatarUser:l,avatarAssistant:d},e.id)),n&&/* @__PURE__ */b("div",{role:"listitem",className:At("flex gap-2 mb-4"),children:[/* @__PURE__ */x("div",{className:At("w-8 h-8 shrink-0")}),/* @__PURE__ */x(io,{})]})]})}),N]})}var so={sm:"text-[11px]",md:"text-xs",lg:"text-sm"},co={sm:"px-2 py-0.5",md:"px-2.5 py-1",lg:"px-3 py-1.5"},uo={sm:"gap-1",md:"gap-1.5",lg:"gap-2"},po={sm:12,md:14,lg:16};function ho({variant:e="subtle",size:t="md",colorScheme:n="default",onRemove:r,leftIcon:o,isDisabled:i=!1,clickable:a=!1,children:l,className:s,style:d,onClick:c,...u}){se();const p=et(),h=function(e,t){const n=se(),r={default:n.textMuted,primary:n.primary,secondary:n.secondary,success:n.success,danger:n.danger,warning:n.warning,info:n.info}[e];return"solid"===t?{bg:r,color:n.bg,border:"transparent"}:"subtle"===t?{bg:`${r}22`,color:r,border:"transparent"}:{bg:"transparent",color:r,border:r}}(n,e),f="string"==typeof l?ke(l):l,m=po[t],g=At("inline-flex items-center font-medium rounded-full select-none",so[t],co[t],uo[t],i?"opacity-50 cursor-not-allowed":a?"cursor-pointer":"cursor-default",a&&!p&&"transition-opacity duration-150");/* @__PURE__ */
143
+ return b("div",{className:At("flex flex-col overflow-hidden rounded-2xl"),style:{height:z,backgroundColor:p.bg,border:`1px solid ${p.border}`,position:"relative"},children:[/* @__PURE__ */x("div",{ref:v,role:"log","aria-live":"polite","aria-label":"Chat messages",className:At("flex-1 overflow-y-auto p-4"),style:{paddingBottom:M?80:void 0},children:/* @__PURE__ */b("div",{role:"list",children:[e.map(e=>/* @__PURE__ */x(ao,{message:e,showTimestamp:i,avatarUser:l,avatarAssistant:d},e.id)),n&&/* @__PURE__ */b("div",{role:"listitem",className:At("flex gap-2 mb-4"),children:[/* @__PURE__ */x("div",{className:At("w-8 h-8 shrink-0")}),/* @__PURE__ */x(io,{})]})]})}),N]})}var so=["👍","❤️","😂","🎉","😢","👀"];function co(e){return e instanceof Date?e:new Date(e)}function uo(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(e)}function po(e){const t=/* @__PURE__ */new Date,n=new Date(t);n.setDate(t.getDate()-1);const r=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();return r(e,t)?"Today":r(e,n)?"Yesterday":e.toLocaleDateString()}function ho({state:e,color:t,danger:n}){if("sending"===e)/* @__PURE__ */return x("span",{"aria-label":"Sending",title:"Sending",style:{display:"inline-block",width:8,height:8,borderRadius:"50%",backgroundColor:t,opacity:.6}});if("failed"===e)/* @__PURE__ */return x("span",{"aria-label":"Failed",title:"Failed",style:{color:n,fontWeight:700,fontSize:12},children:"!"});if("sent"===e)/* @__PURE__ */return x("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,"aria-label":"Sent",children:/* @__PURE__ */x("path",{d:"M2 8l4 4 8-8",stroke:t,strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})});const r="read"===e?2.2:1.4;/* @__PURE__ */
144
+ return b("svg",{width:18,height:14,viewBox:"0 0 22 16",fill:"none","aria-label":"read"===e?"Read":"Delivered",children:[/* @__PURE__ */x("path",{d:"M2 8l4 4 8-8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),/* @__PURE__ */x("path",{d:"M8 12l4 4 8-8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fo({sender:e,color:t,bg:n}){return e.avatar?/* @__PURE__ */x("img",{src:e.avatar,alt:ke(e.name),className:At("rounded-full"),style:{width:32,height:32,objectFit:"cover"}}):/* @__PURE__ */x("div",{className:At("rounded-full flex items-center justify-center text-xs font-medium"),style:{width:32,height:32,backgroundColor:n,color:t},"aria-hidden":"true",children:(r=e.name,ke(r).split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()??"").join("")||"?")});var r}function mo({att:e,theme:t}){const n=ke(e.name);return"image"===e.kind?/* @__PURE__ */x("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:At("block mt-2"),children:/* @__PURE__ */x("img",{src:e.url,alt:n,loading:"lazy",className:At("rounded-md"),style:{maxWidth:260,maxHeight:260,display:"block"}})}):"audio"===e.kind?/* @__PURE__ */x("audio",{controls:!0,src:e.url,className:At("mt-2 block"),style:{maxWidth:260},"aria-label":n}):"video"===e.kind?/* @__PURE__ */x("video",{controls:!0,src:e.url,poster:e.thumbnail,className:At("mt-2 rounded-md"),style:{maxWidth:260,display:"block"},"aria-label":n}):/* @__PURE__ */b("a",{href:e.url,download:e.name,target:"_blank",rel:"noopener noreferrer",className:At("flex items-center gap-2 mt-2 px-2.5 py-2 rounded-md text-xs no-underline"),style:{backgroundColor:t.surfaceAlt,color:t.text,border:`1px solid ${t.border}`},children:[
145
+ /* @__PURE__ */b("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[/* @__PURE__ */x("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),/* @__PURE__ */x("polyline",{points:"14 2 14 8 20 8"})]}),
146
+ /* @__PURE__ */b("div",{className:At("flex flex-col min-w-0"),children:[/* @__PURE__ */x("span",{className:At("truncate font-medium"),style:{maxWidth:200},children:n}),/* @__PURE__ */b("span",{style:{color:t.textMuted,fontSize:10},children:[ke(e.mimeType),null!=e.size?" · "+(r=e.size,r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:`${(r/1048576).toFixed(1)} MB`):""]})]}),
147
+ /* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M4 21h16"})})]});var r}function go({messages:e,senders:t,currentUserId:n,onSend:r,onReact:o,onEdit:i,onDelete:l,onAttach:d,height:c=520,placeholder:u="Type a message…",showTimeSeparators:h=!0,groupConsecutive:y=!0,emojiPickerOptions:v=so,className:w,style:k,typingUserIds:$,onTypingStart:S,onTypingStop:C}){const z=se(),M=et(),[N,D]=m(""),[R,P]=m(null),[F,I]=m(null),[A,L]=m(null),[T,W]=m(""),[j,E]=m(null),B=f(null),V=f(null),H=f(null),O=f(!1),q=f(null),U=a(()=>{null!=q.current&&(clearTimeout(q.current),q.current=null),O.current&&(O.current=!1,C?.())},[C]),K=a(()=>{O.current||(O.current=!0,S?.()),null!=q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{q.current=null,O.current&&(O.current=!1,C?.())},3e3)},[S,C]);s(()=>()=>{null!=q.current&&(clearTimeout(q.current),q.current=null)},[]),s(()=>{const e=B.current;e&&e.scrollTo({top:e.scrollHeight,behavior:M?"auto":"smooth"})},[e.length,M]);const Y=p(()=>{const t={};for(const n of e)t[n.id]=n;return t},[e]),X=a(()=>{const e=N.trim();e&&r&&(r(ke(e),R??void 0),D(""),P(null),V.current&&(V.current.style.height="auto"),U())},[N,r,R,U]),Z=a(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),X())},[X]),G=a(e=>{const t=e.target.value;D(t);const n=V.current;if(n){n.style.height="auto";const e=160;n.style.height=`${Math.min(n.scrollHeight,e)}px`}0===t.length?U():K()},[K,U]),_=a(()=>{U()},[U]),J=a(async e=>{const t=Array.from(e.target.files??[]);if(e.target.value="",!t.length||!d)return;E(null);const n=[],r=[];for(const o of t)try{const e=await Xe(o),t=(o.type||"").split("/")[0],i=e?e.split("/")[0]:null;if(!e||t&&i&&t!==i){r.push(o.name);continue}n.push(o)}catch{r.push(o.name)}r.length&&E(`File type does not match its content — refusing to attach: ${r.map(ke).join(", ")}`),n.length&&await d(n)},[d]),Q=a((e,t)=>{I(null),o?.(e,t)},[o]),ee=a(e=>{("undefined"==typeof window||window.confirm("Delete this message?"))&&l?.(e)},[l]),te=a(e=>{L(e.id),W(e.text??"")},[]),ne=a(e=>{const t=T.trim();t&&(i?.(e,ke(t)),L(null),W(""))},[T,i]),re="number"==typeof c?`${c}px`:c,oe=R?Y[R]:null,ie=oe?t[oe.senderId]:null,ae=p(()=>{if(!$||0===$.length)return null;const e=$.map(e=>ke(t[e]?.name??"Unknown"));return 1===e.length?`${e[0]} is typing`:2===e.length?`${e[0]} and ${e[1]} are typing`:"Several people are typing"},[$,t]),le=[];let de=null;for(const a of e){const e=co(a.timestamp);h&&(de?co(de.timestamp).toDateString():null)!==e.toDateString()&&le.push({kind:"sep",key:`sep-${a.id}`,label:po(e)});const t=y&&null!=de&&de.senderId===a.senderId&&co(de.timestamp).toDateString()===e.toDateString()&&e.getTime()-co(de.timestamp).getTime()<3e5;le.push({kind:"msg",key:a.id,msg:a,showHeader:!t}),de=a}/* @__PURE__ */
148
+ return b("div",{className:jt(At("flex flex-col overflow-hidden rounded-2xl"),w),style:{height:re,backgroundColor:z.bg,border:`1px solid ${z.border}`,...k},children:[
149
+ /* @__PURE__ */x("div",{ref:B,role:"log","aria-live":"polite","aria-label":"Message thread",className:At("flex-1 overflow-y-auto p-4"),children:le.map(e=>{if("sep"===e.kind)/* @__PURE__ */return x("div",{className:At("flex items-center justify-center my-3"),children:/* @__PURE__ */x("span",{className:At("text-[11px] px-2.5 py-0.5 rounded-full"),style:{color:z.textMuted,backgroundColor:z.surfaceAlt},children:e.label})},e.key);const r=e.msg,a=t[r.senderId]??{id:r.senderId,name:"Unknown"},s=r.senderId===n,d=co(r.timestamp),c=!!r.deletedAt,u=r.replyTo?Y[r.replyTo]:null,p=u?t[u.senderId]:null,h=A===r.id,f=s?{backgroundColor:z.primary,color:z.bg}:{backgroundColor:z.surface,color:z.text,border:`1px solid ${z.border}`};/* @__PURE__ */
150
+ return b("div",{role:"article","aria-label":`${ke(a.name)}, ${uo(d)}`,"data-own":s?"true":"false","data-grouped":e.showHeader?"false":"true",className:At("flex gap-2 mb-1",s?"flex-row-reverse":"flex-row"),style:{marginTop:e.showHeader?12:2},children:[/* @__PURE__ */x("div",{className:At("shrink-0"),style:{width:32},children:e.showHeader?/* @__PURE__ */x(fo,{sender:a,color:z.primary,bg:z.surfaceAlt}):null}),/* @__PURE__ */b("div",{className:At("flex flex-col max-w-[75%]",s?"items-end":"items-start"),children:[e.showHeader&&/* @__PURE__ */b("div",{className:At("flex items-center gap-2 mb-0.5 text-xs"),style:{color:z.textMuted},children:[
151
+ /* @__PURE__ */x("span",{style:{fontWeight:600,color:z.text},children:ke(a.name)}),a.role&&/* @__PURE__ */b("span",{children:["· ",ke(a.role)]}),
152
+ /* @__PURE__ */b("span",{children:["· ",uo(d)]}),r.editedAt&&!c&&/* @__PURE__ */x("span",{children:"(edited)"})]}),u&&!c&&/* @__PURE__ */b("div",{className:At("mb-1 px-2 py-1 rounded text-xs"),style:{backgroundColor:z.surfaceAlt,borderLeft:`3px solid ${z.primary}`,color:z.textMuted,maxWidth:"100%"},children:[
153
+ /* @__PURE__ */b("span",{style:{fontWeight:600},children:[ke(p?.name??"Unknown"),":"," "]}),ke((u.text??"").slice(0,80)),(u.text??"").length>80?"…":""]}),
154
+ /* @__PURE__ */x("div",{className:At("px-3 py-2 rounded-2xl text-sm leading-relaxed break-words whitespace-pre-wrap"),style:f,children:c?/* @__PURE__ */x("span",{style:{fontStyle:"italic",opacity:.7},children:"Message deleted"}):h?/* @__PURE__ */b("div",{className:At("flex flex-col gap-1"),children:[/* @__PURE__ */x("textarea",{value:T,onChange:e=>W(e.target.value),"aria-label":"Edit message",className:At("text-sm leading-relaxed bg-transparent outline-none resize-none w-full"),style:{color:"inherit",minHeight:48,border:`1px solid ${z.border}`,borderRadius:8,padding:4}}),/* @__PURE__ */b("div",{className:At("flex gap-2 justify-end"),children:[/* @__PURE__ */x("button",{type:"button",onClick:()=>L(null),className:At("text-xs px-2 py-1 rounded bg-transparent border-none cursor-pointer"),style:{color:"inherit"},children:"Cancel"}),/* @__PURE__ */x("button",{type:"button",onClick:()=>ne(r.id),className:At("text-xs px-2 py-1 rounded border-none cursor-pointer"),style:{backgroundColor:z.bg,color:z.primary},children:"Save"})]})]}):/* @__PURE__ */b(g,{children:[r.text&&ke(r.text),r.attachments?.map(e=>/* @__PURE__ */x(mo,{att:e,theme:z},e.id))]})}),!c&&/* @__PURE__ */b("div",{className:At("flex items-center gap-1 mt-1 flex-wrap",s?"justify-end":"justify-start"),children:[r.reactions?.map(e=>{const t=e.by.includes(n);/* @__PURE__ */
155
+ return b("button",{type:"button",onClick:()=>o?.(r.id,e.emoji),"aria-label":`React ${e.emoji} (${e.by.length})`,"aria-pressed":t,className:At("text-xs px-1.5 py-0.5 rounded-full cursor-pointer"),style:{backgroundColor:t?z.primary+"33":z.surfaceAlt,border:`1px solid ${t?z.primary:z.border}`,color:z.text},children:[e.emoji," ",e.by.length]},e.emoji)}),s&&r.delivery&&/* @__PURE__ */x("span",{className:At("inline-flex items-center ml-1"),children:/* @__PURE__ */x(ho,{state:r.delivery,color:z.textMuted,danger:z.danger})})]}),!c&&!h&&/* @__PURE__ */b("div",{className:At("flex items-center gap-1 mt-1 text-xs"),style:{color:z.textMuted,opacity:.85},children:[
156
+ /* @__PURE__ */x("button",{type:"button",onClick:()=>P(r.id),"aria-label":"Reply to message",className:At("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"Reply"}),
157
+ /* @__PURE__ */x("button",{type:"button",onClick:()=>I(e=>e===r.id?null:r.id),"aria-label":"React to message","aria-expanded":F===r.id,className:At("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"React"}),s&&i&&/* @__PURE__ */x("button",{type:"button",onClick:()=>te(r),"aria-label":"Edit message",className:At("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"Edit"}),s&&l&&/* @__PURE__ */x("button",{type:"button",onClick:()=>ee(r.id),"aria-label":"Delete message",className:At("bg-transparent border-none cursor-pointer px-1 py-0.5 rounded"),style:{color:"inherit"},children:"Delete"}),F===r.id&&/* @__PURE__ */x("div",{role:"menu","aria-label":"Pick a reaction",className:At("flex items-center gap-1 ml-1 px-1.5 py-1 rounded-full"),style:{backgroundColor:z.surface,border:`1px solid ${z.border}`},children:v.map(e=>/* @__PURE__ */x("button",{type:"button",role:"menuitem",onClick:()=>Q(r.id,e),"aria-label":`React with ${e}`,className:At("bg-transparent border-none cursor-pointer text-sm px-1"),style:{color:"inherit"},children:e},e))})]})]})]},e.key)})}),ae&&/* @__PURE__ */b("div",{role:"status","aria-live":"polite",className:At("px-4 py-1 flex items-center gap-1"),style:{color:z.textMuted,fontSize:12,fontStyle:"italic",borderTop:`1px solid ${z.border}`,backgroundColor:z.bg},children:[/* @__PURE__ */x("span",{children:ae}),M?/* @__PURE__ */x("span",{"aria-hidden":"true",children:"…"}):/* @__PURE__ */b("span",{"aria-hidden":"true",className:At("inline-flex items-end gap-0.5"),style:{marginLeft:2},children:[
158
+ /* @__PURE__ */x("span",{style:{width:3,height:3,borderRadius:"50%",backgroundColor:"currentColor",animation:"tkx-typing-dot 1.2s infinite ease-in-out",animationDelay:"0s",display:"inline-block"}}),
159
+ /* @__PURE__ */x("span",{style:{width:3,height:3,borderRadius:"50%",backgroundColor:"currentColor",animation:"tkx-typing-dot 1.2s infinite ease-in-out",animationDelay:"0.15s",display:"inline-block"}}),
160
+ /* @__PURE__ */x("span",{style:{width:3,height:3,borderRadius:"50%",backgroundColor:"currentColor",animation:"tkx-typing-dot 1.2s infinite ease-in-out",animationDelay:"0.3s",display:"inline-block"}}),
161
+ /* @__PURE__ */x("style",{children:"@keyframes tkx-typing-dot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } } @media (prefers-reduced-motion: reduce) { @keyframes tkx-typing-dot { 0%, 100% { opacity: 1; transform: none; } } }"})]})]}),
162
+ /* @__PURE__ */b("div",{className:At("flex flex-col gap-1 p-3"),style:{borderTop:`1px solid ${z.border}`,backgroundColor:z.surface},children:[j&&/* @__PURE__ */x("div",{role:"alert",className:At("text-xs px-2 py-1 rounded"),style:{backgroundColor:z.danger+"20",color:z.danger,border:`1px solid ${z.danger}`},children:j}),oe&&/* @__PURE__ */b("div",{className:At("flex items-center gap-2 px-2 py-1 rounded text-xs"),style:{backgroundColor:z.surfaceAlt,color:z.textMuted},children:[/* @__PURE__ */b("span",{className:At("truncate flex-1"),children:["Replying to"," ",
163
+ /* @__PURE__ */x("span",{style:{fontWeight:600,color:z.text},children:ke(ie?.name??"Unknown")}),": ",ke((oe.text??"").slice(0,80))]}),/* @__PURE__ */x("button",{type:"button",onClick:()=>P(null),"aria-label":"Cancel reply",className:At("bg-transparent border-none cursor-pointer"),style:{color:"inherit"},children:"×"})]}),
164
+ /* @__PURE__ */b("div",{className:At("flex items-end gap-2"),children:[d&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("input",{ref:H,type:"file",multiple:!0,onChange:J,className:At("sr-only"),tabIndex:-1,"aria-hidden":"true"}),/* @__PURE__ */x("button",{type:"button",onClick:()=>H.current?.click(),"aria-label":"Attach files",className:At("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center cursor-pointer border-none"),style:{backgroundColor:z.surfaceAlt,color:z.text},children:/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,"aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})})]}),
165
+ /* @__PURE__ */x("textarea",{ref:V,rows:1,value:N,onChange:G,onKeyDown:Z,onBlur:_,placeholder:ke(u),"aria-label":"Message input","aria-multiline":"true",className:At("flex-1 resize-none text-sm leading-6 bg-transparent outline-none py-1"),style:{color:z.text,caretColor:z.primary,minHeight:32,maxHeight:160}}),
166
+ /* @__PURE__ */x("button",{type:"button",onClick:X,disabled:!N.trim(),"aria-label":"Send message",className:At("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center border-none",N.trim()?"cursor-pointer opacity-100":"opacity-40 cursor-not-allowed"),style:{backgroundColor:z.primary,color:z.bg},children:/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M2 14L14 8 2 2v4.5l8 1.5-8 1.5V14z",fill:"currentColor"})})})]})]})]})}var xo={sm:"text-[11px]",md:"text-xs",lg:"text-sm"},bo={sm:"px-2 py-0.5",md:"px-2.5 py-1",lg:"px-3 py-1.5"},yo={sm:"gap-1",md:"gap-1.5",lg:"gap-2"},vo={sm:12,md:14,lg:16};function wo({variant:e="subtle",size:t="md",colorScheme:n="default",onRemove:r,leftIcon:o,isDisabled:i=!1,clickable:a=!1,children:l,className:s,style:d,onClick:c,...u}){se();const p=et(),h=function(e,t){const n=se(),r={default:n.textMuted,primary:n.primary,secondary:n.secondary,success:n.success,danger:n.danger,warning:n.warning,info:n.info}[e];return"solid"===t?{bg:r,color:n.bg,border:"transparent"}:"subtle"===t?{bg:`${r}22`,color:r,border:"transparent"}:{bg:"transparent",color:r,border:r}}(n,e),f="string"==typeof l?ke(l):l,m=vo[t],g=At("inline-flex items-center font-medium rounded-full select-none",xo[t],bo[t],yo[t],i?"opacity-50 cursor-not-allowed":a?"cursor-pointer":"cursor-default",a&&!p&&"transition-opacity duration-150");/* @__PURE__ */
144
167
  return b("span",{role:a?"button":void 0,tabIndex:a&&!i?0:void 0,"aria-disabled":i||void 0,className:jt(g,s),style:{backgroundColor:h.bg,color:h.color,border:`1px solid ${"transparent"===h.border?"transparent":h.border}`,...d},onClick:i?void 0:c,onKeyDown:a&&!i&&c?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),c(e))}:void 0,...u,children:[o&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:At("shrink-0 flex items-center"),children:o}),
145
- /* @__PURE__ */x("span",{children:f}),r&&!i&&/* @__PURE__ */x("button",{type:"button","aria-label":`Remove ${"string"==typeof l?l:"tag"}`,onClick:e=>{e.stopPropagation(),r()},className:At("shrink-0 flex items-center justify-center rounded-full cursor-pointer"),style:{width:m+4,height:m+4,color:h.color,backgroundColor:"transparent",border:"none",padding:0},tabIndex:0,children:/* @__PURE__ */x("svg",{width:m,height:m,viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M2 2l8 8M10 2L2 10",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})})]})}function fo({value:e,defaultValue:t=[],onChange:n,placeholder:r="Add tag…",maxTags:o,allowDuplicates:i=!1,validate:l,colorScheme:s="primary",size:d="md",label:c,hint:u,isDisabled:p=!1}){const h=se(),g=et(),[y,v]=m(t),[w,k]=m(""),[$,S]=m(null),C=f(null),z=void 0!==e,M=z?e:y,N=a(e=>{z||v(e),n?.(e)},[z,n]),D=a(e=>{const t=e.trim();if(t)if(void 0!==o&&M.length>=o)S(`Maximum ${o} tags allowed`);else if(i||!M.includes(t)){if(l){const e=l(t);if(!1===e)return void S("Invalid tag");if("string"==typeof e)return void S(e)}S(null),N([...M,t]),k("")}else S("Duplicate tags are not allowed")},[M,o,i,l,N]),P=a(e=>{N(M.filter((t,n)=>n!==e)),S(null)},[M,N]),R=a(e=>{"Enter"===e.key||","===e.key?(e.preventDefault(),D(w)):"Backspace"===e.key&&""===w&&M.length>0&&P(M.length-1)},[w,M,D,P]),F=a(e=>{const t=e.target.value;t.endsWith(",")?D(t.slice(0,-1)):(k(t),$&&S(null))},[D,$]),I="sm"===d?"6px 8px":"lg"===d?"10px 12px":"8px 10px",A="sm"===d?11:"lg"===d?14:12;/* @__PURE__ */
168
+ /* @__PURE__ */x("span",{children:f}),r&&!i&&/* @__PURE__ */x("button",{type:"button","aria-label":`Remove ${"string"==typeof l?l:"tag"}`,onClick:e=>{e.stopPropagation(),r()},className:At("shrink-0 flex items-center justify-center rounded-full cursor-pointer"),style:{width:m+4,height:m+4,color:h.color,backgroundColor:"transparent",border:"none",padding:0},tabIndex:0,children:/* @__PURE__ */x("svg",{width:m,height:m,viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M2 2l8 8M10 2L2 10",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})})]})}function ko({value:e,defaultValue:t=[],onChange:n,placeholder:r="Add tag…",maxTags:o,allowDuplicates:i=!1,validate:l,colorScheme:s="primary",size:d="md",label:c,hint:u,isDisabled:p=!1}){const h=se(),g=et(),[y,v]=m(t),[w,k]=m(""),[$,S]=m(null),C=f(null),z=void 0!==e,M=z?e:y,N=a(e=>{z||v(e),n?.(e)},[z,n]),D=a(e=>{const t=e.trim();if(t)if(void 0!==o&&M.length>=o)S(`Maximum ${o} tags allowed`);else if(i||!M.includes(t)){if(l){const e=l(t);if(!1===e)return void S("Invalid tag");if("string"==typeof e)return void S(e)}S(null),N([...M,t]),k("")}else S("Duplicate tags are not allowed")},[M,o,i,l,N]),R=a(e=>{N(M.filter((t,n)=>n!==e)),S(null)},[M,N]),P=a(e=>{"Enter"===e.key||","===e.key?(e.preventDefault(),D(w)):"Backspace"===e.key&&""===w&&M.length>0&&R(M.length-1)},[w,M,D,R]),F=a(e=>{const t=e.target.value;t.endsWith(",")?D(t.slice(0,-1)):(k(t),$&&S(null))},[D,$]),I="sm"===d?"6px 8px":"lg"===d?"10px 12px":"8px 10px",A="sm"===d?11:"lg"===d?14:12;/* @__PURE__ */
146
169
  return b("div",{className:At("flex flex-col gap-1.5"),children:[c&&/* @__PURE__ */x("label",{className:At("text-sm font-medium"),style:{color:h.text},onClick:()=>C.current?.focus(),children:ke(c)}),
147
- /* @__PURE__ */b("div",{className:At("flex flex-wrap items-center gap-1.5 rounded-lg cursor-text",!g&&"transition-colors duration-150"),style:{padding:I,backgroundColor:h.surface,border:`1.5px solid ${$?h.danger:h.border}`,opacity:p?.55:1,minHeight:"sm"===d?36:"lg"===d?48:40},onClick:()=>!p&&C.current?.focus(),children:[M.map((e,t)=>/* @__PURE__ */x(ho,{size:d,variant:"subtle",colorScheme:s,onRemove:p?void 0:()=>P(t),isDisabled:p,children:e},`${e}-${t}`)),(!o||M.length<o)&&!p&&/* @__PURE__ */x("input",{ref:C,type:"text",value:w,onChange:F,onKeyDown:R,placeholder:0===M.length?ke(r):"",disabled:p,className:At("flex-1 bg-transparent outline-none min-w-[80px]"),style:{fontSize:A,color:h.text,caretColor:h.primary},"aria-label":c??"Tag input"})]}),$&&/* @__PURE__ */x("p",{className:At("text-xs"),style:{color:h.danger},role:"alert",children:$}),u&&!$&&/* @__PURE__ */x("p",{className:At("text-xs"),style:{color:h.textMuted},children:ke(u)})]})}var mo=!1;function go({status:e="pending",icon:t,size:n=28}){const r=se(),o=et(),i=function(e="pending"){const t=se();return{completed:t.success,active:t.primary,pending:t.border,error:t.danger}[e]}(e),a="active"===e;/* @__PURE__ */
148
- return x("div",{className:jt(At("relative flex items-center justify-center rounded-full shrink-0 z-10"),a&&!o?"tkx-pulse-dot":""),style:{width:n,height:n,backgroundColor:"pending"===e?r.surface:i,border:`2px solid ${i}`,color:"pending"===e?i:r.bg},"aria-hidden":"true",children:/* @__PURE__ */x("span",t?{style:{fontSize:.45*n,lineHeight:1},children:t}:{style:{width:.35*n,height:.35*n,borderRadius:"50%",backgroundColor:"pending"===e?i:r.bg,display:"block"}})})}function xo({style:e,color:t,animate:n}){return se(),/* @__PURE__ */x("div",{className:jt(At("w-0.5 flex-1 min-h-[24px]"),n?"tkx-draw-v":""),style:{borderLeft:`2px ${e} ${t}`,backgroundColor:"transparent",alignSelf:"stretch",borderColor:t,marginLeft:1},"aria-hidden":"true"})}function bo({style:e,color:t,animate:n}){/* @__PURE__ */
149
- return x("div",{className:jt(At("h-0.5 flex-1 min-w-[24px]"),n?"tkx-draw-h":""),style:{borderTop:`2px ${e} ${t}`,borderColor:t},"aria-hidden":"true"})}function yo({item:e,compact:t}){const n=se(),r=e.timestamp?ke(e.timestamp):null;/* @__PURE__ */
170
+ /* @__PURE__ */b("div",{className:At("flex flex-wrap items-center gap-1.5 rounded-lg cursor-text",!g&&"transition-colors duration-150"),style:{padding:I,backgroundColor:h.surface,border:`1.5px solid ${$?h.danger:h.border}`,opacity:p?.55:1,minHeight:"sm"===d?36:"lg"===d?48:40},onClick:()=>!p&&C.current?.focus(),children:[M.map((e,t)=>/* @__PURE__ */x(wo,{size:d,variant:"subtle",colorScheme:s,onRemove:p?void 0:()=>R(t),isDisabled:p,children:e},`${e}-${t}`)),(!o||M.length<o)&&!p&&/* @__PURE__ */x("input",{ref:C,type:"text",value:w,onChange:F,onKeyDown:P,placeholder:0===M.length?ke(r):"",disabled:p,className:At("flex-1 bg-transparent outline-none min-w-[80px]"),style:{fontSize:A,color:h.text,caretColor:h.primary},"aria-label":c??"Tag input"})]}),$&&/* @__PURE__ */x("p",{className:At("text-xs"),style:{color:h.danger},role:"alert",children:$}),u&&!$&&/* @__PURE__ */x("p",{className:At("text-xs"),style:{color:h.textMuted},children:ke(u)})]})}var $o=!1;function So({status:e="pending",icon:t,size:n=28}){const r=se(),o=et(),i=function(e="pending"){const t=se();return{completed:t.success,active:t.primary,pending:t.border,error:t.danger}[e]}(e),a="active"===e;/* @__PURE__ */
171
+ return x("div",{className:jt(At("relative flex items-center justify-center rounded-full shrink-0 z-10"),a&&!o?"tkx-pulse-dot":""),style:{width:n,height:n,backgroundColor:"pending"===e?r.surface:i,border:`2px solid ${i}`,color:"pending"===e?i:r.bg},"aria-hidden":"true",children:/* @__PURE__ */x("span",t?{style:{fontSize:.45*n,lineHeight:1},children:t}:{style:{width:.35*n,height:.35*n,borderRadius:"50%",backgroundColor:"pending"===e?i:r.bg,display:"block"}})})}function Co({style:e,color:t,animate:n}){return se(),/* @__PURE__ */x("div",{className:jt(At("w-0.5 flex-1 min-h-[24px]"),n?"tkx-draw-v":""),style:{borderLeft:`2px ${e} ${t}`,backgroundColor:"transparent",alignSelf:"stretch",borderColor:t,marginLeft:1},"aria-hidden":"true"})}function zo({style:e,color:t,animate:n}){/* @__PURE__ */
172
+ return x("div",{className:jt(At("h-0.5 flex-1 min-w-[24px]"),n?"tkx-draw-h":""),style:{borderTop:`2px ${e} ${t}`,borderColor:t},"aria-hidden":"true"})}function Mo({item:e,compact:t}){const n=se(),r=e.timestamp?ke(e.timestamp):null;/* @__PURE__ */
150
173
  return b("div",{className:At("flex flex-col gap-0.5",t?"pb-3":"pb-5"),children:[/* @__PURE__ */b("div",{className:At("flex items-center gap-2 flex-wrap"),children:[
151
- /* @__PURE__ */x("span",{className:At("text-sm font-semibold leading-snug"),style:{color:n.text},children:"string"==typeof e.title?ke(e.title):e.title}),e.badge&&/* @__PURE__ */x("span",{children:e.badge}),r&&/* @__PURE__ */x("span",{className:At("text-[11px] ml-auto"),style:{color:n.textMuted},children:r})]}),e.description&&!t&&/* @__PURE__ */x("div",{className:At("text-xs leading-relaxed mt-0.5"),style:{color:n.textMuted},children:"string"==typeof e.description?ke(e.description):e.description})]})}function vo({items:e,variant:t="default",orientation:n="vertical",connectorStyle:r="solid"}){const o=se(),i=et(),a=f(!1);s(()=>{!function(){if(mo||"undefined"==typeof document)return;mo=!0;const e=document.createElement("style");e.textContent="\n @keyframes tkx-pulse-dot { 0%,100% { box-shadow:0 0 0 0 currentColor; opacity:1; } 70% { box-shadow:0 0 0 8px transparent; opacity:0.7; } }\n @keyframes tkx-draw-line { from { transform:scaleY(0); transform-origin:top center; } to { transform:scaleY(1); } }\n @keyframes tkx-draw-line-h { from { transform:scaleX(0); transform-origin:left center; } to { transform:scaleX(1); } }\n .tkx-pulse-dot { animation: tkx-pulse-dot 1.5s ease-in-out infinite; }\n .tkx-draw-v { animation: tkx-draw-line 0.6s ease forwards; }\n .tkx-draw-h { animation: tkx-draw-line-h 0.6s ease forwards; }\n ",document.head.appendChild(e)}(),a.current=!0},[]);const l=!i,d="compact"===t,c="alternating"===t&&"vertical"===n;/* @__PURE__ */
174
+ /* @__PURE__ */x("span",{className:At("text-sm font-semibold leading-snug"),style:{color:n.text},children:"string"==typeof e.title?ke(e.title):e.title}),e.badge&&/* @__PURE__ */x("span",{children:e.badge}),r&&/* @__PURE__ */x("span",{className:At("text-[11px] ml-auto"),style:{color:n.textMuted},children:r})]}),e.description&&!t&&/* @__PURE__ */x("div",{className:At("text-xs leading-relaxed mt-0.5"),style:{color:n.textMuted},children:"string"==typeof e.description?ke(e.description):e.description})]})}function No({items:e,variant:t="default",orientation:n="vertical",connectorStyle:r="solid"}){const o=se(),i=et(),a=f(!1);s(()=>{!function(){if($o||"undefined"==typeof document)return;$o=!0;const e=document.createElement("style");e.textContent="\n @keyframes tkx-pulse-dot { 0%,100% { box-shadow:0 0 0 0 currentColor; opacity:1; } 70% { box-shadow:0 0 0 8px transparent; opacity:0.7; } }\n @keyframes tkx-draw-line { from { transform:scaleY(0); transform-origin:top center; } to { transform:scaleY(1); } }\n @keyframes tkx-draw-line-h { from { transform:scaleX(0); transform-origin:left center; } to { transform:scaleX(1); } }\n .tkx-pulse-dot { animation: tkx-pulse-dot 1.5s ease-in-out infinite; }\n .tkx-draw-v { animation: tkx-draw-line 0.6s ease forwards; }\n .tkx-draw-h { animation: tkx-draw-line-h 0.6s ease forwards; }\n ",document.head.appendChild(e)}(),a.current=!0},[]);const l=!i,d="compact"===t,c="alternating"===t&&"vertical"===n;/* @__PURE__ */
152
175
  return x("div","horizontal"===n?{role:"list","aria-label":"Timeline",className:At("flex items-start w-full overflow-x-auto"),children:e.map((t,n)=>{const i=t.status??"pending",a="completed"===i?o.success:o.border,s=n===e.length-1;/* @__PURE__ */
153
- return x("div",{role:"listitem",className:At("flex items-start flex-1 min-w-0"),children:/* @__PURE__ */b("div",{className:At("flex flex-col items-center flex-1 min-w-0"),children:[/* @__PURE__ */b("div",{className:At("flex items-center w-full"),children:[n>0&&/* @__PURE__ */x(bo,{style:r,color:a,animate:l}),
154
- /* @__PURE__ */x(go,{status:i,icon:t.icon,size:24}),!s&&/* @__PURE__ */x(bo,{style:r,color:a,animate:l})]}),/* @__PURE__ */b("div",{className:At("mt-2 px-1 text-center min-w-0 w-full"),children:[/* @__PURE__ */x("div",{className:At("text-xs font-semibold truncate"),style:{color:o.text},children:"string"==typeof t.title?ke(t.title):t.title}),t.timestamp&&/* @__PURE__ */x("div",{className:At("text-[10px] mt-0.5"),style:{color:o.textMuted},children:ke(t.timestamp)})]})]})},t.id)})}:{role:"list","aria-label":"Timeline",className:At("flex flex-col"),children:e.map((t,n)=>{const i=t.status??"pending",a=n===e.length-1,s="completed"===i?o.success:o.border,u=c&&n%2==0;/* @__PURE__ */
176
+ return x("div",{role:"listitem",className:At("flex items-start flex-1 min-w-0"),children:/* @__PURE__ */b("div",{className:At("flex flex-col items-center flex-1 min-w-0"),children:[/* @__PURE__ */b("div",{className:At("flex items-center w-full"),children:[n>0&&/* @__PURE__ */x(zo,{style:r,color:a,animate:l}),
177
+ /* @__PURE__ */x(So,{status:i,icon:t.icon,size:24}),!s&&/* @__PURE__ */x(zo,{style:r,color:a,animate:l})]}),/* @__PURE__ */b("div",{className:At("mt-2 px-1 text-center min-w-0 w-full"),children:[/* @__PURE__ */x("div",{className:At("text-xs font-semibold truncate"),style:{color:o.text},children:"string"==typeof t.title?ke(t.title):t.title}),t.timestamp&&/* @__PURE__ */x("div",{className:At("text-[10px] mt-0.5"),style:{color:o.textMuted},children:ke(t.timestamp)})]})]})},t.id)})}:{role:"list","aria-label":"Timeline",className:At("flex flex-col"),children:e.map((t,n)=>{const i=t.status??"pending",a=n===e.length-1,s="completed"===i?o.success:o.border,u=c&&n%2==0;/* @__PURE__ */
155
178
  return b("div",c?{role:"listitem",className:At("flex items-stretch gap-0"),children:[
156
- /* @__PURE__ */x("div",{className:At("flex-1 flex flex-col items-end pr-4",u?"":"invisible"),children:u&&/* @__PURE__ */x(yo,{item:t,compact:d})}),
157
- /* @__PURE__ */b("div",{className:At("flex flex-col items-center"),children:[/* @__PURE__ */x(go,{status:i,icon:t.icon,size:28}),!a&&/* @__PURE__ */x(xo,{style:r,color:s,animate:l})]}),
158
- /* @__PURE__ */x("div",{className:At("flex-1 flex flex-col items-start pl-4",u?"invisible":""),children:!u&&/* @__PURE__ */x(yo,{item:t,compact:d})})]}:{role:"listitem",className:At("flex gap-3 items-stretch"),children:[/* @__PURE__ */b("div",{className:At("flex flex-col items-center"),children:[/* @__PURE__ */x(go,{status:i,icon:t.icon,size:d?22:28}),!a&&/* @__PURE__ */x(xo,{style:r,color:s,animate:l})]}),/* @__PURE__ */x("div",{className:At("flex-1 min-w-0 pt-0.5"),children:/* @__PURE__ */x(yo,{item:t,compact:d})})]},t.id)})})}function wo(e,t,n,r){const o=window.innerWidth,i=window.innerHeight;let a=0,l=0,s="top left";switch(t){case"bottom-start":a=e.bottom+6,l=e.left,s="top left",a+r>i&&e.top-6-r>0&&(a=e.top-6-r,s="bottom left"),l+n>o&&(l=Math.max(0,o-n-8));break;case"bottom-end":a=e.bottom+6,l=e.right-n,s="top right",a+r>i&&e.top-6-r>0&&(a=e.top-6-r,s="bottom right"),l<0&&(l=8);break;case"top-start":a=e.top-6-r,l=e.left,s="bottom left",a<0&&(a=e.bottom+6,s="top left"),l+n>o&&(l=Math.max(0,o-n-8));break;case"top-end":a=e.top-6-r,l=e.right-n,s="bottom right",a<0&&(a=e.bottom+6,s="top right"),l<0&&(l=8);break;case"right-start":a=e.top,l=e.right+6,s="top left",l+n>o&&(l=e.left-6-n,s="top right"),a+r>i&&(a=Math.max(8,i-r-8));break;case"left-start":a=e.top,l=e.left-6-n,s="top right",l<0&&(l=e.right+6,s="top left"),a+r>i&&(a=Math.max(8,i-r-8))}return{top:a+window.scrollY,left:l+window.scrollX,transformOrigin:s}}function ko(e,t){return{position:"absolute",top:t.top,left:t.left,zIndex:9999,minWidth:200,maxWidth:320,backgroundColor:e.surface,border:`1.5px solid ${e.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",padding:"4px 0",transformOrigin:t.transformOrigin,overflow:"hidden"}}function $o({color:e}){/* @__PURE__ */
159
- return x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M20 6L9 17l-5-5"})})}function So({color:e}){/* @__PURE__ */
160
- return b("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"12",cy:"12",r:"5",fill:e}),/* @__PURE__ */x("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:e,strokeWidth:"2"})]})}function Co({color:e}){/* @__PURE__ */
161
- return x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M9 18l6-6-6-6"})})}function zo({items:e,pos:t,panelId:n,onClose:r,onCloseAll:o,isSubmenu:i=!1}){const l=se(),[d,c]=m(-1),[u,p]=m(null),[h,v]=m(null),w=f(null),[k,$]=m(""),S=f(null),C=function(e){const t=[];let n=0;for(const r of e)if("separator"!==r.type)if("radio-group"===r.type)for(let e=0;e<r.options.length;e++)t.push({kind:"radio",item:r,optionIdx:e,idx:n++});else"check"===r.type?t.push({kind:"check",item:r,idx:n++}):"submenu"===r.type?t.push({kind:"submenu",item:r,idx:n++}):t.push({kind:"action",item:r,idx:n++});return t}(e);s(()=>{w.current?.focus()},[]),s(()=>{d<0||(w.current?.querySelector(`[data-midx="${d}"]`))?.scrollIntoView({block:"nearest"})},[d]);const z=a(e=>{if("action"===e.kind){if(e.item.disabled)return;e.item.onClick?.(),o()}else if("check"===e.kind){if(e.item.disabled)return;e.item.onChange?.(!e.item.checked)}else if("radio"===e.kind){if(e.item.disabled)return;e.item.onChange?.(e.item.options[e.optionIdx].value)}else if("submenu"===e.kind){if(e.item.disabled)return;const t=w.current?.querySelector(`[data-midx="${e.idx}"]`);t?M(e.item,t):p(e.item.id)}},[o]);function M(e,t){const n=t.getBoundingClientRect();p(e.id),v(function(e,t,n){const r=window.innerWidth,o=window.innerHeight;let i=e.right+4,a="top left";i+220>r&&(i=e.left-4-220,a="top right");let l=e.top;return l+n>o&&(l=Math.max(8,o-n-8)),{top:l+window.scrollY,left:i+window.scrollX,transformOrigin:a}}(n,0,Math.min(38*e.items.length+12,360)))}function N(){p(null),v(null)}/* @__PURE__ */
162
- return b(g,{children:[/* @__PURE__ */x("style",{children:"\n@keyframes tkxMenuIn {\n from { opacity: 0; transform: scale(0.94); }\n to { opacity: 1; transform: scale(1); }\n}\n@keyframes tkxMenuInReduced {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@media (prefers-reduced-motion: no-preference) {\n .tkx-menu-panel {\n animation: tkxMenuIn 130ms cubic-bezier(0.16, 1, 0.3, 1) forwards;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-menu-panel {\n animation: tkxMenuInReduced 100ms ease forwards;\n }\n}\n"}),/* @__PURE__ */x("div",{ref:w,id:n,role:"menu",tabIndex:-1,className:"tkx-menu-panel",onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),c(e=>{const t=e+1;return t<C.length?t:0});break;case"ArrowUp":e.preventDefault(),c(e=>{const t=e-1;return t>=0?t:C.length-1});break;case"Home":e.preventDefault(),c(0);break;case"End":e.preventDefault(),c(C.length-1);break;case"Enter":case" ":e.preventDefault(),d>=0&&C[d]&&z(C[d]);break;case"Escape":e.preventDefault(),i?r():o();break;case"Tab":e.preventDefault(),o();break;case"ArrowRight":if(e.preventDefault(),d>=0&&"submenu"===C[d]?.kind){const e=C[d],t=w.current?.querySelector(`[data-midx="${e.idx}"]`);t?M(e.item,t):p(e.item.id)}break;case"ArrowLeft":e.preventDefault(),i&&r();break;default:1!==e.key.length||e.ctrlKey||e.metaKey||function(e){S.current&&clearTimeout(S.current);const t=k+e.toLowerCase();$(t);const n=C.findIndex(e=>("radio"===e.kind?e.item.options[e.optionIdx].label:e.item.label).toLowerCase().startsWith(t));n>=0&&c(n),S.current=setTimeout(()=>$(""),800)}(e.key)}},style:{...ko(l,t),maxHeight:400,overflowY:"auto"},children:(()=>{let t=-1;return e.map(e=>{if("separator"===e.type)/* @__PURE__ */return x("div",{role:"separator",style:{margin:(e.label,"4px 0"),display:"flex",alignItems:"center",gap:8},children:e.label?/* @__PURE__ */b(g,{children:[
179
+ /* @__PURE__ */x("div",{className:At("flex-1 flex flex-col items-end pr-4",u?"":"invisible"),children:u&&/* @__PURE__ */x(Mo,{item:t,compact:d})}),
180
+ /* @__PURE__ */b("div",{className:At("flex flex-col items-center"),children:[/* @__PURE__ */x(So,{status:i,icon:t.icon,size:28}),!a&&/* @__PURE__ */x(Co,{style:r,color:s,animate:l})]}),
181
+ /* @__PURE__ */x("div",{className:At("flex-1 flex flex-col items-start pl-4",u?"invisible":""),children:!u&&/* @__PURE__ */x(Mo,{item:t,compact:d})})]}:{role:"listitem",className:At("flex gap-3 items-stretch"),children:[/* @__PURE__ */b("div",{className:At("flex flex-col items-center"),children:[/* @__PURE__ */x(So,{status:i,icon:t.icon,size:d?22:28}),!a&&/* @__PURE__ */x(Co,{style:r,color:s,animate:l})]}),/* @__PURE__ */x("div",{className:At("flex-1 min-w-0 pt-0.5"),children:/* @__PURE__ */x(Mo,{item:t,compact:d})})]},t.id)})})}function Do(e,t,n,r){const o=window.innerWidth,i=window.innerHeight;let a=0,l=0,s="top left";switch(t){case"bottom-start":a=e.bottom+6,l=e.left,s="top left",a+r>i&&e.top-6-r>0&&(a=e.top-6-r,s="bottom left"),l+n>o&&(l=Math.max(0,o-n-8));break;case"bottom-end":a=e.bottom+6,l=e.right-n,s="top right",a+r>i&&e.top-6-r>0&&(a=e.top-6-r,s="bottom right"),l<0&&(l=8);break;case"top-start":a=e.top-6-r,l=e.left,s="bottom left",a<0&&(a=e.bottom+6,s="top left"),l+n>o&&(l=Math.max(0,o-n-8));break;case"top-end":a=e.top-6-r,l=e.right-n,s="bottom right",a<0&&(a=e.bottom+6,s="top right"),l<0&&(l=8);break;case"right-start":a=e.top,l=e.right+6,s="top left",l+n>o&&(l=e.left-6-n,s="top right"),a+r>i&&(a=Math.max(8,i-r-8));break;case"left-start":a=e.top,l=e.left-6-n,s="top right",l<0&&(l=e.right+6,s="top left"),a+r>i&&(a=Math.max(8,i-r-8))}return{top:a+window.scrollY,left:l+window.scrollX,transformOrigin:s}}function Ro(e,t){return{position:"absolute",top:t.top,left:t.left,zIndex:9999,minWidth:200,maxWidth:320,backgroundColor:e.surface,border:`1.5px solid ${e.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",padding:"4px 0",transformOrigin:t.transformOrigin,overflow:"hidden"}}function Po({color:e}){/* @__PURE__ */
182
+ return x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M20 6L9 17l-5-5"})})}function Fo({color:e}){/* @__PURE__ */
183
+ return b("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"12",cy:"12",r:"5",fill:e}),/* @__PURE__ */x("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:e,strokeWidth:"2"})]})}function Io({color:e}){/* @__PURE__ */
184
+ return x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M9 18l6-6-6-6"})})}function Ao({items:e,pos:t,panelId:n,onClose:r,onCloseAll:o,isSubmenu:i=!1}){const l=se(),[d,c]=m(-1),[u,p]=m(null),[h,v]=m(null),w=f(null),[k,$]=m(""),S=f(null),C=function(e){const t=[];let n=0;for(const r of e)if("separator"!==r.type)if("radio-group"===r.type)for(let e=0;e<r.options.length;e++)t.push({kind:"radio",item:r,optionIdx:e,idx:n++});else"check"===r.type?t.push({kind:"check",item:r,idx:n++}):"submenu"===r.type?t.push({kind:"submenu",item:r,idx:n++}):t.push({kind:"action",item:r,idx:n++});return t}(e);s(()=>{w.current?.focus()},[]),s(()=>{d<0||(w.current?.querySelector(`[data-midx="${d}"]`))?.scrollIntoView({block:"nearest"})},[d]);const z=a(e=>{if("action"===e.kind){if(e.item.disabled)return;e.item.onClick?.(),o()}else if("check"===e.kind){if(e.item.disabled)return;e.item.onChange?.(!e.item.checked)}else if("radio"===e.kind){if(e.item.disabled)return;e.item.onChange?.(e.item.options[e.optionIdx].value)}else if("submenu"===e.kind){if(e.item.disabled)return;const t=w.current?.querySelector(`[data-midx="${e.idx}"]`);t?M(e.item,t):p(e.item.id)}},[o]);function M(e,t){const n=t.getBoundingClientRect();p(e.id),v(function(e,t,n){const r=window.innerWidth,o=window.innerHeight;let i=e.right+4,a="top left";i+220>r&&(i=e.left-4-220,a="top right");let l=e.top;return l+n>o&&(l=Math.max(8,o-n-8)),{top:l+window.scrollY,left:i+window.scrollX,transformOrigin:a}}(n,0,Math.min(38*e.items.length+12,360)))}function N(){p(null),v(null)}/* @__PURE__ */
185
+ return b(g,{children:[/* @__PURE__ */x("style",{children:"\n@keyframes tkxMenuIn {\n from { opacity: 0; transform: scale(0.94); }\n to { opacity: 1; transform: scale(1); }\n}\n@keyframes tkxMenuInReduced {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@media (prefers-reduced-motion: no-preference) {\n .tkx-menu-panel {\n animation: tkxMenuIn 130ms cubic-bezier(0.16, 1, 0.3, 1) forwards;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-menu-panel {\n animation: tkxMenuInReduced 100ms ease forwards;\n }\n}\n"}),/* @__PURE__ */x("div",{ref:w,id:n,role:"menu",tabIndex:-1,className:"tkx-menu-panel",onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),c(e=>{const t=e+1;return t<C.length?t:0});break;case"ArrowUp":e.preventDefault(),c(e=>{const t=e-1;return t>=0?t:C.length-1});break;case"Home":e.preventDefault(),c(0);break;case"End":e.preventDefault(),c(C.length-1);break;case"Enter":case" ":e.preventDefault(),d>=0&&C[d]&&z(C[d]);break;case"Escape":e.preventDefault(),i?r():o();break;case"Tab":e.preventDefault(),o();break;case"ArrowRight":if(e.preventDefault(),d>=0&&"submenu"===C[d]?.kind){const e=C[d],t=w.current?.querySelector(`[data-midx="${e.idx}"]`);t?M(e.item,t):p(e.item.id)}break;case"ArrowLeft":e.preventDefault(),i&&r();break;default:1!==e.key.length||e.ctrlKey||e.metaKey||function(e){S.current&&clearTimeout(S.current);const t=k+e.toLowerCase();$(t);const n=C.findIndex(e=>("radio"===e.kind?e.item.options[e.optionIdx].label:e.item.label).toLowerCase().startsWith(t));n>=0&&c(n),S.current=setTimeout(()=>$(""),800)}(e.key)}},style:{...Ro(l,t),maxHeight:400,overflowY:"auto"},children:(()=>{let t=-1;return e.map(e=>{if("separator"===e.type)/* @__PURE__ */return x("div",{role:"separator",style:{margin:(e.label,"4px 0"),display:"flex",alignItems:"center",gap:8},children:e.label?/* @__PURE__ */b(g,{children:[
163
186
  /* @__PURE__ */x("div",{style:{flex:1,height:1,backgroundColor:l.border,marginLeft:14}}),
164
187
  /* @__PURE__ */x("span",{style:{fontSize:"11px",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:l.textMuted,fontFamily:"inherit",whiteSpace:"nowrap"},children:ke(e.label)}),
165
- /* @__PURE__ */x("div",{style:{flex:1,height:1,backgroundColor:l.border,marginRight:14}})]}):/* @__PURE__ */x("div",{style:{flex:1,height:1,backgroundColor:l.border,margin:"0 10px"}})},e.id);if("radio-group"===e.type)/* @__PURE__ */return b("div",{role:"group","aria-label":e.label,children:[e.label&&/* @__PURE__ */x("div",{style:{padding:"6px 14px 2px",fontSize:"11px",fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:l.textMuted,fontFamily:"inherit"},"aria-hidden":"true",children:ke(e.label)}),e.options.map((n,r)=>{t++;const o=t,i=o===d,a=n.value===e.value,s=!!e.disabled,u=Mo(l,i,!1,s);/* @__PURE__ */
188
+ /* @__PURE__ */x("div",{style:{flex:1,height:1,backgroundColor:l.border,marginRight:14}})]}):/* @__PURE__ */x("div",{style:{flex:1,height:1,backgroundColor:l.border,margin:"0 10px"}})},e.id);if("radio-group"===e.type)/* @__PURE__ */return b("div",{role:"group","aria-label":e.label,children:[e.label&&/* @__PURE__ */x("div",{style:{padding:"6px 14px 2px",fontSize:"11px",fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:l.textMuted,fontFamily:"inherit"},"aria-hidden":"true",children:ke(e.label)}),e.options.map((n,r)=>{t++;const o=t,i=o===d,a=n.value===e.value,s=!!e.disabled,u=Lo(l,i,!1,s);/* @__PURE__ */
166
189
  return b("div",{role:"menuitemradio","aria-checked":a,"aria-disabled":s||void 0,"data-midx":o,tabIndex:-1,style:u,onClick:()=>!s&&e.onChange?.(n.value),onMouseEnter:()=>!s&&c(o),children:[
167
- /* @__PURE__ */x("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:a?/* @__PURE__ */x(So,{color:l.primary}):/* @__PURE__ */x("span",{style:{width:14,height:14,borderRadius:"50%",border:`2px solid ${l.border}`,display:"inline-block"}})}),n.icon&&/* @__PURE__ */x("span",{style:{flexShrink:0,display:"flex",color:l.textMuted},children:n.icon}),
168
- /* @__PURE__ */x("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(n.label)})]},n.value)})]},e.id);if("check"===e.type){t++;const n=t,r=n===d,o=!!e.disabled,i=Mo(l,r,!1,o);/* @__PURE__ */
190
+ /* @__PURE__ */x("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:a?/* @__PURE__ */x(Fo,{color:l.primary}):/* @__PURE__ */x("span",{style:{width:14,height:14,borderRadius:"50%",border:`2px solid ${l.border}`,display:"inline-block"}})}),n.icon&&/* @__PURE__ */x("span",{style:{flexShrink:0,display:"flex",color:l.textMuted},children:n.icon}),
191
+ /* @__PURE__ */x("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(n.label)})]},n.value)})]},e.id);if("check"===e.type){t++;const n=t,r=n===d,o=!!e.disabled,i=Lo(l,r,!1,o);/* @__PURE__ */
169
192
  return b("div",{role:"menuitemcheckbox","aria-checked":e.checked,"aria-disabled":o||void 0,"data-midx":n,tabIndex:-1,style:i,onClick:()=>!o&&e.onChange?.(!e.checked),onMouseEnter:()=>!o&&c(n),children:[
170
- /* @__PURE__ */x("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:e.checked?/* @__PURE__ */x($o,{color:l.primary}):/* @__PURE__ */x("span",{style:{width:14,height:14,display:"inline-block"}})}),e.icon&&/* @__PURE__ */x("span",{style:{flexShrink:0,display:"flex",color:l.textMuted},children:e.icon}),
171
- /* @__PURE__ */x("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.label)})]},e.id)}if("submenu"===e.type){t++;const r=t,i=r===d,a=!!e.disabled,s=u===e.id,p=Mo(l,i||s,!1,a);/* @__PURE__ */
193
+ /* @__PURE__ */x("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:e.checked?/* @__PURE__ */x(Po,{color:l.primary}):/* @__PURE__ */x("span",{style:{width:14,height:14,display:"inline-block"}})}),e.icon&&/* @__PURE__ */x("span",{style:{flexShrink:0,display:"flex",color:l.textMuted},children:e.icon}),
194
+ /* @__PURE__ */x("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.label)})]},e.id)}if("submenu"===e.type){t++;const r=t,i=r===d,a=!!e.disabled,s=u===e.id,p=Lo(l,i||s,!1,a);/* @__PURE__ */
172
195
  return b("div",{style:{position:"relative"},children:[/* @__PURE__ */b("div",{role:"menuitem","aria-haspopup":"menu","aria-expanded":s,"aria-disabled":a||void 0,"data-midx":r,tabIndex:-1,style:p,onMouseEnter:t=>{a||(c(r),M(e,t.currentTarget))},onMouseLeave:()=>{},onClick:t=>{a||(s?N():M(e,t.currentTarget))},children:[
173
196
  /* @__PURE__ */x("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:e.icon?/* @__PURE__ */x("span",{style:{display:"flex",color:l.textMuted},children:e.icon}):/* @__PURE__ */x("span",{style:{width:14}})}),
174
197
  /* @__PURE__ */x("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(e.label)}),
175
- /* @__PURE__ */x(Co,{color:l.textMuted})]}),s&&h&&y(/* @__PURE__ */x(zo,{items:e.items,pos:h,panelId:`${n}-sub-${e.id}`,onClose:N,onCloseAll:o,isSubmenu:!0}),document.body)]},e.id)}const r=e;t++;const i=t,a=i===d,s=!!r.disabled,p=!!r.danger,f=Mo(l,a,p,s);/* @__PURE__ */
198
+ /* @__PURE__ */x(Io,{color:l.textMuted})]}),s&&h&&y(/* @__PURE__ */x(Ao,{items:e.items,pos:h,panelId:`${n}-sub-${e.id}`,onClose:N,onCloseAll:o,isSubmenu:!0}),document.body)]},e.id)}const r=e;t++;const i=t,a=i===d,s=!!r.disabled,p=!!r.danger,f=Lo(l,a,p,s);/* @__PURE__ */
176
199
  return b("div",{role:"menuitem","aria-disabled":s||void 0,"data-midx":i,tabIndex:-1,style:f,onClick:()=>{s||(r.onClick?.(),o())},onMouseEnter:()=>{s||(c(i),N())},children:[
177
200
  /* @__PURE__ */x("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:r.icon?/* @__PURE__ */x("span",{style:{display:"flex",color:p?l.danger:l.textMuted},children:r.icon}):/* @__PURE__ */x("span",{style:{width:14}})}),
178
- /* @__PURE__ */b("span",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */x("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(r.label)}),r.description&&/* @__PURE__ */x("span",{style:{display:"block",fontSize:"12px",color:l.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(r.description)})]}),r.shortcut&&/* @__PURE__ */x("span",{style:{fontSize:"12px",color:l.textMuted,fontFamily:"inherit",flexShrink:0,marginLeft:16,opacity:.8},children:ke(r.shortcut)})]},r.id)})})()})]})}function Mo(e,t,n,r){const o=n?e.danger:e.text;return{display:"flex",alignItems:"center",gap:8,padding:"7px 14px",fontSize:"14px",fontFamily:"inherit",cursor:r?"not-allowed":"pointer",userSelect:"none",color:r?e.textMuted:t&&n?e.danger:o,backgroundColor:t?n?`${e.danger}18`:`${e.primary}18`:"transparent",transition:"background-color 80ms",opacity:r?.5:1,outline:"none"}}function No({trigger:e,items:t,placement:n="bottom-start",isDisabled:r=!1,onOpen:o,onClose:i,className:l,style:c}){const u=`tkx-menu-${d().replace(/:/g,"")}`,[p,h]=m(!1),[g,v]=m(null),w=f(null),k=a(()=>{if(r)return;const e=w.current;e&&(v(wo(e.getBoundingClientRect(),n,220,Math.min(38*t.length+12,360))),h(!0),o?.())},[r,t.length,o,n]),$=a(()=>{h(!1),i?.(),(w.current?.firstElementChild)?.focus?.()},[i]);return s(()=>{if(!p)return;const e=e=>{const t=e.target;if(w.current?.contains(t))return;const n=document.querySelectorAll(".tkx-menu-panel");for(const r of n)if(r.contains(t))return;$()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[p,$]),s(()=>{if(!p)return;const e=()=>{const e=w.current;e&&v(wo(e.getBoundingClientRect(),n,220,Math.min(38*t.length+12,360)))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[p,t.length,n]),/* @__PURE__ */b("span",{ref:w,className:l,style:{display:"inline-flex",...c},children:[/* @__PURE__ */x("span",{role:"button",tabIndex:r?-1:0,"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?u:void 0,"aria-disabled":r||void 0,onClick:()=>p?$():k(),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||(e.preventDefault(),p||k()),"Escape"===e.key&&p&&(e.preventDefault(),$())},style:{display:"inline-flex",cursor:r?"not-allowed":"pointer",opacity:r?.55:1,outline:"none"},children:e}),p&&g&&y(/* @__PURE__ */x(zo,{items:t,pos:g,panelId:u,onClose:$,onCloseAll:$}),document.body)]})}No.displayName="TkxMenu";var Do={sm:120,md:180,lg:240,xl:320};function Po(e){const t=/* @__PURE__ */new Date;if(e)try{const n=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"numeric",second:"numeric",hour12:!1,weekday:"long",month:"long",day:"2-digit",year:"numeric"}).formatToParts(t),r=e=>n.find(t=>t.type===e)?.value??"0";let o=parseInt(r("hour"),10);24===o&&(o=0);const i=parseInt(r("minute"),10),a=parseInt(r("second"),10),l=`${r("weekday")}, ${r("month")} ${r("day")}, ${r("year")}`;return{hours:o,minutes:i,seconds:a,milliseconds:t.getMilliseconds(),dateString:l}}catch{}const n=t.getHours(),r=t.getMinutes(),o=t.getSeconds(),i=t.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"2-digit",year:"numeric"});return{hours:n,minutes:r,seconds:o,milliseconds:t.getMilliseconds(),dateString:i}}function Ro({time:e,size:t,analogStyle:n,showSeconds:r,reducedMotion:o,primary:i,danger:a,text:l,textMuted:s,border:d,surface:c,bg:u}){const p=t/2,h=t/2,f=t/2-4,{hours:m,minutes:y,seconds:v,milliseconds:w}=e,k=(v+(o?0:w)/1e3)/60*360,$=y/60*360+v/60*6,S=m%12/12*360+y/60*30,C=(e,t)=>{const n=(e-90)*Math.PI/180;return{x:p+Math.cos(n)*t,y:h+Math.sin(n)*t}},z=o?"none":"transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44)";if("modern"===n){const e=(e,t)=>{const n=360*e-90;return`M ${p+Math.cos(-90*Math.PI/180)*t} ${h+Math.sin(-90*Math.PI/180)*t} A ${t} ${t} 0 ${e>.5?1:0} 1 ${p+Math.cos(n*Math.PI/180)*t} ${h+Math.sin(n*Math.PI/180)*t}`},n=m%12/12+y/60/12,c=y/60+v/3600,u=(v+(o?0:w/1e3))/60,g=f-2,k=f-10,$=f-18;/* @__PURE__ */
201
+ /* @__PURE__ */b("span",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */x("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(r.label)}),r.description&&/* @__PURE__ */x("span",{style:{display:"block",fontSize:"12px",color:l.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ke(r.description)})]}),r.shortcut&&/* @__PURE__ */x("span",{style:{fontSize:"12px",color:l.textMuted,fontFamily:"inherit",flexShrink:0,marginLeft:16,opacity:.8},children:ke(r.shortcut)})]},r.id)})})()})]})}function Lo(e,t,n,r){const o=n?e.danger:e.text;return{display:"flex",alignItems:"center",gap:8,padding:"7px 14px",fontSize:"14px",fontFamily:"inherit",cursor:r?"not-allowed":"pointer",userSelect:"none",color:r?e.textMuted:t&&n?e.danger:o,backgroundColor:t?n?`${e.danger}18`:`${e.primary}18`:"transparent",transition:"background-color 80ms",opacity:r?.5:1,outline:"none"}}function To({trigger:e,items:t,placement:n="bottom-start",isDisabled:r=!1,onOpen:o,onClose:i,className:l,style:c}){const u=`tkx-menu-${d().replace(/:/g,"")}`,[p,h]=m(!1),[g,v]=m(null),w=f(null),k=a(()=>{if(r)return;const e=w.current;e&&(v(Do(e.getBoundingClientRect(),n,220,Math.min(38*t.length+12,360))),h(!0),o?.())},[r,t.length,o,n]),$=a(()=>{h(!1),i?.(),(w.current?.firstElementChild)?.focus?.()},[i]);return s(()=>{if(!p)return;const e=e=>{const t=e.target;if(w.current?.contains(t))return;const n=document.querySelectorAll(".tkx-menu-panel");for(const r of n)if(r.contains(t))return;$()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[p,$]),s(()=>{if(!p)return;const e=()=>{const e=w.current;e&&v(Do(e.getBoundingClientRect(),n,220,Math.min(38*t.length+12,360)))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[p,t.length,n]),/* @__PURE__ */b("span",{ref:w,className:l,style:{display:"inline-flex",...c},children:[/* @__PURE__ */x("span",{role:"button",tabIndex:r?-1:0,"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?u:void 0,"aria-disabled":r||void 0,onClick:()=>p?$():k(),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||(e.preventDefault(),p||k()),"Escape"===e.key&&p&&(e.preventDefault(),$())},style:{display:"inline-flex",cursor:r?"not-allowed":"pointer",opacity:r?.55:1,outline:"none"},children:e}),p&&g&&y(/* @__PURE__ */x(Ao,{items:t,pos:g,panelId:u,onClose:$,onCloseAll:$}),document.body)]})}To.displayName="TkxMenu";var Wo={sm:120,md:180,lg:240,xl:320};function jo(e){const t=/* @__PURE__ */new Date;if(e)try{const n=new Intl.DateTimeFormat("en-US",{timeZone:e,hour:"numeric",minute:"numeric",second:"numeric",hour12:!1,weekday:"long",month:"long",day:"2-digit",year:"numeric"}).formatToParts(t),r=e=>n.find(t=>t.type===e)?.value??"0";let o=parseInt(r("hour"),10);24===o&&(o=0);const i=parseInt(r("minute"),10),a=parseInt(r("second"),10),l=`${r("weekday")}, ${r("month")} ${r("day")}, ${r("year")}`;return{hours:o,minutes:i,seconds:a,milliseconds:t.getMilliseconds(),dateString:l}}catch{}const n=t.getHours(),r=t.getMinutes(),o=t.getSeconds(),i=t.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"2-digit",year:"numeric"});return{hours:n,minutes:r,seconds:o,milliseconds:t.getMilliseconds(),dateString:i}}function Eo({time:e,size:t,analogStyle:n,showSeconds:r,reducedMotion:o,primary:i,danger:a,text:l,textMuted:s,border:d,surface:c,bg:u}){const p=t/2,h=t/2,f=t/2-4,{hours:m,minutes:y,seconds:v,milliseconds:w}=e,k=(v+(o?0:w)/1e3)/60*360,$=y/60*360+v/60*6,S=m%12/12*360+y/60*30,C=(e,t)=>{const n=(e-90)*Math.PI/180;return{x:p+Math.cos(n)*t,y:h+Math.sin(n)*t}},z=o?"none":"transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44)";if("modern"===n){const e=(e,t)=>{const n=360*e-90;return`M ${p+Math.cos(-90*Math.PI/180)*t} ${h+Math.sin(-90*Math.PI/180)*t} A ${t} ${t} 0 ${e>.5?1:0} 1 ${p+Math.cos(n*Math.PI/180)*t} ${h+Math.sin(n*Math.PI/180)*t}`},n=m%12/12+y/60/12,c=y/60+v/3600,u=(v+(o?0:w/1e3))/60,g=f-2,k=f-10,$=f-18;/* @__PURE__ */
179
202
  return b("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",children:[
180
203
  /* @__PURE__ */x("circle",{cx:p,cy:h,r:g,fill:"none",stroke:d,strokeWidth:4}),
181
204
  /* @__PURE__ */x("circle",{cx:p,cy:h,r:k,fill:"none",stroke:d,strokeWidth:4}),r&&/* @__PURE__ */x("circle",{cx:p,cy:h,r:$,fill:"none",stroke:d,strokeWidth:3}),
182
205
  /* @__PURE__ */x("path",{d:e(n,g),fill:"none",stroke:i,strokeWidth:4,strokeLinecap:"round"}),
183
206
  /* @__PURE__ */x("path",{d:e(c,k),fill:"none",stroke:l,strokeWidth:4,strokeLinecap:"round"}),r&&/* @__PURE__ */x("path",{d:e(u,$),fill:"none",stroke:a,strokeWidth:3,strokeLinecap:"round"}),
184
207
  /* @__PURE__ */x("circle",{cx:p,cy:h,r:4,fill:i}),
185
- /* @__PURE__ */b("text",{x:p,y:h+20,textAnchor:"middle",fontSize:.12*t,fill:s,fontFamily:"monospace",style:{fontVariantNumeric:"tabular-nums"},children:[String(m).padStart(2,"0"),":",String(y).padStart(2,"0")]})]})}const M=C(S,.5*f),N=C($,.75*f),D=C(k,.85*f),P=C(k+180,.2*f),R=[];if("classic"===n){for(let e=0;e<60;e++){const t=e%5==0,n=(e/60*360-90)*Math.PI/180,r=t?f-10:f-6,o=p+Math.cos(n)*f,i=h+Math.sin(n)*f,a=p+Math.cos(n)*r,d=h+Math.sin(n)*r;R.push(/* @__PURE__ */x("line",{x1:o,y1:i,x2:a,y2:d,stroke:t?l:s,strokeWidth:t?2:1,strokeLinecap:"round"},e))}for(const{n:e,angle:n}of[{n:12,angle:0},{n:3,angle:90},{n:6,angle:180},{n:9,angle:270}]){const r=(n-90)*Math.PI/180,o=f-20;R.push(/* @__PURE__ */x("text",{x:p+Math.cos(r)*o,y:h+Math.sin(r)*o,textAnchor:"middle",dominantBaseline:"central",fontSize:.09*t,fill:l,fontFamily:"system-ui, sans-serif",fontWeight:"600",children:e},`n${e}`))}}else for(let g=0;g<12;g++){const e=(g/12*360-90)*Math.PI/180,t=f-8;R.push(/* @__PURE__ */x("circle",{cx:p+Math.cos(e)*t,cy:h+Math.sin(e)*t,r:g%3==0?3:2,fill:g%3==0?l:s},g))}/* @__PURE__ */
208
+ /* @__PURE__ */b("text",{x:p,y:h+20,textAnchor:"middle",fontSize:.12*t,fill:s,fontFamily:"monospace",style:{fontVariantNumeric:"tabular-nums"},children:[String(m).padStart(2,"0"),":",String(y).padStart(2,"0")]})]})}const M=C(S,.5*f),N=C($,.75*f),D=C(k,.85*f),R=C(k+180,.2*f),P=[];if("classic"===n){for(let e=0;e<60;e++){const t=e%5==0,n=(e/60*360-90)*Math.PI/180,r=t?f-10:f-6,o=p+Math.cos(n)*f,i=h+Math.sin(n)*f,a=p+Math.cos(n)*r,d=h+Math.sin(n)*r;P.push(/* @__PURE__ */x("line",{x1:o,y1:i,x2:a,y2:d,stroke:t?l:s,strokeWidth:t?2:1,strokeLinecap:"round"},e))}for(const{n:e,angle:n}of[{n:12,angle:0},{n:3,angle:90},{n:6,angle:180},{n:9,angle:270}]){const r=(n-90)*Math.PI/180,o=f-20;P.push(/* @__PURE__ */x("text",{x:p+Math.cos(r)*o,y:h+Math.sin(r)*o,textAnchor:"middle",dominantBaseline:"central",fontSize:.09*t,fill:l,fontFamily:"system-ui, sans-serif",fontWeight:"600",children:e},`n${e}`))}}else for(let g=0;g<12;g++){const e=(g/12*360-90)*Math.PI/180,t=f-8;P.push(/* @__PURE__ */x("circle",{cx:p+Math.cos(e)*t,cy:h+Math.sin(e)*t,r:g%3==0?3:2,fill:g%3==0?l:s},g))}/* @__PURE__ */
186
209
  return b("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",style:{display:"block"},children:[
187
- /* @__PURE__ */x("circle",{cx:p,cy:h,r:f,fill:c,stroke:d,strokeWidth:2}),R,
210
+ /* @__PURE__ */x("circle",{cx:p,cy:h,r:f,fill:c,stroke:d,strokeWidth:2}),P,
188
211
  /* @__PURE__ */x("line",{x1:p,y1:h,x2:M.x,y2:M.y,stroke:i,strokeWidth:"minimal"===n?3:4,strokeLinecap:"round",style:{transformOrigin:`${p}px ${h}px`,transition:z}}),
189
- /* @__PURE__ */x("line",{x1:p,y1:h,x2:N.x,y2:N.y,stroke:l,strokeWidth:"minimal"===n?2:3,strokeLinecap:"round",style:{transformOrigin:`${p}px ${h}px`,transition:z}}),r&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("line",{x1:P.x,y1:P.y,x2:D.x,y2:D.y,stroke:a,strokeWidth:1.5,strokeLinecap:"round",style:{transformOrigin:`${p}px ${h}px`,transition:"none"}}),/* @__PURE__ */x("circle",{cx:p,cy:h,r:3,fill:a})]}),
190
- /* @__PURE__ */x("circle",{cx:p,cy:h,r:"minimal"===n?3:5,fill:i})]})}function Fo({time:e,format:t,showSeconds:n,showDate:r,label:o,size:i,primary:a,text:l,textMuted:s,colonVisible:d}){const{hours:c,minutes:u,seconds:p,dateString:h}=e;let f=c,m="";"12h"===t&&(m=c>=12?"PM":"AM",f=c%12||12);const y=.2*i,v={opacity:d?1:0,transition:"opacity 0.1s",display:"inline-block",minWidth:"0.5ch",textAlign:"center"};/* @__PURE__ */
212
+ /* @__PURE__ */x("line",{x1:p,y1:h,x2:N.x,y2:N.y,stroke:l,strokeWidth:"minimal"===n?2:3,strokeLinecap:"round",style:{transformOrigin:`${p}px ${h}px`,transition:z}}),r&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("line",{x1:R.x,y1:R.y,x2:D.x,y2:D.y,stroke:a,strokeWidth:1.5,strokeLinecap:"round",style:{transformOrigin:`${p}px ${h}px`,transition:"none"}}),/* @__PURE__ */x("circle",{cx:p,cy:h,r:3,fill:a})]}),
213
+ /* @__PURE__ */x("circle",{cx:p,cy:h,r:"minimal"===n?3:5,fill:i})]})}function Bo({time:e,format:t,showSeconds:n,showDate:r,label:o,size:i,primary:a,text:l,textMuted:s,colonVisible:d}){const{hours:c,minutes:u,seconds:p,dateString:h}=e;let f=c,m="";"12h"===t&&(m=c>=12?"PM":"AM",f=c%12||12);const y=.2*i,v={opacity:d?1:0,transition:"opacity 0.1s",display:"inline-block",minWidth:"0.5ch",textAlign:"center"};/* @__PURE__ */
191
214
  return b("div",{style:{textAlign:"center",fontFamily:"'Courier New', Courier, monospace",fontVariantNumeric:"tabular-nums",lineHeight:1.1},children:[
192
215
  /* @__PURE__ */b("div",{style:{fontSize:y,color:a,fontWeight:700,letterSpacing:"0.05em",display:"flex",alignItems:"center",justifyContent:"center",gap:0},children:[
193
216
  /* @__PURE__ */x("span",{children:String(f).padStart(2,"0")}),
194
217
  /* @__PURE__ */x("span",{style:v,children:":"}),
195
- /* @__PURE__ */x("span",{children:String(u).padStart(2,"0")}),n&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("span",{style:v,children:":"}),/* @__PURE__ */x("span",{children:String(p).padStart(2,"0")})]}),"12h"===t&&/* @__PURE__ */x("span",{style:{fontSize:.45*y,color:s,marginLeft:"0.4ch",alignSelf:"flex-end",marginBottom:.05*y},children:m})]}),r&&/* @__PURE__ */x("div",{style:{fontSize:.072*i,color:s,marginTop:.025*i,letterSpacing:"0.03em"},children:h}),o&&/* @__PURE__ */x("div",{style:{fontSize:.065*i,color:s,marginTop:.015*i,textTransform:"uppercase",letterSpacing:"0.08em"},children:ke(o)})]})}function Io({variant:e="both",size:t="md",showSeconds:n=!0,showDate:r=!1,format:o="24h",timezone:i,timezone2:a,label:l,analogStyle:d="classic",className:c,style:u}){const p=se(),h=et(),[g,y]=m(()=>Po(i)),[v,w]=m(()=>a?Po(a):null),[k,$]=m(!0),[S,C]=m(!1),z=f(null);s(()=>{C(!0)},[]),s(()=>{const e=()=>{y(Po(i)),a&&w(Po(a))};e();const t=setInterval(e,1e3);return()=>clearInterval(t)},[i,a]),s(()=>(z.current=setInterval(()=>{$(e=>!e)},500),()=>{z.current&&clearInterval(z.current)}),[]);const M=Do[t],N="digital"===e||"both"===e;/* @__PURE__ */
196
- return b("div",{className:c,style:{display:"inline-flex",flexDirection:"column",alignItems:"center",gap:"both"===e?.06*M+"px":0,opacity:S?1:0,transition:h?"none":"opacity 0.4s ease",...u},role:"timer","aria-live":"off",children:[("analog"===e||"both"===e)&&/* @__PURE__ */x(Ro,{time:g,size:M,analogStyle:d,showSeconds:n,reducedMotion:h,primary:p.primary,danger:p.danger,text:p.text,textMuted:p.textMuted,border:p.border,surface:p.surface,bg:p.bg}),N&&/* @__PURE__ */x(Fo,{time:g,format:o,showSeconds:n,showDate:r,label:l,size:M,primary:p.primary,text:p.text,textMuted:p.textMuted,colonVisible:k}),v&&a&&/* @__PURE__ */x("div",{style:{marginTop:.04*M,padding:`${.03*M}px ${.06*M}px`,borderTop:`1px solid ${p.border}`,textAlign:"center"},children:/* @__PURE__ */x(Fo,{time:v,format:o,showSeconds:!1,showDate:!1,label:a,size:.7*M,primary:p.secondary,text:p.text,textMuted:p.textMuted,colonVisible:k})})]})}function Ao(e){if(!isFinite(e)||isNaN(e))return"0:00";const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?`${t}:${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${n}:${String(r).padStart(2,"0")}`}function Lo({path:e,size:t=20,color:n="currentColor",title:r}){/* @__PURE__ */
197
- return x("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:n,"aria-hidden":r?void 0:"true",role:r?"img":void 0,"aria-label":r,style:{display:"block",flexShrink:0},children:/* @__PURE__ */x("path",{d:e})})}Io.displayName="TkxClock";var To="M8 5v14l11-7z",Wo="M6 19h4V5H6v14zm8-14v14h4V5h-4z";function jo({onClick:e,title:t,children:n,active:r,primary:o}){const[i,a]=m(!1);/* @__PURE__ */
198
- return x("button",{type:"button",onClick:e,title:t,"aria-label":t,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{background:"none",border:"none",padding:"6px",cursor:"pointer",color:r||i?o:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",flexShrink:0,transition:"color 0.15s ease"},children:n})}function Eo({src:e,poster:t,title:n,width:r="100%",height:o,autoPlay:i=!1,loop:l=!1,muted:d=!1,controls:c=!0,showTitle:u=!0,allowFullscreen:p=!0,allowPiP:h=!0,allowDownload:g=!1,chapters:y=[],subtitles:v=[],startTime:w,onPlay:k,onPause:$,onEnded:S,onTimeUpdate:C,className:z,style:M}){const N=se(),D=et(),P=f(null),R=f(null),F=f(null),I=f(null),[A,L]=m(!1),[T,W]=m(0),[j,E]=m(0),[B,V]=m(0),[H,O]=m(1),[q,U]=m(d),[K,Y]=m(!1),[X,Z]=m(!0),[G,_]=m(!1),[J,Q]=m(1),[ee,te]=m(!1),[ne,re]=m(-1),[oe,ie]=m(null),[ae,le]=m(0),[de,ce]=m(null),[ue,pe]=m(!1),[he,fe]=m(!1),[me,ge]=m(null),[xe,be]=m(!1);s(()=>{const e=P.current;if(!e)return;void 0!==w&&(e.currentTime=w);const t=()=>{W(e.currentTime),e.buffered.length>0&&V(e.buffered.end(e.buffered.length-1))},n=()=>E(e.duration),r=()=>L(!0),o=()=>{L(!1),_(!0)},i=()=>{L(!1),_(!0),S?.()},a=()=>pe(!0),l=()=>pe(!1),s=()=>fe(!0),d=()=>fe(!1),c=()=>{const t=e.error;ge(t?`Error ${t.code}: ${t.message||"Failed to load video"}`:"Failed to load video"),fe(!1)};return e.addEventListener("timeupdate",t),e.addEventListener("durationchange",n),e.addEventListener("play",r),e.addEventListener("pause",o),e.addEventListener("ended",i),e.addEventListener("enterpictureinpicture",a),e.addEventListener("leavepictureinpicture",l),e.addEventListener("waiting",s),e.addEventListener("canplay",d),e.addEventListener("error",c),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("durationchange",n),e.removeEventListener("play",r),e.removeEventListener("pause",o),e.removeEventListener("ended",i),e.removeEventListener("enterpictureinpicture",a),e.removeEventListener("leavepictureinpicture",l),e.removeEventListener("waiting",s),e.removeEventListener("canplay",d),e.removeEventListener("error",c)}},[S,w]),s(()=>{P.current&&(A?k?.():$?.())},[A,k,$]),s(()=>{C?.(T,j)},[T,j,C]),s(()=>{const e=P.current;if(!e)return;const t=e.textTracks;for(let n=0;n<t.length;n++)t[n].mode=n===ne?"showing":"disabled"},[ne]),s(()=>{const e=()=>Y(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),s(()=>{const e=R.current;if(!e)return;const t=e=>{const t=P.current;if(t&&"INPUT"!==e.target.tagName)switch(e.key){case" ":case"k":e.preventDefault(),ve();break;case"f":case"F":p&&$e();break;case"m":case"M":we();break;case"ArrowRight":e.preventDefault(),t.currentTime=Math.min(t.currentTime+10,t.duration);break;case"ArrowLeft":e.preventDefault(),t.currentTime=Math.max(t.currentTime-10,0);break;case"ArrowUp":e.preventDefault(),O(Math.min(H+.1,1)),P.current&&(P.current.volume=Math.min(H+.1,1));break;case"ArrowDown":e.preventDefault(),O(Math.max(H-.1,0)),P.current&&(P.current.volume=Math.max(H-.1,0))}};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)},[H,p]);const ye=a(()=>{Z(!0),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{A&&Z(!1)},3e3)},[A]);s(()=>(ye(),()=>{I.current&&clearTimeout(I.current)}),[A,ye]);const ve=a(()=>{const e=P.current;e&&(e.paused?(e.play().catch(()=>{}),ce("play"),_(!1)):(e.pause(),ce("pause")),setTimeout(()=>ce(null),600))},[]),we=a(()=>{const e=P.current;if(!e)return;const t=!q;U(t),e.muted=t},[q]),$e=a(()=>{const e=R.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]),Se=a(async()=>{const e=P.current;if(e)try{document.pictureInPictureElement?await document.exitPictureInPicture():await e.requestPictureInPicture()}catch{}},[]),Ce=a(()=>{0!==v.length&&(re(e=>(e+1)%(v.length+1)-1),re(e=>{const t=e+1;return t>=v.length?-1:t}))},[v.length]),ze=a(()=>{const e=P.current;e&&(e.currentTime=Math.min(e.currentTime+10,e.duration||0))},[]),Me=a(()=>{const e=P.current;e&&(e.currentTime=Math.max(e.currentTime-10,0))},[]),Ne=a(()=>{const e=P.current;e&&(ge(null),e.load())},[]),De=a(()=>{p&&$e()},[p,$e]),Pe=a(e=>{const t=P.current,n=F.current;if(!t||!n||!j)return;const r=n.getBoundingClientRect();t.currentTime=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*j},[j]),Re=a(e=>{const t=F.current;if(!t||!j)return;const n=t.getBoundingClientRect();ie(Math.max(0,Math.min(1,(e.clientX-n.left)/n.width))*j),le(e.clientX-n.left)},[j]),Fe=a(e=>{const t=parseFloat(e.target.value);O(t),P.current&&(P.current.volume=t,P.current.muted=0===t,U(0===t))},[]),Ie=a(e=>{Q(e),P.current&&(P.current.playbackRate=e),te(!1)},[]),Ae=y.length>0?[...y].reverse().find(e=>T>=e.time):null,Le=e=>[...y].reverse().find(t=>e>=t.time)??null,Te=Array.isArray(e)?e:[{src:e,type:"video/mp4"}],We=Array.isArray(e)?e[0].src:e,je=X||G||!A,Ee=D?"none":"opacity 0.25s ease",Be=q||0===H?"M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z":H<.5?"M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z":"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z",Ve=j>0?T/j*100:0,He=j>0?B/j*100:0;/* @__PURE__ */
199
- return b("div",{ref:R,className:z,tabIndex:0,onMouseMove:ye,onMouseLeave:()=>{A&&Z(!1)},style:{position:"relative",width:r,height:o??"auto",background:"#000",borderRadius:"8px",overflow:"hidden",outline:"none",userSelect:"none",...M},children:[
200
- /* @__PURE__ */b("video",{ref:P,style:{width:"100%",height:"100%",display:"block",objectFit:"contain"},poster:t,autoPlay:i,loop:l,muted:d,playsInline:!0,onClick:ve,onDoubleClick:De,children:[Te.map((e,t)=>/* @__PURE__ */x("source",{src:e.src,type:e.type},t)),v.map((e,t)=>/* @__PURE__ */x("track",{kind:"subtitles",label:ke(e.label),srcLang:e.lang,src:e.src,default:e.default},t))]}),u&&n&&/* @__PURE__ */b("div",{style:{position:"absolute",top:0,left:0,right:0,background:"linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%)",padding:"16px 16px 32px",opacity:je?1:0,transition:Ee,pointerEvents:"none"},children:[/* @__PURE__ */x("span",{style:{color:"#fff",fontSize:"0.95rem",fontWeight:600,textShadow:"0 1px 3px rgba(0,0,0,0.7)"},children:ke(n)}),Ae&&/* @__PURE__ */b("span",{style:{color:"rgba(255,255,255,0.65)",fontSize:"0.8rem",marginLeft:8},children:["— ",ke(Ae.label)]})]}),de&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(0,0,0,0.45)",borderRadius:"50%",width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",animation:D?"none":"tkxvp-flash 0.6s ease forwards",pointerEvents:"none"},children:/* @__PURE__ */x(Lo,{path:"play"===de?To:Wo,size:32,color:"#fff"})}),he&&!me&&/* @__PURE__ */x("div",{"aria-label":"Loading",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:10},children:/* @__PURE__ */x("div",{style:{width:48,height:48,border:"4px solid rgba(255,255,255,0.25)",borderTopColor:N.primary,borderRadius:"50%",animation:D?"none":"tkxvp-spin 0.8s linear infinite"}})}),me&&/* @__PURE__ */b("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.8)",zIndex:20,gap:12},children:[
201
- /* @__PURE__ */x(Lo,{path:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",size:48,color:"#ef4444"}),
218
+ /* @__PURE__ */x("span",{children:String(u).padStart(2,"0")}),n&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("span",{style:v,children:":"}),/* @__PURE__ */x("span",{children:String(p).padStart(2,"0")})]}),"12h"===t&&/* @__PURE__ */x("span",{style:{fontSize:.45*y,color:s,marginLeft:"0.4ch",alignSelf:"flex-end",marginBottom:.05*y},children:m})]}),r&&/* @__PURE__ */x("div",{style:{fontSize:.072*i,color:s,marginTop:.025*i,letterSpacing:"0.03em"},children:h}),o&&/* @__PURE__ */x("div",{style:{fontSize:.065*i,color:s,marginTop:.015*i,textTransform:"uppercase",letterSpacing:"0.08em"},children:ke(o)})]})}function Vo({variant:e="both",size:t="md",showSeconds:n=!0,showDate:r=!1,format:o="24h",timezone:i,timezone2:a,label:l,analogStyle:d="classic",className:c,style:u}){const p=se(),h=et(),[g,y]=m(()=>jo(i)),[v,w]=m(()=>a?jo(a):null),[k,$]=m(!0),[S,C]=m(!1),z=f(null);s(()=>{C(!0)},[]),s(()=>{const e=()=>{y(jo(i)),a&&w(jo(a))};e();const t=setInterval(e,1e3);return()=>clearInterval(t)},[i,a]),s(()=>(z.current=setInterval(()=>{$(e=>!e)},500),()=>{z.current&&clearInterval(z.current)}),[]);const M=Wo[t],N="digital"===e||"both"===e;/* @__PURE__ */
219
+ return b("div",{className:c,style:{display:"inline-flex",flexDirection:"column",alignItems:"center",gap:"both"===e?.06*M+"px":0,opacity:S?1:0,transition:h?"none":"opacity 0.4s ease",...u},role:"timer","aria-live":"off",children:[("analog"===e||"both"===e)&&/* @__PURE__ */x(Eo,{time:g,size:M,analogStyle:d,showSeconds:n,reducedMotion:h,primary:p.primary,danger:p.danger,text:p.text,textMuted:p.textMuted,border:p.border,surface:p.surface,bg:p.bg}),N&&/* @__PURE__ */x(Bo,{time:g,format:o,showSeconds:n,showDate:r,label:l,size:M,primary:p.primary,text:p.text,textMuted:p.textMuted,colonVisible:k}),v&&a&&/* @__PURE__ */x("div",{style:{marginTop:.04*M,padding:`${.03*M}px ${.06*M}px`,borderTop:`1px solid ${p.border}`,textAlign:"center"},children:/* @__PURE__ */x(Bo,{time:v,format:o,showSeconds:!1,showDate:!1,label:a,size:.7*M,primary:p.secondary,text:p.text,textMuted:p.textMuted,colonVisible:k})})]})}function Ho(e){if(!isFinite(e)||isNaN(e))return"0:00";const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?`${t}:${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${n}:${String(r).padStart(2,"0")}`}function Oo({path:e,size:t=20,color:n="currentColor",title:r}){/* @__PURE__ */
220
+ return x("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:n,"aria-hidden":r?void 0:"true",role:r?"img":void 0,"aria-label":r,style:{display:"block",flexShrink:0},children:/* @__PURE__ */x("path",{d:e})})}Vo.displayName="TkxClock";var qo="M8 5v14l11-7z",Uo="M6 19h4V5H6v14zm8-14v14h4V5h-4z";function Ko({onClick:e,title:t,children:n,active:r,primary:o}){const[i,a]=m(!1);/* @__PURE__ */
221
+ return x("button",{type:"button",onClick:e,title:t,"aria-label":t,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{background:"none",border:"none",padding:"6px",cursor:"pointer",color:r||i?o:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",flexShrink:0,transition:"color 0.15s ease"},children:n})}function Yo({src:e,poster:t,title:n,width:r="100%",height:o,autoPlay:i=!1,loop:l=!1,muted:d=!1,controls:c=!0,showTitle:u=!0,allowFullscreen:p=!0,allowPiP:h=!0,allowDownload:g=!1,chapters:y=[],subtitles:v=[],startTime:w,onPlay:k,onPause:$,onEnded:S,onTimeUpdate:C,className:z,style:M}){const N=se(),D=et(),R=f(null),P=f(null),F=f(null),I=f(null),[A,L]=m(!1),[T,W]=m(0),[j,E]=m(0),[B,V]=m(0),[H,O]=m(1),[q,U]=m(d),[K,Y]=m(!1),[X,Z]=m(!0),[G,_]=m(!1),[J,Q]=m(1),[ee,te]=m(!1),[ne,re]=m(-1),[oe,ie]=m(null),[ae,le]=m(0),[de,ce]=m(null),[ue,pe]=m(!1),[he,fe]=m(!1),[me,ge]=m(null),[xe,be]=m(!1);s(()=>{const e=R.current;if(!e)return;void 0!==w&&(e.currentTime=w);const t=()=>{W(e.currentTime),e.buffered.length>0&&V(e.buffered.end(e.buffered.length-1))},n=()=>E(e.duration),r=()=>L(!0),o=()=>{L(!1),_(!0)},i=()=>{L(!1),_(!0),S?.()},a=()=>pe(!0),l=()=>pe(!1),s=()=>fe(!0),d=()=>fe(!1),c=()=>{const t=e.error;ge(t?`Error ${t.code}: ${t.message||"Failed to load video"}`:"Failed to load video"),fe(!1)};return e.addEventListener("timeupdate",t),e.addEventListener("durationchange",n),e.addEventListener("play",r),e.addEventListener("pause",o),e.addEventListener("ended",i),e.addEventListener("enterpictureinpicture",a),e.addEventListener("leavepictureinpicture",l),e.addEventListener("waiting",s),e.addEventListener("canplay",d),e.addEventListener("error",c),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("durationchange",n),e.removeEventListener("play",r),e.removeEventListener("pause",o),e.removeEventListener("ended",i),e.removeEventListener("enterpictureinpicture",a),e.removeEventListener("leavepictureinpicture",l),e.removeEventListener("waiting",s),e.removeEventListener("canplay",d),e.removeEventListener("error",c)}},[S,w]),s(()=>{R.current&&(A?k?.():$?.())},[A,k,$]),s(()=>{C?.(T,j)},[T,j,C]),s(()=>{const e=R.current;if(!e)return;const t=e.textTracks;for(let n=0;n<t.length;n++)t[n].mode=n===ne?"showing":"disabled"},[ne]),s(()=>{const e=()=>Y(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),s(()=>{const e=P.current;if(!e)return;const t=e=>{const t=R.current;if(t&&"INPUT"!==e.target.tagName)switch(e.key){case" ":case"k":e.preventDefault(),ve();break;case"f":case"F":p&&$e();break;case"m":case"M":we();break;case"ArrowRight":e.preventDefault(),t.currentTime=Math.min(t.currentTime+10,t.duration);break;case"ArrowLeft":e.preventDefault(),t.currentTime=Math.max(t.currentTime-10,0);break;case"ArrowUp":e.preventDefault(),O(Math.min(H+.1,1)),R.current&&(R.current.volume=Math.min(H+.1,1));break;case"ArrowDown":e.preventDefault(),O(Math.max(H-.1,0)),R.current&&(R.current.volume=Math.max(H-.1,0))}};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)},[H,p]);const ye=a(()=>{Z(!0),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{A&&Z(!1)},3e3)},[A]);s(()=>(ye(),()=>{I.current&&clearTimeout(I.current)}),[A,ye]);const ve=a(()=>{const e=R.current;e&&(e.paused?(e.play().catch(()=>{}),ce("play"),_(!1)):(e.pause(),ce("pause")),setTimeout(()=>ce(null),600))},[]),we=a(()=>{const e=R.current;if(!e)return;const t=!q;U(t),e.muted=t},[q]),$e=a(()=>{const e=P.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]),Se=a(async()=>{const e=R.current;if(e)try{document.pictureInPictureElement?await document.exitPictureInPicture():await e.requestPictureInPicture()}catch{}},[]),Ce=a(()=>{0!==v.length&&(re(e=>(e+1)%(v.length+1)-1),re(e=>{const t=e+1;return t>=v.length?-1:t}))},[v.length]),ze=a(()=>{const e=R.current;e&&(e.currentTime=Math.min(e.currentTime+10,e.duration||0))},[]),Me=a(()=>{const e=R.current;e&&(e.currentTime=Math.max(e.currentTime-10,0))},[]),Ne=a(()=>{const e=R.current;e&&(ge(null),e.load())},[]),De=a(()=>{p&&$e()},[p,$e]),Re=a(e=>{const t=R.current,n=F.current;if(!t||!n||!j)return;const r=n.getBoundingClientRect();t.currentTime=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*j},[j]),Pe=a(e=>{const t=F.current;if(!t||!j)return;const n=t.getBoundingClientRect();ie(Math.max(0,Math.min(1,(e.clientX-n.left)/n.width))*j),le(e.clientX-n.left)},[j]),Fe=a(e=>{const t=parseFloat(e.target.value);O(t),R.current&&(R.current.volume=t,R.current.muted=0===t,U(0===t))},[]),Ie=a(e=>{Q(e),R.current&&(R.current.playbackRate=e),te(!1)},[]),Ae=y.length>0?[...y].reverse().find(e=>T>=e.time):null,Le=e=>[...y].reverse().find(t=>e>=t.time)??null,Te=Array.isArray(e)?e:[{src:e,type:"video/mp4"}],We=Array.isArray(e)?e[0].src:e,je=X||G||!A,Ee=D?"none":"opacity 0.25s ease",Be=q||0===H?"M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z":H<.5?"M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z":"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z",Ve=j>0?T/j*100:0,He=j>0?B/j*100:0;/* @__PURE__ */
222
+ return b("div",{ref:P,className:z,tabIndex:0,onMouseMove:ye,onMouseLeave:()=>{A&&Z(!1)},style:{position:"relative",width:r,height:o??"auto",background:"#000",borderRadius:"8px",overflow:"hidden",outline:"none",userSelect:"none",...M},children:[
223
+ /* @__PURE__ */b("video",{ref:R,style:{width:"100%",height:"100%",display:"block",objectFit:"contain"},poster:t,autoPlay:i,loop:l,muted:d,playsInline:!0,onClick:ve,onDoubleClick:De,children:[Te.map((e,t)=>/* @__PURE__ */x("source",{src:e.src,type:e.type},t)),v.map((e,t)=>/* @__PURE__ */x("track",{kind:"subtitles",label:ke(e.label),srcLang:e.lang,src:e.src,default:e.default},t))]}),u&&n&&/* @__PURE__ */b("div",{style:{position:"absolute",top:0,left:0,right:0,background:"linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%)",padding:"16px 16px 32px",opacity:je?1:0,transition:Ee,pointerEvents:"none"},children:[/* @__PURE__ */x("span",{style:{color:"#fff",fontSize:"0.95rem",fontWeight:600,textShadow:"0 1px 3px rgba(0,0,0,0.7)"},children:ke(n)}),Ae&&/* @__PURE__ */b("span",{style:{color:"rgba(255,255,255,0.65)",fontSize:"0.8rem",marginLeft:8},children:["— ",ke(Ae.label)]})]}),de&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(0,0,0,0.45)",borderRadius:"50%",width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",animation:D?"none":"tkxvp-flash 0.6s ease forwards",pointerEvents:"none"},children:/* @__PURE__ */x(Oo,{path:"play"===de?qo:Uo,size:32,color:"#fff"})}),he&&!me&&/* @__PURE__ */x("div",{"aria-label":"Loading",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:10},children:/* @__PURE__ */x("div",{style:{width:48,height:48,border:"4px solid rgba(255,255,255,0.25)",borderTopColor:N.primary,borderRadius:"50%",animation:D?"none":"tkxvp-spin 0.8s linear infinite"}})}),me&&/* @__PURE__ */b("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.8)",zIndex:20,gap:12},children:[
224
+ /* @__PURE__ */x(Oo,{path:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",size:48,color:"#ef4444"}),
202
225
  /* @__PURE__ */x("span",{style:{color:"#fff",fontSize:"0.9rem",maxWidth:"80%",textAlign:"center"},children:me}),
203
- /* @__PURE__ */b("button",{type:"button",onClick:Ne,style:{display:"flex",alignItems:"center",gap:6,background:N.primary,color:"#fff",border:"none",borderRadius:6,padding:"8px 18px",fontSize:"0.85rem",fontWeight:600,cursor:"pointer",marginTop:4},children:[/* @__PURE__ */x(Lo,{path:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z",size:18,color:"#fff"}),"Retry"]})]}),c&&/* @__PURE__ */b("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 70%, transparent 100%)",padding:"32px 12px 8px",opacity:je?1:0,transition:Ee},onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[/* @__PURE__ */b("div",{ref:F,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(j),"aria-valuenow":Math.floor(T),tabIndex:0,onClick:Pe,onMouseMove:Re,style:{position:"relative",height:4,borderRadius:2,background:"rgba(255,255,255,0.25)",cursor:"pointer",marginBottom:8,transition:"height 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.height="8px"},onMouseLeave:e=>{e.currentTarget.style.height="4px",ie(null)},children:[
226
+ /* @__PURE__ */b("button",{type:"button",onClick:Ne,style:{display:"flex",alignItems:"center",gap:6,background:N.primary,color:"#fff",border:"none",borderRadius:6,padding:"8px 18px",fontSize:"0.85rem",fontWeight:600,cursor:"pointer",marginTop:4},children:[/* @__PURE__ */x(Oo,{path:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z",size:18,color:"#fff"}),"Retry"]})]}),c&&/* @__PURE__ */b("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 70%, transparent 100%)",padding:"32px 12px 8px",opacity:je?1:0,transition:Ee},onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[/* @__PURE__ */b("div",{ref:F,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(j),"aria-valuenow":Math.floor(T),tabIndex:0,onClick:Re,onMouseMove:Pe,style:{position:"relative",height:4,borderRadius:2,background:"rgba(255,255,255,0.25)",cursor:"pointer",marginBottom:8,transition:"height 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.height="8px"},onMouseLeave:e=>{e.currentTarget.style.height="4px",ie(null)},children:[
204
227
  /* @__PURE__ */x("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${He}%`,background:"rgba(255,255,255,0.3)",borderRadius:2,pointerEvents:"none"}}),
205
228
  /* @__PURE__ */x("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${Ve}%`,background:N.primary,borderRadius:2,pointerEvents:"none"}}),
206
229
  /* @__PURE__ */x("div",{style:{position:"absolute",top:"50%",left:`${Ve}%`,transform:"translate(-50%, -50%)",width:12,height:12,borderRadius:"50%",background:N.primary,pointerEvents:"none"}}),y.map((e,t)=>{const n=j>0?e.time/j*100:0;/* @__PURE__ */
207
- return x("div",{title:ke(e.label),style:{position:"absolute",top:"50%",left:`${n}%`,transform:"translate(-50%, -50%)",width:8,height:8,borderRadius:"50%",background:"#fff",border:`2px solid ${N.primary}`,zIndex:2,cursor:"pointer",pointerEvents:"auto"}},t)}),null!==oe&&/* @__PURE__ */b("div",{style:{position:"absolute",bottom:12,left:ae,transform:"translateX(-50%)",background:"rgba(0,0,0,0.8)",color:"#fff",fontSize:"0.72rem",padding:"2px 6px",borderRadius:4,whiteSpace:"nowrap",pointerEvents:"none"},children:[Ao(oe),Le(oe)&&/* @__PURE__ */x("span",{style:{display:"block",fontSize:"0.65rem",color:"rgba(255,255,255,0.7)"},children:ke(Le(oe).label)})]})]}),/* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:2},children:[
208
- /* @__PURE__ */x(jo,{onClick:ve,title:A?"Pause":"Play",primary:N.primary,children:/* @__PURE__ */x(Lo,{path:A?Wo:To,size:22})}),
209
- /* @__PURE__ */x(jo,{onClick:Me,title:"Skip back 10 seconds",primary:N.primary,children:/* @__PURE__ */b("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[/* @__PURE__ */x(Lo,{path:"M11.99 5V1l-5 5 5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z",size:22}),/* @__PURE__ */x("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),
210
- /* @__PURE__ */x(jo,{onClick:ze,title:"Skip forward 10 seconds",primary:N.primary,children:/* @__PURE__ */b("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[/* @__PURE__ */x(Lo,{path:"M18 13c0 3.31-2.69 6-6 6s-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8V1l-5 5 5 5V7c3.31 0 6 2.69 6 6z",size:22}),/* @__PURE__ */x("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),
211
- /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",position:"relative"},onMouseEnter:()=>be(!0),onMouseLeave:()=>be(!1),children:[/* @__PURE__ */x(jo,{onClick:we,title:q?"Unmute":"Mute",primary:N.primary,children:/* @__PURE__ */x(Lo,{path:Be,size:20})}),/* @__PURE__ */x("div",{style:{overflow:"hidden",width:xe?64:0,opacity:xe?1:0,transition:D?"none":"width 0.2s ease, opacity 0.2s ease",display:"flex",alignItems:"center"},children:/* @__PURE__ */x("input",{type:"range",min:0,max:1,step:.05,value:q?0:H,onChange:Fe,"aria-label":"Volume",style:{width:64,accentColor:N.primary,cursor:"pointer",height:4}})})]}),
212
- /* @__PURE__ */b("span",{style:{color:"#fff",fontSize:"0.78rem",fontFamily:"monospace",fontVariantNumeric:"tabular-nums",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:[Ao(T)," / ",Ao(j)]}),
213
- /* @__PURE__ */x("div",{style:{flex:1}}),v.length>0&&/* @__PURE__ */x(jo,{onClick:Ce,title:"Subtitles",primary:N.primary,active:ne>=0,children:/* @__PURE__ */x(Lo,{path:"M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z",size:20})}),
230
+ return x("div",{title:ke(e.label),style:{position:"absolute",top:"50%",left:`${n}%`,transform:"translate(-50%, -50%)",width:8,height:8,borderRadius:"50%",background:"#fff",border:`2px solid ${N.primary}`,zIndex:2,cursor:"pointer",pointerEvents:"auto"}},t)}),null!==oe&&/* @__PURE__ */b("div",{style:{position:"absolute",bottom:12,left:ae,transform:"translateX(-50%)",background:"rgba(0,0,0,0.8)",color:"#fff",fontSize:"0.72rem",padding:"2px 6px",borderRadius:4,whiteSpace:"nowrap",pointerEvents:"none"},children:[Ho(oe),Le(oe)&&/* @__PURE__ */x("span",{style:{display:"block",fontSize:"0.65rem",color:"rgba(255,255,255,0.7)"},children:ke(Le(oe).label)})]})]}),/* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:2},children:[
231
+ /* @__PURE__ */x(Ko,{onClick:ve,title:A?"Pause":"Play",primary:N.primary,children:/* @__PURE__ */x(Oo,{path:A?Uo:qo,size:22})}),
232
+ /* @__PURE__ */x(Ko,{onClick:Me,title:"Skip back 10 seconds",primary:N.primary,children:/* @__PURE__ */b("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[/* @__PURE__ */x(Oo,{path:"M11.99 5V1l-5 5 5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z",size:22}),/* @__PURE__ */x("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),
233
+ /* @__PURE__ */x(Ko,{onClick:ze,title:"Skip forward 10 seconds",primary:N.primary,children:/* @__PURE__ */b("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[/* @__PURE__ */x(Oo,{path:"M18 13c0 3.31-2.69 6-6 6s-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8V1l-5 5 5 5V7c3.31 0 6 2.69 6 6z",size:22}),/* @__PURE__ */x("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),
234
+ /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",position:"relative"},onMouseEnter:()=>be(!0),onMouseLeave:()=>be(!1),children:[/* @__PURE__ */x(Ko,{onClick:we,title:q?"Unmute":"Mute",primary:N.primary,children:/* @__PURE__ */x(Oo,{path:Be,size:20})}),/* @__PURE__ */x("div",{style:{overflow:"hidden",width:xe?64:0,opacity:xe?1:0,transition:D?"none":"width 0.2s ease, opacity 0.2s ease",display:"flex",alignItems:"center"},children:/* @__PURE__ */x("input",{type:"range",min:0,max:1,step:.05,value:q?0:H,onChange:Fe,"aria-label":"Volume",style:{width:64,accentColor:N.primary,cursor:"pointer",height:4}})})]}),
235
+ /* @__PURE__ */b("span",{style:{color:"#fff",fontSize:"0.78rem",fontFamily:"monospace",fontVariantNumeric:"tabular-nums",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:[Ho(T)," / ",Ho(j)]}),
236
+ /* @__PURE__ */x("div",{style:{flex:1}}),v.length>0&&/* @__PURE__ */x(Ko,{onClick:Ce,title:"Subtitles",primary:N.primary,active:ne>=0,children:/* @__PURE__ */x(Oo,{path:"M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z",size:20})}),
214
237
  /* @__PURE__ */b("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[
215
- /* @__PURE__ */b("button",{type:"button",onClick:()=>te(e=>!e),title:"Playback speed",style:{background:"none",border:"none",cursor:"pointer",color:"#fff",fontSize:"0.75rem",fontWeight:600,padding:"6px 8px",letterSpacing:"0.02em",position:"relative"},children:[J,"×"]}),1!==J&&/* @__PURE__ */b("span",{style:{position:"absolute",top:0,right:0,background:N.primary,color:"#fff",fontSize:"0.55rem",fontWeight:700,borderRadius:6,padding:"1px 4px",lineHeight:1.2,pointerEvents:"none"},children:[J,"x"]}),ee&&/* @__PURE__ */x("div",{style:{position:"absolute",bottom:"100%",right:0,background:"rgba(20,20,20,0.97)",border:`1px solid ${N.border}`,borderRadius:6,overflow:"hidden",zIndex:100,minWidth:80},children:[.5,.75,1,1.25,1.5,2].map(e=>/* @__PURE__ */b("button",{type:"button",onClick:()=>Ie(e),style:{display:"block",width:"100%",padding:"6px 14px",background:e===J?N.primary+"30":"none",border:"none",color:e===J?N.primary:"#fff",fontSize:"0.8rem",cursor:"pointer",textAlign:"left"},children:[e,"×"]},e))})]}),h&&"undefined"!=typeof document&&"pictureInPictureEnabled"in document&&/* @__PURE__ */x(jo,{onClick:Se,title:"Picture-in-Picture",primary:N.primary,active:ue,children:/* @__PURE__ */x(Lo,{path:"M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z",size:20})}),g&&/* @__PURE__ */x("a",{href:We,download:!0,title:"Download",style:{color:"#fff",display:"flex",alignItems:"center",padding:"6px"},children:/* @__PURE__ */x(Lo,{path:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",size:20})}),p&&/* @__PURE__ */x(jo,{onClick:$e,title:K?"Exit fullscreen":"Fullscreen",primary:N.primary,children:/* @__PURE__ */x(Lo,{path:K?"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z":"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",size:20})})]})]}),
216
- /* @__PURE__ */x("style",{children:"\n @keyframes tkxvp-flash {\n 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); }\n 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); }\n }\n @keyframes tkxvp-spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]})}Eo.displayName="TkxVideoPlayer";var Bo={sm:{circle:24,fontSize:"0.75rem",titleSize:"0.8rem",descSize:"0.7rem",connectorWidth:2},md:{circle:32,fontSize:"0.875rem",titleSize:"0.9rem",descSize:"0.775rem",connectorWidth:2},lg:{circle:40,fontSize:"1rem",titleSize:"1rem",descSize:"0.85rem",connectorWidth:3}};function Vo({size:e}){const t=.55*e;/* @__PURE__ */
217
- return x("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"})})}function Ho({size:e}){const t=.55*e;/* @__PURE__ */
218
- return x("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})})}function Oo({status:e,index:t,showStepNumbers:n,icon:r,circleSize:o,fontSize:i,primary:a,danger:l,success:s,text:d,textMuted:c,border:u,surface:p,variant:h,reducedMotion:f,clickable:m}){const y="completed"===e,v="active"===e,w="error"===e;let k=p,$=u,S=c,C=2;y?(k="filled"===h?s:p,$=s,S="filled"===h?"#fff":s):v?(k="outlined"===h?p:a,$=a,S="outlined"===h?a:"#fff",C=2):w?(k="filled"===h?l:p,$=l,S="filled"===h?"#fff":l):"pending"===e&&(k=p,$=u,S=c);const z=v&&!f?{boxShadow:`0 0 0 4px ${a}30`,animation:"tkxstepper-pulse 2s ease-in-out infinite"}:{},M=m?{cursor:"pointer",transition:"transform 0.15s ease, box-shadow 0.15s ease"}:{};let N;return N=!r||y||w?y?/* @__PURE__ */x(Vo,{size:o}):w?/* @__PURE__ */x(Ho,{size:o}):/* @__PURE__ */x("span",n?{style:{fontSize:i,fontWeight:600,lineHeight:1},children:t+1}:{style:{fontSize:.22*o,lineHeight:1,background:S,borderRadius:"50%",width:.22*o,height:.22*o,display:"block"}}):/* @__PURE__ */x("span",{style:{fontSize:i,lineHeight:1},children:r}),/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("style",{children:`\n @keyframes tkxstepper-pulse {\n 0%, 100% { box-shadow: 0 0 0 0 ${a}50; }\n 50% { box-shadow: 0 0 0 6px ${a}20; }\n }\n `}),/* @__PURE__ */x("div",{style:{width:o,height:o,minWidth:o,borderRadius:"50%",border:`${C}px solid ${$}`,backgroundColor:k,color:S,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:f?"none":"background-color 0.2s, border-color 0.2s",...z,...M},children:N})]})}function qo({completed:e,orientation:t,connectorStyle:n,connectorWidth:r,primary:o,border:i,reducedMotion:a}){const l=e?o:i;/* @__PURE__ */
219
- return x("div","horizontal"===t?{"aria-hidden":"true",style:{flex:1,height:r,backgroundColor:"solid"===n?l:"transparent",backgroundImage:"solid"!==n?`repeating-linear-gradient(90deg, ${l} 0, ${l} 6px, transparent 6px, transparent ${"dashed"===n?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background-color 0.3s ease, background-image 0.3s ease",alignSelf:"center",marginLeft:4,marginRight:4}}:{"aria-hidden":"true",style:{width:r,flex:1,minHeight:20,backgroundColor:"solid"===n?l:"transparent",backgroundImage:"solid"!==n?`repeating-linear-gradient(180deg, ${l} 0, ${l} 6px, transparent 6px, transparent ${"dashed"===n?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background-color 0.3s ease, background-image 0.3s ease",alignSelf:"stretch",marginTop:4,marginBottom:4,marginLeft:"auto",marginRight:"auto"}})}function Uo({steps:e,activeStep:t=0,orientation:n="horizontal",variant:r="default",size:o="md",clickable:i=!1,onStepClick:a,showStepNumbers:l=!0,alternateLabel:s=!1,connector:d="solid",className:c,style:u}){const p=se(),h=et(),f=Bo[o],m="horizontal"===n;/* @__PURE__ */
220
- return x("div",{className:c,role:"list","aria-label":"Steps",style:{display:"flex",flexDirection:m?"row":"column",alignItems:m?s?"flex-start":"center":"stretch",width:"100%",gap:0,...u},children:e.map((n,o)=>{const c=((e,n)=>e.status?e.status:n<t?"completed":n===t?"active":"pending")(n,o),u=o===e.length-1,g="completed"===c||o<t,y=o%2==0,v=()=>{i&&a?.(o)},w=/* @__PURE__ */x(Oo,{status:c,index:o,showStepNumbers:l,icon:n.icon,circleSize:f.circle,fontSize:f.fontSize,primary:p.primary,danger:p.danger,success:p.success,text:p.text,textMuted:p.textMuted,border:p.border,surface:p.surface,variant:r,reducedMotion:h,clickable:i}),k=/* @__PURE__ */b("div",{style:{textAlign:m&&!s?"center":"left",maxWidth:m?120:void 0},children:[
238
+ /* @__PURE__ */b("button",{type:"button",onClick:()=>te(e=>!e),title:"Playback speed",style:{background:"none",border:"none",cursor:"pointer",color:"#fff",fontSize:"0.75rem",fontWeight:600,padding:"6px 8px",letterSpacing:"0.02em",position:"relative"},children:[J,"×"]}),1!==J&&/* @__PURE__ */b("span",{style:{position:"absolute",top:0,right:0,background:N.primary,color:"#fff",fontSize:"0.55rem",fontWeight:700,borderRadius:6,padding:"1px 4px",lineHeight:1.2,pointerEvents:"none"},children:[J,"x"]}),ee&&/* @__PURE__ */x("div",{style:{position:"absolute",bottom:"100%",right:0,background:"rgba(20,20,20,0.97)",border:`1px solid ${N.border}`,borderRadius:6,overflow:"hidden",zIndex:100,minWidth:80},children:[.5,.75,1,1.25,1.5,2].map(e=>/* @__PURE__ */b("button",{type:"button",onClick:()=>Ie(e),style:{display:"block",width:"100%",padding:"6px 14px",background:e===J?N.primary+"30":"none",border:"none",color:e===J?N.primary:"#fff",fontSize:"0.8rem",cursor:"pointer",textAlign:"left"},children:[e,"×"]},e))})]}),h&&"undefined"!=typeof document&&"pictureInPictureEnabled"in document&&/* @__PURE__ */x(Ko,{onClick:Se,title:"Picture-in-Picture",primary:N.primary,active:ue,children:/* @__PURE__ */x(Oo,{path:"M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z",size:20})}),g&&/* @__PURE__ */x("a",{href:We,download:!0,title:"Download",style:{color:"#fff",display:"flex",alignItems:"center",padding:"6px"},children:/* @__PURE__ */x(Oo,{path:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",size:20})}),p&&/* @__PURE__ */x(Ko,{onClick:$e,title:K?"Exit fullscreen":"Fullscreen",primary:N.primary,children:/* @__PURE__ */x(Oo,{path:K?"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z":"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",size:20})})]})]}),
239
+ /* @__PURE__ */x("style",{children:"\n @keyframes tkxvp-flash {\n 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); }\n 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); }\n }\n @keyframes tkxvp-spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]})}Yo.displayName="TkxVideoPlayer";var Xo={sm:{circle:24,fontSize:"0.75rem",titleSize:"0.8rem",descSize:"0.7rem",connectorWidth:2},md:{circle:32,fontSize:"0.875rem",titleSize:"0.9rem",descSize:"0.775rem",connectorWidth:2},lg:{circle:40,fontSize:"1rem",titleSize:"1rem",descSize:"0.85rem",connectorWidth:3}};function Zo({size:e}){const t=.55*e;/* @__PURE__ */
240
+ return x("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"})})}function Go({size:e}){const t=.55*e;/* @__PURE__ */
241
+ return x("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})})}function _o({status:e,index:t,showStepNumbers:n,icon:r,circleSize:o,fontSize:i,primary:a,danger:l,success:s,text:d,textMuted:c,border:u,surface:p,variant:h,reducedMotion:f,clickable:m}){const y="completed"===e,v="active"===e,w="error"===e;let k=p,$=u,S=c,C=2;y?(k="filled"===h?s:p,$=s,S="filled"===h?"#fff":s):v?(k="outlined"===h?p:a,$=a,S="outlined"===h?a:"#fff",C=2):w?(k="filled"===h?l:p,$=l,S="filled"===h?"#fff":l):"pending"===e&&(k=p,$=u,S=c);const z=v&&!f?{boxShadow:`0 0 0 4px ${a}30`,animation:"tkxstepper-pulse 2s ease-in-out infinite"}:{},M=m?{cursor:"pointer",transition:"transform 0.15s ease, box-shadow 0.15s ease"}:{};let N;return N=!r||y||w?y?/* @__PURE__ */x(Zo,{size:o}):w?/* @__PURE__ */x(Go,{size:o}):/* @__PURE__ */x("span",n?{style:{fontSize:i,fontWeight:600,lineHeight:1},children:t+1}:{style:{fontSize:.22*o,lineHeight:1,background:S,borderRadius:"50%",width:.22*o,height:.22*o,display:"block"}}):/* @__PURE__ */x("span",{style:{fontSize:i,lineHeight:1},children:r}),/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("style",{children:`\n @keyframes tkxstepper-pulse {\n 0%, 100% { box-shadow: 0 0 0 0 ${a}50; }\n 50% { box-shadow: 0 0 0 6px ${a}20; }\n }\n `}),/* @__PURE__ */x("div",{style:{width:o,height:o,minWidth:o,borderRadius:"50%",border:`${C}px solid ${$}`,backgroundColor:k,color:S,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:f?"none":"background-color 0.2s, border-color 0.2s",...z,...M},children:N})]})}function Jo({completed:e,orientation:t,connectorStyle:n,connectorWidth:r,primary:o,border:i,reducedMotion:a}){const l=e?o:i;/* @__PURE__ */
242
+ return x("div","horizontal"===t?{"aria-hidden":"true",style:{flex:1,height:r,backgroundColor:"solid"===n?l:"transparent",backgroundImage:"solid"!==n?`repeating-linear-gradient(90deg, ${l} 0, ${l} 6px, transparent 6px, transparent ${"dashed"===n?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background-color 0.3s ease, background-image 0.3s ease",alignSelf:"center",marginLeft:4,marginRight:4}}:{"aria-hidden":"true",style:{width:r,flex:1,minHeight:20,backgroundColor:"solid"===n?l:"transparent",backgroundImage:"solid"!==n?`repeating-linear-gradient(180deg, ${l} 0, ${l} 6px, transparent 6px, transparent ${"dashed"===n?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background-color 0.3s ease, background-image 0.3s ease",alignSelf:"stretch",marginTop:4,marginBottom:4,marginLeft:"auto",marginRight:"auto"}})}function Qo({steps:e,activeStep:t=0,orientation:n="horizontal",variant:r="default",size:o="md",clickable:i=!1,onStepClick:a,showStepNumbers:l=!0,alternateLabel:s=!1,connector:d="solid",className:c,style:u}){const p=se(),h=et(),f=Xo[o],m="horizontal"===n;/* @__PURE__ */
243
+ return x("div",{className:c,role:"list","aria-label":"Steps",style:{display:"flex",flexDirection:m?"row":"column",alignItems:m?s?"flex-start":"center":"stretch",width:"100%",gap:0,...u},children:e.map((n,o)=>{const c=((e,n)=>e.status?e.status:n<t?"completed":n===t?"active":"pending")(n,o),u=o===e.length-1,g="completed"===c||o<t,y=o%2==0,v=()=>{i&&a?.(o)},w=/* @__PURE__ */x(_o,{status:c,index:o,showStepNumbers:l,icon:n.icon,circleSize:f.circle,fontSize:f.fontSize,primary:p.primary,danger:p.danger,success:p.success,text:p.text,textMuted:p.textMuted,border:p.border,surface:p.surface,variant:r,reducedMotion:h,clickable:i}),k=/* @__PURE__ */b("div",{style:{textAlign:m&&!s?"center":"left",maxWidth:m?120:void 0},children:[
221
244
  /* @__PURE__ */b("div",{style:{fontSize:f.titleSize,fontWeight:"active"===c?600:500,color:"pending"===c?p.textMuted:"error"===c?p.danger:p.text,lineHeight:1.3,transition:h?"none":"color 0.2s"},children:[ke(n.title),n.optional&&/* @__PURE__ */x("span",{style:{fontSize:f.descSize,color:p.textMuted,fontWeight:400,marginLeft:4},children:"(optional)"})]}),n.description&&/* @__PURE__ */x("div",{style:{fontSize:f.descSize,color:p.textMuted,marginTop:2,lineHeight:1.4},children:ke(n.description)}),n.error&&"error"===c&&/* @__PURE__ */x("div",{style:{fontSize:f.descSize,color:p.danger,marginTop:2},children:ke(n.error)})]});/* @__PURE__ */
222
- return b("div",m?{role:"listitem",style:{display:"flex",flex:u?0:1,alignItems:"center",minWidth:0},children:[/* @__PURE__ */b("div",{onClick:v,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,cursor:i?"pointer":"default",flexShrink:0},"aria-current":"active"===c?"step":void 0,children:[s&&!y&&/* @__PURE__ */x("div",{style:{minHeight:1.5*f.circle+6,display:"flex",alignItems:"flex-end",paddingBottom:6},children:k}),w,!s&&k,s&&y&&/* @__PURE__ */x("div",{style:{marginTop:6},children:k})]}),!u&&/* @__PURE__ */x(qo,{completed:g,orientation:"horizontal",connectorStyle:d,connectorWidth:f.connectorWidth,primary:p.primary,border:p.border,reducedMotion:h})]}:{role:"listitem",style:{display:"flex",flexDirection:"row",minHeight:0},children:[/* @__PURE__ */b("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginRight:14,flexShrink:0},children:[/* @__PURE__ */x("div",{onClick:v,style:{cursor:i?"pointer":"default"},"aria-current":"active"===c?"step":void 0,children:w}),!u&&/* @__PURE__ */x(qo,{completed:g,orientation:"vertical",connectorStyle:d,connectorWidth:f.connectorWidth,primary:p.primary,border:p.border,reducedMotion:h})]}),/* @__PURE__ */x("div",{style:{paddingTop:(f.circle-16*parseFloat(f.titleSize))/2,paddingBottom:u?0:16,flex:1,minWidth:0},children:k})]},n.id)})})}function Ko(e){let t=0,n=0,r=0;const o=e.replace("#","");3===o.length?(t=parseInt(o[0]+o[0],16),n=parseInt(o[1]+o[1],16),r=parseInt(o[2]+o[2],16)):o.length>=6&&(t=parseInt(o.slice(0,2),16),n=parseInt(o.slice(2,4),16),r=parseInt(o.slice(4,6),16)),t/=255,n/=255,r/=255;const i=Math.max(t,n,r),a=Math.min(t,n,r);let l=0,s=0;const d=(i+a)/2;if(i!==a){const e=i-a;switch(s=d>.5?e/(2-i-a):e/(i+a),i){case t:l=((n-r)/e+(n<r?6:0))/6;break;case n:l=((r-t)/e+2)/6;break;case r:l=((t-n)/e+4)/6}}return[Math.round(360*l),Math.round(100*s),Math.round(100*d)]}function Yo(e,t,n){n/=100;const r=(t/=100)*Math.min(n,1-n),o=t=>{const o=(t+e/30)%12,i=n-r*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}function Xo(e){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);return[isNaN(n)?0:n,isNaN(r)?0:r,isNaN(o)?0:o]}function Zo(e,t,n){return`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}function Go(e){return/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e)}function _o(e,t,n){if("hex"===n)return t<1?`${e}${Math.round(255*t).toString(16).padStart(2,"0")}`:e;const[r,o,i]=Xo(e);if("rgb"===n)return t<1?`rgba(${r}, ${o}, ${i}, ${t.toFixed(2)})`:`rgb(${r}, ${o}, ${i})`;const[a,l,s]=Ko(e);return"hsl"===n?t<1?`hsla(${a}, ${l}%, ${s}%, ${t.toFixed(2)})`:`hsl(${a}, ${l}%, ${s}%)`:e}Uo.displayName="TkxStepper";var Jo=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#ffffff","#94a3b8","#475569","#0f172a"];function Qo({hue:e,sat:t,bright:n,onChange:r}){const o=f(null),i=f(!1),l=a(e=>{const t=o.current;if(!t)return;const n=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-n.left)/n.width)),a=Math.max(0,Math.min(1,(e.clientY-n.top)/n.height));r(Math.round(100*i),Math.round(100*(1-a)))},[r]);s(()=>{const e=e=>{i.current&&l(e)},t=()=>{i.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[l]);const d=`${t}%`,c=100-n+"%";/* @__PURE__ */
245
+ return b("div",m?{role:"listitem",style:{display:"flex",flex:u?0:1,alignItems:"center",minWidth:0},children:[/* @__PURE__ */b("div",{onClick:v,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,cursor:i?"pointer":"default",flexShrink:0},"aria-current":"active"===c?"step":void 0,children:[s&&!y&&/* @__PURE__ */x("div",{style:{minHeight:1.5*f.circle+6,display:"flex",alignItems:"flex-end",paddingBottom:6},children:k}),w,!s&&k,s&&y&&/* @__PURE__ */x("div",{style:{marginTop:6},children:k})]}),!u&&/* @__PURE__ */x(Jo,{completed:g,orientation:"horizontal",connectorStyle:d,connectorWidth:f.connectorWidth,primary:p.primary,border:p.border,reducedMotion:h})]}:{role:"listitem",style:{display:"flex",flexDirection:"row",minHeight:0},children:[/* @__PURE__ */b("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginRight:14,flexShrink:0},children:[/* @__PURE__ */x("div",{onClick:v,style:{cursor:i?"pointer":"default"},"aria-current":"active"===c?"step":void 0,children:w}),!u&&/* @__PURE__ */x(Jo,{completed:g,orientation:"vertical",connectorStyle:d,connectorWidth:f.connectorWidth,primary:p.primary,border:p.border,reducedMotion:h})]}),/* @__PURE__ */x("div",{style:{paddingTop:(f.circle-16*parseFloat(f.titleSize))/2,paddingBottom:u?0:16,flex:1,minWidth:0},children:k})]},n.id)})})}function ei(e){let t=0,n=0,r=0;const o=e.replace("#","");3===o.length?(t=parseInt(o[0]+o[0],16),n=parseInt(o[1]+o[1],16),r=parseInt(o[2]+o[2],16)):o.length>=6&&(t=parseInt(o.slice(0,2),16),n=parseInt(o.slice(2,4),16),r=parseInt(o.slice(4,6),16)),t/=255,n/=255,r/=255;const i=Math.max(t,n,r),a=Math.min(t,n,r);let l=0,s=0;const d=(i+a)/2;if(i!==a){const e=i-a;switch(s=d>.5?e/(2-i-a):e/(i+a),i){case t:l=((n-r)/e+(n<r?6:0))/6;break;case n:l=((r-t)/e+2)/6;break;case r:l=((t-n)/e+4)/6}}return[Math.round(360*l),Math.round(100*s),Math.round(100*d)]}function ti(e,t,n){n/=100;const r=(t/=100)*Math.min(n,1-n),o=t=>{const o=(t+e/30)%12,i=n-r*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}function ni(e){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);return[isNaN(n)?0:n,isNaN(r)?0:r,isNaN(o)?0:o]}function ri(e,t,n){return`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}function oi(e){return/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e)}function ii(e,t,n){if("hex"===n)return t<1?`${e}${Math.round(255*t).toString(16).padStart(2,"0")}`:e;const[r,o,i]=ni(e);if("rgb"===n)return t<1?`rgba(${r}, ${o}, ${i}, ${t.toFixed(2)})`:`rgb(${r}, ${o}, ${i})`;const[a,l,s]=ei(e);return"hsl"===n?t<1?`hsla(${a}, ${l}%, ${s}%, ${t.toFixed(2)})`:`hsl(${a}, ${l}%, ${s}%)`:e}Qo.displayName="TkxStepper";var ai=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#ffffff","#94a3b8","#475569","#0f172a"];function li({hue:e,sat:t,bright:n,onChange:r}){const o=f(null),i=f(!1),l=a(e=>{const t=o.current;if(!t)return;const n=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-n.left)/n.width)),a=Math.max(0,Math.min(1,(e.clientY-n.top)/n.height));r(Math.round(100*i),Math.round(100*(1-a)))},[r]);s(()=>{const e=e=>{i.current&&l(e)},t=()=>{i.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[l]);const d=`${t}%`,c=100-n+"%";/* @__PURE__ */
223
246
  return b("div",{ref:o,style:{position:"relative",width:"100%",height:"160px",borderRadius:"6px",cursor:"crosshair",background:`hsl(${e}, 100%, 50%)`,flexShrink:0},onMouseDown:e=>{i.current=!0,l(e)},children:[
224
247
  /* @__PURE__ */x("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to right, #ffffff, transparent)"}}),
225
248
  /* @__PURE__ */x("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to bottom, transparent, #000000)"}}),
226
- /* @__PURE__ */x("div",{style:{position:"absolute",left:d,top:c,transform:"translate(-50%, -50%)",width:"14px",height:"14px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.4)",pointerEvents:"none",backgroundColor:Yo(e,t,n/2+25)}})]})}function ei({hue:e,onChange:t}){const n=f(null),r=f(!1),o=a(e=>{const r=n.current;if(!r)return;const o=r.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-o.left)/o.width));t(Math.round(360*i))},[t]);return s(()=>{const e=e=>{r.current&&o(e)},t=()=>{r.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[o]),/* @__PURE__ */x("div",{ref:n,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:"linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)"},onMouseDown:e=>{r.current=!0,o(e)},children:/* @__PURE__ */x("div",{style:{position:"absolute",left:e/360*100+"%",top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`hsl(${e}, 100%, 50%)`,pointerEvents:"none"}})})}function ti({alpha:e,hex:t,onChange:n}){const r=f(null),o=f(!1),i=a(e=>{const t=r.current;if(!t)return;const o=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-o.left)/o.width));n(Math.round(100*i)/100)},[n]);s(()=>{const e=e=>{o.current&&i(e)},t=()=>{o.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[i]);const[l,d,c]=Xo(t);/* @__PURE__ */
227
- return b("div",{style:{position:"relative"},children:[/* @__PURE__ */x("div",{style:{position:"absolute",inset:0,borderRadius:"6px",backgroundImage:"repeating-conic-gradient(#ccc 0% 25%, white 0% 50%)",backgroundSize:"8px 8px"}}),/* @__PURE__ */x("div",{ref:r,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:`linear-gradient(to right, rgba(${l},${d},${c},0), rgba(${l},${d},${c},1))`},onMouseDown:e=>{o.current=!0,i(e)},children:/* @__PURE__ */x("div",{style:{position:"absolute",left:100*e+"%",top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`rgba(${l},${d},${c},${e})`,pointerEvents:"none"}})})]})}function ni({value:e,defaultValue:t="#3b82f6",onChange:n,format:r="hex",showAlpha:o=!1,presets:i=Jo,disabled:l=!1,size:d="md",placeholder:c,label:u,style:p}){const h=se(),v=f(null),w=f(null),[k,$]=m(!1),S=void 0!==e,[C,z]=m(S&&e||t),M=S?e||t:C,[N,D]=m(1),[P,R]=m(M),[F,I]=m({top:0,left:0}),[A,L,T]=Ko(Go(M)?M:t);Math.round(T+L/100*Math.min(T/100,1-T/100)*100);const W=a((e,t=N)=>{Go(e)&&(R(e),S||z(e),n?.(_o(e,t,r),r))},[N,S,r,n]);s(()=>{S&&e&&Go(e)&&R(e)},[S,e]),s(()=>{if(!k)return;const e=e=>{w.current&&!w.current.contains(e.target)&&v.current&&!v.current.contains(e.target)&&$(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[k]),s(()=>{if(!k)return;const e=e=>{"Escape"===e.key&&$(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[k]);const j=e=>{D(e),n?.(_o(M,e,r),r)},E={sm:28,md:34,lg:40}[d],[B,V,H]=Xo(Go(M)?M:t),O={display:"inline-flex",alignItems:"center",gap:"8px",height:`${E}px`,padding:"4px 10px 4px 6px",borderRadius:"8px",border:`1px solid ${h.border}`,backgroundColor:h.surface,cursor:l?"not-allowed":"pointer",opacity:l?.5:1,color:h.text,fontSize:"13px",fontFamily:"inherit",transition:"border-color 0.15s",...p},q={width:E-8+"px",height:E-8+"px",borderRadius:"4px",backgroundColor:`rgba(${B},${V},${H},${N})`,border:`1px solid ${h.border}`,flexShrink:0},U={position:"absolute",top:F.top,left:F.left,zIndex:9999,width:"260px",backgroundColor:h.surface,border:`1px solid ${h.border}`,borderRadius:"12px",padding:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.24)",display:"flex",flexDirection:"column",gap:"12px"},K={width:"100%",padding:"6px 10px",borderRadius:"6px",border:`1px solid ${h.border}`,backgroundColor:h.bg,color:h.text,fontSize:"12px",fontFamily:"monospace",outline:"none"},Y={flex:1,padding:"5px 6px",borderRadius:"6px",border:`1px solid ${h.border}`,backgroundColor:h.bg,color:h.text,fontSize:"11px",textAlign:"center",fontFamily:"monospace",outline:"none"},X=e=>({width:"20px",height:"20px",borderRadius:"50%",backgroundColor:e,border:e.toLowerCase()===M.toLowerCase()?`2px solid ${h.primary}`:`1px solid ${h.border}`,cursor:"pointer",flexShrink:0,transition:"transform 0.1s"});/* @__PURE__ */
249
+ /* @__PURE__ */x("div",{style:{position:"absolute",left:d,top:c,transform:"translate(-50%, -50%)",width:"14px",height:"14px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.4)",pointerEvents:"none",backgroundColor:ti(e,t,n/2+25)}})]})}function si({hue:e,onChange:t}){const n=f(null),r=f(!1),o=a(e=>{const r=n.current;if(!r)return;const o=r.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-o.left)/o.width));t(Math.round(360*i))},[t]);return s(()=>{const e=e=>{r.current&&o(e)},t=()=>{r.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[o]),/* @__PURE__ */x("div",{ref:n,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:"linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)"},onMouseDown:e=>{r.current=!0,o(e)},children:/* @__PURE__ */x("div",{style:{position:"absolute",left:e/360*100+"%",top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`hsl(${e}, 100%, 50%)`,pointerEvents:"none"}})})}function di({alpha:e,hex:t,onChange:n}){const r=f(null),o=f(!1),i=a(e=>{const t=r.current;if(!t)return;const o=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-o.left)/o.width));n(Math.round(100*i)/100)},[n]);s(()=>{const e=e=>{o.current&&i(e)},t=()=>{o.current=!1};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[i]);const[l,d,c]=ni(t);/* @__PURE__ */
250
+ return b("div",{style:{position:"relative"},children:[/* @__PURE__ */x("div",{style:{position:"absolute",inset:0,borderRadius:"6px",backgroundImage:"repeating-conic-gradient(#ccc 0% 25%, white 0% 50%)",backgroundSize:"8px 8px"}}),/* @__PURE__ */x("div",{ref:r,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:`linear-gradient(to right, rgba(${l},${d},${c},0), rgba(${l},${d},${c},1))`},onMouseDown:e=>{o.current=!0,i(e)},children:/* @__PURE__ */x("div",{style:{position:"absolute",left:100*e+"%",top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`rgba(${l},${d},${c},${e})`,pointerEvents:"none"}})})]})}function ci({value:e,defaultValue:t="#3b82f6",onChange:n,format:r="hex",showAlpha:o=!1,presets:i=ai,disabled:l=!1,size:d="md",placeholder:c,label:u,style:p}){const h=se(),v=f(null),w=f(null),[k,$]=m(!1),S=void 0!==e,[C,z]=m(S&&e||t),M=S?e||t:C,[N,D]=m(1),[R,P]=m(M),[F,I]=m({top:0,left:0}),[A,L,T]=ei(oi(M)?M:t);Math.round(T+L/100*Math.min(T/100,1-T/100)*100);const W=a((e,t=N)=>{oi(e)&&(P(e),S||z(e),n?.(ii(e,t,r),r))},[N,S,r,n]);s(()=>{S&&e&&oi(e)&&P(e)},[S,e]),s(()=>{if(!k)return;const e=e=>{w.current&&!w.current.contains(e.target)&&v.current&&!v.current.contains(e.target)&&$(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[k]),s(()=>{if(!k)return;const e=e=>{"Escape"===e.key&&$(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[k]);const j=e=>{D(e),n?.(ii(M,e,r),r)},E={sm:28,md:34,lg:40}[d],[B,V,H]=ni(oi(M)?M:t),O={display:"inline-flex",alignItems:"center",gap:"8px",height:`${E}px`,padding:"4px 10px 4px 6px",borderRadius:"8px",border:`1px solid ${h.border}`,backgroundColor:h.surface,cursor:l?"not-allowed":"pointer",opacity:l?.5:1,color:h.text,fontSize:"13px",fontFamily:"inherit",transition:"border-color 0.15s",...p},q={width:E-8+"px",height:E-8+"px",borderRadius:"4px",backgroundColor:`rgba(${B},${V},${H},${N})`,border:`1px solid ${h.border}`,flexShrink:0},U={position:"absolute",top:F.top,left:F.left,zIndex:9999,width:"260px",backgroundColor:h.surface,border:`1px solid ${h.border}`,borderRadius:"12px",padding:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.24)",display:"flex",flexDirection:"column",gap:"12px"},K={width:"100%",padding:"6px 10px",borderRadius:"6px",border:`1px solid ${h.border}`,backgroundColor:h.bg,color:h.text,fontSize:"12px",fontFamily:"monospace",outline:"none"},Y={flex:1,padding:"5px 6px",borderRadius:"6px",border:`1px solid ${h.border}`,backgroundColor:h.bg,color:h.text,fontSize:"11px",textAlign:"center",fontFamily:"monospace",outline:"none"},X=e=>({width:"20px",height:"20px",borderRadius:"50%",backgroundColor:e,border:e.toLowerCase()===M.toLowerCase()?`2px solid ${h.primary}`:`1px solid ${h.border}`,cursor:"pointer",flexShrink:0,transition:"transform 0.1s"});/* @__PURE__ */
228
251
  return b(g,{children:[u&&/* @__PURE__ */x("label",{style:{display:"block",fontSize:"13px",color:h.text,marginBottom:"6px",fontWeight:500},children:u}),
229
- /* @__PURE__ */b("button",{ref:v,type:"button",style:O,onClick:()=>{if(l)return;const e=v.current;if(!e)return;const t=e.getBoundingClientRect();I({top:(window.innerHeight-t.bottom>320?t.bottom+6:t.top-326)+window.scrollY,left:t.left+window.scrollX}),$(!0)},disabled:l,"aria-label":`Color picker, current color ${M}`,"aria-haspopup":"dialog","aria-expanded":k,children:[/* @__PURE__ */x("div",{style:q}),/* @__PURE__ */x("span",{style:{fontFamily:"monospace",fontSize:"12px",color:h.textMuted},children:c??_o(Go(M)?M:t,N,r)})]}),k&&y(/* @__PURE__ */b("div",{ref:w,style:U,role:"dialog","aria-label":"Color picker",children:[
230
- /* @__PURE__ */x(Qo,{hue:A,sat:L,bright:T,onChange:(e,t)=>{const n=t/100,r=n*(1-e/100/2),o=0===r||1===r?0:(n-r)/Math.min(r,1-r);W(Yo(A,Math.round(100*o),Math.round(100*r)))}}),
231
- /* @__PURE__ */x(ei,{hue:A,onChange:e=>{W(Yo(e,L,T))}}),o&&/* @__PURE__ */x(ti,{alpha:N,hex:Go(M)?M:t,onChange:j}),
232
- /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[/* @__PURE__ */x("div",{style:{width:"28px",height:"28px",borderRadius:"6px",flexShrink:0,backgroundColor:`rgba(${B},${V},${H},${N})`,border:`1px solid ${h.border}`}}),/* @__PURE__ */x("input",{style:K,value:P,onChange:e=>{const t=e.target.value;R(t),Go(t)&&W(t)},maxLength:7,spellCheck:!1,"aria-label":"Hex color value"})]}),
233
- /* @__PURE__ */b("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[["r","g","b"].map(e=>/* @__PURE__ */b("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[/* @__PURE__ */x("input",{style:Y,type:"number",min:0,max:255,value:"r"===e?B:"g"===e?V:H,onChange:t=>((e,t)=>{const n=Math.max(0,Math.min(255,parseInt(t)||0)),[r,o,i]=Xo(M);W("r"===e?Zo(n,o,i):"g"===e?Zo(r,n,i):Zo(r,o,n))})(e,t.target.value),"aria-label":`${e.toUpperCase()} channel`}),/* @__PURE__ */x("span",{style:{fontSize:"10px",color:h.textMuted,textTransform:"uppercase"},children:e})]},e)),o&&/* @__PURE__ */b("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[/* @__PURE__ */x("input",{style:Y,type:"number",min:0,max:100,value:Math.round(100*N),onChange:e=>j(Math.max(0,Math.min(1,parseInt(e.target.value)/100||0))),"aria-label":"Alpha channel"}),/* @__PURE__ */x("span",{style:{fontSize:"10px",color:h.textMuted},children:"A%"})]})]}),i.length>0&&/* @__PURE__ */b("div",{children:[/* @__PURE__ */x("div",{style:{fontSize:"11px",color:h.textMuted,marginBottom:"6px",fontWeight:500},children:"Presets"}),/* @__PURE__ */x("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:i.map(e=>/* @__PURE__ */x("button",{type:"button",style:X(e),onClick:()=>W(e),"aria-label":`Select color ${e}`,onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.15)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"}},e))})]})]}),document.body)]})}var ri={sm:{height:"32px",fontSize:"0.8125rem",px:"8px",btnW:"28px",iconSz:14},md:{height:"40px",fontSize:"0.875rem",px:"12px",btnW:"34px",iconSz:16},lg:{height:"48px",fontSize:"1rem",px:"14px",btnW:"40px",iconSz:18}};function oi(e,t,n){let r=e;return void 0!==t&&(r=Math.max(r,t)),void 0!==n&&(r=Math.min(r,n)),r}function ii(e,t){if(void 0===t)return e;const n=Math.pow(10,t);return Math.round(e*n)/n}function ai({direction:e,isDisabled:t,btnW:n,height:r,primaryColor:o,borderColor:i,textMuted:l,iconSz:d,onStep:c,incrementLabel:u,decrementLabel:p}){const h=f(null),m=f(null),g="inc"===e?1:-1,y=a(()=>{c(g),h.current=setTimeout(()=>{m.current=setInterval(()=>c(g),60)},400)},[g,c]),v=a(()=>{h.current&&(clearTimeout(h.current),h.current=null),m.current&&(clearInterval(m.current),m.current=null)},[]);s(()=>()=>v(),[v]);const w="inc"===e;/* @__PURE__ */
234
- return x("button",{type:"button","aria-label":w?u:p,disabled:t,onMouseDown:y,onMouseUp:v,onMouseLeave:v,onTouchStart:e=>{e.preventDefault(),y()},onTouchEnd:v,style:{width:n,height:r,minWidth:n,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",borderRight:w?void 0:`1px solid ${i}`,borderLeft:w?`1px solid ${i}`:void 0,cursor:t?"not-allowed":"pointer",color:t?l:o,transition:"color 120ms ease, background 120ms ease",outline:"none"},onFocus:e=>{t||(e.currentTarget.style.background=`${o}12`)},onBlur:e=>{e.currentTarget.style.background="transparent"},children:w?/* @__PURE__ */b("svg",{width:d,height:d,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[/* @__PURE__ */x("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),/* @__PURE__ */x("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):/* @__PURE__ */x("svg",{width:d,height:d,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:/* @__PURE__ */x("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})}function li({value:e,defaultValue:t=0,onChange:n,min:r,max:o,step:i=1,precision:l,prefix:s,suffix:c,format:u,currency:p,locale:h,clampOnBlur:f=!0,allowMouseWheel:g=!1,size:y="md",label:v,hint:w,isDisabled:k=!1,isReadOnly:$=!1,isInvalid:S=!1,errorMessage:C,id:z,className:M,style:N}){const D=se(),P=yn(),R=P.increment??"Increment",F=P.decrement??"Decrement",I=d(),A=z??I,L=`${A}-hint`,T=`${A}-error`,W=void 0!==e,[j,E]=m(t),B=W?e:j,[V,H]=m(!1),[O,q]=m(""),U=ri[y],K=S||!!C,Y=K?D.danger:V?D.primary:D.border,X=[w&&L,K&&T].filter(Boolean).join(" ")||void 0,Z=v?ke(v):void 0,G=w?ke(w):void 0,_=C?ke(C):void 0,J=s?ke(s):void 0,Q=c?ke(c):void 0,ee=a(e=>{const t=ii(e,l);W||E(t),n?.(t)},[W,n,l]),te=a(e=>{k||$||ee(oi(ii(B+e*i,l),r,o))},[k,$,B,i,l,r,o,ee]),ne=V?O:function(e,t,n,r,o){const i=r??"en-US";return"currency"===t?new Intl.NumberFormat(i,{style:"currency",currency:n??"USD",minimumFractionDigits:o??2,maximumFractionDigits:o??2}).format(e):"percent"===t?new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:o??0,maximumFractionDigits:o??0}).format(e/100):"decimal"===t||void 0!==o?new Intl.NumberFormat(i,{minimumFractionDigits:o??0,maximumFractionDigits:o??20}).format(e):String(e)}(B,u,p,h,l),re=(J||Q)&&!V;/* @__PURE__ */
252
+ /* @__PURE__ */b("button",{ref:v,type:"button",style:O,onClick:()=>{if(l)return;const e=v.current;if(!e)return;const t=e.getBoundingClientRect();I({top:(window.innerHeight-t.bottom>320?t.bottom+6:t.top-326)+window.scrollY,left:t.left+window.scrollX}),$(!0)},disabled:l,"aria-label":`Color picker, current color ${M}`,"aria-haspopup":"dialog","aria-expanded":k,children:[/* @__PURE__ */x("div",{style:q}),/* @__PURE__ */x("span",{style:{fontFamily:"monospace",fontSize:"12px",color:h.textMuted},children:c??ii(oi(M)?M:t,N,r)})]}),k&&y(/* @__PURE__ */b("div",{ref:w,style:U,role:"dialog","aria-label":"Color picker",children:[
253
+ /* @__PURE__ */x(li,{hue:A,sat:L,bright:T,onChange:(e,t)=>{const n=t/100,r=n*(1-e/100/2),o=0===r||1===r?0:(n-r)/Math.min(r,1-r);W(ti(A,Math.round(100*o),Math.round(100*r)))}}),
254
+ /* @__PURE__ */x(si,{hue:A,onChange:e=>{W(ti(e,L,T))}}),o&&/* @__PURE__ */x(di,{alpha:N,hex:oi(M)?M:t,onChange:j}),
255
+ /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[/* @__PURE__ */x("div",{style:{width:"28px",height:"28px",borderRadius:"6px",flexShrink:0,backgroundColor:`rgba(${B},${V},${H},${N})`,border:`1px solid ${h.border}`}}),/* @__PURE__ */x("input",{style:K,value:R,onChange:e=>{const t=e.target.value;P(t),oi(t)&&W(t)},maxLength:7,spellCheck:!1,"aria-label":"Hex color value"})]}),
256
+ /* @__PURE__ */b("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[["r","g","b"].map(e=>/* @__PURE__ */b("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[/* @__PURE__ */x("input",{style:Y,type:"number",min:0,max:255,value:"r"===e?B:"g"===e?V:H,onChange:t=>((e,t)=>{const n=Math.max(0,Math.min(255,parseInt(t)||0)),[r,o,i]=ni(M);W("r"===e?ri(n,o,i):"g"===e?ri(r,n,i):ri(r,o,n))})(e,t.target.value),"aria-label":`${e.toUpperCase()} channel`}),/* @__PURE__ */x("span",{style:{fontSize:"10px",color:h.textMuted,textTransform:"uppercase"},children:e})]},e)),o&&/* @__PURE__ */b("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[/* @__PURE__ */x("input",{style:Y,type:"number",min:0,max:100,value:Math.round(100*N),onChange:e=>j(Math.max(0,Math.min(1,parseInt(e.target.value)/100||0))),"aria-label":"Alpha channel"}),/* @__PURE__ */x("span",{style:{fontSize:"10px",color:h.textMuted},children:"A%"})]})]}),i.length>0&&/* @__PURE__ */b("div",{children:[/* @__PURE__ */x("div",{style:{fontSize:"11px",color:h.textMuted,marginBottom:"6px",fontWeight:500},children:"Presets"}),/* @__PURE__ */x("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:i.map(e=>/* @__PURE__ */x("button",{type:"button",style:X(e),onClick:()=>W(e),"aria-label":`Select color ${e}`,onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.15)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"}},e))})]})]}),document.body)]})}var ui={sm:{height:"32px",fontSize:"0.8125rem",px:"8px",btnW:"28px",iconSz:14},md:{height:"40px",fontSize:"0.875rem",px:"12px",btnW:"34px",iconSz:16},lg:{height:"48px",fontSize:"1rem",px:"14px",btnW:"40px",iconSz:18}};function pi(e,t,n){let r=e;return void 0!==t&&(r=Math.max(r,t)),void 0!==n&&(r=Math.min(r,n)),r}function hi(e,t){if(void 0===t)return e;const n=Math.pow(10,t);return Math.round(e*n)/n}function fi({direction:e,isDisabled:t,btnW:n,height:r,primaryColor:o,borderColor:i,textMuted:l,iconSz:d,onStep:c,incrementLabel:u,decrementLabel:p}){const h=f(null),m=f(null),g="inc"===e?1:-1,y=a(()=>{c(g),h.current=setTimeout(()=>{m.current=setInterval(()=>c(g),60)},400)},[g,c]),v=a(()=>{h.current&&(clearTimeout(h.current),h.current=null),m.current&&(clearInterval(m.current),m.current=null)},[]);s(()=>()=>v(),[v]);const w="inc"===e;/* @__PURE__ */
257
+ return x("button",{type:"button","aria-label":w?u:p,disabled:t,onMouseDown:y,onMouseUp:v,onMouseLeave:v,onTouchStart:e=>{e.preventDefault(),y()},onTouchEnd:v,style:{width:n,height:r,minWidth:n,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",borderRight:w?void 0:`1px solid ${i}`,borderLeft:w?`1px solid ${i}`:void 0,cursor:t?"not-allowed":"pointer",color:t?l:o,transition:"color 120ms ease, background 120ms ease",outline:"none"},onFocus:e=>{t||(e.currentTarget.style.background=`${o}12`)},onBlur:e=>{e.currentTarget.style.background="transparent"},children:w?/* @__PURE__ */b("svg",{width:d,height:d,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[/* @__PURE__ */x("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),/* @__PURE__ */x("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):/* @__PURE__ */x("svg",{width:d,height:d,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:/* @__PURE__ */x("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})}function mi({value:e,defaultValue:t=0,onChange:n,min:r,max:o,step:i=1,precision:l,prefix:s,suffix:c,format:u,currency:p,locale:h,clampOnBlur:f=!0,allowMouseWheel:g=!1,size:y="md",label:v,hint:w,isDisabled:k=!1,isReadOnly:$=!1,isInvalid:S=!1,errorMessage:C,id:z,className:M,style:N}){const D=se(),R=yn(),P=R.increment??"Increment",F=R.decrement??"Decrement",I=d(),A=z??I,L=`${A}-hint`,T=`${A}-error`,W=void 0!==e,[j,E]=m(t),B=W?e:j,[V,H]=m(!1),[O,q]=m(""),U=ui[y],K=S||!!C,Y=K?D.danger:V?D.primary:D.border,X=[w&&L,K&&T].filter(Boolean).join(" ")||void 0,Z=v?ke(v):void 0,G=w?ke(w):void 0,_=C?ke(C):void 0,J=s?ke(s):void 0,Q=c?ke(c):void 0,ee=a(e=>{const t=hi(e,l);W||E(t),n?.(t)},[W,n,l]),te=a(e=>{k||$||ee(pi(hi(B+e*i,l),r,o))},[k,$,B,i,l,r,o,ee]),ne=V?O:function(e,t,n,r,o){const i=r??"en-US";return"currency"===t?new Intl.NumberFormat(i,{style:"currency",currency:n??"USD",minimumFractionDigits:o??2,maximumFractionDigits:o??2}).format(e):"percent"===t?new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:o??0,maximumFractionDigits:o??0}).format(e/100):"decimal"===t||void 0!==o?new Intl.NumberFormat(i,{minimumFractionDigits:o??0,maximumFractionDigits:o??20}).format(e):String(e)}(B,u,p,h,l),re=(J||Q)&&!V;/* @__PURE__ */
235
258
  return b("div",{className:jt(At("flex flex-col gap-1 w-full"),M),style:N,children:[Z&&/* @__PURE__ */x("label",{htmlFor:A,className:At("text-sm font-medium font-sans"),style:{color:D.text},children:Z}),
236
259
  /* @__PURE__ */b("div",{className:At("flex items-stretch overflow-hidden rounded-lg transition-colors duration-150"),style:{border:`1.5px solid ${Y}`,backgroundColor:k?D.surfaceAlt:D.surface,opacity:k?.65:1,height:U.height},children:[
237
- /* @__PURE__ */x(ai,{direction:"dec",isDisabled:k||$,btnW:U.btnW,height:U.height,primaryColor:D.primary,borderColor:D.border,textMuted:D.textMuted,iconSz:U.iconSz,onStep:te,incrementLabel:R,decrementLabel:F}),
260
+ /* @__PURE__ */x(fi,{direction:"dec",isDisabled:k||$,btnW:U.btnW,height:U.height,primaryColor:D.primary,borderColor:D.border,textMuted:D.textMuted,iconSz:U.iconSz,onStep:te,incrementLabel:P,decrementLabel:F}),
238
261
  /* @__PURE__ */b("div",{className:At("relative flex-1 flex items-center overflow-hidden"),children:[re&&J&&/* @__PURE__ */x("span",{style:{position:"absolute",left:U.px,fontSize:U.fontSize,color:D.textMuted,pointerEvents:"none",userSelect:"none"},children:J}),
239
- /* @__PURE__ */x("input",{id:A,type:"text",inputMode:"decimal",value:V?O:ne,readOnly:$,disabled:k,"aria-invalid":K,"aria-describedby":X,"aria-valuemin":r,"aria-valuemax":o,"aria-valuenow":B,style:{width:"100%",height:"100%",border:"none",background:"transparent",outline:"none",textAlign:"center",fontSize:U.fontSize,fontFamily:"inherit",color:D.text,paddingLeft:re&&J?`calc(${U.px} + 1.2em)`:U.px,paddingRight:re&&Q?`calc(${U.px} + 1.2em)`:U.px,cursor:k?"not-allowed":$?"default":"text"},onFocus:()=>{H(!0),q(String(B))},onBlur:()=>{H(!1);const e=parseFloat(O);if(isNaN(e))return n?.(null),void q(String(B));let t=ii(e,l);f&&(t=oi(t,r,o)),ee(t)},onChange:e=>{q(He(e.target.value))},onKeyDown:e=>{"ArrowUp"===e.key&&(e.preventDefault(),te(1)),"ArrowDown"===e.key&&(e.preventDefault(),te(-1))},onWheel:e=>{g&&V&&(e.preventDefault(),te(e.deltaY<0?1:-1))}}),re&&Q&&/* @__PURE__ */x("span",{style:{position:"absolute",right:U.px,fontSize:U.fontSize,color:D.textMuted,pointerEvents:"none",userSelect:"none"},children:Q})]}),
240
- /* @__PURE__ */x(ai,{direction:"inc",isDisabled:k||$,btnW:U.btnW,height:U.height,primaryColor:D.primary,borderColor:D.border,textMuted:D.textMuted,iconSz:U.iconSz,onStep:te,incrementLabel:R,decrementLabel:F})]}),G&&!_&&/* @__PURE__ */x("span",{id:L,className:At("text-xs"),style:{color:D.textMuted},children:G}),_&&/* @__PURE__ */b("span",{id:T,role:"alert",className:At("text-xs flex items-center gap-1"),style:{color:D.danger},children:[/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),_]})]})}li.displayName="TkxNumberInput";var si={sm:{box:"36px",fontSize:"1rem",gap:"6px"},md:{box:"44px",fontSize:"1.25rem",gap:"8px"},lg:{box:"52px",fontSize:"1.5rem",gap:"10px"}},di={number:/^\d$/,alphanumeric:/^[a-zA-Z0-9]$/,alpha:/^[a-zA-Z]$/};function ci(e,t){return di[t].test(e)?e.toUpperCase():""}function ui({length:e=6,value:t,onChange:n,onComplete:r,type:o="number",mask:i=!1,autoFocus:l=!1,isDisabled:c=!1,isInvalid:u=!1,errorMessage:p,hint:h,size:g="md",separator:y,separatorPosition:v,webOTP:w=!0,className:k,style:$}){const S=se(),C=yn(),z=d(),M=`${z}-hint`,N=`${z}-error`,D=void 0!==t,P=t=>{const n=t.split("").slice(0,e);for(;n.length<e;)n.push("");return n},[R,F]=m(()=>P(D?t:"")),I=D?P(t):R,A=f([]),L=si[g],T=u||!!p,W=I.every(e=>""!==e),j=h?ke(h):void 0,E=p?ke(p):void 0,B=e=>T?S.danger:W?S.success:S.border;s(()=>{l&&A.current[0]?.focus()},[]);const V=a(e=>{D||F(e);const t=e.join("");n?.(t),e.every(e=>""!==e)&&r?.(t)},[D,n,r]);s(()=>{if(!w||c)return;if("undefined"==typeof window||!("OTPCredential"in window))return;const t=new AbortController;return navigator.credentials?.get({otp:{transport:["sms"]},signal:t.signal}).then(t=>{if(!t?.code)return;const n=String(t.code).slice(0,e).split("").map(e=>ci(e,o));for(;n.length<e;)n.push("");V(n)}).catch(()=>{}),()=>t.abort()},[w,c,e,o]);const H=t=>{const n=Math.max(0,Math.min(e-1,t));A.current[n]?.focus()},O=t=>n=>{if(!c){if("Backspace"!==n.key){if("Delete"===n.key){n.preventDefault();const e=[...I];return e[t]="",void V(e)}return"ArrowLeft"===n.key?(n.preventDefault(),void H(t-1)):"ArrowRight"===n.key?(n.preventDefault(),void H(t+1)):"Home"===n.key?(n.preventDefault(),void H(0)):"End"===n.key?(n.preventDefault(),void H(e-1)):void 0}if(n.preventDefault(),""!==I[t]){const e=[...I];e[t]="",V(e)}else if(t>0){const e=[...I];e[t-1]="",V(e),H(t-1)}}},q=t=>n=>{if(c)return;const r=He(n.target.value).slice(-1);if(!r)return;const i=ci(r,o);if(!i)return;const a=[...I];a[t]=i,V(a),t<e-1&&H(t+1)},U=t=>n=>{if(n.preventDefault(),c)return;const r=He(n.clipboardData.getData("text")).split("").map(e=>ci(e,o)).filter(Boolean);if(!r.length)return;const i=[...I];let a=t;for(const t of r){if(a>=e)break;i[a]=t,a++}V(i),H(Math.min(a,e-1))},K=[j&&M,T&&N].filter(Boolean).join(" ")||void 0;/* @__PURE__ */
262
+ /* @__PURE__ */x("input",{id:A,type:"text",inputMode:"decimal",value:V?O:ne,readOnly:$,disabled:k,"aria-invalid":K,"aria-describedby":X,"aria-valuemin":r,"aria-valuemax":o,"aria-valuenow":B,style:{width:"100%",height:"100%",border:"none",background:"transparent",outline:"none",textAlign:"center",fontSize:U.fontSize,fontFamily:"inherit",color:D.text,paddingLeft:re&&J?`calc(${U.px} + 1.2em)`:U.px,paddingRight:re&&Q?`calc(${U.px} + 1.2em)`:U.px,cursor:k?"not-allowed":$?"default":"text"},onFocus:()=>{H(!0),q(String(B))},onBlur:()=>{H(!1);const e=parseFloat(O);if(isNaN(e))return n?.(null),void q(String(B));let t=hi(e,l);f&&(t=pi(t,r,o)),ee(t)},onChange:e=>{q(He(e.target.value))},onKeyDown:e=>{"ArrowUp"===e.key&&(e.preventDefault(),te(1)),"ArrowDown"===e.key&&(e.preventDefault(),te(-1))},onWheel:e=>{g&&V&&(e.preventDefault(),te(e.deltaY<0?1:-1))}}),re&&Q&&/* @__PURE__ */x("span",{style:{position:"absolute",right:U.px,fontSize:U.fontSize,color:D.textMuted,pointerEvents:"none",userSelect:"none"},children:Q})]}),
263
+ /* @__PURE__ */x(fi,{direction:"inc",isDisabled:k||$,btnW:U.btnW,height:U.height,primaryColor:D.primary,borderColor:D.border,textMuted:D.textMuted,iconSz:U.iconSz,onStep:te,incrementLabel:P,decrementLabel:F})]}),G&&!_&&/* @__PURE__ */x("span",{id:L,className:At("text-xs"),style:{color:D.textMuted},children:G}),_&&/* @__PURE__ */b("span",{id:T,role:"alert",className:At("text-xs flex items-center gap-1"),style:{color:D.danger},children:[/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),_]})]})}mi.displayName="TkxNumberInput";var gi={sm:{box:"36px",fontSize:"1rem",gap:"6px"},md:{box:"44px",fontSize:"1.25rem",gap:"8px"},lg:{box:"52px",fontSize:"1.5rem",gap:"10px"}},xi={number:/^\d$/,alphanumeric:/^[a-zA-Z0-9]$/,alpha:/^[a-zA-Z]$/};function bi(e,t){return xi[t].test(e)?e.toUpperCase():""}function yi({length:e=6,value:t,onChange:n,onComplete:r,type:o="number",mask:i=!1,autoFocus:l=!1,isDisabled:c=!1,isInvalid:u=!1,errorMessage:p,hint:h,size:g="md",separator:y,separatorPosition:v,webOTP:w=!0,className:k,style:$}){const S=se(),C=yn(),z=d(),M=`${z}-hint`,N=`${z}-error`,D=void 0!==t,R=t=>{const n=t.split("").slice(0,e);for(;n.length<e;)n.push("");return n},[P,F]=m(()=>R(D?t:"")),I=D?R(t):P,A=f([]),L=gi[g],T=u||!!p,W=I.every(e=>""!==e),j=h?ke(h):void 0,E=p?ke(p):void 0,B=e=>T?S.danger:W?S.success:S.border;s(()=>{l&&A.current[0]?.focus()},[]);const V=a(e=>{D||F(e);const t=e.join("");n?.(t),e.every(e=>""!==e)&&r?.(t)},[D,n,r]);s(()=>{if(!w||c)return;if("undefined"==typeof window||!("OTPCredential"in window))return;const t=new AbortController;return navigator.credentials?.get({otp:{transport:["sms"]},signal:t.signal}).then(t=>{if(!t?.code)return;const n=String(t.code).slice(0,e).split("").map(e=>bi(e,o));for(;n.length<e;)n.push("");V(n)}).catch(()=>{}),()=>t.abort()},[w,c,e,o]);const H=t=>{const n=Math.max(0,Math.min(e-1,t));A.current[n]?.focus()},O=t=>n=>{if(!c){if("Backspace"!==n.key){if("Delete"===n.key){n.preventDefault();const e=[...I];return e[t]="",void V(e)}return"ArrowLeft"===n.key?(n.preventDefault(),void H(t-1)):"ArrowRight"===n.key?(n.preventDefault(),void H(t+1)):"Home"===n.key?(n.preventDefault(),void H(0)):"End"===n.key?(n.preventDefault(),void H(e-1)):void 0}if(n.preventDefault(),""!==I[t]){const e=[...I];e[t]="",V(e)}else if(t>0){const e=[...I];e[t-1]="",V(e),H(t-1)}}},q=t=>n=>{if(c)return;const r=He(n.target.value).slice(-1);if(!r)return;const i=bi(r,o);if(!i)return;const a=[...I];a[t]=i,V(a),t<e-1&&H(t+1)},U=t=>n=>{if(n.preventDefault(),c)return;const r=He(n.clipboardData.getData("text")).split("").map(e=>bi(e,o)).filter(Boolean);if(!r.length)return;const i=[...I];let a=t;for(const t of r){if(a>=e)break;i[a]=t,a++}V(i),H(Math.min(a,e-1))},K=[j&&M,T&&N].filter(Boolean).join(" ")||void 0;/* @__PURE__ */
241
264
  return b("div",{className:jt(At("flex flex-col gap-2 w-fit"),k),style:$,children:[
242
- /* @__PURE__ */x("div",{role:"group","aria-label":C.oneTimePassword??"One-time password","aria-describedby":K,className:At("flex items-center"),style:{gap:L.gap},children:Array.from({length:e},(t,n)=>{const r=B();return"undefined"!=typeof document&&(document.activeElement,A.current[n]/* @__PURE__ */),b("div",{className:At("flex items-center"),style:{gap:L.gap},children:[y&&v===n&&0!==n&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{color:S.textMuted,userSelect:"none",flexShrink:0},children:y}),/* @__PURE__ */x("input",{ref:e=>{A.current[n]=e},type:i?"password":"text",inputMode:"number"===o?"numeric":"text",maxLength:1,value:I[n],disabled:c,"aria-label":`Digit ${n+1} of ${e}`,autoComplete:"one-time-code",spellCheck:!1,onChange:q(n),onKeyDown:O(n),onPaste:U(n),onFocus:e=>e.target.select(),style:{width:L.box,height:L.box,textAlign:"center",fontSize:L.fontSize,fontFamily:"monospace",fontWeight:600,border:`1.5px solid ${r}`,borderRadius:"8px",backgroundColor:c?S.surfaceAlt:S.surface,color:S.text,outline:"none",boxShadow:"none",cursor:c?"not-allowed":"text",transition:"border-color 150ms ease, box-shadow 150ms ease",opacity:c?.6:1},onFocusCapture:e=>{c||(e.currentTarget.style.borderColor=T?S.danger:S.primary,e.currentTarget.style.boxShadow=`0 0 0 3px ${T?S.danger:S.primary}33`)},onBlurCapture:e=>{e.currentTarget.style.borderColor=B(),e.currentTarget.style.boxShadow="none"}})]},n)})}),j&&!E&&/* @__PURE__ */x("span",{id:M,className:At("text-xs"),style:{color:S.textMuted},children:j}),E&&/* @__PURE__ */b("span",{id:N,role:"alert",className:At("text-xs flex items-center gap-1"),style:{color:S.danger},children:[/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),E]})]})}function pi(){const[e,t]=m(!1);return{isOpen:e,open:a(()=>t(!0),[]),close:a(()=>t(!1),[]),toggle:a(()=>t(e=>!e),[])}}function hi(e,t){if(!e)return{matched:!0,ranges:[],score:0};const n=e.toLowerCase(),r=t.toLowerCase(),o=r.indexOf(n);if(-1!==o)return{matched:!0,ranges:[[o,o+n.length-1]],score:0===o?100:80};const i=[];let a=0,l=-1,s=-1;for(let d=0;d<r.length&&a<n.length;d++)r[d]===n[a]&&(-1!==s&&d===s+1||(-1!==l&&i.push([l,s]),l=d),s=d,a++);return-1!==l&&-1!==s&&i.push([l,s]),a<n.length?{matched:!1,ranges:[],score:0}:{matched:!0,ranges:i,score:40}}function fi({text:e,ranges:t,color:n}){if(!t.length)/* @__PURE__ */return x(g,{children:e});const r=[];let o=0;for(const[i,a]of t)o<i&&r.push(/* @__PURE__ */x("span",{children:e.slice(o,i)},`t-${o}`)),r.push(/* @__PURE__ */x("span",{style:{color:n,fontWeight:700},children:e.slice(i,a+1)},`h-${i}`)),o=a+1;return o<e.length&&r.push(/* @__PURE__ */x("span",{children:e.slice(o)},"t-end")),/* @__PURE__ */x(g,{children:r})}function mi({surface:e,border:t}){/* @__PURE__ */
243
- return b("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:8,overflow:"hidden"},children:[/* @__PURE__ */x("div",{style:{width:24,height:24,borderRadius:6,background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite",flexShrink:0}}),/* @__PURE__ */b("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:5},children:[/* @__PURE__ */x("div",{style:{height:13,borderRadius:4,width:"60%",background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite"}}),/* @__PURE__ */x("div",{style:{height:10,borderRadius:4,width:"40%",background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out 0.2s infinite"}})]})]})}function gi({items:e,isOpen:t=!1,onClose:n,placeholder:r,emptyMessage:o,maxItems:i=8,onItemSelect:l,className:c,style:u}){const p=se(),h=yn(),g=r??h.commandSearch??"Type a command or search…",[v,w]=m(""),[k,$]=m(0),[S,C]=m(!1),z=f(null),M=f(null),N=d(),D=function(e){const t=f(null);return s(()=>{if(!e||!t.current)return;const n=t.current,r=n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),o=r[0],i=r[r.length-1],a=e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===o&&(e.preventDefault(),i?.focus()):document.activeElement===i&&(e.preventDefault(),o?.focus()))};return n.addEventListener("keydown",a),()=>n.removeEventListener("keydown",a)},[e]),t}(t),P=function(e,t){if(!e.trim())return t.filter(e=>!e.disabled).map(e=>({item:e,score:0,labelRanges:[]}));const n=[];for(const r of t){if(r.disabled)continue;const t=hi(e,r.label),o=r.description?hi(e,r.description):{matched:!1,score:0},i=(r.keywords??[]).some(t=>hi(e,t).matched);t.matched?n.push({item:r,score:t.score+20,labelRanges:t.ranges}):o.matched?n.push({item:r,score:o.score,labelRanges:[]}):i&&n.push({item:r,score:20,labelRanges:[]})}return n.sort((e,t)=>t.score-e.score)}(v,e).slice(0,i),R=[];for(const a of P){const e=a.item.group,t=R.find(t=>t.group===e);t?t.items.push(a):R.push({group:e,items:[a]})}const F=R.flatMap(e=>e.items);var I,A;s(()=>{if(!A)return;const e=e=>{"Escape"===e.key&&I()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[I=()=>{n?.()},A=t]),s(()=>{t&&(w(""),$(0),setTimeout(()=>z.current?.focus(),30))},[t]),s(()=>{k>=F.length&&$(Math.max(0,F.length-1))},[F.length,k]);const L=a(e=>{const t=M.current;t&&t.querySelectorAll("[data-command-item]")[e]?.scrollIntoView({block:"nearest"})},[]),T=e=>{e.disabled||(e.onSelect?.(),l?.(e),n?.())};if(!t||"undefined"==typeof document)return null;const W=ke(g),j=h.noCommandsFound??`No results for "${ke(v)}"`,E=o?ke(o):j;if("undefined"!=typeof document&&!document.getElementById("tkx-shimmer-style")){const e=document.createElement("style");e.id="tkx-shimmer-style",e.textContent="@keyframes tkx-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }",document.head.appendChild(e)}return y(/* @__PURE__ */b("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:1e4,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",paddingLeft:16,paddingRight:16},children:[/* @__PURE__ */x("div",{"aria-hidden":"true",onClick:n,style:{position:"absolute",inset:0,backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",animation:"tkx-fade-in 120ms ease"}}),/* @__PURE__ */b("div",{ref:D,role:"dialog","aria-modal":"true","aria-label":"Command palette",id:N,className:jt(c),style:{position:"relative",zIndex:1,width:"100%",maxWidth:560,backgroundColor:p.surface,border:`1px solid ${p.border}`,borderRadius:16,boxShadow:`0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px ${p.border}`,overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"70vh",...u},children:[
265
+ /* @__PURE__ */x("div",{role:"group","aria-label":C.oneTimePassword??"One-time password","aria-describedby":K,className:At("flex items-center"),style:{gap:L.gap},children:Array.from({length:e},(t,n)=>{const r=B();return"undefined"!=typeof document&&(document.activeElement,A.current[n]/* @__PURE__ */),b("div",{className:At("flex items-center"),style:{gap:L.gap},children:[y&&v===n&&0!==n&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{color:S.textMuted,userSelect:"none",flexShrink:0},children:y}),/* @__PURE__ */x("input",{ref:e=>{A.current[n]=e},type:i?"password":"text",inputMode:"number"===o?"numeric":"text",maxLength:1,value:I[n],disabled:c,"aria-label":`Digit ${n+1} of ${e}`,autoComplete:"one-time-code",spellCheck:!1,onChange:q(n),onKeyDown:O(n),onPaste:U(n),onFocus:e=>e.target.select(),style:{width:L.box,height:L.box,textAlign:"center",fontSize:L.fontSize,fontFamily:"monospace",fontWeight:600,border:`1.5px solid ${r}`,borderRadius:"8px",backgroundColor:c?S.surfaceAlt:S.surface,color:S.text,outline:"none",boxShadow:"none",cursor:c?"not-allowed":"text",transition:"border-color 150ms ease, box-shadow 150ms ease",opacity:c?.6:1},onFocusCapture:e=>{c||(e.currentTarget.style.borderColor=T?S.danger:S.primary,e.currentTarget.style.boxShadow=`0 0 0 3px ${T?S.danger:S.primary}33`)},onBlurCapture:e=>{e.currentTarget.style.borderColor=B(),e.currentTarget.style.boxShadow="none"}})]},n)})}),j&&!E&&/* @__PURE__ */x("span",{id:M,className:At("text-xs"),style:{color:S.textMuted},children:j}),E&&/* @__PURE__ */b("span",{id:N,role:"alert",className:At("text-xs flex items-center gap-1"),style:{color:S.danger},children:[/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),E]})]})}function vi(){const[e,t]=m(!1);return{isOpen:e,open:a(()=>t(!0),[]),close:a(()=>t(!1),[]),toggle:a(()=>t(e=>!e),[])}}function wi(e,t){if(!e)return{matched:!0,ranges:[],score:0};const n=e.toLowerCase(),r=t.toLowerCase(),o=r.indexOf(n);if(-1!==o)return{matched:!0,ranges:[[o,o+n.length-1]],score:0===o?100:80};const i=[];let a=0,l=-1,s=-1;for(let d=0;d<r.length&&a<n.length;d++)r[d]===n[a]&&(-1!==s&&d===s+1||(-1!==l&&i.push([l,s]),l=d),s=d,a++);return-1!==l&&-1!==s&&i.push([l,s]),a<n.length?{matched:!1,ranges:[],score:0}:{matched:!0,ranges:i,score:40}}function ki({text:e,ranges:t,color:n}){if(!t.length)/* @__PURE__ */return x(g,{children:e});const r=[];let o=0;for(const[i,a]of t)o<i&&r.push(/* @__PURE__ */x("span",{children:e.slice(o,i)},`t-${o}`)),r.push(/* @__PURE__ */x("span",{style:{color:n,fontWeight:700},children:e.slice(i,a+1)},`h-${i}`)),o=a+1;return o<e.length&&r.push(/* @__PURE__ */x("span",{children:e.slice(o)},"t-end")),/* @__PURE__ */x(g,{children:r})}function $i({surface:e,border:t}){/* @__PURE__ */
266
+ return b("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:8,overflow:"hidden"},children:[/* @__PURE__ */x("div",{style:{width:24,height:24,borderRadius:6,background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite",flexShrink:0}}),/* @__PURE__ */b("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:5},children:[/* @__PURE__ */x("div",{style:{height:13,borderRadius:4,width:"60%",background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite"}}),/* @__PURE__ */x("div",{style:{height:10,borderRadius:4,width:"40%",background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out 0.2s infinite"}})]})]})}function Si({items:e,isOpen:t=!1,onClose:n,placeholder:r,emptyMessage:o,maxItems:i=8,onItemSelect:l,className:c,style:u}){const p=se(),h=yn(),g=r??h.commandSearch??"Type a command or search…",[v,w]=m(""),[k,$]=m(0),[S,C]=m(!1),z=f(null),M=f(null),N=d(),D=function(e){const t=f(null);return s(()=>{if(!e||!t.current)return;const n=t.current,r=n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),o=r[0],i=r[r.length-1],a=e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===o&&(e.preventDefault(),i?.focus()):document.activeElement===i&&(e.preventDefault(),o?.focus()))};return n.addEventListener("keydown",a),()=>n.removeEventListener("keydown",a)},[e]),t}(t),R=function(e,t){if(!e.trim())return t.filter(e=>!e.disabled).map(e=>({item:e,score:0,labelRanges:[]}));const n=[];for(const r of t){if(r.disabled)continue;const t=wi(e,r.label),o=r.description?wi(e,r.description):{matched:!1,score:0},i=(r.keywords??[]).some(t=>wi(e,t).matched);t.matched?n.push({item:r,score:t.score+20,labelRanges:t.ranges}):o.matched?n.push({item:r,score:o.score,labelRanges:[]}):i&&n.push({item:r,score:20,labelRanges:[]})}return n.sort((e,t)=>t.score-e.score)}(v,e).slice(0,i),P=[];for(const a of R){const e=a.item.group,t=P.find(t=>t.group===e);t?t.items.push(a):P.push({group:e,items:[a]})}const F=P.flatMap(e=>e.items);var I,A;s(()=>{if(!A)return;const e=e=>{"Escape"===e.key&&I()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[I=()=>{n?.()},A=t]),s(()=>{t&&(w(""),$(0),setTimeout(()=>z.current?.focus(),30))},[t]),s(()=>{k>=F.length&&$(Math.max(0,F.length-1))},[F.length,k]);const L=a(e=>{const t=M.current;t&&t.querySelectorAll("[data-command-item]")[e]?.scrollIntoView({block:"nearest"})},[]),T=e=>{e.disabled||(e.onSelect?.(),l?.(e),n?.())};if(!t||"undefined"==typeof document)return null;const W=ke(g),j=h.noCommandsFound??`No results for "${ke(v)}"`,E=o?ke(o):j;if("undefined"!=typeof document&&!document.getElementById("tkx-shimmer-style")){const e=document.createElement("style");e.id="tkx-shimmer-style",e.textContent="@keyframes tkx-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }",document.head.appendChild(e)}return y(/* @__PURE__ */b("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:1e4,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",paddingLeft:16,paddingRight:16},children:[/* @__PURE__ */x("div",{"aria-hidden":"true",onClick:n,style:{position:"absolute",inset:0,backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",animation:"tkx-fade-in 120ms ease"}}),/* @__PURE__ */b("div",{ref:D,role:"dialog","aria-modal":"true","aria-label":"Command palette",id:N,className:jt(c),style:{position:"relative",zIndex:1,width:"100%",maxWidth:560,backgroundColor:p.surface,border:`1px solid ${p.border}`,borderRadius:16,boxShadow:`0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px ${p.border}`,overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"70vh",...u},children:[
244
267
  /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px",borderBottom:`1px solid ${p.border}`},children:[
245
268
  /* @__PURE__ */b("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:p.textMuted,strokeWidth:2,"aria-hidden":"true",style:{flexShrink:0},children:[/* @__PURE__ */x("circle",{cx:"11",cy:"11",r:"8"}),/* @__PURE__ */x("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),
246
269
  /* @__PURE__ */x("input",{ref:z,type:"text",role:"combobox","aria-expanded":!0,"aria-autocomplete":"list","aria-controls":`${N}-list`,"aria-activedescendant":F[k]?`${N}-item-${F[k].item.id}`:void 0,value:v,onChange:e=>{w(e.target.value),$(0)},onKeyDown:e=>{if("ArrowDown"===e.key){e.preventDefault();const t=Math.min(F.length-1,k+1);$(t),L(t)}else if("ArrowUp"===e.key){e.preventDefault();const t=Math.max(0,k-1);$(t),L(t)}else if("Enter"===e.key){e.preventDefault();const t=F[k];t&&T(t.item)}},placeholder:W,style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:16,fontFamily:"inherit",color:p.text}}),v&&/* @__PURE__ */x("button",{type:"button","aria-label":h.clearSelection,onClick:()=>{w(""),$(0),z.current?.focus()},style:{border:"none",background:"transparent",cursor:"pointer",color:p.textMuted,display:"flex",alignItems:"center",padding:0},children:/* @__PURE__ */b("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[/* @__PURE__ */x("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),/* @__PURE__ */x("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),
247
- /* @__PURE__ */x("div",{id:`${N}-list`,ref:M,role:"listbox","aria-label":"Command results",style:{overflowY:"auto",flex:1,padding:"6px 8px"},children:S?Array.from({length:4},(e,t)=>/* @__PURE__ */x(mi,{surface:p.surface,border:p.border},t)):0===F.length?/* @__PURE__ */b("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:"32px 16px",color:p.textMuted},children:[/* @__PURE__ */b("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[
270
+ /* @__PURE__ */x("div",{id:`${N}-list`,ref:M,role:"listbox","aria-label":"Command results",style:{overflowY:"auto",flex:1,padding:"6px 8px"},children:S?Array.from({length:4},(e,t)=>/* @__PURE__ */x($i,{surface:p.surface,border:p.border},t)):0===F.length?/* @__PURE__ */b("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:"32px 16px",color:p.textMuted},children:[/* @__PURE__ */b("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[
248
271
  /* @__PURE__ */x("circle",{cx:"11",cy:"11",r:"8"}),
249
272
  /* @__PURE__ */x("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),
250
- /* @__PURE__ */x("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]}),/* @__PURE__ */x("span",{style:{fontSize:"0.875rem"},children:E})]}):R.map(({group:e,items:t},n)=>{const r=R.slice(0,n).reduce((e,t)=>e+t.items.length,0);/* @__PURE__ */
273
+ /* @__PURE__ */x("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]}),/* @__PURE__ */x("span",{style:{fontSize:"0.875rem"},children:E})]}):P.map(({group:e,items:t},n)=>{const r=P.slice(0,n).reduce((e,t)=>e+t.items.length,0);/* @__PURE__ */
251
274
  return b("div",{children:[e&&/* @__PURE__ */x("div",{role:"presentation",style:{fontSize:"0.6875rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:p.textMuted,padding:"10px 12px 4px"},children:ke(e)}),t.map((e,t)=>{const n=r+t,o=n===k,i=e.item;/* @__PURE__ */
252
275
  return b("div",{id:`${N}-item-${i.id}`,role:"option","aria-selected":o,"aria-disabled":i.disabled,"data-command-item":!0,onClick:()=>T(i),onMouseEnter:()=>$(n),style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderRadius:8,cursor:i.disabled?"not-allowed":"pointer",opacity:i.disabled?.45:1,backgroundColor:o?`${p.primary}18`:"transparent",borderLeft:o?`2px solid ${p.primary}`:"2px solid transparent",transition:"background 80ms ease",userSelect:"none"},children:[i.icon&&/* @__PURE__ */x("span",{style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",color:o?p.primary:p.textMuted},children:i.icon}),
253
- /* @__PURE__ */b("div",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */x("div",{style:{fontSize:"0.875rem",fontWeight:500,color:p.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:/* @__PURE__ */x(fi,{text:i.label,ranges:e.labelRanges,color:p.primary})}),i.description&&/* @__PURE__ */x("div",{style:{fontSize:"0.75rem",color:p.textMuted,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:ke(i.description)})]}),i.shortcut&&/* @__PURE__ */x("span",{style:{flexShrink:0,fontSize:"0.6875rem",fontWeight:500,color:p.textMuted,backgroundColor:p.surfaceAlt,border:`1px solid ${p.border}`,borderRadius:6,padding:"2px 6px",fontFamily:"monospace",letterSpacing:"0.04em"},children:ke(i.shortcut)})]},i.id)})]},e??"__default__")})}),F.length>0&&/* @__PURE__ */b("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 16px",borderTop:`1px solid ${p.border}`,fontSize:"0.6875rem",color:p.textMuted},children:[
276
+ /* @__PURE__ */b("div",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */x("div",{style:{fontSize:"0.875rem",fontWeight:500,color:p.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:/* @__PURE__ */x(ki,{text:i.label,ranges:e.labelRanges,color:p.primary})}),i.description&&/* @__PURE__ */x("div",{style:{fontSize:"0.75rem",color:p.textMuted,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:ke(i.description)})]}),i.shortcut&&/* @__PURE__ */x("span",{style:{flexShrink:0,fontSize:"0.6875rem",fontWeight:500,color:p.textMuted,backgroundColor:p.surfaceAlt,border:`1px solid ${p.border}`,borderRadius:6,padding:"2px 6px",fontFamily:"monospace",letterSpacing:"0.04em"},children:ke(i.shortcut)})]},i.id)})]},e??"__default__")})}),F.length>0&&/* @__PURE__ */b("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 16px",borderTop:`1px solid ${p.border}`,fontSize:"0.6875rem",color:p.textMuted},children:[
254
277
  /* @__PURE__ */b("span",{children:[/* @__PURE__ */x("kbd",{style:{fontFamily:"monospace"},children:"↑↓"})," navigate"]}),
255
278
  /* @__PURE__ */b("span",{children:[/* @__PURE__ */x("kbd",{style:{fontFamily:"monospace"},children:"↵"})," select"]}),
256
- /* @__PURE__ */b("span",{children:[/* @__PURE__ */x("kbd",{style:{fontFamily:"monospace"},children:"Esc"})," close"]})]})]})]}),document.body)}function xi({direction:e,onClick:t,isDisabled:n,primaryColor:r,position:o,orientation:i}){const a="vertical"===i,l="prev"===e,s="inside"===o?{position:"absolute",zIndex:3,...a?{[l?"top":"bottom"]:10,left:"50%",transform:"translateX(-50%)"}:{[l?"left":"right"]:10,top:"50%",transform:"translateY(-50%)"}}:{flexShrink:0,position:"relative"};/* @__PURE__ */
257
- return x("button",{type:"button","aria-label":l?"Previous slide":"Next slide",disabled:n,onClick:t,style:{...s,width:36,height:36,borderRadius:"50%",border:"none",backgroundColor:"rgba(0,0,0,0.45)",backdropFilter:"blur(4px)",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:n?"not-allowed":"pointer",opacity:n?.35:1,transition:"background 150ms ease, opacity 150ms ease",outline:"none"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${r}55`},onBlur:e=>{e.currentTarget.style.boxShadow="none"},onMouseEnter:e=>{n||(e.currentTarget.style.backgroundColor="rgba(0,0,0,0.65)")},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="rgba(0,0,0,0.45)"},children:/* @__PURE__ */x("svg",a?l?{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"18 15 12 9 6 15"})}:{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"6 9 12 15 18 9"})}:l?{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"15 18 9 12 15 6"})}:{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"9 18 15 12 9 6"})})})}function bi({slides:e,autoPlay:t=!1,autoPlayInterval:n=4e3,pauseOnHover:r=!0,loop:o=!0,showArrows:i=!0,showDots:l=!0,showThumbnails:c=!1,orientation:u="horizontal",slidesToShow:p=1,gap:h=0,transitionDuration:y=400,swipeable:v=!0,initialIndex:w=0,onChange:k,arrowPosition:$="inside",height:S=320,className:C,style:z}){const M=se(),N=et(),D=d(),P=e.length,[R,F]=m(w),[I,A]=m(o?w+1:w),[L,T]=m(!1),[W,j]=m(!1),E=f(null),B=f(null),V=f(null),H=f(0),O=f(!1),q="vertical"===u,U=N?0:y,K=o&&P>1?[e[P-1],...e,e[0]]:e,Y=K.length,X=100/p,Z=(e,t=0)=>{const n=0!==t?` - ${t}px`:"";return q?`translateY(calc(-${e*X}%${n}))`:`translateX(calc(-${e*X}%${n}))`},G=a((e,t=!1)=>{const n=o?(e%P+P)%P:Math.max(0,Math.min(P-1,e)),r=o?n+1:n;t&&E.current?(E.current.style.transition="none",A(r),F(n),E.current.offsetHeight,E.current.style.transition=""):(T(!0),A(r),F(n)),k?.(n)},[P,o,k]),_=a(()=>G(R-1),[R,G]),J=a(()=>G(R+1),[R,G]),Q=a(()=>{T(!1),!o||P<=1||(0===I?G(P-1,!0):I===Y-1&&G(0,!0))},[o,P,I,Y,G]);s(()=>{if(!(!t||W||P<=1))return B.current=setInterval(J,n),()=>{B.current&&clearInterval(B.current)}},[t,W,n,J,P]),s(()=>{const e=e=>{const t=document.activeElement;document.getElementById(D)?.contains(t)&&(e.key===(q?"ArrowUp":"ArrowLeft")&&(e.preventDefault(),_()),e.key===(q?"ArrowDown":"ArrowRight")&&(e.preventDefault(),J()))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[D,q,_,J]);const ee=e=>"touches"in e?q?e.touches[0].clientY:e.touches[0].clientX:q?e.clientY:e.clientX,te=e=>{v&&(V.current=ee(e),H.current=0,O.current=!0)},ne=e=>{if(!O.current||null===V.current)return;const t=ee(e)-V.current;H.current=t,E.current&&(E.current.style.transition="none",E.current.style.transform=Z(I,-t))},re=()=>{if(!O.current)return;O.current=!1;const e=H.current;E.current&&(E.current.style.transition="",E.current.style.transform=""),e<-50?J():e>50?_():E.current&&(E.current.style.transform=Z(I)),V.current=null,H.current=0},oe="number"==typeof S?`${S}px`:S,ie={display:"flex",flexDirection:q?"column":"row",width:q?"100%":Y/p*100+"%",height:q?Y/p*100+"%":"100%",transform:Z(I),transition:L||!N?`transform ${U}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none",willChange:"transform",gap:h>0?h:void 0},ae={flexShrink:0,width:q?"100%":X/(Y/p)+"%",height:q?X/(Y/p)+"%":"100%",overflow:"hidden",position:"relative"},le=o||R>0,de=o||R<P-1,ce="outside"===$;/* @__PURE__ */
258
- return b("div",{id:D,className:jt(At("flex flex-col gap-2"),C),style:z,"aria-roledescription":"carousel","aria-label":"Content carousel",children:[/* @__PURE__ */b("div",{className:At("flex items-center gap-2"),style:{gap:ce&&i?8:0},children:[i&&ce&&/* @__PURE__ */x(xi,{direction:"prev",onClick:_,isDisabled:!le,primaryColor:M.primary,position:"outside",orientation:u}),
259
- /* @__PURE__ */b("div",{style:{position:"relative",flex:1,overflow:"hidden",height:oe,borderRadius:12,cursor:v?O.current?"grabbing":"grab":"default",userSelect:"none"},onMouseEnter:()=>r&&j(!0),onMouseLeave:()=>{j(!1),re()},onTouchStart:te,onTouchMove:ne,onTouchEnd:re,onMouseDown:te,onMouseMove:ne,onMouseUp:re,"aria-live":"polite","aria-atomic":"false",children:[i&&!ce&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x(xi,{direction:"prev",onClick:_,isDisabled:!le,primaryColor:M.primary,position:"inside",orientation:u}),/* @__PURE__ */x(xi,{direction:"next",onClick:J,isDisabled:!de,primaryColor:M.primary,position:"inside",orientation:u})]}),
260
- /* @__PURE__ */x("div",{ref:E,style:ie,onTransitionEnd:Q,children:K.map((e,t)=>/* @__PURE__ */x("div",{style:ae,role:"group","aria-roledescription":"slide","aria-label":`Slide ${(t-(o?1:0)+P)%P+1} of ${P}`,"aria-hidden":(t-(o?1:0)+P)%P!==R,children:e.content},`${e.id}-${t}`))}),l&&!c&&/* @__PURE__ */x("div",{"aria-label":"Slide indicators",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:6,zIndex:2},children:e.map((e,t)=>/* @__PURE__ */x("button",{type:"button","aria-label":`Go to slide ${t+1}`,"aria-current":t===R?"true":void 0,onClick:()=>G(t),style:{width:t===R?20:8,height:8,borderRadius:9999,border:"none",backgroundColor:t===R?M.primary:"rgba(255,255,255,0.5)",cursor:"pointer",padding:0,transition:"width 250ms ease, background 250ms ease",outline:"none"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${M.primary}66`},onBlur:e=>{e.currentTarget.style.boxShadow="none"}},e.id))})]}),i&&ce&&/* @__PURE__ */x(xi,{direction:"next",onClick:J,isDisabled:!de,primaryColor:M.primary,position:"outside",orientation:u})]}),c&&/* @__PURE__ */x("div",{role:"tablist","aria-label":"Slide thumbnails",style:{display:"flex",gap:6,overflowX:"auto",paddingBottom:4,scrollbarWidth:"thin"},children:e.map((e,t)=>/* @__PURE__ */b("button",{type:"button",role:"tab","aria-selected":t===R,"aria-label":`Thumbnail for slide ${t+1}`,onClick:()=>G(t),style:{flexShrink:0,width:60,height:42,border:`2px solid ${t===R?M.primary:M.border}`,borderRadius:6,overflow:"hidden",cursor:"pointer",padding:0,background:M.surfaceAlt,transition:"border-color 150ms ease",outline:"none",position:"relative"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${M.primary}55`},onBlur:e=>{e.currentTarget.style.boxShadow="none"},children:[e.thumbnail?/* @__PURE__ */x("img",{src:e.thumbnail,alt:"","aria-hidden":"true",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):/* @__PURE__ */x("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.625rem",color:M.textMuted,fontWeight:600},children:t+1}),t===R&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:`${M.primary}22`}})]},e.id))})]})}function yi({color:e}){/* @__PURE__ */
261
- return x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{flexShrink:0},children:/* @__PURE__ */x("path",{d:"M6 3l5 5-5 5",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function vi({onClick:e,bgColor:t,hoverColor:n,textColor:r,label:o}){/* @__PURE__ */
262
- return x("button",{type:"button",onClick:e,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e())},"aria-label":o,className:At("inline-flex items-center justify-center rounded px-1.5 py-0.5","text-sm font-medium cursor-pointer border-none outline-none","focus-visible:ring-2 focus-visible:ring-offset-1"),style:{backgroundColor:t,color:r,transition:"background-color 150ms ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=n},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=t},children:"…"})}function wi({items:e,separator:t,maxItems:n,onNavigate:r,className:o,style:i}){const l=se(),s=yn(),d=et(),c=void 0!==n&&n>1&&e.length>n,u=a(()=>{if(!c||!n)return e.map((e,t)=>({item:e,originalIndex:t}));const t=Math.ceil((n-1)/2),r=n-1-t,o=e.slice(0,t).map((e,t)=>({item:e,originalIndex:t})),i=e.slice(e.length-r).map((t,n)=>({item:t,originalIndex:e.length-r+n}));return o.concat(i)},[e,n,c])(),p=c&&n?Math.ceil((n-1)/2):-1,h=(e,t)=>{r?.(e,t)},f=d?{}:{transition:"color 150ms ease, background-color 150ms ease"},m=e=>/* @__PURE__ */x("li",{role:"presentation","aria-hidden":"true",className:At("flex items-center mx-1.5"),children:t??/* @__PURE__ */x(yi,{color:l.textMuted})},e),y=(e,t,n)=>{const o=ke(e.label);if(n)/* @__PURE__ */return x("li",{children:/* @__PURE__ */b("span",{"aria-current":"page",className:At("inline-flex items-center gap-1.5 text-sm font-medium"),style:{color:l.text},children:[e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:At("flex-shrink-0"),children:e.icon}),o]})},`item-${t}`);const i=!!e.href,a={color:l.textMuted,textDecoration:"none",...f},s={onMouseEnter:e=>{e.currentTarget.style.color=l.primary},onMouseLeave:e=>{e.currentTarget.style.color=l.textMuted}},d=/* @__PURE__ */b(g,{children:[e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:At("flex-shrink-0"),children:e.icon}),o]});/* @__PURE__ */
263
- return x("li",i?{children:/* @__PURE__ */x("a",{href:e.href,onClick:n=>{r&&(n.preventDefault(),h(e,t))},className:At("inline-flex items-center gap-1.5 text-sm rounded","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:{...a,focusRingColor:l.primary},...s,children:d})}:{children:/* @__PURE__ */x("button",{type:"button",onClick:()=>h(e,t),onKeyDown:n=>((e,t,n)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),h(t,n))})(n,e,t),className:At("inline-flex items-center gap-1.5 text-sm rounded","border-none bg-transparent cursor-pointer p-0","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:a,...s,children:d})},`item-${t}`)},v=[];let w=!1;for(let a=0;a<u.length;a++){const{item:t,originalIndex:n}=u[a],r=n===e.length-1;c&&!w&&a===p&&(v.length>0&&v.push(m("sep-ellipsis-before")),v.push(/* @__PURE__ */x("li",{role:"presentation",children:/* @__PURE__ */x(vi,{onClick:()=>{},bgColor:l.surfaceAlt,hoverColor:l.surface,textColor:l.textMuted,label:s.showHiddenItems??"Show hidden breadcrumb items"})},"ellipsis")),w=!0),v.length>0&&null!==v[v.length-1]&&v.push(m(`sep-${n}`)),v.push(y(t,n,r))}/* @__PURE__ */
264
- return x("nav",{"aria-label":s.breadcrumb??"Breadcrumb",className:At("font-sans",o??""),style:{...i},children:/* @__PURE__ */x("ol",{role:"list",className:At("flex items-center flex-wrap list-none m-0 p-0"),children:v})})}function ki({trigger:e,content:t,placement:n="bottom",isOpen:r,onOpenChange:o,closeOnClickOutside:i=!0,className:l,style:c}){const u=se(),p=et(),h=d(),v=void 0!==r,[w,k]=m(!1),$=v?r:w,S=f(null),C=f(null);f(null);const[z,M]=m(null),N=a(e=>{v||k(e),o?.(e)},[v,o]),D=a(()=>N(!1),[N]),P=a(()=>N(!$),[N,$]);ot(D,$),s(()=>{if(!$||!i)return;const e=e=>{const t=e.target;S.current?.contains(t)||C.current?.contains(t)||D()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[$,i,D]),s(()=>{if(!$||!S.current)return;const e=()=>{S.current&&C.current&&M(function(e,t,n){const r=t.getBoundingClientRect(),o=window.scrollX,i=window.scrollY,a=window.innerWidth,l=window.innerHeight;let s=0,d=0,c=n;const u={top:e.top-r.height-8-8>0,bottom:e.bottom+r.height+8+8<l,left:e.left-r.width-8-8>0,right:e.right+r.width+8+8<a};if(!u[n]){const e={top:"bottom",bottom:"top",left:"right",right:"left"};u[e[n]]&&(c=e[n])}switch(c){case"top":s=e.top+i-r.height-8-8,d=e.left+o+e.width/2-r.width/2;break;case"bottom":s=e.bottom+i+8+8,d=e.left+o+e.width/2-r.width/2;break;case"left":s=e.top+i+e.height/2-r.height/2,d=e.left+o-r.width-8-8;break;case"right":s=e.top+i+e.height/2-r.height/2,d=e.right+o+8+8}d=Math.max(8,Math.min(d,a+o-r.width-8)),s=Math.max(8,Math.min(s,l+i-r.height-8));const p={position:"absolute",width:0,height:0,borderStyle:"solid",borderWidth:8};switch(c){case"top":Object.assign(p,{bottom:-16,left:"50%",transform:"translateX(-50%)",borderColor:"var(--tkx-popover-bg) transparent transparent transparent"});break;case"bottom":Object.assign(p,{top:-16,left:"50%",transform:"translateX(-50%)",borderColor:"transparent transparent var(--tkx-popover-bg) transparent"});break;case"left":Object.assign(p,{right:-16,top:"50%",transform:"translateY(-50%)",borderColor:"transparent transparent transparent var(--tkx-popover-bg)"});break;case"right":Object.assign(p,{left:-16,top:"50%",transform:"translateY(-50%)",borderColor:"transparent var(--tkx-popover-bg) transparent transparent"})}return{top:s,left:d,arrowStyle:p,resolvedPlacement:c}}(S.current.getBoundingClientRect(),C.current,n))};return requestAnimationFrame(e),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[$,n]);const R=p?{opacity:1}:{animation:"tkxPopoverFadeIn 150ms ease forwards",opacity:0},F=$&&"undefined"!=typeof document?y(/* @__PURE__ */b("div",{ref:C,id:h,role:"dialog","aria-modal":"false",className:At("absolute z-[9100] rounded-lg font-sans",l??""),style:{"--tkx-popover-bg":u.surface,top:z?.top??-9999,left:z?.left??-9999,backgroundColor:u.surface,border:`1px solid ${u.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",minWidth:200,maxWidth:420,padding:"12px 16px",color:u.text,...R,...c},children:[z&&/* @__PURE__ */x("span",{style:z.arrowStyle,"aria-hidden":"true"}),t]}),document.body):null;/* @__PURE__ */
279
+ /* @__PURE__ */b("span",{children:[/* @__PURE__ */x("kbd",{style:{fontFamily:"monospace"},children:"Esc"})," close"]})]})]})]}),document.body)}function Ci({direction:e,onClick:t,isDisabled:n,primaryColor:r,position:o,orientation:i}){const a="vertical"===i,l="prev"===e,s="inside"===o?{position:"absolute",zIndex:3,...a?{[l?"top":"bottom"]:10,left:"50%",transform:"translateX(-50%)"}:{[l?"left":"right"]:10,top:"50%",transform:"translateY(-50%)"}}:{flexShrink:0,position:"relative"};/* @__PURE__ */
280
+ return x("button",{type:"button","aria-label":l?"Previous slide":"Next slide",disabled:n,onClick:t,style:{...s,width:36,height:36,borderRadius:"50%",border:"none",backgroundColor:"rgba(0,0,0,0.45)",backdropFilter:"blur(4px)",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:n?"not-allowed":"pointer",opacity:n?.35:1,transition:"background 150ms ease, opacity 150ms ease",outline:"none"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${r}55`},onBlur:e=>{e.currentTarget.style.boxShadow="none"},onMouseEnter:e=>{n||(e.currentTarget.style.backgroundColor="rgba(0,0,0,0.65)")},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="rgba(0,0,0,0.45)"},children:/* @__PURE__ */x("svg",a?l?{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"18 15 12 9 6 15"})}:{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"6 9 12 15 18 9"})}:l?{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"15 18 9 12 15 6"})}:{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"9 18 15 12 9 6"})})})}function zi({slides:e,autoPlay:t=!1,autoPlayInterval:n=4e3,pauseOnHover:r=!0,loop:o=!0,showArrows:i=!0,showDots:l=!0,showThumbnails:c=!1,orientation:u="horizontal",slidesToShow:p=1,gap:h=0,transitionDuration:y=400,swipeable:v=!0,initialIndex:w=0,onChange:k,arrowPosition:$="inside",height:S=320,className:C,style:z}){const M=se(),N=et(),D=d(),R=e.length,[P,F]=m(w),[I,A]=m(o?w+1:w),[L,T]=m(!1),[W,j]=m(!1),E=f(null),B=f(null),V=f(null),H=f(0),O=f(!1),q="vertical"===u,U=N?0:y,K=o&&R>1?[e[R-1],...e,e[0]]:e,Y=K.length,X=100/p,Z=(e,t=0)=>{const n=0!==t?` - ${t}px`:"";return q?`translateY(calc(-${e*X}%${n}))`:`translateX(calc(-${e*X}%${n}))`},G=a((e,t=!1)=>{const n=o?(e%R+R)%R:Math.max(0,Math.min(R-1,e)),r=o?n+1:n;t&&E.current?(E.current.style.transition="none",A(r),F(n),E.current.offsetHeight,E.current.style.transition=""):(T(!0),A(r),F(n)),k?.(n)},[R,o,k]),_=a(()=>G(P-1),[P,G]),J=a(()=>G(P+1),[P,G]),Q=a(()=>{T(!1),!o||R<=1||(0===I?G(R-1,!0):I===Y-1&&G(0,!0))},[o,R,I,Y,G]);s(()=>{if(!(!t||W||R<=1))return B.current=setInterval(J,n),()=>{B.current&&clearInterval(B.current)}},[t,W,n,J,R]),s(()=>{const e=e=>{const t=document.activeElement;document.getElementById(D)?.contains(t)&&(e.key===(q?"ArrowUp":"ArrowLeft")&&(e.preventDefault(),_()),e.key===(q?"ArrowDown":"ArrowRight")&&(e.preventDefault(),J()))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[D,q,_,J]);const ee=e=>"touches"in e?q?e.touches[0].clientY:e.touches[0].clientX:q?e.clientY:e.clientX,te=e=>{v&&(V.current=ee(e),H.current=0,O.current=!0)},ne=e=>{if(!O.current||null===V.current)return;const t=ee(e)-V.current;H.current=t,E.current&&(E.current.style.transition="none",E.current.style.transform=Z(I,-t))},re=()=>{if(!O.current)return;O.current=!1;const e=H.current;E.current&&(E.current.style.transition="",E.current.style.transform=""),e<-50?J():e>50?_():E.current&&(E.current.style.transform=Z(I)),V.current=null,H.current=0},oe="number"==typeof S?`${S}px`:S,ie={display:"flex",flexDirection:q?"column":"row",width:q?"100%":Y/p*100+"%",height:q?Y/p*100+"%":"100%",transform:Z(I),transition:L||!N?`transform ${U}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none",willChange:"transform",gap:h>0?h:void 0},ae={flexShrink:0,width:q?"100%":X/(Y/p)+"%",height:q?X/(Y/p)+"%":"100%",overflow:"hidden",position:"relative"},le=o||P>0,de=o||P<R-1,ce="outside"===$;/* @__PURE__ */
281
+ return b("div",{id:D,className:jt(At("flex flex-col gap-2"),C),style:z,"aria-roledescription":"carousel","aria-label":"Content carousel",children:[/* @__PURE__ */b("div",{className:At("flex items-center gap-2"),style:{gap:ce&&i?8:0},children:[i&&ce&&/* @__PURE__ */x(Ci,{direction:"prev",onClick:_,isDisabled:!le,primaryColor:M.primary,position:"outside",orientation:u}),
282
+ /* @__PURE__ */b("div",{style:{position:"relative",flex:1,overflow:"hidden",height:oe,borderRadius:12,cursor:v?O.current?"grabbing":"grab":"default",userSelect:"none"},onMouseEnter:()=>r&&j(!0),onMouseLeave:()=>{j(!1),re()},onTouchStart:te,onTouchMove:ne,onTouchEnd:re,onMouseDown:te,onMouseMove:ne,onMouseUp:re,"aria-live":"polite","aria-atomic":"false",children:[i&&!ce&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x(Ci,{direction:"prev",onClick:_,isDisabled:!le,primaryColor:M.primary,position:"inside",orientation:u}),/* @__PURE__ */x(Ci,{direction:"next",onClick:J,isDisabled:!de,primaryColor:M.primary,position:"inside",orientation:u})]}),
283
+ /* @__PURE__ */x("div",{ref:E,style:ie,onTransitionEnd:Q,children:K.map((e,t)=>/* @__PURE__ */x("div",{style:ae,role:"group","aria-roledescription":"slide","aria-label":`Slide ${(t-(o?1:0)+R)%R+1} of ${R}`,"aria-hidden":(t-(o?1:0)+R)%R!==P,children:e.content},`${e.id}-${t}`))}),l&&!c&&/* @__PURE__ */x("div",{"aria-label":"Slide indicators",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:6,zIndex:2},children:e.map((e,t)=>/* @__PURE__ */x("button",{type:"button","aria-label":`Go to slide ${t+1}`,"aria-current":t===P?"true":void 0,onClick:()=>G(t),style:{width:t===P?20:8,height:8,borderRadius:9999,border:"none",backgroundColor:t===P?M.primary:"rgba(255,255,255,0.5)",cursor:"pointer",padding:0,transition:"width 250ms ease, background 250ms ease",outline:"none"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${M.primary}66`},onBlur:e=>{e.currentTarget.style.boxShadow="none"}},e.id))})]}),i&&ce&&/* @__PURE__ */x(Ci,{direction:"next",onClick:J,isDisabled:!de,primaryColor:M.primary,position:"outside",orientation:u})]}),c&&/* @__PURE__ */x("div",{role:"tablist","aria-label":"Slide thumbnails",style:{display:"flex",gap:6,overflowX:"auto",paddingBottom:4,scrollbarWidth:"thin"},children:e.map((e,t)=>/* @__PURE__ */b("button",{type:"button",role:"tab","aria-selected":t===P,"aria-label":`Thumbnail for slide ${t+1}`,onClick:()=>G(t),style:{flexShrink:0,width:60,height:42,border:`2px solid ${t===P?M.primary:M.border}`,borderRadius:6,overflow:"hidden",cursor:"pointer",padding:0,background:M.surfaceAlt,transition:"border-color 150ms ease",outline:"none",position:"relative"},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${M.primary}55`},onBlur:e=>{e.currentTarget.style.boxShadow="none"},children:[e.thumbnail?/* @__PURE__ */x("img",{src:e.thumbnail,alt:"","aria-hidden":"true",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):/* @__PURE__ */x("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.625rem",color:M.textMuted,fontWeight:600},children:t+1}),t===P&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:`${M.primary}22`}})]},e.id))})]})}function Mi({color:e}){/* @__PURE__ */
284
+ return x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{flexShrink:0},children:/* @__PURE__ */x("path",{d:"M6 3l5 5-5 5",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ni({onClick:e,bgColor:t,hoverColor:n,textColor:r,label:o}){/* @__PURE__ */
285
+ return x("button",{type:"button",onClick:e,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e())},"aria-label":o,className:At("inline-flex items-center justify-center rounded px-1.5 py-0.5","text-sm font-medium cursor-pointer border-none outline-none","focus-visible:ring-2 focus-visible:ring-offset-1"),style:{backgroundColor:t,color:r,transition:"background-color 150ms ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=n},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=t},children:"…"})}function Di({items:e,separator:t,maxItems:n,onNavigate:r,className:o,style:i}){const l=se(),s=yn(),d=et(),c=void 0!==n&&n>1&&e.length>n,u=a(()=>{if(!c||!n)return e.map((e,t)=>({item:e,originalIndex:t}));const t=Math.ceil((n-1)/2),r=n-1-t,o=e.slice(0,t).map((e,t)=>({item:e,originalIndex:t})),i=e.slice(e.length-r).map((t,n)=>({item:t,originalIndex:e.length-r+n}));return o.concat(i)},[e,n,c])(),p=c&&n?Math.ceil((n-1)/2):-1,h=(e,t)=>{r?.(e,t)},f=d?{}:{transition:"color 150ms ease, background-color 150ms ease"},m=e=>/* @__PURE__ */x("li",{role:"presentation","aria-hidden":"true",className:At("flex items-center mx-1.5"),children:t??/* @__PURE__ */x(Mi,{color:l.textMuted})},e),y=(e,t,n)=>{const o=ke(e.label);if(n)/* @__PURE__ */return x("li",{children:/* @__PURE__ */b("span",{"aria-current":"page",className:At("inline-flex items-center gap-1.5 text-sm font-medium"),style:{color:l.text},children:[e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:At("flex-shrink-0"),children:e.icon}),o]})},`item-${t}`);const i=!!e.href,a={color:l.textMuted,textDecoration:"none",...f},s={onMouseEnter:e=>{e.currentTarget.style.color=l.primary},onMouseLeave:e=>{e.currentTarget.style.color=l.textMuted}},d=/* @__PURE__ */b(g,{children:[e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:At("flex-shrink-0"),children:e.icon}),o]});/* @__PURE__ */
286
+ return x("li",i?{children:/* @__PURE__ */x("a",{href:e.href,onClick:n=>{r&&(n.preventDefault(),h(e,t))},className:At("inline-flex items-center gap-1.5 text-sm rounded","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:{...a,focusRingColor:l.primary},...s,children:d})}:{children:/* @__PURE__ */x("button",{type:"button",onClick:()=>h(e,t),onKeyDown:n=>((e,t,n)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),h(t,n))})(n,e,t),className:At("inline-flex items-center gap-1.5 text-sm rounded","border-none bg-transparent cursor-pointer p-0","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:a,...s,children:d})},`item-${t}`)},v=[];let w=!1;for(let a=0;a<u.length;a++){const{item:t,originalIndex:n}=u[a],r=n===e.length-1;c&&!w&&a===p&&(v.length>0&&v.push(m("sep-ellipsis-before")),v.push(/* @__PURE__ */x("li",{role:"presentation",children:/* @__PURE__ */x(Ni,{onClick:()=>{},bgColor:l.surfaceAlt,hoverColor:l.surface,textColor:l.textMuted,label:s.showHiddenItems??"Show hidden breadcrumb items"})},"ellipsis")),w=!0),v.length>0&&null!==v[v.length-1]&&v.push(m(`sep-${n}`)),v.push(y(t,n,r))}/* @__PURE__ */
287
+ return x("nav",{"aria-label":s.breadcrumb??"Breadcrumb",className:At("font-sans",o??""),style:{...i},children:/* @__PURE__ */x("ol",{role:"list",className:At("flex items-center flex-wrap list-none m-0 p-0"),children:v})})}function Ri({trigger:e,content:t,placement:n="bottom",isOpen:r,onOpenChange:o,closeOnClickOutside:i=!0,className:l,style:c}){const u=se(),p=et(),h=d(),v=void 0!==r,[w,k]=m(!1),$=v?r:w,S=f(null),C=f(null);f(null);const[z,M]=m(null),N=a(e=>{v||k(e),o?.(e)},[v,o]),D=a(()=>N(!1),[N]),R=a(()=>N(!$),[N,$]);ot(D,$),s(()=>{if(!$||!i)return;const e=e=>{const t=e.target;S.current?.contains(t)||C.current?.contains(t)||D()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[$,i,D]),s(()=>{if(!$||!S.current)return;const e=()=>{S.current&&C.current&&M(function(e,t,n){const r=t.getBoundingClientRect(),o=window.scrollX,i=window.scrollY,a=window.innerWidth,l=window.innerHeight;let s=0,d=0,c=n;const u={top:e.top-r.height-8-8>0,bottom:e.bottom+r.height+8+8<l,left:e.left-r.width-8-8>0,right:e.right+r.width+8+8<a};if(!u[n]){const e={top:"bottom",bottom:"top",left:"right",right:"left"};u[e[n]]&&(c=e[n])}switch(c){case"top":s=e.top+i-r.height-8-8,d=e.left+o+e.width/2-r.width/2;break;case"bottom":s=e.bottom+i+8+8,d=e.left+o+e.width/2-r.width/2;break;case"left":s=e.top+i+e.height/2-r.height/2,d=e.left+o-r.width-8-8;break;case"right":s=e.top+i+e.height/2-r.height/2,d=e.right+o+8+8}d=Math.max(8,Math.min(d,a+o-r.width-8)),s=Math.max(8,Math.min(s,l+i-r.height-8));const p={position:"absolute",width:0,height:0,borderStyle:"solid",borderWidth:8};switch(c){case"top":Object.assign(p,{bottom:-16,left:"50%",transform:"translateX(-50%)",borderColor:"var(--tkx-popover-bg) transparent transparent transparent"});break;case"bottom":Object.assign(p,{top:-16,left:"50%",transform:"translateX(-50%)",borderColor:"transparent transparent var(--tkx-popover-bg) transparent"});break;case"left":Object.assign(p,{right:-16,top:"50%",transform:"translateY(-50%)",borderColor:"transparent transparent transparent var(--tkx-popover-bg)"});break;case"right":Object.assign(p,{left:-16,top:"50%",transform:"translateY(-50%)",borderColor:"transparent var(--tkx-popover-bg) transparent transparent"})}return{top:s,left:d,arrowStyle:p,resolvedPlacement:c}}(S.current.getBoundingClientRect(),C.current,n))};return requestAnimationFrame(e),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[$,n]);const P=p?{opacity:1}:{animation:"tkxPopoverFadeIn 150ms ease forwards",opacity:0},F=$&&"undefined"!=typeof document?y(/* @__PURE__ */b("div",{ref:C,id:h,role:"dialog","aria-modal":"false",className:At("absolute z-[9100] rounded-lg font-sans",l??""),style:{"--tkx-popover-bg":u.surface,top:z?.top??-9999,left:z?.left??-9999,backgroundColor:u.surface,border:`1px solid ${u.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",minWidth:200,maxWidth:420,padding:"12px 16px",color:u.text,...P,...c},children:[z&&/* @__PURE__ */x("span",{style:z.arrowStyle,"aria-hidden":"true"}),t]}),document.body):null;/* @__PURE__ */
265
288
  return b(g,{children:[
266
- /* @__PURE__ */x("div",{ref:S,className:At("inline-flex"),onClick:P,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),P())},"aria-expanded":$,"aria-haspopup":"dialog","aria-controls":$?h:void 0,children:e}),F,$&&!p&&/* @__PURE__ */x("style",{children:"\n @keyframes tkxPopoverFadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n "})]})}function $i(e,t){if(!t)return!0;const n=t.toLowerCase(),r=e.label.toLowerCase();let o=0;for(let i=0;i<r.length&&o<n.length;i++)r[i]===n[o]&&o++;return o===n.length}function Si({color:e}){/* @__PURE__ */
267
- return b("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{animation:"spin 0.8s linear infinite",flexShrink:0},children:[/* @__PURE__ */x("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"2",opacity:"0.3"}),/* @__PURE__ */x("path",{d:"M14 8a6 6 0 00-6-6",stroke:e,strokeWidth:"2",strokeLinecap:"round"})]})}function Ci({options:e,value:t,onChange:n,onInputChange:r,placeholder:o="",label:i,isLoading:l=!1,emptyMessage:c,filterFn:u,freeSolo:h=!1,className:g,style:v}){const w=se(),k=yn(),$=c??k.noResults,S=et(),C=d(),z=d(),M=f(null),N=f(null),[D,P]=m(""),[R,F]=m(!1),[I,A]=m(-1),[L,T]=m(null);s(()=>{if(void 0!==t){const n=e.find(e=>e.value===t);P(n?n.label:t)}},[t,e]);const W=u??$i,j=p(()=>R?e.filter(e=>W(e,D)):[],[e,D,R,W]),E=ke(i),B=ke($);s(()=>{if(!R||!N.current)return;const e=()=>{N.current&&T(function(e){const t=e.getBoundingClientRect(),n=window.innerHeight-t.bottom,r=t.top,o=n>=284||n>=r?"below":"above";return{top:"below"===o?t.bottom+window.scrollY+4:t.top+window.scrollY-280-4,left:t.left+window.scrollX,width:t.width,placement:o}}(N.current))};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[R]),s(()=>{if(!R)return;const e=e=>{const t=e.target;N.current?.contains(t)||document.getElementById(z)?.contains(t)||F(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[R,z]),ot(()=>F(!1),R);const V=a(e=>{e.disabled||(P(e.label),n?.(e.value),F(!1),A(-1),M.current?.focus())},[n]);s(()=>{if(I<0)return;const e=`${z}-opt-${I}`;document.getElementById(e)?.scrollIntoView({block:"nearest"})},[I,z]);const H=I>=0?`${z}-opt-${I}`:void 0,O=S?{}:{animation:"tkxAutoFadeIn 120ms ease forwards"},q=R&&"undefined"!=typeof document&&L?y(/* @__PURE__ */x("ul",{id:z,role:"listbox","aria-label":E,className:At("absolute z-[9200] list-none m-0 p-1 rounded-lg overflow-y-auto font-sans"),style:{top:L.top,left:L.left,width:L.width,maxHeight:280,backgroundColor:w.surface,border:`1px solid ${w.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",...O},children:l?/* @__PURE__ */b("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:At("flex items-center gap-2 px-3 py-2 text-sm"),style:{color:w.textMuted},children:[/* @__PURE__ */x(Si,{color:w.primary}),"Loading..."]}):0===j.length?/* @__PURE__ */x("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:At("px-3 py-2 text-sm text-center"),style:{color:w.textMuted},children:B}):j.map((e,n)=>{const r=n===I,o=ke(e.label),i=e.description?ke(e.description):null;/* @__PURE__ */
289
+ /* @__PURE__ */x("div",{ref:S,className:At("inline-flex"),onClick:R,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),R())},"aria-expanded":$,"aria-haspopup":"dialog","aria-controls":$?h:void 0,children:e}),F,$&&!p&&/* @__PURE__ */x("style",{children:"\n @keyframes tkxPopoverFadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n "})]})}function Pi(e,t){if(!t)return!0;const n=t.toLowerCase(),r=e.label.toLowerCase();let o=0;for(let i=0;i<r.length&&o<n.length;i++)r[i]===n[o]&&o++;return o===n.length}function Fi({color:e}){/* @__PURE__ */
290
+ return b("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{animation:"spin 0.8s linear infinite",flexShrink:0},children:[/* @__PURE__ */x("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"2",opacity:"0.3"}),/* @__PURE__ */x("path",{d:"M14 8a6 6 0 00-6-6",stroke:e,strokeWidth:"2",strokeLinecap:"round"})]})}function Ii({options:e,value:t,onChange:n,onInputChange:r,placeholder:o="",label:i,isLoading:l=!1,emptyMessage:c,filterFn:u,freeSolo:h=!1,className:g,style:v}){const w=se(),k=yn(),$=c??k.noResults,S=et(),C=d(),z=d(),M=f(null),N=f(null),[D,R]=m(""),[P,F]=m(!1),[I,A]=m(-1),[L,T]=m(null);s(()=>{if(void 0!==t){const n=e.find(e=>e.value===t);R(n?n.label:t)}},[t,e]);const W=u??Pi,j=p(()=>P?e.filter(e=>W(e,D)):[],[e,D,P,W]),E=ke(i),B=ke($);s(()=>{if(!P||!N.current)return;const e=()=>{N.current&&T(function(e){const t=e.getBoundingClientRect(),n=window.innerHeight-t.bottom,r=t.top,o=n>=284||n>=r?"below":"above";return{top:"below"===o?t.bottom+window.scrollY+4:t.top+window.scrollY-280-4,left:t.left+window.scrollX,width:t.width,placement:o}}(N.current))};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[P]),s(()=>{if(!P)return;const e=e=>{const t=e.target;N.current?.contains(t)||document.getElementById(z)?.contains(t)||F(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[P,z]),ot(()=>F(!1),P);const V=a(e=>{e.disabled||(R(e.label),n?.(e.value),F(!1),A(-1),M.current?.focus())},[n]);s(()=>{if(I<0)return;const e=`${z}-opt-${I}`;document.getElementById(e)?.scrollIntoView({block:"nearest"})},[I,z]);const H=I>=0?`${z}-opt-${I}`:void 0,O=S?{}:{animation:"tkxAutoFadeIn 120ms ease forwards"},q=P&&"undefined"!=typeof document&&L?y(/* @__PURE__ */x("ul",{id:z,role:"listbox","aria-label":E,className:At("absolute z-[9200] list-none m-0 p-1 rounded-lg overflow-y-auto font-sans"),style:{top:L.top,left:L.left,width:L.width,maxHeight:280,backgroundColor:w.surface,border:`1px solid ${w.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",...O},children:l?/* @__PURE__ */b("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:At("flex items-center gap-2 px-3 py-2 text-sm"),style:{color:w.textMuted},children:[/* @__PURE__ */x(Fi,{color:w.primary}),"Loading..."]}):0===j.length?/* @__PURE__ */x("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:At("px-3 py-2 text-sm text-center"),style:{color:w.textMuted},children:B}):j.map((e,n)=>{const r=n===I,o=ke(e.label),i=e.description?ke(e.description):null;/* @__PURE__ */
268
291
  return b("li",{id:`${z}-opt-${n}`,role:"option","aria-selected":e.value===t,"aria-disabled":e.disabled||void 0,className:At("flex items-center gap-2 px-3 py-2 text-sm rounded-md cursor-pointer",e.disabled?"opacity-50 cursor-not-allowed":""),style:{backgroundColor:r?w.surfaceAlt:"transparent",color:e.disabled?w.textMuted:w.text,transition:S?"none":"background-color 100ms ease"},onMouseEnter:()=>!e.disabled&&A(n),onMouseDown:t=>{t.preventDefault(),V(e)},children:[e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:At("flex-shrink-0"),children:e.icon}),
269
292
  /* @__PURE__ */b("span",{className:At("flex flex-col min-w-0"),children:[/* @__PURE__ */x("span",{className:At("truncate"),children:o}),i&&/* @__PURE__ */x("span",{className:At("text-xs truncate"),style:{color:w.textMuted},children:i})]}),e.value===t&&/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:At("ml-auto flex-shrink-0"),children:/* @__PURE__ */x("path",{d:"M3 8l3.5 3.5L13 5",stroke:w.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},e.value)})}),document.body):null;/* @__PURE__ */
270
293
  return b("div",{ref:N,className:At("relative font-sans",g??""),style:v,children:[
271
294
  /* @__PURE__ */x("label",{htmlFor:C,className:At("block text-sm font-medium mb-1.5"),style:{color:w.text},children:E}),
272
- /* @__PURE__ */b("div",{className:At("relative flex items-center"),style:{backgroundColor:w.surface,border:`1px solid ${R?w.primary:w.border}`,borderRadius:8,transition:S?"none":"border-color 150ms ease"},children:[/* @__PURE__ */x("input",{ref:M,id:C,type:"text",role:"combobox","aria-expanded":R,"aria-controls":z,"aria-activedescendant":H,"aria-autocomplete":"list","aria-label":E,value:D,placeholder:o,onChange:e=>{const t=He(e.target.value);P(t),r?.(t),R||F(!0),A(-1),h&&n?.(t)},onFocus:()=>F(!0),onKeyDown:e=>{if(R||"ArrowDown"!==e.key&&"ArrowUp"!==e.key)switch(e.key){case"ArrowDown":e.preventDefault(),A(e=>{let t=e+1;for(;t<j.length&&j[t].disabled;)t++;return t<j.length?t:e});break;case"ArrowUp":e.preventDefault(),A(e=>{let t=e-1;for(;t>=0&&j[t].disabled;)t--;return t>=0?t:e});break;case"Enter":e.preventDefault(),I>=0&&I<j.length?V(j[I]):h&&D&&(n?.(D),F(!1));break;case"Escape":F(!1),A(-1)}else F(!0)},className:At("w-full bg-transparent border-none outline-none text-sm py-2.5 px-3","placeholder:opacity-50"),style:{color:w.text}}),l&&/* @__PURE__ */x("span",{className:At("pr-3"),children:/* @__PURE__ */x(Si,{color:w.primary})})]}),q,R&&!S&&/* @__PURE__ */x("style",{children:"\n @keyframes tkxAutoFadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n "})]})}function zi({expanded:e,color:t,reducedMotion:n}){/* @__PURE__ */
273
- return x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{transform:e?"rotate(90deg)":"rotate(0deg)",transition:n?"none":"transform 150ms ease",flexShrink:0},children:/* @__PURE__ */x("path",{d:"M6 3l5 5-5 5",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Mi({checked:e,color:t,borderColor:n}){/* @__PURE__ */
274
- return x("span",{role:"presentation","aria-hidden":"true",className:At("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?t:n}`,backgroundColor:e?t:"transparent",transition:"all 100ms ease"},children:e&&/* @__PURE__ */x("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:/* @__PURE__ */x("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Ni({data:e,selected:t,onSelect:n,expanded:r,onExpand:o,multiSelect:i=!1,showCheckboxes:l=!1,showLines:s=!1,className:c,style:u}){const p=se(),h=et();d();const[g,y]=m([]),[v,w]=m([]),k=new Set(t??g),$=new Set(r??v),S=a(e=>{void 0===r&&w(e),o?.(e)},[r,o]),C=a(e=>{void 0===t&&y(e),n?.(e)},[t,n]),z=a(e=>{const t=Array.from($);$.has(e)?S(t.filter(t=>t!==e)):S([...t,e])},[$,S]),M=a(e=>{if(i){const t=Array.from(k);k.has(e)?C(t.filter(t=>t!==e)):C([...t,e])}else C(k.has(e)?[]:[e])},[i,k,C]),N=function(e,t){const n=[];return function e(r,o){for(const i of r)n.push({node:i,depth:o}),i.children?.length&&t.has(i.id)&&e(i.children,o+1)}(e,0),n}(e,$),D=f(0),P=f(/* @__PURE__ */new Map),R=e=>{D.current=e,P.current.get(e)?.focus()};/* @__PURE__ */
295
+ /* @__PURE__ */b("div",{className:At("relative flex items-center"),style:{backgroundColor:w.surface,border:`1px solid ${P?w.primary:w.border}`,borderRadius:8,transition:S?"none":"border-color 150ms ease"},children:[/* @__PURE__ */x("input",{ref:M,id:C,type:"text",role:"combobox","aria-expanded":P,"aria-controls":z,"aria-activedescendant":H,"aria-autocomplete":"list","aria-label":E,value:D,placeholder:o,onChange:e=>{const t=He(e.target.value);R(t),r?.(t),P||F(!0),A(-1),h&&n?.(t)},onFocus:()=>F(!0),onKeyDown:e=>{if(P||"ArrowDown"!==e.key&&"ArrowUp"!==e.key)switch(e.key){case"ArrowDown":e.preventDefault(),A(e=>{let t=e+1;for(;t<j.length&&j[t].disabled;)t++;return t<j.length?t:e});break;case"ArrowUp":e.preventDefault(),A(e=>{let t=e-1;for(;t>=0&&j[t].disabled;)t--;return t>=0?t:e});break;case"Enter":e.preventDefault(),I>=0&&I<j.length?V(j[I]):h&&D&&(n?.(D),F(!1));break;case"Escape":F(!1),A(-1)}else F(!0)},className:At("w-full bg-transparent border-none outline-none text-sm py-2.5 px-3","placeholder:opacity-50"),style:{color:w.text}}),l&&/* @__PURE__ */x("span",{className:At("pr-3"),children:/* @__PURE__ */x(Fi,{color:w.primary})})]}),q,P&&!S&&/* @__PURE__ */x("style",{children:"\n @keyframes tkxAutoFadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n "})]})}function Ai({expanded:e,color:t,reducedMotion:n}){/* @__PURE__ */
296
+ return x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{transform:e?"rotate(90deg)":"rotate(0deg)",transition:n?"none":"transform 150ms ease",flexShrink:0},children:/* @__PURE__ */x("path",{d:"M6 3l5 5-5 5",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Li({checked:e,color:t,borderColor:n}){/* @__PURE__ */
297
+ return x("span",{role:"presentation","aria-hidden":"true",className:At("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?t:n}`,backgroundColor:e?t:"transparent",transition:"all 100ms ease"},children:e&&/* @__PURE__ */x("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:/* @__PURE__ */x("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Ti({data:e,selected:t,onSelect:n,expanded:r,onExpand:o,multiSelect:i=!1,showCheckboxes:l=!1,showLines:s=!1,className:c,style:u}){const p=se(),h=et();d();const[g,y]=m([]),[v,w]=m([]),k=new Set(t??g),$=new Set(r??v),S=a(e=>{void 0===r&&w(e),o?.(e)},[r,o]),C=a(e=>{void 0===t&&y(e),n?.(e)},[t,n]),z=a(e=>{const t=Array.from($);$.has(e)?S(t.filter(t=>t!==e)):S([...t,e])},[$,S]),M=a(e=>{if(i){const t=Array.from(k);k.has(e)?C(t.filter(t=>t!==e)):C([...t,e])}else C(k.has(e)?[]:[e])},[i,k,C]),N=function(e,t){const n=[];return function e(r,o){for(const i of r)n.push({node:i,depth:o}),i.children?.length&&t.has(i.id)&&e(i.children,o+1)}(e,0),n}(e,$),D=f(0),R=f(/* @__PURE__ */new Map),P=e=>{D.current=e,R.current.get(e)?.focus()};/* @__PURE__ */
275
298
  return x("ul",{role:"tree","aria-label":"Tree view","aria-multiselectable":i||void 0,className:At("list-none m-0 p-0 font-sans select-none",c??""),style:{color:p.text,...u},children:N.map(({node:e,depth:t},n)=>{const r=(e.children?.length??0)>0,o=$.has(e.id),i=k.has(e.id),a=ke(e.label);/* @__PURE__ */
276
- return b("li",{role:"treeitem","aria-selected":i,"aria-expanded":r?o:void 0,"aria-disabled":e.disabled||void 0,"aria-level":t+1,"aria-setsize":N.filter(e=>e.depth===t).length,tabIndex:0===n?0:-1,ref:e=>{e?P.current.set(n,e):P.current.delete(n)},onKeyDown:e=>((e,t)=>{const n=N[t];if(!n)return;const{node:r}=n,o=(r.children?.length??0)>0;switch(e.key){case"ArrowDown":e.preventDefault(),t<N.length-1&&R(t+1);break;case"ArrowUp":e.preventDefault(),t>0&&R(t-1);break;case"ArrowRight":e.preventDefault(),o&&!$.has(r.id)?z(r.id):o&&$.has(r.id)&&t<N.length-1&&R(t+1);break;case"ArrowLeft":if(e.preventDefault(),o&&$.has(r.id))z(r.id);else for(let e=t-1;e>=0;e--)if(N[e].depth<n.depth){R(e);break}break;case"Enter":case" ":e.preventDefault(),r.disabled||M(r.id);break;case"Home":e.preventDefault(),R(0);break;case"End":e.preventDefault(),R(N.length-1)}})(e,n),onClick:()=>{e.disabled||(r&&z(e.id),M(e.id))},className:At("relative flex items-center gap-1.5 py-1 px-2 rounded-md cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",e.disabled?"opacity-50 cursor-not-allowed":""),style:{paddingLeft:24*t+8,backgroundColor:i?`${p.primary}18`:"transparent",transition:h?"none":"background-color 100ms ease",minHeight:32},onMouseEnter:t=>{i||e.disabled||(t.currentTarget.style.backgroundColor=p.surfaceAlt)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=i?`${p.primary}18`:"transparent"},children:[s&&t>0&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{position:"absolute",left:24*(t-1)+16,top:0,bottom:0,width:1,backgroundColor:p.border}}),/* @__PURE__ */x("span",r?{role:"presentation",onClick:t=>{t.stopPropagation(),z(e.id)},className:At("inline-flex items-center justify-center cursor-pointer"),style:{width:20,height:20},children:/* @__PURE__ */x(zi,{expanded:o,color:p.textMuted,reducedMotion:h})}:{style:{width:20,height:20},"aria-hidden":"true"}),l&&/* @__PURE__ */x(Mi,{checked:i,color:p.primary,borderColor:p.border}),e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:At("flex-shrink-0"),children:e.icon}),
277
- /* @__PURE__ */x("span",{className:At("text-sm truncate"),style:{color:e.disabled?p.textMuted:p.text},children:a})]},e.id)})})}ui.displayName="TkxOTP",gi.displayName="TkxCommand",bi.displayName="TkxCarousel";var Di={sm:{buttonPx:6,buttonPy:4,fontSize:12,iconSize:14,gap:2,separatorSize:16},md:{buttonPx:8,buttonPy:6,fontSize:13,iconSize:16,gap:4,separatorSize:20},lg:{buttonPx:12,buttonPy:8,fontSize:14,iconSize:18,gap:6,separatorSize:24}};function Pi({items:e,orientation:t="horizontal",size:n="md",variant:r="default",ariaLabel:o="Toolbar",className:i,style:l}){const s=se(),d=et(),c=Di[n],u="horizontal"===t,p=f(/* @__PURE__ */new Map),h=e.filter(e=>"separator"!==e.type&&!e.disabled).map(e=>e.id),m=a(e=>{p.current.get(e)?.focus()},[]),g=a((e,t)=>{const n=h.indexOf(t);if(n<0)return;const r=u?"ArrowRight":"ArrowDown",o=u?"ArrowLeft":"ArrowUp";switch(e.key){case r:e.preventDefault(),m(h[n+1<h.length?n+1:0]);break;case o:e.preventDefault(),m(h[n-1>=0?n-1:h.length-1]);break;case"Home":e.preventDefault(),m(h[0]);break;case"End":e.preventDefault(),m(h[h.length-1])}},[h,m,u]),y=e=>{e.type;const t=e.active;return{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,padding:`${c.buttonPy}px ${c.buttonPx}px`,fontSize:c.fontSize,borderRadius:6,border:"none",cursor:e.disabled?"not-allowed":"pointer",backgroundColor:t?`${s.primary}20`:"transparent",color:t?s.primary:e.disabled?s.textMuted:s.text,opacity:e.disabled?.5:1,outline:"none",transition:d?"none":"all 100ms ease",whiteSpace:"nowrap",lineHeight:1}};/* @__PURE__ */
299
+ return b("li",{role:"treeitem","aria-selected":i,"aria-expanded":r?o:void 0,"aria-disabled":e.disabled||void 0,"aria-level":t+1,"aria-setsize":N.filter(e=>e.depth===t).length,tabIndex:0===n?0:-1,ref:e=>{e?R.current.set(n,e):R.current.delete(n)},onKeyDown:e=>((e,t)=>{const n=N[t];if(!n)return;const{node:r}=n,o=(r.children?.length??0)>0;switch(e.key){case"ArrowDown":e.preventDefault(),t<N.length-1&&P(t+1);break;case"ArrowUp":e.preventDefault(),t>0&&P(t-1);break;case"ArrowRight":e.preventDefault(),o&&!$.has(r.id)?z(r.id):o&&$.has(r.id)&&t<N.length-1&&P(t+1);break;case"ArrowLeft":if(e.preventDefault(),o&&$.has(r.id))z(r.id);else for(let e=t-1;e>=0;e--)if(N[e].depth<n.depth){P(e);break}break;case"Enter":case" ":e.preventDefault(),r.disabled||M(r.id);break;case"Home":e.preventDefault(),P(0);break;case"End":e.preventDefault(),P(N.length-1)}})(e,n),onClick:()=>{e.disabled||(r&&z(e.id),M(e.id))},className:At("relative flex items-center gap-1.5 py-1 px-2 rounded-md cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",e.disabled?"opacity-50 cursor-not-allowed":""),style:{paddingLeft:24*t+8,backgroundColor:i?`${p.primary}18`:"transparent",transition:h?"none":"background-color 100ms ease",minHeight:32},onMouseEnter:t=>{i||e.disabled||(t.currentTarget.style.backgroundColor=p.surfaceAlt)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=i?`${p.primary}18`:"transparent"},children:[s&&t>0&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{position:"absolute",left:24*(t-1)+16,top:0,bottom:0,width:1,backgroundColor:p.border}}),/* @__PURE__ */x("span",r?{role:"presentation",onClick:t=>{t.stopPropagation(),z(e.id)},className:At("inline-flex items-center justify-center cursor-pointer"),style:{width:20,height:20},children:/* @__PURE__ */x(Ai,{expanded:o,color:p.textMuted,reducedMotion:h})}:{style:{width:20,height:20},"aria-hidden":"true"}),l&&/* @__PURE__ */x(Li,{checked:i,color:p.primary,borderColor:p.border}),e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:At("flex-shrink-0"),children:e.icon}),
300
+ /* @__PURE__ */x("span",{className:At("text-sm truncate"),style:{color:e.disabled?p.textMuted:p.text},children:a})]},e.id)})})}yi.displayName="TkxOTP",Si.displayName="TkxCommand",zi.displayName="TkxCarousel";var Wi={sm:{buttonPx:6,buttonPy:4,fontSize:12,iconSize:14,gap:2,separatorSize:16},md:{buttonPx:8,buttonPy:6,fontSize:13,iconSize:16,gap:4,separatorSize:20},lg:{buttonPx:12,buttonPy:8,fontSize:14,iconSize:18,gap:6,separatorSize:24}};function ji({items:e,orientation:t="horizontal",size:n="md",variant:r="default",ariaLabel:o="Toolbar",className:i,style:l}){const s=se(),d=et(),c=Wi[n],u="horizontal"===t,p=f(/* @__PURE__ */new Map),h=e.filter(e=>"separator"!==e.type&&!e.disabled).map(e=>e.id),m=a(e=>{p.current.get(e)?.focus()},[]),g=a((e,t)=>{const n=h.indexOf(t);if(n<0)return;const r=u?"ArrowRight":"ArrowDown",o=u?"ArrowLeft":"ArrowUp";switch(e.key){case r:e.preventDefault(),m(h[n+1<h.length?n+1:0]);break;case o:e.preventDefault(),m(h[n-1>=0?n-1:h.length-1]);break;case"Home":e.preventDefault(),m(h[0]);break;case"End":e.preventDefault(),m(h[h.length-1])}},[h,m,u]),y=e=>{e.type;const t=e.active;return{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,padding:`${c.buttonPy}px ${c.buttonPx}px`,fontSize:c.fontSize,borderRadius:6,border:"none",cursor:e.disabled?"not-allowed":"pointer",backgroundColor:t?`${s.primary}20`:"transparent",color:t?s.primary:e.disabled?s.textMuted:s.text,opacity:e.disabled?.5:1,outline:"none",transition:d?"none":"all 100ms ease",whiteSpace:"nowrap",lineHeight:1}};/* @__PURE__ */
278
301
  return x("div",{role:"toolbar","aria-label":o,"aria-orientation":t,className:At("inline-flex items-center rounded-lg font-sans",u?"flex-row":"flex-col",i??""),style:{...(()=>{switch(r){case"outlined":return{backgroundColor:"transparent",border:`1px solid ${s.border}`};case"filled":return{backgroundColor:s.surfaceAlt,border:"none"};default:return{backgroundColor:s.surface,border:`1px solid ${s.border}`}}})(),padding:c.gap,gap:c.gap,...l},children:e.map((e,t)=>{if("separator"===e.type)/* @__PURE__ */return x("div",{role:"separator","aria-orientation":u?"vertical":"horizontal",className:At("flex-shrink-0"),style:{...u?{width:1,height:c.separatorSize,marginLeft:2,marginRight:2}:{height:1,width:c.separatorSize,marginTop:2,marginBottom:2},backgroundColor:s.border}},e.id);const n=ke(e.label),r=!e.disabled,o=h[0]===e.id;/* @__PURE__ */
279
- return b("button",{ref:t=>{t?p.current.set(e.id,t):p.current.delete(e.id)},type:"button",role:void e.type,"aria-pressed":"toggle"===e.type?e.active:void 0,"aria-label":n,"aria-disabled":e.disabled||void 0,tabIndex:r&&o?0:-1,disabled:e.disabled,onClick:()=>{e.disabled||e.onClick?.()},onKeyDown:t=>{g(t,e.id),"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.disabled||e.onClick?.())},className:At("focus-visible:ring-2 focus-visible:ring-offset-1"),style:y(e),onMouseEnter:t=>{e.disabled||e.active||(t.currentTarget.style.backgroundColor=s.surfaceAlt)},onMouseLeave:t=>{e.disabled||(t.currentTarget.style.backgroundColor=e.active?`${s.primary}20`:"transparent")},children:[e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{width:c.iconSize,height:c.iconSize,display:"flex",alignItems:"center",justifyContent:"center"},children:e.icon}),!e.icon&&n]},e.id)})})}function Ri({color:e}){/* @__PURE__ */
280
- return b("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"6",cy:"6",r:"4.5",stroke:e,strokeWidth:"1.5"}),/* @__PURE__ */x("path",{d:"M9.5 9.5L13 13",stroke:e,strokeWidth:"1.5",strokeLinecap:"round"})]})}function Fi({checked:e,primaryColor:t,borderColor:n}){/* @__PURE__ */
281
- return x("span",{"aria-hidden":"true",className:At("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?t:n}`,backgroundColor:e?t:"transparent",transition:"all 100ms ease"},children:e&&/* @__PURE__ */x("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:/* @__PURE__ */x("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Ii({color:e}){/* @__PURE__ */
282
- return x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M3 8h10M9 4l4 4-4 4",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ai({color:e}){/* @__PURE__ */
283
- return x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M13 8H3M7 4l-4 4 4 4",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Li({title:e,items:t,selected:n,onToggle:r,onToggleAll:o,search:i,onSearchChange:a,searchable:l,height:s,listId:d}){const c=se(),u=et(),h=ke(e),f=p(()=>{if(!i)return t;const e=i.toLowerCase();return t.filter(t=>t.label.toLowerCase().includes(e))},[t,i]),m=f.filter(e=>!e.disabled),g=m.length>0&&m.every(e=>n.has(e.value));return m.some(e=>n.has(e.value)),/* @__PURE__ */b("div",{className:At("flex flex-col rounded-lg overflow-hidden flex-1 min-w-0"),style:{border:`1px solid ${c.border}`,backgroundColor:c.surface},children:[
302
+ return b("button",{ref:t=>{t?p.current.set(e.id,t):p.current.delete(e.id)},type:"button",role:void e.type,"aria-pressed":"toggle"===e.type?e.active:void 0,"aria-label":n,"aria-disabled":e.disabled||void 0,tabIndex:r&&o?0:-1,disabled:e.disabled,onClick:()=>{e.disabled||e.onClick?.()},onKeyDown:t=>{g(t,e.id),"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.disabled||e.onClick?.())},className:At("focus-visible:ring-2 focus-visible:ring-offset-1"),style:y(e),onMouseEnter:t=>{e.disabled||e.active||(t.currentTarget.style.backgroundColor=s.surfaceAlt)},onMouseLeave:t=>{e.disabled||(t.currentTarget.style.backgroundColor=e.active?`${s.primary}20`:"transparent")},children:[e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{width:c.iconSize,height:c.iconSize,display:"flex",alignItems:"center",justifyContent:"center"},children:e.icon}),!e.icon&&n]},e.id)})})}function Ei({color:e}){/* @__PURE__ */
303
+ return b("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"6",cy:"6",r:"4.5",stroke:e,strokeWidth:"1.5"}),/* @__PURE__ */x("path",{d:"M9.5 9.5L13 13",stroke:e,strokeWidth:"1.5",strokeLinecap:"round"})]})}function Bi({checked:e,primaryColor:t,borderColor:n}){/* @__PURE__ */
304
+ return x("span",{"aria-hidden":"true",className:At("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?t:n}`,backgroundColor:e?t:"transparent",transition:"all 100ms ease"},children:e&&/* @__PURE__ */x("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:/* @__PURE__ */x("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Vi({color:e}){/* @__PURE__ */
305
+ return x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M3 8h10M9 4l4 4-4 4",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Hi({color:e}){/* @__PURE__ */
306
+ return x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M13 8H3M7 4l-4 4 4 4",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Oi({title:e,items:t,selected:n,onToggle:r,onToggleAll:o,search:i,onSearchChange:a,searchable:l,height:s,listId:d}){const c=se(),u=et(),h=ke(e),f=p(()=>{if(!i)return t;const e=i.toLowerCase();return t.filter(t=>t.label.toLowerCase().includes(e))},[t,i]),m=f.filter(e=>!e.disabled),g=m.length>0&&m.every(e=>n.has(e.value));return m.some(e=>n.has(e.value)),/* @__PURE__ */b("div",{className:At("flex flex-col rounded-lg overflow-hidden flex-1 min-w-0"),style:{border:`1px solid ${c.border}`,backgroundColor:c.surface},children:[
284
307
  /* @__PURE__ */b("div",{className:At("flex items-center gap-2 px-3 py-2 border-b"),style:{borderColor:c.border,backgroundColor:c.surfaceAlt},children:[
285
- /* @__PURE__ */x("button",{type:"button","aria-label":g?`Deselect all ${h}`:`Select all ${h}`,onClick:o,className:At("border-none bg-transparent cursor-pointer p-0 outline-none focus-visible:ring-2"),children:/* @__PURE__ */x(Fi,{checked:g,primaryColor:c.primary,borderColor:c.border})}),
308
+ /* @__PURE__ */x("button",{type:"button","aria-label":g?`Deselect all ${h}`:`Select all ${h}`,onClick:o,className:At("border-none bg-transparent cursor-pointer p-0 outline-none focus-visible:ring-2"),children:/* @__PURE__ */x(Bi,{checked:g,primaryColor:c.primary,borderColor:c.border})}),
286
309
  /* @__PURE__ */x("span",{className:At("text-sm font-medium flex-1 truncate"),style:{color:c.text},children:h}),
287
- /* @__PURE__ */b("span",{className:At("text-xs"),style:{color:c.textMuted},children:[n.size,"/",t.length]})]}),l&&/* @__PURE__ */b("div",{className:At("flex items-center gap-1.5 px-3 py-1.5 border-b"),style:{borderColor:c.border},children:[/* @__PURE__ */x(Ri,{color:c.textMuted}),/* @__PURE__ */x("input",{type:"text","aria-label":`Search ${h}`,value:i,onChange:e=>a(e.target.value),placeholder:"Search...",className:At("flex-1 bg-transparent border-none outline-none text-xs"),style:{color:c.text}})]}),
310
+ /* @__PURE__ */b("span",{className:At("text-xs"),style:{color:c.textMuted},children:[n.size,"/",t.length]})]}),l&&/* @__PURE__ */b("div",{className:At("flex items-center gap-1.5 px-3 py-1.5 border-b"),style:{borderColor:c.border},children:[/* @__PURE__ */x(Ei,{color:c.textMuted}),/* @__PURE__ */x("input",{type:"text","aria-label":`Search ${h}`,value:i,onChange:e=>a(e.target.value),placeholder:"Search...",className:At("flex-1 bg-transparent border-none outline-none text-xs"),style:{color:c.text}})]}),
288
311
  /* @__PURE__ */x("ul",{id:d,role:"listbox","aria-label":h,"aria-multiselectable":"true",className:At("list-none m-0 p-1 overflow-y-auto"),style:{height:s,minHeight:100},children:0===f.length?/* @__PURE__ */x("li",{className:At("text-xs text-center py-4"),style:{color:c.textMuted},"aria-disabled":"true",children:"No items"}):f.map(e=>{const t=n.has(e.value),o=ke(e.label);/* @__PURE__ */
289
- return b("li",{role:"option","aria-selected":t,"aria-disabled":e.disabled||void 0,tabIndex:0,onClick:()=>!e.disabled&&r(e.value),onKeyDown:t=>!e.disabled&&((e,t)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r(t))})(t,e.value),className:At("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",e.disabled?"opacity-50 cursor-not-allowed":""),style:{color:e.disabled?c.textMuted:c.text,backgroundColor:t?`${c.primary}10`:"transparent",transition:u?"none":"background-color 100ms ease"},onMouseEnter:n=>{e.disabled||t||(n.currentTarget.style.backgroundColor=c.surfaceAlt)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=t?`${c.primary}10`:"transparent"},children:[/* @__PURE__ */x(Fi,{checked:t,primaryColor:c.primary,borderColor:c.border}),/* @__PURE__ */x("span",{className:At("truncate"),children:o})]},e.value)})})]})}function Ti({sourceItems:e,targetItems:t,onTransfer:n,sourceTitle:r="Available",targetTitle:o="Selected",searchable:i=!1,height:l=300,className:s,style:c}){const u=se(),p=et(),h=d(),f=d(),[g,y]=m(/* @__PURE__ */new Set),[v,w]=m(/* @__PURE__ */new Set),[k,$]=m(""),[S,C]=m(""),z=a(e=>{y(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),M=a(e=>{w(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),N=a(()=>{const t=e.filter(e=>!e.disabled).map(e=>e.value);t.every(e=>g.has(e))?y(/* @__PURE__ */new Set):y(new Set(t))},[e,g]),D=a(()=>{const e=t.filter(e=>!e.disabled).map(e=>e.value);e.every(e=>v.has(e))?w(/* @__PURE__ */new Set):w(new Set(e))},[t,v]),P=a(()=>{if(0===g.size)return;const r=e.filter(e=>g.has(e.value)&&!e.disabled);n(e.filter(e=>!g.has(e.value)||e.disabled),[...t,...r]),y(/* @__PURE__ */new Set)},[e,t,g,n]),R=a(()=>{if(0===v.size)return;const r=t.filter(e=>v.has(e.value)&&!e.disabled),o=t.filter(e=>!v.has(e.value)||e.disabled);n([...e,...r],o),w(/* @__PURE__ */new Set)},[e,t,v,n]),F=e=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:8,border:`1px solid ${u.border}`,backgroundColor:e?u.surface:u.surfaceAlt,cursor:e?"not-allowed":"pointer",opacity:e?.5:1,transition:p?"none":"all 100ms ease",outline:"none"});/* @__PURE__ */
312
+ return b("li",{role:"option","aria-selected":t,"aria-disabled":e.disabled||void 0,tabIndex:0,onClick:()=>!e.disabled&&r(e.value),onKeyDown:t=>!e.disabled&&((e,t)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r(t))})(t,e.value),className:At("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",e.disabled?"opacity-50 cursor-not-allowed":""),style:{color:e.disabled?c.textMuted:c.text,backgroundColor:t?`${c.primary}10`:"transparent",transition:u?"none":"background-color 100ms ease"},onMouseEnter:n=>{e.disabled||t||(n.currentTarget.style.backgroundColor=c.surfaceAlt)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=t?`${c.primary}10`:"transparent"},children:[/* @__PURE__ */x(Bi,{checked:t,primaryColor:c.primary,borderColor:c.border}),/* @__PURE__ */x("span",{className:At("truncate"),children:o})]},e.value)})})]})}function qi({sourceItems:e,targetItems:t,onTransfer:n,sourceTitle:r="Available",targetTitle:o="Selected",searchable:i=!1,height:l=300,className:s,style:c}){const u=se(),p=et(),h=d(),f=d(),[g,y]=m(/* @__PURE__ */new Set),[v,w]=m(/* @__PURE__ */new Set),[k,$]=m(""),[S,C]=m(""),z=a(e=>{y(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),M=a(e=>{w(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),N=a(()=>{const t=e.filter(e=>!e.disabled).map(e=>e.value);t.every(e=>g.has(e))?y(/* @__PURE__ */new Set):y(new Set(t))},[e,g]),D=a(()=>{const e=t.filter(e=>!e.disabled).map(e=>e.value);e.every(e=>v.has(e))?w(/* @__PURE__ */new Set):w(new Set(e))},[t,v]),R=a(()=>{if(0===g.size)return;const r=e.filter(e=>g.has(e.value)&&!e.disabled);n(e.filter(e=>!g.has(e.value)||e.disabled),[...t,...r]),y(/* @__PURE__ */new Set)},[e,t,g,n]),P=a(()=>{if(0===v.size)return;const r=t.filter(e=>v.has(e.value)&&!e.disabled),o=t.filter(e=>!v.has(e.value)||e.disabled);n([...e,...r],o),w(/* @__PURE__ */new Set)},[e,t,v,n]),F=e=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:8,border:`1px solid ${u.border}`,backgroundColor:e?u.surface:u.surfaceAlt,cursor:e?"not-allowed":"pointer",opacity:e?.5:1,transition:p?"none":"all 100ms ease",outline:"none"});/* @__PURE__ */
290
313
  return b("div",{className:At("flex gap-3 font-sans","flex-col sm:flex-row",s??""),style:{color:u.text,...c},children:[
291
- /* @__PURE__ */x(Li,{title:r,items:e,selected:g,onToggle:z,onToggleAll:N,search:k,onSearchChange:$,searchable:i,height:l,listId:h}),
292
- /* @__PURE__ */b("div",{className:At("flex items-center justify-center gap-2","flex-row sm:flex-col"),style:{padding:"8px 0"},children:[/* @__PURE__ */x("button",{type:"button","aria-label":"Move selected items to target list",disabled:0===g.size,onClick:P,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),P())},className:At("focus-visible:ring-2 focus-visible:ring-offset-1"),style:F(0===g.size),onMouseEnter:e=>{g.size>0&&(e.currentTarget.style.backgroundColor=u.primary,e.currentTarget.style.borderColor=u.primary)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=0===g.size?u.surface:u.surfaceAlt,e.currentTarget.style.borderColor=u.border},children:/* @__PURE__ */x(Ii,{color:u.text})}),/* @__PURE__ */x("button",{type:"button","aria-label":"Move selected items to source list",disabled:0===v.size,onClick:R,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),R())},className:At("focus-visible:ring-2 focus-visible:ring-offset-1"),style:F(0===v.size),onMouseEnter:e=>{v.size>0&&(e.currentTarget.style.backgroundColor=u.primary,e.currentTarget.style.borderColor=u.primary)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=0===v.size?u.surface:u.surfaceAlt,e.currentTarget.style.borderColor=u.border},children:/* @__PURE__ */x(Ai,{color:u.text})})]}),
293
- /* @__PURE__ */x(Li,{title:o,items:t,selected:v,onToggle:M,onToggleAll:D,search:S,onSearchChange:C,searchable:i,height:l,listId:f})]})}function Wi({color:e,rotated:t,reducedMotion:n}){/* @__PURE__ */
294
- return x("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{transform:t?"rotate(45deg)":"rotate(0deg)",transition:n?"none":"transform 200ms ease"},children:/* @__PURE__ */x("path",{d:"M12 5v14M5 12h14",stroke:e,strokeWidth:"2.5",strokeLinecap:"round"})})}var ji={"bottom-right":{bottom:24,right:24},"bottom-left":{bottom:24,left:24},"top-right":{top:24,right:24},"top-left":{top:24,left:24}};function Ei({actions:e,icon:t,direction:n="up",position:r="bottom-right",className:o,style:i}){const l=se(),c=et(),u=d(),[p,h]=m(!1),[v,w]=m(-1),k=f(null),$=f(/* @__PURE__ */new Map),S=a(()=>{h(e=>!e),w(-1)},[]),C=a(()=>{h(!1),w(-1)},[]);ot(C,p),s(()=>{if(!p)return;const e=e=>{k.current?.contains(e.target)||C()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[p,C]),s(()=>{v>=0&&$.current.get(v)?.focus()},[v]);const z=e=>c?"0ms":40*e+"ms";/* @__PURE__ */
314
+ /* @__PURE__ */x(Oi,{title:r,items:e,selected:g,onToggle:z,onToggleAll:N,search:k,onSearchChange:$,searchable:i,height:l,listId:h}),
315
+ /* @__PURE__ */b("div",{className:At("flex items-center justify-center gap-2","flex-row sm:flex-col"),style:{padding:"8px 0"},children:[/* @__PURE__ */x("button",{type:"button","aria-label":"Move selected items to target list",disabled:0===g.size,onClick:R,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),R())},className:At("focus-visible:ring-2 focus-visible:ring-offset-1"),style:F(0===g.size),onMouseEnter:e=>{g.size>0&&(e.currentTarget.style.backgroundColor=u.primary,e.currentTarget.style.borderColor=u.primary)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=0===g.size?u.surface:u.surfaceAlt,e.currentTarget.style.borderColor=u.border},children:/* @__PURE__ */x(Vi,{color:u.text})}),/* @__PURE__ */x("button",{type:"button","aria-label":"Move selected items to source list",disabled:0===v.size,onClick:P,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),P())},className:At("focus-visible:ring-2 focus-visible:ring-offset-1"),style:F(0===v.size),onMouseEnter:e=>{v.size>0&&(e.currentTarget.style.backgroundColor=u.primary,e.currentTarget.style.borderColor=u.primary)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=0===v.size?u.surface:u.surfaceAlt,e.currentTarget.style.borderColor=u.border},children:/* @__PURE__ */x(Hi,{color:u.text})})]}),
316
+ /* @__PURE__ */x(Oi,{title:o,items:t,selected:v,onToggle:M,onToggleAll:D,search:S,onSearchChange:C,searchable:i,height:l,listId:f})]})}function Ui({color:e,rotated:t,reducedMotion:n}){/* @__PURE__ */
317
+ return x("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{transform:t?"rotate(45deg)":"rotate(0deg)",transition:n?"none":"transform 200ms ease"},children:/* @__PURE__ */x("path",{d:"M12 5v14M5 12h14",stroke:e,strokeWidth:"2.5",strokeLinecap:"round"})})}var Ki={"bottom-right":{bottom:24,right:24},"bottom-left":{bottom:24,left:24},"top-right":{top:24,right:24},"top-left":{top:24,left:24}};function Yi({actions:e,icon:t,direction:n="up",position:r="bottom-right",className:o,style:i}){const l=se(),c=et(),u=d(),[p,h]=m(!1),[v,w]=m(-1),k=f(null),$=f(/* @__PURE__ */new Map),S=a(()=>{h(e=>!e),w(-1)},[]),C=a(()=>{h(!1),w(-1)},[]);ot(C,p),s(()=>{if(!p)return;const e=e=>{k.current?.contains(e.target)||C()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[p,C]),s(()=>{v>=0&&$.current.get(v)?.focus()},[v]);const z=e=>c?"0ms":40*e+"ms";/* @__PURE__ */
295
318
  return b(g,{children:[p&&"undefined"!=typeof document&&y(/* @__PURE__ */x("div",{"aria-hidden":"true",onClick:C,style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.3)",zIndex:9e3,transition:c?"none":"opacity 200ms ease"}}),document.body),
296
- /* @__PURE__ */b("div",{ref:k,className:At("fixed z-[9100] font-sans",o??""),style:{...ji[r],...i},children:[p&&e.map((t,r)=>{const o=ke(t.label),i=function(e,t){const n=64*(t+1);switch(e){case"up":return{bottom:n,left:"50%",transform:"translateX(-50%)"};case"down":return{top:n,left:"50%",transform:"translateX(-50%)"};case"left":return{right:n,top:"50%",transform:"translateY(-50%)"};case"right":return{left:n,top:"50%",transform:"translateY(-50%)"}}}(n,r),a=function(e){switch(e){case"up":case"down":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:10};case"left":case"right":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:10}}}(n);/* @__PURE__ */
319
+ /* @__PURE__ */b("div",{ref:k,className:At("fixed z-[9100] font-sans",o??""),style:{...Ki[r],...i},children:[p&&e.map((t,r)=>{const o=ke(t.label),i=function(e,t){const n=64*(t+1);switch(e){case"up":return{bottom:n,left:"50%",transform:"translateX(-50%)"};case"down":return{top:n,left:"50%",transform:"translateX(-50%)"};case"left":return{right:n,top:"50%",transform:"translateY(-50%)"};case"right":return{left:n,top:"50%",transform:"translateY(-50%)"}}}(n,r),a=function(e){switch(e){case"up":case"down":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:10};case"left":case"right":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:10}}}(n);/* @__PURE__ */
297
320
  return x("div",{className:At("absolute"),style:{...i,opacity:c?1:0,animation:c?"none":"tkxSpeedDialIn 180ms ease forwards",animationDelay:z(r)},children:/* @__PURE__ */b("div",{className:At("relative inline-flex"),children:[/* @__PURE__ */x("span",{className:At("absolute z-10 whitespace-nowrap text-xs py-1 px-2 rounded-md pointer-events-none"),style:{...a,backgroundColor:l.surfaceAlt,color:l.text,border:`1px solid ${l.border}`,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},role:"tooltip",children:o}),/* @__PURE__ */x("button",{ref:e=>{e?$.current.set(r,e):$.current.delete(r)},type:"button","aria-label":o,tabIndex:p?0:-1,onClick:()=>{t.onClick?.(),C()},onKeyDown:t=>((t,n)=>{switch(t.key){case"ArrowUp":case"ArrowLeft":t.preventDefault(),w(n>0?n-1:e.length-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),w(n<e.length-1?n+1:0);break;case"Enter":case" ":t.preventDefault(),e[n].onClick?.(),C();break;case"Escape":C();break;case"Home":t.preventDefault(),w(0);break;case"End":t.preventDefault(),w(e.length-1)}})(t,r),className:At("inline-flex items-center justify-center rounded-full border-none cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-2","shadow-lg"),style:{width:48,height:48,backgroundColor:l.surface,color:l.text,border:`1px solid ${l.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",transition:c?"none":"all 150ms ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=l.surfaceAlt,e.currentTarget.style.transform="scale(1.1)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=l.surface,e.currentTarget.style.transform="scale(1)"},children:t.icon})]})},t.id)}),
298
- /* @__PURE__ */x("button",{type:"button","aria-label":p?"Close actions menu":"Open actions menu","aria-expanded":p,"aria-controls":u,"aria-haspopup":"true",onClick:S,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S()),p&&("ArrowUp"!==e.key&&"ArrowLeft"!==e.key||(e.preventDefault(),w(0)),"ArrowDown"!==e.key&&"ArrowRight"!==e.key||(e.preventDefault(),w(0)))},className:At("inline-flex items-center justify-center rounded-full border-none cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-2"),style:{width:56,height:56,backgroundColor:l.primary,color:l.bg,boxShadow:`0 6px 20px ${l.primary}40`,transition:c?"none":"all 200ms ease",position:"relative",zIndex:1},onMouseEnter:e=>{e.currentTarget.style.boxShadow=`0 8px 28px ${l.primary}60`,c||(e.currentTarget.style.transform="scale(1.05)")},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`0 6px 20px ${l.primary}40`,e.currentTarget.style.transform="scale(1)"},children:t??/* @__PURE__ */x(Wi,{color:l.bg,rotated:p,reducedMotion:c})}),
299
- /* @__PURE__ */x("div",{id:u,role:"menu","aria-label":"Speed dial actions",style:{display:"none"},children:e.map(e=>/* @__PURE__ */x("div",{role:"menuitem",children:ke(e.label)},e.id))})]}),p&&!c&&/* @__PURE__ */x("style",{children:"\n @keyframes tkxSpeedDialIn {\n from { opacity: 0; transform: translateX(-50%) scale(0.5); }\n to { opacity: 1; transform: translateX(-50%) scale(1); }\n }\n "})]})}function Bi({open:e}){/* @__PURE__ */
321
+ /* @__PURE__ */x("button",{type:"button","aria-label":p?"Close actions menu":"Open actions menu","aria-expanded":p,"aria-controls":u,"aria-haspopup":"true",onClick:S,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S()),p&&("ArrowUp"!==e.key&&"ArrowLeft"!==e.key||(e.preventDefault(),w(0)),"ArrowDown"!==e.key&&"ArrowRight"!==e.key||(e.preventDefault(),w(0)))},className:At("inline-flex items-center justify-center rounded-full border-none cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-2"),style:{width:56,height:56,backgroundColor:l.primary,color:l.bg,boxShadow:`0 6px 20px ${l.primary}40`,transition:c?"none":"all 200ms ease",position:"relative",zIndex:1},onMouseEnter:e=>{e.currentTarget.style.boxShadow=`0 8px 28px ${l.primary}60`,c||(e.currentTarget.style.transform="scale(1.05)")},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`0 6px 20px ${l.primary}40`,e.currentTarget.style.transform="scale(1)"},children:t??/* @__PURE__ */x(Ui,{color:l.bg,rotated:p,reducedMotion:c})}),
322
+ /* @__PURE__ */x("div",{id:u,role:"menu","aria-label":"Speed dial actions",style:{display:"none"},children:e.map(e=>/* @__PURE__ */x("div",{role:"menuitem",children:ke(e.label)},e.id))})]}),p&&!c&&/* @__PURE__ */x("style",{children:"\n @keyframes tkxSpeedDialIn {\n from { opacity: 0; transform: translateX(-50%) scale(0.5); }\n to { opacity: 1; transform: translateX(-50%) scale(1); }\n }\n "})]})}function Xi({open:e}){/* @__PURE__ */
300
323
  return x("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round","aria-hidden":"true",children:/* @__PURE__ */b(g,e?{children:[/* @__PURE__ */x("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),/* @__PURE__ */x("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}:{children:[
301
324
  /* @__PURE__ */x("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),
302
325
  /* @__PURE__ */x("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),
303
- /* @__PURE__ */x("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})}function Vi({title:e,leading:t,logo:n,actions:r,navigation:o,position:i="sticky",variant:l="default",color:c="surface"}){const u=se(),p=et(),h=function(){const[e,t]=m(()=>"undefined"!=typeof window&&window.innerWidth<768);return s(()=>{if("undefined"==typeof window)return;const e=()=>t(window.innerWidth<768);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),[g,y]=m(!1),v=f(null),w=d();ot(()=>y(!1),g),s(()=>{!h&&g&&y(!1)},[h,g]),s(()=>{if(!g)return;const e=e=>{v.current&&!v.current.contains(e.target)&&y(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[g]);const k=a(()=>{y(e=>!e)},[]),$="primary"===c?u.primary:u.surface,S="primary"===c?u.bg:u.text,C={default:{backgroundColor:$,borderBottom:`1px solid ${u.border}`},transparent:{backgroundColor:"transparent",borderBottom:"none"},elevated:{backgroundColor:$,boxShadow:`0 2px 8px ${u.bg}66`,borderBottom:"none"}},z="string"==typeof e?ke(e):e,M=p?"none":"max-height 300ms cubic-bezier(0.4,0,0.2,1), opacity 300ms ease";/* @__PURE__ */
304
- return b("header",{role:"banner",className:At("font-sans w-full"),style:{...{fixed:{position:"fixed",top:0,left:0,right:0,zIndex:1100},sticky:{position:"sticky",top:0,zIndex:1100},static:{position:"static"}}[i],...C[l],color:S,height:56},children:[/* @__PURE__ */b("div",{ref:v,className:At("flex items-center h-full px-4"),style:{maxWidth:1440,margin:"0 auto"},children:[t&&/* @__PURE__ */x("div",{className:At("flex items-center shrink-0 mr-2"),children:t}),n&&/* @__PURE__ */x("div",{className:At("flex items-center shrink-0 mr-3"),"aria-hidden":"true",children:n}),z&&/* @__PURE__ */x("div",{className:At("text-base font-semibold shrink-0 mr-4 leading-snug"),style:{color:S},children:z}),!h&&o&&/* @__PURE__ */x("nav",{id:w,"aria-label":"Main navigation",className:At("flex items-center flex-1 gap-1"),children:o}),h&&/* @__PURE__ */x("div",{className:At("flex-1")}),r&&/* @__PURE__ */x("div",{className:At("flex items-center gap-2 ml-auto shrink-0"),children:r}),h&&o&&/* @__PURE__ */x("button",{onClick:k,"aria-expanded":g,"aria-controls":w,"aria-label":g?"Close navigation menu":"Open navigation menu",className:At("bg-transparent border-none cursor-pointer p-2 ml-2 rounded flex items-center justify-center","focus-visible:focus-ring"),style:{color:S},children:/* @__PURE__ */x(Bi,{open:g})})]}),h&&o&&/* @__PURE__ */x("nav",{id:w,"aria-label":"Main navigation",style:{maxHeight:g?400:0,opacity:g?1:0,overflow:"hidden",transition:M,backgroundColor:u.surface,borderBottom:g?`1px solid ${u.border}`:"none"},children:/* @__PURE__ */x("div",{className:At("flex flex-col gap-1 px-4 py-3"),role:"menu",children:o})})]})}var Hi=!1;function Oi({items:e,activeId:t,onChange:n,showLabels:r=!0}){const o=se(),i=et(),l=f(null);s(()=>{!function(){if(Hi||"undefined"==typeof document)return;Hi=!0;const e=document.createElement("style");e.id="tkx-bottom-nav-kf",e.textContent="\n @keyframes tkx-bottom-nav-pulse {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.15); }\n 100% { transform: scale(1); }\n }\n ",document.head.appendChild(e)}()},[]);const d=e.slice(0,5),c=a(e=>{n?.(e)},[n]),u=a(e=>{const t=l.current;if(!t)return;const n=Array.from(t.querySelectorAll('[role="tab"]')),r=n.findIndex(e=>e===document.activeElement);if(-1===r)return;let o=r;"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),o=(r+1)%n.length):"ArrowLeft"===e.key||"ArrowUp"===e.key?(e.preventDefault(),o=(r-1+n.length)%n.length):"Home"===e.key?(e.preventDefault(),o=0):"End"===e.key&&(e.preventDefault(),o=n.length-1),o!==r&&(n[o].focus(),c(d[o].id))},[c,d]),p=i?"none":"color 200ms ease, transform 150ms ease";/* @__PURE__ */
326
+ /* @__PURE__ */x("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})}function Zi({title:e,leading:t,logo:n,actions:r,navigation:o,position:i="sticky",variant:l="default",color:c="surface"}){const u=se(),p=et(),h=function(){const[e,t]=m(()=>"undefined"!=typeof window&&window.innerWidth<768);return s(()=>{if("undefined"==typeof window)return;const e=()=>t(window.innerWidth<768);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),[g,y]=m(!1),v=f(null),w=d();ot(()=>y(!1),g),s(()=>{!h&&g&&y(!1)},[h,g]),s(()=>{if(!g)return;const e=e=>{v.current&&!v.current.contains(e.target)&&y(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[g]);const k=a(()=>{y(e=>!e)},[]),$="primary"===c?u.primary:u.surface,S="primary"===c?u.bg:u.text,C={default:{backgroundColor:$,borderBottom:`1px solid ${u.border}`},transparent:{backgroundColor:"transparent",borderBottom:"none"},elevated:{backgroundColor:$,boxShadow:`0 2px 8px ${u.bg}66`,borderBottom:"none"}},z="string"==typeof e?ke(e):e,M=p?"none":"max-height 300ms cubic-bezier(0.4,0,0.2,1), opacity 300ms ease";/* @__PURE__ */
327
+ return b("header",{role:"banner",className:At("font-sans w-full"),style:{...{fixed:{position:"fixed",top:0,left:0,right:0,zIndex:1100},sticky:{position:"sticky",top:0,zIndex:1100},static:{position:"static"}}[i],...C[l],color:S,height:56},children:[/* @__PURE__ */b("div",{ref:v,className:At("flex items-center h-full px-4"),style:{maxWidth:1440,margin:"0 auto"},children:[t&&/* @__PURE__ */x("div",{className:At("flex items-center shrink-0 mr-2"),children:t}),n&&/* @__PURE__ */x("div",{className:At("flex items-center shrink-0 mr-3"),"aria-hidden":"true",children:n}),z&&/* @__PURE__ */x("div",{className:At("text-base font-semibold shrink-0 mr-4 leading-snug"),style:{color:S},children:z}),!h&&o&&/* @__PURE__ */x("nav",{id:w,"aria-label":"Main navigation",className:At("flex items-center flex-1 gap-1"),children:o}),h&&/* @__PURE__ */x("div",{className:At("flex-1")}),r&&/* @__PURE__ */x("div",{className:At("flex items-center gap-2 ml-auto shrink-0"),children:r}),h&&o&&/* @__PURE__ */x("button",{onClick:k,"aria-expanded":g,"aria-controls":w,"aria-label":g?"Close navigation menu":"Open navigation menu",className:At("bg-transparent border-none cursor-pointer p-2 ml-2 rounded flex items-center justify-center","focus-visible:focus-ring"),style:{color:S},children:/* @__PURE__ */x(Xi,{open:g})})]}),h&&o&&/* @__PURE__ */x("nav",{id:w,"aria-label":"Main navigation",style:{maxHeight:g?400:0,opacity:g?1:0,overflow:"hidden",transition:M,backgroundColor:u.surface,borderBottom:g?`1px solid ${u.border}`:"none"},children:/* @__PURE__ */x("div",{className:At("flex flex-col gap-1 px-4 py-3"),role:"menu",children:o})})]})}var Gi=!1;function _i({items:e,activeId:t,onChange:n,showLabels:r=!0}){const o=se(),i=et(),l=f(null);s(()=>{!function(){if(Gi||"undefined"==typeof document)return;Gi=!0;const e=document.createElement("style");e.id="tkx-bottom-nav-kf",e.textContent="\n @keyframes tkx-bottom-nav-pulse {\n 0% { transform: scale(1); }\n 50% { transform: scale(1.15); }\n 100% { transform: scale(1); }\n }\n ",document.head.appendChild(e)}()},[]);const d=e.slice(0,5),c=a(e=>{n?.(e)},[n]),u=a(e=>{const t=l.current;if(!t)return;const n=Array.from(t.querySelectorAll('[role="tab"]')),r=n.findIndex(e=>e===document.activeElement);if(-1===r)return;let o=r;"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),o=(r+1)%n.length):"ArrowLeft"===e.key||"ArrowUp"===e.key?(e.preventDefault(),o=(r-1+n.length)%n.length):"Home"===e.key?(e.preventDefault(),o=0):"End"===e.key&&(e.preventDefault(),o=n.length-1),o!==r&&(n[o].focus(),c(d[o].id))},[c,d]),p=i?"none":"color 200ms ease, transform 150ms ease";/* @__PURE__ */
305
328
  return x("nav",{ref:l,role:"navigation","aria-label":"Bottom navigation",className:At("fixed bottom-0 left-0 right-0 z-[1000] font-sans"),style:{height:56,backgroundColor:o.surface,borderTop:`1px solid ${o.border}`,boxShadow:`0 -2px 12px ${o.bg}44`},children:/* @__PURE__ */x("div",{role:"tablist","aria-label":"Navigation tabs",className:At("flex items-center justify-around h-full"),onKeyDown:u,children:d.map(e=>{const n=e.id===t,a=ke(e.label),l=n?o.primary:o.textMuted;/* @__PURE__ */
306
329
  return b("button",{role:"tab","aria-selected":n,"aria-label":a,tabIndex:n?0:-1,onClick:()=>c(e.id),className:At("flex flex-col items-center justify-center gap-0.5","bg-transparent border-none cursor-pointer p-1","flex-1 h-full relative","focus-visible:focus-ring"),style:{color:l,transition:p,outline:"none"},children:[n&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:"25%",right:"25%",height:3,borderRadius:"0 0 3px 3px",backgroundColor:o.primary,transition:i?"none":"width 200ms ease"}}),
307
- /* @__PURE__ */b("div",{className:At("relative flex items-center justify-center"),style:{animation:n&&!i?"tkx-bottom-nav-pulse 300ms ease-out":"none"},children:[e.icon,void 0!==e.badge&&e.badge>0&&/* @__PURE__ */x("span",{"aria-label":`${e.badge} notifications`,className:At("absolute flex items-center justify-center","text-[10px] font-bold leading-none rounded-full"),style:{top:-4,right:-8,minWidth:16,height:16,padding:"0 4px",backgroundColor:o.danger,color:o.bg},children:e.badge>99?"99+":e.badge})]}),r&&/* @__PURE__ */x("span",{className:At("text-[10px] leading-tight mt-0.5"),style:{fontWeight:n?600:400,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]},e.id)})})})}var qi=!1,Ui={success:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),error:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),warning:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),info:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})})},Ki={"bottom-left":{bottom:24,left:24},"bottom-center":{bottom:24,left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:24,right:24},"top-center":{top:24,left:"50%",transform:"translateX(-50%)"}};function Yi({message:e,isOpen:t,onClose:n,action:r,variant:o="default",position:i="bottom-center",autoHideDuration:l=5e3,icon:c}){const u=se(),p=et(),h=d(),g=f(null),[v,w]=m(!1),[k,$]=m(!1);s(()=>{!function(){if(qi||"undefined"==typeof document)return;qi=!0;const e=document.createElement("style");e.id="tkx-snackbar-kf",e.textContent="\n @keyframes tkx-snackbar-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tkx-snackbar-slide-down {\n from { opacity: 0; transform: translateY(-24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tkx-snackbar-fade-out {\n from { opacity: 1; }\n to { opacity: 0; transform: translateY(8px); }\n }\n ",document.head.appendChild(e)}()},[]),s(()=>{if(t)$(!1),w(!0);else if(v){if(!p){$(!0);const e=setTimeout(()=>{w(!1),$(!1)},250);return()=>clearTimeout(e)}w(!1)}},[t,p,v]),s(()=>{if(t&&!(l<=0)&&n)return g.current=setTimeout(()=>{n()},l),()=>{g.current&&clearTimeout(g.current)}},[t,l,n]);const S=a(()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),C=a(()=>{t&&l>0&&n&&(g.current=setTimeout(()=>n(),l))},[t,l,n]),z={default:u.textMuted,success:u.success,error:u.danger,warning:u.warning,info:u.info}[o],M=ke(e);if(!v||"undefined"==typeof document)return null;let N={};p||(N=k?{animation:"tkx-snackbar-fade-out 250ms ease forwards"}:{animation:("top-center"===i?"tkx-snackbar-slide-down":"tkx-snackbar-slide-up")+" 250ms cubic-bezier(0.16,1,0.3,1) both"});const D=c??Ui[o]??null;return y(/* @__PURE__ */x("div",{role:"error"===o?"alert":"status","aria-live":"error"===o?"assertive":"polite","aria-atomic":"true","aria-labelledby":h,className:At("fixed z-[9500] font-sans"),style:{...Ki[i],...N,pointerEvents:"auto"},onMouseEnter:S,onMouseLeave:C,children:/* @__PURE__ */b("div",{className:At("flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg","min-w-[280px] max-w-[480px]"),style:{backgroundColor:u.surface,border:`1px solid ${z}44`,boxShadow:`0 8px 24px ${u.bg}aa`,color:u.text},children:[D&&/* @__PURE__ */x("span",{className:At("shrink-0 flex items-center"),style:{color:z},children:D}),
308
- /* @__PURE__ */x("span",{id:h,className:At("flex-1 text-sm leading-snug"),children:M}),r&&/* @__PURE__ */x("button",{onClick:()=>{r.onClick(),n?.()},className:At("bg-transparent border-none cursor-pointer p-0 ml-2","text-sm font-semibold shrink-0","focus-visible:focus-ring"),style:{color:u.primary},children:ke(r.label)}),n&&/* @__PURE__ */x("button",{"aria-label":"Dismiss snackbar",onClick:n,className:At("bg-transparent border-none cursor-pointer rounded p-[2px] ml-1","shrink-0 flex items-center justify-center","focus-visible:focus-ring"),style:{color:u.textMuted},children:/* @__PURE__ */b("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[/* @__PURE__ */x("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),/* @__PURE__ */x("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),document.body)}function Xi({direction:e}){/* @__PURE__ */
309
- return x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:At("shrink-0 ml-1"),children:/* @__PURE__ */x("path","asc"===e?{d:"M7 14l5-5 5 5H7z"}:"desc"===e?{d:"M7 10l5 5 5-5H7z"}:{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.35"})})}function Zi({expanded:e}){/* @__PURE__ */
310
- return x("svg",{width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":"true",style:{display:"inline-block",marginRight:6,transform:e?"rotate(90deg)":"rotate(0deg)",transition:"transform 120ms ease"},children:/* @__PURE__ */x("path",{d:"M2 1l6 4-6 4z",fill:"currentColor"})})}function Gi({checked:e,indeterminate:t}){const n=se();/* @__PURE__ */
330
+ /* @__PURE__ */b("div",{className:At("relative flex items-center justify-center"),style:{animation:n&&!i?"tkx-bottom-nav-pulse 300ms ease-out":"none"},children:[e.icon,void 0!==e.badge&&e.badge>0&&/* @__PURE__ */x("span",{"aria-label":`${e.badge} notifications`,className:At("absolute flex items-center justify-center","text-[10px] font-bold leading-none rounded-full"),style:{top:-4,right:-8,minWidth:16,height:16,padding:"0 4px",backgroundColor:o.danger,color:o.bg},children:e.badge>99?"99+":e.badge})]}),r&&/* @__PURE__ */x("span",{className:At("text-[10px] leading-tight mt-0.5"),style:{fontWeight:n?600:400,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]},e.id)})})})}var Ji=!1,Qi={success:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),error:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),warning:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),info:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})})},ea={"bottom-left":{bottom:24,left:24},"bottom-center":{bottom:24,left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:24,right:24},"top-center":{top:24,left:"50%",transform:"translateX(-50%)"}};function ta({message:e,isOpen:t,onClose:n,action:r,variant:o="default",position:i="bottom-center",autoHideDuration:l=5e3,icon:c}){const u=se(),p=et(),h=d(),g=f(null),[v,w]=m(!1),[k,$]=m(!1);s(()=>{!function(){if(Ji||"undefined"==typeof document)return;Ji=!0;const e=document.createElement("style");e.id="tkx-snackbar-kf",e.textContent="\n @keyframes tkx-snackbar-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tkx-snackbar-slide-down {\n from { opacity: 0; transform: translateY(-24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tkx-snackbar-fade-out {\n from { opacity: 1; }\n to { opacity: 0; transform: translateY(8px); }\n }\n ",document.head.appendChild(e)}()},[]),s(()=>{if(t)$(!1),w(!0);else if(v){if(!p){$(!0);const e=setTimeout(()=>{w(!1),$(!1)},250);return()=>clearTimeout(e)}w(!1)}},[t,p,v]),s(()=>{if(t&&!(l<=0)&&n)return g.current=setTimeout(()=>{n()},l),()=>{g.current&&clearTimeout(g.current)}},[t,l,n]);const S=a(()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),C=a(()=>{t&&l>0&&n&&(g.current=setTimeout(()=>n(),l))},[t,l,n]),z={default:u.textMuted,success:u.success,error:u.danger,warning:u.warning,info:u.info}[o],M=ke(e);if(!v||"undefined"==typeof document)return null;let N={};p||(N=k?{animation:"tkx-snackbar-fade-out 250ms ease forwards"}:{animation:("top-center"===i?"tkx-snackbar-slide-down":"tkx-snackbar-slide-up")+" 250ms cubic-bezier(0.16,1,0.3,1) both"});const D=c??Qi[o]??null;return y(/* @__PURE__ */x("div",{role:"error"===o?"alert":"status","aria-live":"error"===o?"assertive":"polite","aria-atomic":"true","aria-labelledby":h,className:At("fixed z-[9500] font-sans"),style:{...ea[i],...N,pointerEvents:"auto"},onMouseEnter:S,onMouseLeave:C,children:/* @__PURE__ */b("div",{className:At("flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg","min-w-[280px] max-w-[480px]"),style:{backgroundColor:u.surface,border:`1px solid ${z}44`,boxShadow:`0 8px 24px ${u.bg}aa`,color:u.text},children:[D&&/* @__PURE__ */x("span",{className:At("shrink-0 flex items-center"),style:{color:z},children:D}),
331
+ /* @__PURE__ */x("span",{id:h,className:At("flex-1 text-sm leading-snug"),children:M}),r&&/* @__PURE__ */x("button",{onClick:()=>{r.onClick(),n?.()},className:At("bg-transparent border-none cursor-pointer p-0 ml-2","text-sm font-semibold shrink-0","focus-visible:focus-ring"),style:{color:u.primary},children:ke(r.label)}),n&&/* @__PURE__ */x("button",{"aria-label":"Dismiss snackbar",onClick:n,className:At("bg-transparent border-none cursor-pointer rounded p-[2px] ml-1","shrink-0 flex items-center justify-center","focus-visible:focus-ring"),style:{color:u.textMuted},children:/* @__PURE__ */b("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[/* @__PURE__ */x("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),/* @__PURE__ */x("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),document.body)}function na({direction:e}){/* @__PURE__ */
332
+ return x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:At("shrink-0 ml-1"),children:/* @__PURE__ */x("path","asc"===e?{d:"M7 14l5-5 5 5H7z"}:"desc"===e?{d:"M7 10l5 5 5-5H7z"}:{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.35"})})}function ra({expanded:e}){/* @__PURE__ */
333
+ return x("svg",{width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":"true",style:{display:"inline-block",marginRight:6,transform:e?"rotate(90deg)":"rotate(0deg)",transition:"transform 120ms ease"},children:/* @__PURE__ */x("path",{d:"M2 1l6 4-6 4z",fill:"currentColor"})})}function oa({expanded:e}){/* @__PURE__ */
334
+ return x("svg",{width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":"true",style:{display:"inline-block",transform:e?"rotate(90deg)":"rotate(0deg)",transition:"transform 120ms ease"},children:/* @__PURE__ */x("path",{d:"M2 1l6 4-6 4z",fill:"currentColor"})})}function ia({checked:e,indeterminate:t}){const n=se();/* @__PURE__ */
311
335
  return b("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[
312
- /* @__PURE__ */x("rect",{x:"1",y:"1",width:"14",height:"14",rx:"2",fill:e||t?n.primary:"transparent",stroke:e||t?n.primary:n.border,strokeWidth:"1.5"}),t&&/* @__PURE__ */x("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:n.bg,strokeWidth:"2"}),e&&!t&&/* @__PURE__ */x("path",{d:"M4.5 8L7 10.5L11.5 5.5",fill:"none",stroke:n.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function _i(e,t){return"function"==typeof t?t(e):String(e[t])}function Ji(e,t){return e[t]}function Qi(e){const t=String(e??"");return t.includes(",")||t.includes('"')||t.includes("\n")?`"${t.replace(/"/g,'""')}"`:t}function ea({colCount:e}){const t=se();/* @__PURE__ */
313
- return x("tbody",{children:Array.from({length:5},(n,r)=>/* @__PURE__ */x("tr",{children:Array.from({length:e},(e,n)=>/* @__PURE__ */x("td",{className:At("px-3 py-2"),style:{borderBottom:`1px solid ${t.border}`},children:/* @__PURE__ */x(Ln,{height:16})},n))},r))})}function ta({label:e,showExport:t,onExport:n,totalRows:r,selectedCount:o,theme:i}){return t||0!==o?/* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:`1px solid ${i.border}`,backgroundColor:i.surface,gap:8},children:[/* @__PURE__ */x("span",{style:{fontSize:13,color:i.textMuted},children:o>0?`${o} of ${r} row${1!==r?"s":""} selected`:`${r} row${1!==r?"s":""}`}),t&&/* @__PURE__ */b("button",{onClick:n,"aria-label":`Export ${e} as CSV`,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",fontSize:13,fontWeight:500,borderRadius:6,border:`1px solid ${i.border}`,backgroundColor:"transparent",color:i.text,cursor:"pointer"},children:[/* @__PURE__ */b("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[
336
+ /* @__PURE__ */x("rect",{x:"1",y:"1",width:"14",height:"14",rx:"2",fill:e||t?n.primary:"transparent",stroke:e||t?n.primary:n.border,strokeWidth:"1.5"}),t&&/* @__PURE__ */x("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:n.bg,strokeWidth:"2"}),e&&!t&&/* @__PURE__ */x("path",{d:"M4.5 8L7 10.5L11.5 5.5",fill:"none",stroke:n.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function aa(e,t){return"function"==typeof t?t(e):String(e[t])}function la(e,t){return e[t]}function sa(e,t){return null==e&&null==t?0:null==e?1:null==t?-1:"number"==typeof e&&"number"==typeof t?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:"base"})}function da(e){const t=String(e??"");return t.includes(",")||t.includes('"')||t.includes("\n")?`"${t.replace(/"/g,'""')}"`:t}function ca({colCount:e}){const t=se();/* @__PURE__ */
337
+ return x("tbody",{children:Array.from({length:5},(n,r)=>/* @__PURE__ */x("tr",{children:Array.from({length:e},(e,n)=>/* @__PURE__ */x("td",{className:At("px-3 py-2"),style:{borderBottom:`1px solid ${t.border}`},children:/* @__PURE__ */x(Ln,{height:16})},n))},r))})}function ua({label:e,showExport:t,onExport:n,totalRows:r,selectedCount:o,theme:i}){return t||0!==o?/* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:`1px solid ${i.border}`,backgroundColor:i.surface,gap:8},children:[/* @__PURE__ */x("span",{style:{fontSize:13,color:i.textMuted},children:o>0?`${o} of ${r} row${1!==r?"s":""} selected`:`${r} row${1!==r?"s":""}`}),t&&/* @__PURE__ */b("button",{onClick:n,"aria-label":`Export ${e} as CSV`,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",fontSize:13,fontWeight:500,borderRadius:6,border:`1px solid ${i.border}`,backgroundColor:"transparent",color:i.text,cursor:"pointer"},children:[/* @__PURE__ */b("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[
314
338
  /* @__PURE__ */x("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
315
339
  /* @__PURE__ */x("polyline",{points:"7 10 12 15 17 10"}),
316
- /* @__PURE__ */x("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"Export CSV"]})]}):null}function na({page:e,totalPages:t,pageSize:n,totalRows:r,onPageChange:o,theme:i}){const a=(e-1)*n+1,l=Math.min(e*n,r),s={display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:6,border:`1px solid ${i.border}`,backgroundColor:"transparent",color:i.text,cursor:"pointer",fontSize:13,fontWeight:500};/* @__PURE__ */
340
+ /* @__PURE__ */x("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"Export CSV"]})]}):null}function pa({page:e,totalPages:t,pageSize:n,totalRows:r,onPageChange:o,theme:i}){const a=(e-1)*n+1,l=Math.min(e*n,r),s={display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:6,border:`1px solid ${i.border}`,backgroundColor:"transparent",color:i.text,cursor:"pointer",fontSize:13,fontWeight:500};/* @__PURE__ */
317
341
  return b("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderTop:`1px solid ${i.border}`,backgroundColor:i.surface,gap:8,flexWrap:"wrap"},role:"navigation","aria-label":"Pagination",children:[/* @__PURE__ */x("span",{style:{fontSize:13,color:i.textMuted},children:0===r?"0 rows":`${a}–${l} of ${r}`}),/* @__PURE__ */b("div",{style:{display:"flex",gap:4},children:[
318
342
  /* @__PURE__ */x("button",{onClick:()=>o(1),disabled:1===e,"aria-label":"First page",style:{...s,opacity:1===e?.4:1},children:"«"}),
319
343
  /* @__PURE__ */x("button",{onClick:()=>o(e-1),disabled:1===e,"aria-label":"Previous page",style:{...s,opacity:1===e?.4:1},children:"‹"}),Array.from({length:Math.min(5,t)},(n,r)=>{let a=r+1;return t>5&&(a=Math.max(1,Math.min(e-Math.floor(2.5),t-4))+r),/* @__PURE__ */x("button",{onClick:()=>o(a),"aria-label":`Page ${a}`,"aria-current":a===e?"page":void 0,style:{...s,backgroundColor:a===e?i.primary:"transparent",color:a===e?i.bg:i.text,borderColor:a===e?i.primary:i.border},children:a},a)}),
320
344
  /* @__PURE__ */x("button",{onClick:()=>o(e+1),disabled:e===t,"aria-label":"Next page",style:{...s,opacity:e===t?.4:1},children:"›"}),
321
- /* @__PURE__ */x("button",{onClick:()=>o(t),disabled:e===t,"aria-label":"Last page",style:{...s,opacity:e===t?.4:1},children:"»"})]})]})}function ra({col:e,row:t,initialValue:n,onCommit:r,onCancel:o}){const i=se(),[l,c]=m(n),[u,p]=m(null),h=f(null),y=d(),v=f(!1);s(()=>{if(h.current&&(h.current.focus(),"select"in h.current&&"function"==typeof h.current.select))try{h.current.select()}catch{}},[]);const w=a(n=>{if(e.validateCell){const r=e.validateCell(n,t);if(r)return p(r),!1}return p(null),r(n),!0},[e,t,r]),k=a(e=>{"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),w(l)):"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),v.current=!0,o())},[l,w,o]),$=a(()=>{v.current?v.current=!1:w(l)},[w,l]);if("function"==typeof e.editor)/* @__PURE__ */return b(g,{children:[e.editor({value:n,row:t,onCommit:e=>w(e),onCancel:o}),u&&/* @__PURE__ */x("span",{id:y,role:"alert",style:{display:"block",marginTop:2,fontSize:11,color:"#dc2626"},children:u})]});const S=`Edit ${e.header}`,C={width:"100%",padding:"3px 6px",fontSize:13,borderRadius:4,border:`1px solid ${u?"#dc2626":i.primary}`,backgroundColor:i.bg,color:i.text,outline:"none",boxSizing:"border-box"};let z;if("select"===e.editor){const t=e.editorOptions?.options??[];z=/* @__PURE__ */x("select",{ref:e=>{h.current=e},value:l,onChange:e=>c(e.target.value),onKeyDown:k,onBlur:$,"aria-label":S,"aria-describedby":u?y:void 0,style:C,children:t.map(e=>/* @__PURE__ */x("option",{value:e.value,children:e.label},String(e.value)))})}else z="number"===e.editor?/* @__PURE__ */x("input",{ref:e=>{h.current=e},type:"number",value:null==l?"":String(l),onChange:e=>{const t=e.target.value;c(""===t?"":Number(t))},onKeyDown:k,onBlur:$,"aria-label":S,"aria-describedby":u?y:void 0,style:C}):/* @__PURE__ */x("input",{ref:e=>{h.current=e},type:"text",value:null==l?"":String(l),onChange:e=>c(e.target.value),onKeyDown:k,onBlur:$,"aria-label":S,"aria-describedby":u?y:void 0,style:C});/* @__PURE__ */
322
- return b(g,{children:[z,u&&/* @__PURE__ */x("span",{id:y,role:"alert","data-cell-error":"",style:{display:"block",marginTop:2,fontSize:11,color:"#dc2626"},children:u})]})}function oa({columns:e,data:t,rowKey:n,selectable:r=!1,selectedRows:o=[],onSelectionChange:i,sortable:l=!1,onSort:c,loading:u=!1,emptyMessage:h,stickyHeader:y=!1,striped:v=!1,bordered:w=!1,compact:k=!1,maxHeight:$,onRowClick:S,virtualScroll:C,rowHeight:z=40,showFilters:M=!1,filterValues:N,onFilterChange:D,pageSize:P=0,showExport:R=!1,exportFileName:F="export",onLoadMore:I,hasMore:A,loadingMore:L=!1,loadMoreThreshold:T=200,groupBy:W,defaultExpandedGroups:j="all",onGroupToggle:E,onCellEdit:B,onCellEditStart:V,onCellEditCancel:H}){const O=se(),q=yn(),U=h??q.noRows??q.noData??"No data to display",K=et(),Y=d(),[X,Z]=m(null),[G,_]=m("asc"),J=a(e=>{const t=X===e&&"asc"===G?"desc":"asc";Z(e),_(t),c?.(e,t)},[X,G,c]),Q=p(()=>c||!X?t:[...t].sort((e,t)=>{const n=function(e,t){return null==e&&null==t?0:null==e?1:null==t?-1:"number"==typeof e&&"number"==typeof t?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:"base"})}(Ji(e,X),Ji(t,X));return"asc"===G?n:-n}),[t,X,G,c]),[ee,te]=m({}),ne=N??ee,re=a((e,t)=>{D?D(e,t):te(n=>({...n,[e]:t}))},[D]),oe=p(()=>{const e=Object.entries(ne).filter(([,e])=>""!==e.trim());return 0===e.length?Q:Q.filter(t=>e.every(([e,n])=>{const r=Ji(t,e);return String(r??"").toLowerCase().includes(n.toLowerCase())}))},[Q,ne]),ie=p(()=>{if(W&&e.some(e=>e.key===W))return W},[W,e]),ae=p(()=>{if(!ie)return[];const e=/* @__PURE__ */new Map;for(const t of oe){const n=t[ie],r=String(n??""),o=e.get(r);o?o.push(t):e.set(r,[t])}return Array.from(e.entries()).map(([e,t])=>({key:e,rows:t}))},[oe,ie]),[le,de]=m(p(()=>"none"===j?/* @__PURE__ */new Set:Array.isArray(j)?new Set(j):/* @__PURE__ */new Set,[j])),ce=f(/* @__PURE__ */new Set);s(()=>{if(!ie||"all"!==j)return;let e=!1;de(t=>{const n=new Set(t);for(const r of ae)ce.current.has(r.key)||(ce.current.add(r.key),n.add(r.key),e=!0);return e?n:t})},[ae,ie,j]);const ue=a(e=>{de(t=>{const n=new Set(t),r=!n.has(e);return r?n.add(e):n.delete(e),E?.(e,r),n})},[E]),pe=p(()=>{if(!ie)return oe.map(e=>({type:"row",row:e}));const e=[];for(const t of ae)if(e.push({type:"group",key:t.key,rows:t.rows}),le.has(t.key))for(const n of t.rows)e.push({type:"row",row:n});return e},[ie,oe,ae,le]),[he,fe]=m(1),me=P>0,ge=pe.length,xe=me?Math.max(1,Math.ceil(ge/P)):1;s(()=>{fe(1)},[ne,X,G]);const be=p(()=>me?pe.slice((he-1)*P,he*P):pe,[pe,me,he,P]),ye=p(()=>ie?[]:me?oe.slice((he-1)*P,he*P):oe,[oe,me,he,P,ie]),ve=void 0!==C?C:!me&&void 0!==$&&ye.length>=50,we=f(null),[$e,Se]=m(0),[Ce,ze]=m(0),Me=a(()=>{we.current&&Se(we.current.scrollTop)},[]);s(()=>{if(!ve||!we.current)return;const e=we.current;ze(e.clientHeight);const t=new ResizeObserver(()=>ze(e.clientHeight));return t.observe(e),()=>t.disconnect()},[ve]),ye.length;const Ne=ve?Math.max(0,Math.floor($e/z)-10):0,De=ve?Math.min(ye.length,Math.ceil(($e+Ce)/z)+10):ye.length,Pe=ve?ye.slice(Ne,De):ye,Re=Ne*z,Fe=f(null),Ie=f(!1);s(()=>{Ie.current=!1},[t.length]),s(()=>{if(!I)return;const e=Fe.current;if(!e)return;const t=new IntersectionObserver(e=>{e[0].isIntersecting&&!Ie.current&&!1!==A&&(Ie.current=!0,I())},{root:we.current,rootMargin:`0px 0px ${T}px 0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[I,A,T]);const Ae=p(()=>new Set(o),[o]),Le=p(()=>oe.map(e=>_i(e,n)),[oe,n]),Te=Le.length>0&&Le.every(e=>Ae.has(e)),We=Le.some(e=>Ae.has(e)),je=a(()=>{i?.(Te?[]:Le)},[Te,Le,i]),Ee=a(e=>{const t=Ae.has(e)?o.filter(t=>t!==e):[...o,e];i?.(t)},[Ae,o,i]),[Be,Ve]=m({}),He=f(null),Oe=p(()=>{const t={},n=e.filter(e=>"left"===e.pinned),o=e.filter(e=>"right"===e.pinned),i=e=>{const t=Be[e.key]??e.width;if("number"==typeof t)return t;if("string"==typeof t){const e=parseFloat(t);if(!Number.isNaN(e))return e}return 150};let a=r?40:0;n.forEach((e,r)=>{t[e.key]={side:"left",offset:a,isEdge:r===n.length-1},a+=i(e)});let l=0;for(let e=o.length-1;e>=0;e--){const n=o[e];t[n.key]={side:"right",offset:l,isEdge:0===e},l+=i(n)}return t},[e,Be,r]),qe=Object.keys(Oe).length>0,[Ue,Ke]=m(!1),[Ye,Xe]=m(!1),Ze=f(null),Ge=a(()=>{const e=we.current;e&&(Ke(e.scrollLeft>0),Xe(e.scrollLeft+e.clientWidth<e.scrollWidth-1))},[]),_e=a(()=>{null==Ze.current&&(Ze.current=requestAnimationFrame(()=>{Ze.current=null,Ge()}))},[Ge]);s(()=>{if(qe)return Ge(),()=>{null!=Ze.current&&cancelAnimationFrame(Ze.current)}},[qe,Ge,e.length]);const Je=a((e,t)=>{const n=Oe[e.key];if(!n)return{};const r="left"===n.side&&n.isEdge&&Ue,o="right"===n.side&&n.isEdge&&Ye,i=r?"2px 0 4px rgba(0,0,0,0.15)":o?"-2px 0 4px rgba(0,0,0,0.15)":void 0;return{position:"sticky",[n.side]:n.offset,zIndex:t?3:2,backgroundColor:O.surface,boxShadow:i}},[Oe,Ue,Ye,O.surface]),Qe=a((e,t)=>{t.preventDefault(),t.stopPropagation();const n=t.target.closest("th");if(!n)return;const r=Be[e]||n.getBoundingClientRect().width;He.current={key:e,startX:t.clientX,startWidth:r};const o=e=>{if(!He.current)return;const t=Math.max(50,He.current.startWidth+e.clientX-He.current.startX);Ve(e=>({...e,[He.current.key]:t}))},i=()=>{He.current=null,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)},[Be]),tt=a(()=>{const t=[e.map(e=>Qi(e.header)).join(","),...oe.map(t=>e.map(e=>Qi(Ji(t,e.key))).join(","))].join("\n"),n=new Blob([t],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${F}.csv`,o.click(),URL.revokeObjectURL(r)},[e,oe,F]),[nt,rt]=m(null),[ot,it]=m(null),at=f(null),lt=f(/* @__PURE__ */new Map),st=f(!1),dt=a((e,t)=>{if(null==e.editable||!1===e.editable)return!1;if("function"==typeof e.editable)try{return e.editable(t)}catch{return!1}return!0===e.editable},[]),ct=a((e,t,n)=>{"undefined"!==e&&"null"!==e&&""!==e?(rt({rowId:e,columnKey:t.key}),V?.({rowId:e,columnKey:t.key,row:n})):st.current||(st.current=!0)},[V]),ut=a((e,t)=>{at.current={rowId:e,columnKey:t},rt(null)},[]);s(()=>{if(null!==nt||!at.current)return;const{rowId:e,columnKey:t}=at.current,n=`${e}::${t}`,r=lt.current.get(n);r&&r.focus(),at.current=null},[nt]);const pt=a((e,t,r)=>{const o=_i(e,n),i=Ji(e,t.key);if(i===r)return void ut(o,t.key);const a=B?.({rowId:o,columnKey:t.key,newValue:r,oldValue:i,row:e});a&&"function"==typeof a.then?(it({rowId:o,columnKey:t.key}),ut(o,t.key),a.catch(()=>{}).finally(()=>{it(e=>e&&e.rowId===o&&e.columnKey===t.key?null:e)})):ut(o,t.key)},[n,B,ut]),ht=a((e,t)=>{const r=_i(e,n);H?.({rowId:r,columnKey:t.key,row:e}),ut(r,t.key)},[n,H,ut]),ft=k?"4px":"8px",mt=k?"8px":"12px",gt=e=>{const t=Be[e.key]||e.width;return{width:null!=t?t:void 0,minWidth:null!=t?t:80,textAlign:e.align??"left",padding:`${ft} ${mt}`}},xt=w?`1px solid ${O.border}`:"none",bt=ke(U),yt=e.length+(r?1:0),vt=e.some(e=>e.filterable);/* @__PURE__ */
323
- return b("div",{role:"grid","aria-label":"Data grid","aria-rowcount":ge,id:Y,className:At("font-sans rounded-lg overflow-hidden"),style:{border:`1px solid ${O.border}`,backgroundColor:O.bg},children:[
324
- /* @__PURE__ */x(ta,{label:"data grid",showExport:R,onExport:tt,totalRows:ge,selectedCount:o.length,theme:O}),
325
- /* @__PURE__ */b("div",{ref:we,"data-scrolled-left":qe&&Ue?"":void 0,"data-scrolled-right":qe&&Ye?"":void 0,onScroll:e=>{ve&&Me(),qe&&_e()},style:{maxHeight:$??"none",overflowX:"auto",overflowY:$?"auto":"visible"},children:[
345
+ /* @__PURE__ */x("button",{onClick:()=>o(t),disabled:e===t,"aria-label":"Last page",style:{...s,opacity:e===t?.4:1},children:"»"})]})]})}function ha({col:e,row:t,initialValue:n,onCommit:r,onCancel:o}){const i=se(),[l,c]=m(n),[u,p]=m(null),h=f(null),y=d(),v=f(!1);s(()=>{if(h.current&&(h.current.focus(),"select"in h.current&&"function"==typeof h.current.select))try{h.current.select()}catch{}},[]);const w=a(n=>{if(e.validateCell){const r=e.validateCell(n,t);if(r)return p(r),!1}return p(null),r(n),!0},[e,t,r]),k=a(e=>{"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),w(l)):"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),v.current=!0,o())},[l,w,o]),$=a(()=>{v.current?v.current=!1:w(l)},[w,l]);if("function"==typeof e.editor)/* @__PURE__ */return b(g,{children:[e.editor({value:n,row:t,onCommit:e=>w(e),onCancel:o}),u&&/* @__PURE__ */x("span",{id:y,role:"alert",style:{display:"block",marginTop:2,fontSize:11,color:"#dc2626"},children:u})]});const S=`Edit ${e.header}`,C={width:"100%",padding:"3px 6px",fontSize:13,borderRadius:4,border:`1px solid ${u?"#dc2626":i.primary}`,backgroundColor:i.bg,color:i.text,outline:"none",boxSizing:"border-box"};let z;if("select"===e.editor){const t=e.editorOptions?.options??[];z=/* @__PURE__ */x("select",{ref:e=>{h.current=e},value:l,onChange:e=>c(e.target.value),onKeyDown:k,onBlur:$,"aria-label":S,"aria-describedby":u?y:void 0,style:C,children:t.map(e=>/* @__PURE__ */x("option",{value:e.value,children:e.label},String(e.value)))})}else z="number"===e.editor?/* @__PURE__ */x("input",{ref:e=>{h.current=e},type:"number",value:null==l?"":String(l),onChange:e=>{const t=e.target.value;c(""===t?"":Number(t))},onKeyDown:k,onBlur:$,"aria-label":S,"aria-describedby":u?y:void 0,style:C}):/* @__PURE__ */x("input",{ref:e=>{h.current=e},type:"text",value:null==l?"":String(l),onChange:e=>c(e.target.value),onKeyDown:k,onBlur:$,"aria-label":S,"aria-describedby":u?y:void 0,style:C});/* @__PURE__ */
346
+ return b(g,{children:[z,u&&/* @__PURE__ */x("span",{id:y,role:"alert","data-cell-error":"",style:{display:"block",marginTop:2,fontSize:11,color:"#dc2626"},children:u})]})}function fa({columns:e,data:t,rowKey:n,selectable:r=!1,selectedRows:o=[],onSelectionChange:i,sortable:l=!1,onSort:c,loading:u=!1,emptyMessage:h,stickyHeader:y=!1,striped:v=!1,bordered:w=!1,compact:k=!1,maxHeight:$,onRowClick:S,virtualScroll:C,rowHeight:z=40,showFilters:M=!1,filterValues:N,onFilterChange:D,pageSize:R=0,showExport:P=!1,exportFileName:F="export",onLoadMore:I,hasMore:A,loadingMore:L=!1,loadMoreThreshold:T=200,groupBy:W,defaultExpandedGroups:j="all",onGroupToggle:E,onCellEdit:B,onCellEditStart:V,onCellEditCancel:H,childRowsKey:O,defaultExpandedRows:q="none",onRowExpand:U,indentSize:K=24}){const Y=se(),X=yn(),Z=h??X.noRows??X.noData??"No data to display",G=et(),_=d(),[J,Q]=m(null),[ee,te]=m("asc"),ne=a(e=>{const t=J===e&&"asc"===ee?"desc":"asc";Q(e),te(t),c?.(e,t)},[J,ee,c]),re=p(()=>c||!J?t:[...t].sort((e,t)=>{const n=sa(la(e,J),la(t,J));return"asc"===ee?n:-n}),[t,J,ee,c]),[oe,ie]=m({}),ae=N??oe,le=a((e,t)=>{D?D(e,t):ie(n=>({...n,[e]:t}))},[D]),de=p(()=>{const e=Object.entries(ae).filter(([,e])=>""!==e.trim());return 0===e.length?re:re.filter(t=>e.every(([e,n])=>{const r=la(t,e);return String(r??"").toLowerCase().includes(n.toLowerCase())}))},[re,ae]),ce=p(()=>{if(W&&e.some(e=>e.key===W))return W},[W,e]),ue=p(()=>{if(!ce)return[];const e=/* @__PURE__ */new Map;for(const t of de){const n=t[ce],r=String(n??""),o=e.get(r);o?o.push(t):e.set(r,[t])}return Array.from(e.entries()).map(([e,t])=>({key:e,rows:t}))},[de,ce]),[pe,he]=m(p(()=>"none"===j?/* @__PURE__ */new Set:Array.isArray(j)?new Set(j):/* @__PURE__ */new Set,[j])),fe=f(/* @__PURE__ */new Set);s(()=>{if(!ce||"all"!==j)return;let e=!1;he(t=>{const n=new Set(t);for(const r of ue)fe.current.has(r.key)||(fe.current.add(r.key),n.add(r.key),e=!0);return e?n:t})},[ue,ce,j]);const me=a(e=>{he(t=>{const n=new Set(t),r=!n.has(e);return r?n.add(e):n.delete(e),E?.(e,r),n})},[E]),ge=p(()=>{if(!ce)return de.map(e=>({type:"row",row:e}));const e=[];for(const t of ue)if(e.push({type:"group",key:t.key,rows:t.rows}),pe.has(t.key))for(const n of t.rows)e.push({type:"row",row:n});return e},[ce,de,ue,pe]),xe=f(!1),be=f(!1),ye=f(!1),ve=p(()=>!(!O||ce&&(xe.current||(xe.current=!0),1)),[O,ce]),we=p(()=>{if(ve)return e.find(e=>e.tree)?.key},[e,ve]),$e=a((e,t,r)=>{if(!(t>32))for(const o of e){const e=o[O??""];if(Array.isArray(e)&&e.length>0){const i=aa(o,n);i&&"undefined"!==i&&"null"!==i&&r.add(i),$e(e,t+1,r)}}},[O,n]),[Se,Ce]=m(p(()=>{if(!ve)/* @__PURE__ */return new Set;if("none"===q)/* @__PURE__ */return new Set;if("all"===q){const e=/* @__PURE__ */new Set;return $e(t,0,e),e}return new Set(q.map(String))},[ve,q,t,$e])),ze=f(null);s(()=>{if(!ve)return;if("all"!==q)return;if(ze.current===t)return;ze.current=t;const e=/* @__PURE__ */new Set;$e(t,0,e),Ce(t=>{const n=new Set(t);for(const r of e)n.add(r);return n})},[ve,q,t,$e]);const Me=a(e=>{Ce(t=>{const n=new Set(t),r=!n.has(e);return r?n.add(e):n.delete(e),U?.(e,r),n})},[U]),Ne=p(()=>{if(!ve||!O)return[];const e=[];let t=!1,r=!1;const o=(i,a)=>{if(a>32)return void(t=!0);const l=0===a?i:(e=>c||!J?e:[...e].sort((e,t)=>{const n=sa(la(e,J),la(t,J));return"asc"===ee?n:-n}))(i);for(let t=0;t<l.length;t++){const i=l[t],s=aa(i,n);if(!s||"undefined"===s||"null"===s){r=!0;continue}const d=i[O],c=Array.isArray(d)?d:[],u=c.length>0,p=u&&Se.has(s);e.push({row:i,depth:a,hasChildren:u,isExpanded:p,siblingCount:l.length,siblingIndex:t,id:s}),p&&o(c,a+1)}};return o(de,0),r&&!be.current&&(be.current=!0),t&&!ye.current&&(ye.current=!0),e},[ve,O,de,Se,n,J,ee,c]),[De,Re]=m(1),Pe=R>0,Fe=ve?Ne.length:ge.length,Ie=Pe?Math.max(1,Math.ceil(Fe/R)):1;s(()=>{Re(1)},[ae,J,ee]);const Ae=p(()=>Pe?ge.slice((De-1)*R,De*R):ge,[ge,Pe,De,R]),Le=p(()=>ve?Pe?Ne.slice((De-1)*R,De*R):Ne:[],[ve,Ne,Pe,De,R]),Te=p(()=>ce||ve?[]:Pe?de.slice((De-1)*R,De*R):de,[de,Pe,De,R,ce,ve]),We=void 0!==C?C:!Pe&&void 0!==$&&Te.length>=50,je=f(null),[Ee,Be]=m(0),[Ve,He]=m(0),Oe=a(()=>{je.current&&Be(je.current.scrollTop)},[]);s(()=>{if(!We||!je.current)return;const e=je.current;He(e.clientHeight);const t=new ResizeObserver(()=>He(e.clientHeight));return t.observe(e),()=>t.disconnect()},[We]);const qe=ve?Le:Te;qe.length;const Ue=We?Math.max(0,Math.floor(Ee/z)-10):0,Ke=We?Math.min(qe.length,Math.ceil((Ee+Ve)/z)+10):qe.length,Ye=We?Te.slice(Ue,Ke):Te,Xe=ve?We?Le.slice(Ue,Ke):Le:[],Ze=Ue*z,Ge=f(null),_e=f(!1);s(()=>{_e.current=!1},[t.length]),s(()=>{if(!I)return;const e=Ge.current;if(!e)return;const t=new IntersectionObserver(e=>{e[0].isIntersecting&&!_e.current&&!1!==A&&(_e.current=!0,I())},{root:je.current,rootMargin:`0px 0px ${T}px 0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[I,A,T]);const Je=p(()=>new Set(o),[o]),Qe=p(()=>de.map(e=>aa(e,n)),[de,n]),tt=Qe.length>0&&Qe.every(e=>Je.has(e)),nt=Qe.some(e=>Je.has(e)),rt=a(()=>{i?.(tt?[]:Qe)},[tt,Qe,i]),ot=a(e=>{const t=Je.has(e)?o.filter(t=>t!==e):[...o,e];i?.(t)},[Je,o,i]),[it,at]=m({}),lt=f(null),st=p(()=>{const t={},n=e.filter(e=>"left"===e.pinned),o=e.filter(e=>"right"===e.pinned),i=e=>{const t=it[e.key]??e.width;if("number"==typeof t)return t;if("string"==typeof t){const e=parseFloat(t);if(!Number.isNaN(e))return e}return 150};let a=r?40:0;n.forEach((e,r)=>{t[e.key]={side:"left",offset:a,isEdge:r===n.length-1},a+=i(e)});let l=0;for(let e=o.length-1;e>=0;e--){const n=o[e];t[n.key]={side:"right",offset:l,isEdge:0===e},l+=i(n)}return t},[e,it,r]),dt=Object.keys(st).length>0,[ct,ut]=m(!1),[pt,ht]=m(!1),ft=f(null),mt=a(()=>{const e=je.current;e&&(ut(e.scrollLeft>0),ht(e.scrollLeft+e.clientWidth<e.scrollWidth-1))},[]),gt=a(()=>{null==ft.current&&(ft.current=requestAnimationFrame(()=>{ft.current=null,mt()}))},[mt]);s(()=>{if(dt)return mt(),()=>{null!=ft.current&&cancelAnimationFrame(ft.current)}},[dt,mt,e.length]);const xt=a((e,t)=>{const n=st[e.key];if(!n)return{};const r="left"===n.side&&n.isEdge&&ct,o="right"===n.side&&n.isEdge&&pt,i=r?"2px 0 4px rgba(0,0,0,0.15)":o?"-2px 0 4px rgba(0,0,0,0.15)":void 0;return{position:"sticky",[n.side]:n.offset,zIndex:t?3:2,backgroundColor:Y.surface,boxShadow:i}},[st,ct,pt,Y.surface]),bt=a((e,t)=>{t.preventDefault(),t.stopPropagation();const n=t.target.closest("th");if(!n)return;const r=it[e]||n.getBoundingClientRect().width;lt.current={key:e,startX:t.clientX,startWidth:r};const o=e=>{if(!lt.current)return;const t=Math.max(50,lt.current.startWidth+e.clientX-lt.current.startX);at(e=>({...e,[lt.current.key]:t}))},i=()=>{lt.current=null,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)},[it]),yt=a(()=>{const t=[e.map(e=>da(e.header)).join(","),...de.map(t=>e.map(e=>da(la(t,e.key))).join(","))].join("\n"),n=new Blob([t],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=`${F}.csv`,o.click(),URL.revokeObjectURL(r)},[e,de,F]),[vt,wt]=m(null),[kt,$t]=m(null),St=f(null),Ct=f(/* @__PURE__ */new Map),zt=f(!1),Mt=a((e,t)=>{if(null==e.editable||!1===e.editable)return!1;if("function"==typeof e.editable)try{return e.editable(t)}catch{return!1}return!0===e.editable},[]),Nt=a((e,t,n)=>{"undefined"!==e&&"null"!==e&&""!==e?(wt({rowId:e,columnKey:t.key}),V?.({rowId:e,columnKey:t.key,row:n})):zt.current||(zt.current=!0)},[V]),Dt=a((e,t)=>{St.current={rowId:e,columnKey:t},wt(null)},[]);s(()=>{if(null!==vt||!St.current)return;const{rowId:e,columnKey:t}=St.current,n=`${e}::${t}`,r=Ct.current.get(n);r&&r.focus(),St.current=null},[vt]);const Rt=a((e,t,r)=>{const o=aa(e,n),i=la(e,t.key);if(i===r)return void Dt(o,t.key);const a=B?.({rowId:o,columnKey:t.key,newValue:r,oldValue:i,row:e});a&&"function"==typeof a.then?($t({rowId:o,columnKey:t.key}),Dt(o,t.key),a.catch(()=>{}).finally(()=>{$t(e=>e&&e.rowId===o&&e.columnKey===t.key?null:e)})):Dt(o,t.key)},[n,B,Dt]),Pt=a((e,t)=>{const r=aa(e,n);H?.({rowId:r,columnKey:t.key,row:e}),Dt(r,t.key)},[n,H,Dt]),Ft=k?"4px":"8px",It=k?"8px":"12px",Lt=e=>{const t=it[e.key]||e.width;return{width:null!=t?t:void 0,minWidth:null!=t?t:80,textAlign:e.align??"left",padding:`${Ft} ${It}`}},Tt=w?`1px solid ${Y.border}`:"none",Wt=ke(Z),jt=e.length+(r?1:0),Et=e.some(e=>e.filterable);/* @__PURE__ */
347
+ return b("div",{role:ve?"treegrid":"grid","aria-label":"Data grid","aria-rowcount":Fe,id:_,className:At("font-sans rounded-lg overflow-hidden"),style:{border:`1px solid ${Y.border}`,backgroundColor:Y.bg},children:[
348
+ /* @__PURE__ */x(ua,{label:"data grid",showExport:P,onExport:yt,totalRows:Fe,selectedCount:o.length,theme:Y}),
349
+ /* @__PURE__ */b("div",{ref:je,"data-scrolled-left":dt&&ct?"":void 0,"data-scrolled-right":dt&&pt?"":void 0,onScroll:e=>{We&&Oe(),dt&&gt()},style:{maxHeight:$??"none",overflowX:"auto",overflowY:$?"auto":"visible"},children:[
326
350
  /* @__PURE__ */b("table",{className:At("w-full"),style:{borderCollapse:"separate",borderSpacing:0,tableLayout:"auto"},children:[
327
- /* @__PURE__ */b("thead",{children:[/* @__PURE__ */b("tr",{role:"row",children:[r&&/* @__PURE__ */x("th",{scope:"col",role:"columnheader",style:{position:y||qe?"sticky":"static",top:0,left:qe?0:void 0,zIndex:3,backgroundColor:O.surface,borderBottom:`2px solid ${O.border}`,borderRight:xt,padding:`${ft} ${mt}`,width:40,textAlign:"center"},children:/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},children:[/* @__PURE__ */x("input",{type:"checkbox",checked:Te,ref:e=>{e&&(e.indeterminate=We&&!Te)},onChange:je,"aria-label":Te?"Deselect all rows":"Select all rows",style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),/* @__PURE__ */x(Gi,{checked:Te,indeterminate:We&&!Te})]})}),e.map(e=>{const t=(e.sortable??l)&&!1!==e.sortable,n=X===e.key,r=ke(e.header),o=Je(e,!0),i=!!Oe[e.key];/* @__PURE__ */
328
- return x("th",{scope:"col",role:"columnheader","data-pinned":Oe[e.key]?.side,"aria-sort":n?"asc"===G?"ascending":"descending":t?"none":void 0,className:At("text-xs font-semibold uppercase tracking-wider"),style:{...gt(e),position:y||i?"sticky":"static",top:0,zIndex:i?o.zIndex:2,backgroundColor:O.surface,color:O.textMuted,borderBottom:`2px solid ${O.border}`,borderRight:xt,cursor:t?"pointer":"default",userSelect:"none",whiteSpace:"nowrap",transition:K?"none":"background-color 150ms ease",...o},onClick:t?()=>J(e.key):void 0,onKeyDown:t?t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),J(e.key))}:void 0,tabIndex:t?0:void 0,children:/* @__PURE__ */b("div",{className:At("flex items-center gap-1"),style:{position:"relative"},children:[e.renderHeader?e.renderHeader(e):r,t&&/* @__PURE__ */x(Xi,{direction:n?G:null}),e.resizable&&/* @__PURE__ */x("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize column ${r}`,className:At("cursor-col-resize shrink-0"),style:{position:"absolute",right:0,top:0,bottom:0,width:4,backgroundColor:"transparent"},onMouseDown:t=>Qe(e.key,t)})]})},e.key)})]}),(M||vt)&&/* @__PURE__ */b("tr",{role:"row","aria-label":"Column filters",children:[r&&/* @__PURE__ */x("th",{scope:"col",style:{backgroundColor:O.surfaceAlt,borderBottom:`1px solid ${O.border}`,borderRight:xt,padding:`4px ${mt}`,width:40,...qe?{position:"sticky",left:0,zIndex:2}:{}}}),e.map(e=>{const t=Oe[e.key];/* @__PURE__ */
329
- return x("th",{scope:"col","data-pinned":t?.side,style:{backgroundColor:O.surfaceAlt,borderBottom:`1px solid ${O.border}`,borderRight:xt,padding:`4px ${mt}`,...t?{position:"sticky",[t.side]:t.offset,zIndex:2}:{}},children:(e.filterable||M)&&/* @__PURE__ */x("input",{type:"text",value:ne[e.key]??"",onChange:t=>re(e.key,t.target.value),placeholder:`${q.filterPlaceholder.replace(/[.…]+$/,"")} ${e.header}…`,"aria-label":`Filter by ${e.header}`,style:{width:"100%",padding:"3px 8px",fontSize:12,borderRadius:4,border:`1px solid ${O.border}`,backgroundColor:O.bg,color:O.text,outline:"none"}})},e.key)})]})]}),u&&/* @__PURE__ */x(ea,{colCount:yt}),!u&&/* @__PURE__ */x("tbody",{children:0===be.length?/* @__PURE__ */x("tr",{children:/* @__PURE__ */x("td",{colSpan:yt,className:At("text-center py-10"),style:{color:O.textMuted},children:bt})}):ie?/* @__PURE__ */x(g,{children:be.map((t,o)=>{if("group"===t.type){const n=le.has(t.key),o=`${Y}-group-${t.key}`;/* @__PURE__ */
330
- return b("tr",{role:"row","data-group-row":"","data-group-key":t.key,tabIndex:0,onClick:()=>ue(t.key),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),ue(t.key))},style:{backgroundColor:O.surfaceAlt,cursor:"pointer",fontWeight:600},children:[r&&/* @__PURE__ */x("td",{style:{borderBottom:`1px solid ${O.border}`,borderRight:xt,padding:`${ft} ${mt}`,width:40,backgroundColor:O.surfaceAlt,...qe?{position:"sticky",left:0,zIndex:2}:{}}}),e.map((e,r)=>{const i=Je(e,!1),a=!!Oe[e.key],l=function(e,t){const n=e.aggregate;if(null==n)return;if("function"==typeof n)try{return n(t)}catch{return}if("count"===n)return t.length;const r=[];for(const o of t){const t=o[e.key],n="number"==typeof t?t:Number(t);Number.isFinite(n)&&r.push(n)}if(0!==r.length)switch(n){case"sum":return r.reduce((e,t)=>e+t,0);case"avg":return r.reduce((e,t)=>e+t,0)/r.length;case"min":return Math.min(...r);case"max":return Math.max(...r);default:return}}(e,t.rows),s=0===r;/* @__PURE__ */
331
- return x("td",{role:s?"rowheader":"gridcell","data-pinned":Oe[e.key]?.side,"aria-expanded":s?n:void 0,"aria-controls":s?o:void 0,className:At("text-sm"),style:{...gt(e),borderBottom:`1px solid ${O.border}`,borderRight:xt,color:O.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",...i,...a?{backgroundColor:O.surfaceAlt}:{}},children:s?/* @__PURE__ */b("span",{children:[
332
- /* @__PURE__ */x(Zi,{expanded:n}),ke(t.key)||"(empty)",
333
- /* @__PURE__ */b("span",{style:{marginLeft:8,fontWeight:400,color:O.textMuted,fontSize:12},children:["(",t.rows.length," row",1!==t.rows.length?"s":"",")"]}),void 0!==l&&e.key!==ie&&/* @__PURE__ */x("span",{style:{marginLeft:12,fontWeight:400,color:O.textMuted,fontSize:12},"data-group-agg":e.key,children:String(l)})]}):void 0!==l?/* @__PURE__ */x("span",{"data-group-agg":e.key,children:String(l)}):null},e.key)})]},`group:${t.key}`)}const i=t.row,a=o,l=_i(i,n),s=Ae.has(l),d=v&&a%2==1;let c="transparent";return s?c=`${O.primary}22`:d&&(c=O.surfaceAlt),/* @__PURE__ */b("tr",{role:"row","aria-rowindex":a+1,"aria-selected":r?s:void 0,"data-group-key":String(i[ie]??""),onClick:S?()=>S(i):void 0,onKeyDown:S?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S(i))}:void 0,tabIndex:S?0:void 0,className:At(S?"cursor-pointer":""),style:{backgroundColor:c,transition:K?"none":"background-color 120ms ease"},children:[r&&/* @__PURE__ */x("td",{role:"gridcell",style:{borderBottom:`1px solid ${O.border}`,borderRight:xt,padding:`${ft} ${mt}`,textAlign:"center",width:40,...qe?{position:"sticky",left:0,zIndex:2,backgroundColor:O.surface}:{}},children:/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[/* @__PURE__ */x("input",{type:"checkbox",checked:s,onChange:()=>Ee(l),"aria-label":s?`Deselect row ${l}`:`Select row ${l}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),/* @__PURE__ */x(Gi,{checked:s})]})}),e.map(e=>{const t=Ji(i,e.key),n=e.renderCell?e.renderCell(t,i):"string"==typeof t?ke(t):String(t??""),r=Je(e,!1),o=dt(e,i),a=nt?.rowId===l&&nt.columnKey===e.key,s=ot?.rowId===l&&ot.columnKey===e.key,d=`${l}::${e.key}`;/* @__PURE__ */
334
- return x("td",{role:"gridcell","data-pinned":Oe[e.key]?.side,"data-editing":a?"":void 0,"data-saving":s?"":void 0,"aria-readonly":o?"false":void 0,tabIndex:o?0:void 0,ref:e=>{e?lt.current.set(d,e):lt.current.delete(d)},onDoubleClick:o&&!a?t=>{t.stopPropagation(),ct(l,e,i)}:void 0,onKeyDown:o&&!a?t=>{"Enter"!==t.key&&"F2"!==t.key||(t.preventDefault(),t.stopPropagation(),ct(l,e,i))}:void 0,className:At("text-sm"),style:{...gt(e),borderBottom:`1px solid ${O.border}`,borderRight:xt,color:O.text,overflow:a?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:a?"normal":"nowrap",opacity:s?.6:1,cursor:o&&!a?"text":void 0,...r},children:a?/* @__PURE__ */x(ra,{col:e,row:i,initialValue:t,onCommit:t=>pt(i,e,t),onCancel:()=>ht(i,e)}):n},e.key)})]},l)})}):/* @__PURE__ */b(g,{children:[ve&&Re>0&&/* @__PURE__ */x("tr",{"aria-hidden":"true",children:/* @__PURE__ */x("td",{colSpan:yt,style:{height:Re,padding:0,border:"none"}})}),Pe.map((t,o)=>{const i=Ne+o,a=_i(t,n),l=Ae.has(a),s=v&&i%2==1;let d="transparent";return l?d=`${O.primary}22`:s&&(d=O.surfaceAlt),/* @__PURE__ */b("tr",{role:"row","aria-rowindex":i+1,"aria-selected":r?l:void 0,onClick:S?()=>S(t):void 0,onKeyDown:S?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S(t))}:void 0,tabIndex:S?0:void 0,className:At(S?"cursor-pointer":""),style:{backgroundColor:d,transition:K?"none":"background-color 120ms ease",...ve?{height:z,boxSizing:"border-box"}:{}},onMouseEnter:S?e=>{e.currentTarget.style.backgroundColor=l?`${O.primary}30`:O.surfaceAlt}:void 0,onMouseLeave:S?e=>{e.currentTarget.style.backgroundColor=d}:void 0,children:[r&&/* @__PURE__ */x("td",{role:"gridcell",style:{borderBottom:`1px solid ${O.border}`,borderRight:xt,padding:`${ft} ${mt}`,textAlign:"center",width:40,...qe?{position:"sticky",left:0,zIndex:2,backgroundColor:O.surface}:{}},children:/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[/* @__PURE__ */x("input",{type:"checkbox",checked:l,onChange:()=>Ee(a),"aria-label":l?`Deselect row ${a}`:`Select row ${a}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),/* @__PURE__ */x(Gi,{checked:l})]})}),e.map(e=>{const n=Ji(t,e.key),r=e.renderCell?e.renderCell(n,t):"string"==typeof n?ke(n):String(n??""),o=Je(e,!1),i=dt(e,t),l=nt?.rowId===a&&nt.columnKey===e.key,s=ot?.rowId===a&&ot.columnKey===e.key,d=`${a}::${e.key}`;/* @__PURE__ */
335
- return x("td",{role:"gridcell","data-pinned":Oe[e.key]?.side,"data-editing":l?"":void 0,"data-saving":s?"":void 0,"aria-readonly":i?"false":void 0,tabIndex:i?0:void 0,ref:e=>{e?lt.current.set(d,e):lt.current.delete(d)},onDoubleClick:i&&!l?n=>{n.stopPropagation(),ct(a,e,t)}:void 0,onKeyDown:i&&!l?n=>{"Enter"!==n.key&&"F2"!==n.key||(n.preventDefault(),n.stopPropagation(),ct(a,e,t))}:void 0,className:At("text-sm"),style:{...gt(e),borderBottom:`1px solid ${O.border}`,borderRight:xt,color:O.text,overflow:l?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:l?"normal":"nowrap",opacity:s?.6:1,cursor:i&&!l?"text":void 0,...o},children:l?/* @__PURE__ */x(ra,{col:e,row:t,initialValue:n,onCommit:n=>pt(t,e,n),onCancel:()=>ht(t,e)}):r},e.key)})]},a)}),ve&&De<ye.length&&/* @__PURE__ */x("tr",{"aria-hidden":"true",children:/* @__PURE__ */x("td",{colSpan:yt,style:{height:(ye.length-De)*z,padding:0,border:"none"}})})]})})]}),(A||L)&&/* @__PURE__ */x("div",{ref:Fe,style:{height:1,width:"100%"},children:L&&/* @__PURE__ */x("table",{style:{width:"100%",borderCollapse:"collapse"},children:/* @__PURE__ */x("tbody",{children:Array.from({length:3},(t,n)=>/* @__PURE__ */x("tr",{children:e.map(e=>/* @__PURE__ */x("td",{style:{padding:"10px 16px"},children:/* @__PURE__ */x(Ln,{variant:"text",height:"16px"})},e.key))},n))})})}),!A&&I&&/* @__PURE__ */x("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:O.textMuted},children:"✓ All rows loaded"})]}),me&&!u&&/* @__PURE__ */x(na,{page:he,totalPages:xe,pageSize:P,totalRows:ge,onPageChange:fe,theme:O})]})}var ia=!1;function aa({columns:e,gap:n=16,children:r}){se();const o=et(),i=function(){const[e,t]=m(()=>{if("undefined"==typeof window)return"lg";const e=window.innerWidth;return e>=1024?"lg":e>=768?"md":"sm"});return s(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth;t(e>=1024?"lg":e>=768?"md":"sm")};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}();s(()=>{!function(){if(ia||"undefined"==typeof document)return;ia=!0;const e=document.createElement("style");e.id="tkx-masonry-kf",e.textContent="\n @keyframes tkx-masonry-fade-in {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n ",document.head.appendChild(e)}()},[]);const a=function(e,t){return void 0===e?3:"number"==typeof e?Math.max(1,e):"lg"===t?e.lg??e.md??e.sm??3:"md"===t?e.md??e.sm??2:e.sm??1}(e,i),l=t.toArray(r),d=p(()=>{const e=Array.from({length:a},()=>[]);return l.forEach((t,n)=>{e[n%a].push(t)}),e},[l,a]);/* @__PURE__ */
351
+ /* @__PURE__ */b("thead",{children:[/* @__PURE__ */b("tr",{role:"row",children:[r&&/* @__PURE__ */x("th",{scope:"col",role:"columnheader",style:{position:y||dt?"sticky":"static",top:0,left:dt?0:void 0,zIndex:3,backgroundColor:Y.surface,borderBottom:`2px solid ${Y.border}`,borderRight:Tt,padding:`${Ft} ${It}`,width:40,textAlign:"center"},children:/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},children:[/* @__PURE__ */x("input",{type:"checkbox",checked:tt,ref:e=>{e&&(e.indeterminate=nt&&!tt)},onChange:rt,"aria-label":tt?"Deselect all rows":"Select all rows",style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),/* @__PURE__ */x(ia,{checked:tt,indeterminate:nt&&!tt})]})}),e.map(e=>{const t=(e.sortable??l)&&!1!==e.sortable,n=J===e.key,r=ke(e.header),o=xt(e,!0),i=!!st[e.key];/* @__PURE__ */
352
+ return x("th",{scope:"col",role:"columnheader","data-pinned":st[e.key]?.side,"aria-sort":n?"asc"===ee?"ascending":"descending":t?"none":void 0,className:At("text-xs font-semibold uppercase tracking-wider"),style:{...Lt(e),position:y||i?"sticky":"static",top:0,zIndex:i?o.zIndex:2,backgroundColor:Y.surface,color:Y.textMuted,borderBottom:`2px solid ${Y.border}`,borderRight:Tt,cursor:t?"pointer":"default",userSelect:"none",whiteSpace:"nowrap",transition:G?"none":"background-color 150ms ease",...o},onClick:t?()=>ne(e.key):void 0,onKeyDown:t?t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),ne(e.key))}:void 0,tabIndex:t?0:void 0,children:/* @__PURE__ */b("div",{className:At("flex items-center gap-1"),style:{position:"relative"},children:[e.renderHeader?e.renderHeader(e):r,t&&/* @__PURE__ */x(na,{direction:n?ee:null}),e.resizable&&/* @__PURE__ */x("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize column ${r}`,className:At("cursor-col-resize shrink-0"),style:{position:"absolute",right:0,top:0,bottom:0,width:4,backgroundColor:"transparent"},onMouseDown:t=>bt(e.key,t)})]})},e.key)})]}),(M||Et)&&/* @__PURE__ */b("tr",{role:"row","aria-label":"Column filters",children:[r&&/* @__PURE__ */x("th",{scope:"col",style:{backgroundColor:Y.surfaceAlt,borderBottom:`1px solid ${Y.border}`,borderRight:Tt,padding:`4px ${It}`,width:40,...dt?{position:"sticky",left:0,zIndex:2}:{}}}),e.map(e=>{const t=st[e.key];/* @__PURE__ */
353
+ return x("th",{scope:"col","data-pinned":t?.side,style:{backgroundColor:Y.surfaceAlt,borderBottom:`1px solid ${Y.border}`,borderRight:Tt,padding:`4px ${It}`,...t?{position:"sticky",[t.side]:t.offset,zIndex:2}:{}},children:(e.filterable||M)&&/* @__PURE__ */x("input",{type:"text",value:ae[e.key]??"",onChange:t=>le(e.key,t.target.value),placeholder:`${X.filterPlaceholder.replace(/[.…]+$/,"")} ${e.header}…`,"aria-label":`Filter by ${e.header}`,style:{width:"100%",padding:"3px 8px",fontSize:12,borderRadius:4,border:`1px solid ${Y.border}`,backgroundColor:Y.bg,color:Y.text,outline:"none"}})},e.key)})]})]}),u&&/* @__PURE__ */x(ca,{colCount:jt}),!u&&/* @__PURE__ */x("tbody",{children:(ve?0===Ne.length:0===Ae.length)?/* @__PURE__ */x("tr",{children:/* @__PURE__ */x("td",{colSpan:jt,className:At("text-center py-10"),style:{color:Y.textMuted},children:Wt})}):ve?/* @__PURE__ */x(g,{children:Xe.map(t=>{const{row:n,depth:o,hasChildren:i,isExpanded:a,siblingCount:l,siblingIndex:s,id:d}=t,c=Je.has(d),u=v&&s%2==1;let p="transparent";return c?p=`${Y.primary}22`:u&&(p=Y.surfaceAlt),/* @__PURE__ */b("tr",{role:"row","data-tree-row":"","data-tree-depth":o,"aria-level":o+1,"aria-setsize":l,"aria-posinset":s+1,"aria-expanded":i?a:void 0,"aria-selected":r?c:void 0,onClick:S?()=>S(n):void 0,onKeyDown:S?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S(n))}:void 0,tabIndex:S?0:void 0,className:At(S?"cursor-pointer":""),style:{backgroundColor:p,transition:G?"none":"background-color 120ms ease"},children:[r&&/* @__PURE__ */x("td",{role:"gridcell",style:{borderBottom:`1px solid ${Y.border}`,borderRight:Tt,padding:`${Ft} ${It}`,textAlign:"center",width:40,...dt?{position:"sticky",left:0,zIndex:2,backgroundColor:Y.surface}:{}},children:/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[/* @__PURE__ */x("input",{type:"checkbox",checked:c,onChange:()=>ot(d),"aria-label":c?`Deselect row ${d}`:`Select row ${d}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),/* @__PURE__ */x(ia,{checked:c})]})}),e.map(e=>{const t=la(n,e.key),r=e.renderCell?e.renderCell(t,n):"string"==typeof t?ke(t):String(t??""),l=xt(e,!1),s=Mt(e,n),c=vt?.rowId===d&&vt.columnKey===e.key,u=kt?.rowId===d&&kt.columnKey===e.key,p=`${d}::${e.key}`,h=e.key===we,f="string"==typeof t&&t?t:String(d);/* @__PURE__ */
354
+ return x("td",{role:"gridcell","data-pinned":st[e.key]?.side,"data-tree-cell":h?"":void 0,"data-editing":c?"":void 0,"data-saving":u?"":void 0,"aria-readonly":s?"false":void 0,tabIndex:s?0:void 0,ref:e=>{e?Ct.current.set(p,e):Ct.current.delete(p)},onDoubleClick:s&&!c?t=>{t.stopPropagation(),Nt(d,e,n)}:void 0,onKeyDown:s&&!c?t=>{"Enter"!==t.key&&"F2"!==t.key||(t.preventDefault(),t.stopPropagation(),Nt(d,e,n))}:void 0,className:At("text-sm"),style:{...Lt(e),borderBottom:`1px solid ${Y.border}`,borderRight:Tt,color:Y.text,overflow:c?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:c?"normal":"nowrap",opacity:u?.6:1,cursor:s&&!c?"text":void 0,...l},children:c?/* @__PURE__ */x(ha,{col:e,row:n,initialValue:t,onCommit:t=>Rt(n,e,t),onCancel:()=>Pt(n,e)}):h?/* @__PURE__ */b("span",{style:{display:"inline-flex",alignItems:"center",gap:0},children:[
355
+ /* @__PURE__ */x("span",{"aria-hidden":"true",style:{display:"inline-block",width:o*K,flexShrink:0}}),i?/* @__PURE__ */x("button",{type:"button","data-tree-caret":"","aria-label":a?`Collapse ${f}`:`Expand ${f}`,onClick:e=>{e.stopPropagation(),Me(d)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),Me(d))},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:16,marginRight:6,padding:0,border:"none",background:"transparent",color:Y.text,cursor:"pointer",flexShrink:0},children:/* @__PURE__ */x(oa,{expanded:a})}):/* @__PURE__ */x("span",{"data-tree-leaf":"","aria-hidden":"true",style:{display:"inline-block",width:16,height:16,marginRight:6,flexShrink:0}}),
356
+ /* @__PURE__ */x("span",{children:r})]}):r},e.key)})]},d)})}):ce?/* @__PURE__ */x(g,{children:Ae.map((t,o)=>{if("group"===t.type){const n=pe.has(t.key),o=`${_}-group-${t.key}`;/* @__PURE__ */
357
+ return b("tr",{role:"row","data-group-row":"","data-group-key":t.key,tabIndex:0,onClick:()=>me(t.key),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),me(t.key))},style:{backgroundColor:Y.surfaceAlt,cursor:"pointer",fontWeight:600},children:[r&&/* @__PURE__ */x("td",{style:{borderBottom:`1px solid ${Y.border}`,borderRight:Tt,padding:`${Ft} ${It}`,width:40,backgroundColor:Y.surfaceAlt,...dt?{position:"sticky",left:0,zIndex:2}:{}}}),e.map((e,r)=>{const i=xt(e,!1),a=!!st[e.key],l=function(e,t){const n=e.aggregate;if(null==n)return;if("function"==typeof n)try{return n(t)}catch{return}if("count"===n)return t.length;const r=[];for(const o of t){const t=o[e.key],n="number"==typeof t?t:Number(t);Number.isFinite(n)&&r.push(n)}if(0!==r.length)switch(n){case"sum":return r.reduce((e,t)=>e+t,0);case"avg":return r.reduce((e,t)=>e+t,0)/r.length;case"min":return Math.min(...r);case"max":return Math.max(...r);default:return}}(e,t.rows),s=0===r;/* @__PURE__ */
358
+ return x("td",{role:s?"rowheader":"gridcell","data-pinned":st[e.key]?.side,"aria-expanded":s?n:void 0,"aria-controls":s?o:void 0,className:At("text-sm"),style:{...Lt(e),borderBottom:`1px solid ${Y.border}`,borderRight:Tt,color:Y.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",...i,...a?{backgroundColor:Y.surfaceAlt}:{}},children:s?/* @__PURE__ */b("span",{children:[
359
+ /* @__PURE__ */x(ra,{expanded:n}),ke(t.key)||"(empty)",
360
+ /* @__PURE__ */b("span",{style:{marginLeft:8,fontWeight:400,color:Y.textMuted,fontSize:12},children:["(",t.rows.length," row",1!==t.rows.length?"s":"",")"]}),void 0!==l&&e.key!==ce&&/* @__PURE__ */x("span",{style:{marginLeft:12,fontWeight:400,color:Y.textMuted,fontSize:12},"data-group-agg":e.key,children:String(l)})]}):void 0!==l?/* @__PURE__ */x("span",{"data-group-agg":e.key,children:String(l)}):null},e.key)})]},`group:${t.key}`)}const i=t.row,a=o,l=aa(i,n),s=Je.has(l),d=v&&a%2==1;let c="transparent";return s?c=`${Y.primary}22`:d&&(c=Y.surfaceAlt),/* @__PURE__ */b("tr",{role:"row","aria-rowindex":a+1,"aria-selected":r?s:void 0,"data-group-key":String(i[ce]??""),onClick:S?()=>S(i):void 0,onKeyDown:S?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S(i))}:void 0,tabIndex:S?0:void 0,className:At(S?"cursor-pointer":""),style:{backgroundColor:c,transition:G?"none":"background-color 120ms ease"},children:[r&&/* @__PURE__ */x("td",{role:"gridcell",style:{borderBottom:`1px solid ${Y.border}`,borderRight:Tt,padding:`${Ft} ${It}`,textAlign:"center",width:40,...dt?{position:"sticky",left:0,zIndex:2,backgroundColor:Y.surface}:{}},children:/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[/* @__PURE__ */x("input",{type:"checkbox",checked:s,onChange:()=>ot(l),"aria-label":s?`Deselect row ${l}`:`Select row ${l}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),/* @__PURE__ */x(ia,{checked:s})]})}),e.map(e=>{const t=la(i,e.key),n=e.renderCell?e.renderCell(t,i):"string"==typeof t?ke(t):String(t??""),r=xt(e,!1),o=Mt(e,i),a=vt?.rowId===l&&vt.columnKey===e.key,s=kt?.rowId===l&&kt.columnKey===e.key,d=`${l}::${e.key}`;/* @__PURE__ */
361
+ return x("td",{role:"gridcell","data-pinned":st[e.key]?.side,"data-editing":a?"":void 0,"data-saving":s?"":void 0,"aria-readonly":o?"false":void 0,tabIndex:o?0:void 0,ref:e=>{e?Ct.current.set(d,e):Ct.current.delete(d)},onDoubleClick:o&&!a?t=>{t.stopPropagation(),Nt(l,e,i)}:void 0,onKeyDown:o&&!a?t=>{"Enter"!==t.key&&"F2"!==t.key||(t.preventDefault(),t.stopPropagation(),Nt(l,e,i))}:void 0,className:At("text-sm"),style:{...Lt(e),borderBottom:`1px solid ${Y.border}`,borderRight:Tt,color:Y.text,overflow:a?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:a?"normal":"nowrap",opacity:s?.6:1,cursor:o&&!a?"text":void 0,...r},children:a?/* @__PURE__ */x(ha,{col:e,row:i,initialValue:t,onCommit:t=>Rt(i,e,t),onCancel:()=>Pt(i,e)}):n},e.key)})]},l)})}):/* @__PURE__ */b(g,{children:[We&&Ze>0&&/* @__PURE__ */x("tr",{"aria-hidden":"true",children:/* @__PURE__ */x("td",{colSpan:jt,style:{height:Ze,padding:0,border:"none"}})}),Ye.map((t,o)=>{const i=Ue+o,a=aa(t,n),l=Je.has(a),s=v&&i%2==1;let d="transparent";return l?d=`${Y.primary}22`:s&&(d=Y.surfaceAlt),/* @__PURE__ */b("tr",{role:"row","aria-rowindex":i+1,"aria-selected":r?l:void 0,onClick:S?()=>S(t):void 0,onKeyDown:S?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S(t))}:void 0,tabIndex:S?0:void 0,className:At(S?"cursor-pointer":""),style:{backgroundColor:d,transition:G?"none":"background-color 120ms ease",...We?{height:z,boxSizing:"border-box"}:{}},onMouseEnter:S?e=>{e.currentTarget.style.backgroundColor=l?`${Y.primary}30`:Y.surfaceAlt}:void 0,onMouseLeave:S?e=>{e.currentTarget.style.backgroundColor=d}:void 0,children:[r&&/* @__PURE__ */x("td",{role:"gridcell",style:{borderBottom:`1px solid ${Y.border}`,borderRight:Tt,padding:`${Ft} ${It}`,textAlign:"center",width:40,...dt?{position:"sticky",left:0,zIndex:2,backgroundColor:Y.surface}:{}},children:/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:e=>e.stopPropagation(),children:[/* @__PURE__ */x("input",{type:"checkbox",checked:l,onChange:()=>ot(a),"aria-label":l?`Deselect row ${a}`:`Select row ${a}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),/* @__PURE__ */x(ia,{checked:l})]})}),e.map(e=>{const n=la(t,e.key),r=e.renderCell?e.renderCell(n,t):"string"==typeof n?ke(n):String(n??""),o=xt(e,!1),i=Mt(e,t),l=vt?.rowId===a&&vt.columnKey===e.key,s=kt?.rowId===a&&kt.columnKey===e.key,d=`${a}::${e.key}`;/* @__PURE__ */
362
+ return x("td",{role:"gridcell","data-pinned":st[e.key]?.side,"data-editing":l?"":void 0,"data-saving":s?"":void 0,"aria-readonly":i?"false":void 0,tabIndex:i?0:void 0,ref:e=>{e?Ct.current.set(d,e):Ct.current.delete(d)},onDoubleClick:i&&!l?n=>{n.stopPropagation(),Nt(a,e,t)}:void 0,onKeyDown:i&&!l?n=>{"Enter"!==n.key&&"F2"!==n.key||(n.preventDefault(),n.stopPropagation(),Nt(a,e,t))}:void 0,className:At("text-sm"),style:{...Lt(e),borderBottom:`1px solid ${Y.border}`,borderRight:Tt,color:Y.text,overflow:l?"visible":"hidden",textOverflow:"ellipsis",whiteSpace:l?"normal":"nowrap",opacity:s?.6:1,cursor:i&&!l?"text":void 0,...o},children:l?/* @__PURE__ */x(ha,{col:e,row:t,initialValue:n,onCommit:n=>Rt(t,e,n),onCancel:()=>Pt(t,e)}):r},e.key)})]},a)}),We&&Ke<Te.length&&/* @__PURE__ */x("tr",{"aria-hidden":"true",children:/* @__PURE__ */x("td",{colSpan:jt,style:{height:(Te.length-Ke)*z,padding:0,border:"none"}})})]})})]}),(A||L)&&/* @__PURE__ */x("div",{ref:Ge,style:{height:1,width:"100%"},children:L&&/* @__PURE__ */x("table",{style:{width:"100%",borderCollapse:"collapse"},children:/* @__PURE__ */x("tbody",{children:Array.from({length:3},(t,n)=>/* @__PURE__ */x("tr",{children:e.map(e=>/* @__PURE__ */x("td",{style:{padding:"10px 16px"},children:/* @__PURE__ */x(Ln,{variant:"text",height:"16px"})},e.key))},n))})})}),!A&&I&&/* @__PURE__ */x("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:Y.textMuted},children:"✓ All rows loaded"})]}),Pe&&!u&&/* @__PURE__ */x(pa,{page:De,totalPages:Ie,pageSize:R,totalRows:Fe,onPageChange:Re,theme:Y})]})}var ma=!1;function ga({columns:e,gap:n=16,children:r}){se();const o=et(),i=function(){const[e,t]=m(()=>{if("undefined"==typeof window)return"lg";const e=window.innerWidth;return e>=1024?"lg":e>=768?"md":"sm"});return s(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth;t(e>=1024?"lg":e>=768?"md":"sm")};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}();s(()=>{!function(){if(ma||"undefined"==typeof document)return;ma=!0;const e=document.createElement("style");e.id="tkx-masonry-kf",e.textContent="\n @keyframes tkx-masonry-fade-in {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n ",document.head.appendChild(e)}()},[]);const a=function(e,t){return void 0===e?3:"number"==typeof e?Math.max(1,e):"lg"===t?e.lg??e.md??e.sm??3:"md"===t?e.md??e.sm??2:e.sm??1}(e,i),l=t.toArray(r),d=p(()=>{const e=Array.from({length:a},()=>[]);return l.forEach((t,n)=>{e[n%a].push(t)}),e},[l,a]);/* @__PURE__ */
336
363
  return x("div",{role:"list","aria-label":"Masonry grid",className:At("flex w-full"),style:{gap:n,alignItems:"flex-start"},children:d.map((e,t)=>/* @__PURE__ */x("div",{className:At("flex flex-col"),style:{flex:1,gap:n,minWidth:0},children:e.map((e,n)=>{/* @__PURE__ */
337
- return x("div",{role:"listitem",style:(r=n*a+t,o?{}:{animation:"tkx-masonry-fade-in 300ms cubic-bezier(0.16,1,0.3,1) both",animationDelay:`${Math.min(40*r,400)}ms`}),children:e},n);var r})},t))})}var la={info:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),warning:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),success:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),danger:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})})},sa={1:{fontSize:"1.75rem",fontWeight:700,lineHeight:1.25,marginTop:24,marginBottom:12},2:{fontSize:"1.375rem",fontWeight:600,lineHeight:1.3,marginTop:20,marginBottom:10},3:{fontSize:"1.1rem",fontWeight:600,lineHeight:1.35,marginTop:16,marginBottom:8}},da={heading:function({block:e}){const t=se(),n=e.level??1,r=`h${n}`,o=ke(e.content??"");/* @__PURE__ */
338
- return x(r,{className:At("m-0"),style:{...sa[n],color:t.text},children:o})},paragraph:function({block:e}){const t=se(),n=ke(e.content??"");/* @__PURE__ */
364
+ return x("div",{role:"listitem",style:(r=n*a+t,o?{}:{animation:"tkx-masonry-fade-in 300ms cubic-bezier(0.16,1,0.3,1) both",animationDelay:`${Math.min(40*r,400)}ms`}),children:e},n);var r})},t))})}var xa={info:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),warning:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),success:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),danger:/* @__PURE__ */x("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})})},ba={1:{fontSize:"1.75rem",fontWeight:700,lineHeight:1.25,marginTop:24,marginBottom:12},2:{fontSize:"1.375rem",fontWeight:600,lineHeight:1.3,marginTop:20,marginBottom:10},3:{fontSize:"1.1rem",fontWeight:600,lineHeight:1.35,marginTop:16,marginBottom:8}},ya={heading:function({block:e}){const t=se(),n=e.level??1,r=`h${n}`,o=ke(e.content??"");/* @__PURE__ */
365
+ return x(r,{className:At("m-0"),style:{...ba[n],color:t.text},children:o})},paragraph:function({block:e}){const t=se(),n=ke(e.content??"");/* @__PURE__ */
339
366
  return x("p",{className:At("m-0"),style:{fontSize:"0.938rem",lineHeight:1.7,color:t.text,marginBottom:12},children:n})},blockquote:function({block:e}){const t=se(),n=ke(e.content??"");/* @__PURE__ */
340
367
  return x("blockquote",{className:At("m-0"),style:{borderLeft:`3px solid ${t.primary}`,paddingLeft:16,paddingTop:8,paddingBottom:8,marginTop:12,marginBottom:12,backgroundColor:`${t.surfaceAlt}`,borderRadius:"0 6px 6px 0",color:t.textMuted,fontStyle:"italic",fontSize:"0.938rem",lineHeight:1.6},children:n})},code:function({block:e}){const t=se(),n=ke(e.content??""),r=e.language?ke(e.language):null;/* @__PURE__ */
341
368
  return b("div",{className:At("rounded-lg overflow-hidden"),style:{marginTop:12,marginBottom:12,border:`1px solid ${t.border}`,backgroundColor:t.surfaceAlt},children:[r&&/* @__PURE__ */x("div",{className:At("px-3 py-1 text-[11px] font-semibold uppercase tracking-wider"),style:{color:t.textMuted,borderBottom:`1px solid ${t.border}`,backgroundColor:t.surface},children:r}),/* @__PURE__ */x("pre",{className:At("m-0 p-4 overflow-x-auto"),style:{fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace",fontSize:"0.85rem",lineHeight:1.6,color:t.text,tabSize:2},children:/* @__PURE__ */x("code",{"aria-label":r?`Code block in ${r}`:"Code block",children:n})})]})},list:function({block:e}){const t=se(),n=e.ordered?"ol":"ul",r=(e.items??[]).map(e=>ke(e));/* @__PURE__ */
342
369
  return x(n,{className:At("m-0"),style:{paddingLeft:24,marginTop:8,marginBottom:12,color:t.text,fontSize:"0.938rem",lineHeight:1.7,listStyleType:e.ordered?"decimal":"disc"},role:"list",children:r.map((e,t)=>/* @__PURE__ */x("li",{role:"listitem",style:{marginBottom:4},children:e},t))})},divider:function(){/* @__PURE__ */
343
370
  return x("hr",{"aria-hidden":"true",style:{border:"none",borderTop:`1px solid ${se().border}`,marginTop:20,marginBottom:20}})},image:function({block:e}){const t=se(),n=ke(e.src??""),r=ke(e.alt??"Image");/* @__PURE__ */
344
- return b("figure",{className:At("m-0"),style:{marginTop:12,marginBottom:12},children:[/* @__PURE__ */x("img",{src:n,alt:r,loading:"lazy",className:At("rounded-lg"),style:{maxWidth:"100%",height:"auto",display:"block",border:`1px solid ${t.border}`}}),e.alt&&/* @__PURE__ */x("figcaption",{className:At("text-xs mt-2 text-center"),style:{color:t.textMuted},children:r})]})},callout:function({block:e}){const t=se(),n=e.variant??"info",r=ke(e.content??""),o={info:t.info,warning:t.warning,success:t.success,danger:t.danger}[n],i=la[n];/* @__PURE__ */
345
- return b("div",{role:{info:"note",warning:"alert",success:"status",danger:"alert"}[n],className:At("flex gap-3 px-4 py-3 rounded-lg"),style:{backgroundColor:`${o}12`,border:`1px solid ${o}33`,marginTop:12,marginBottom:12},children:[/* @__PURE__ */x("span",{className:At("shrink-0 mt-[2px]"),style:{color:o},children:i}),/* @__PURE__ */x("div",{className:At("flex-1"),style:{fontSize:"0.9rem",lineHeight:1.6,color:t.text},children:r})]})}};function ca({blocks:e,className:t,style:n}){const r=se(),o=yn(),i=et(),a=p(()=>e.map((e,t)=>{const n=da[e.type];return n?/* @__PURE__ */x("div",{style:i?void 0:{animation:"tkx-rich-text-fade-in 300ms ease both",animationDelay:`${Math.min(30*t,300)}ms`},children:/* @__PURE__ */x(n,{block:e,index:t})},t):null}),[e,i]);return p(()=>{if("undefined"==typeof document)return;if(document.getElementById("tkx-rich-text-kf"))return;const e=document.createElement("style");e.id="tkx-rich-text-kf",e.textContent="\n @keyframes tkx-rich-text-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n ",document.head.appendChild(e)},[]),/* @__PURE__ */x("article",{"aria-label":o.richTextContent??"Rich text content",className:At("font-sans",t??""),style:{color:r.text,maxWidth:720,...n},children:a})}function ua(e){const t=[];let n=0,r="";const o=()=>{r&&(t.push({kind:"text",value:r}),r="")};for(;n<e.length;){const i=e[n];if("\\"===i&&n+1<e.length)r+=e[n+1],n+=2;else{if("!"===i&&"["===e[n+1]){const r=e.indexOf("]",n+2);if(-1!==r&&"("===e[r+1]){const i=e.indexOf(")",r+2);if(-1!==i){o(),t.push({kind:"image",alt:e.slice(n+2,r),src:e.slice(r+2,i)}),n=i+1;continue}}}if("["===i){const r=pa(e,n,"[","]");if(-1!==r&&"("===e[r+1]){const i=e.indexOf(")",r+2);if(-1!==i){o(),t.push({kind:"link",href:e.slice(r+2,i).trim(),children:ua(e.slice(n+1,r))}),n=i+1;continue}}}if("<"===i){const r=e.indexOf(">",n+1);if(-1!==r){const i=e.slice(n+1,r);if(/^(https?:\/\/|mailto:)/i.test(i)||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)){o();const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)?`mailto:${i}`:i;t.push({kind:"link",href:e,children:[{kind:"text",value:i}]}),n=r+1;continue}}}if("`"===i){const r=e.indexOf("`",n+1);if(-1!==r){o(),t.push({kind:"code",value:e.slice(n+1,r)}),n=r+1;continue}}if("~"===i&&"~"===e[n+1]){const r=e.indexOf("~~",n+2);if(-1!==r){o(),t.push({kind:"strike",children:ua(e.slice(n+2,r))}),n=r+2;continue}}if("*"===i&&"*"===e[n+1]||"_"===i&&"_"===e[n+1]){const r=i+i,a=e.indexOf(r,n+2);if(-1!==a){o(),t.push({kind:"bold",children:ua(e.slice(n+2,a))}),n=a+2;continue}}if(("*"===i||"_"===i)&&e[n+1]!==i){const r=e.indexOf(i,n+1);if(-1!==r&&e.slice(n+1,r).trim().length>0){o(),t.push({kind:"italic",children:ua(e.slice(n+1,r))}),n=r+1;continue}}r+=i,n++}}return o(),t}function pa(e,t,n,r){let o=0;for(let i=t;i<e.length;i++)if("\\"!==e[i]){if(e[i]===n)o++;else if(e[i]===r&&(o--,0===o))return i}else i++;return-1}function ha(e){const t=e.replace(/^\uFEFF/,"").replace(/\r\n?/g,"\n").split("\n"),n=[];let r=0;for(;r<t.length;){const e=t[r];if(/^\s*$/.test(e)){r++;continue}const o=e.match(/^\s*```(.*)$/);if(o){const e=o[1].trim();r++;const i=[];for(;r<t.length&&!/^\s*```\s*$/.test(t[r]);)i.push(t[r]),r++;r<t.length&&r++,n.push({kind:"code",language:e,value:i.join("\n")});continue}const i=e.match(/^(#{1,6})\s+(.*?)\s*#*\s*$/);if(i){n.push({kind:"heading",level:i[1].length,inline:ua(i[2])}),r++;continue}if(/^\s*([-*_])\s*(?:\1\s*){2,}$/.test(e)){n.push({kind:"hr"}),r++;continue}if(ga(e)&&r+1<t.length&&xa(t[r+1])){const o=ba(e).map(ua),i=ya(t[r+1]);r+=2;const a=[];for(;r<t.length&&ga(t[r]);)a.push(ba(t[r]).map(ua)),r++;n.push({kind:"table",headers:o,rows:a,align:i});continue}if(/^\s*>/.test(e)){const e=[];for(;r<t.length&&/^\s*>/.test(t[r]);)e.push(t[r].replace(/^\s*>\s?/,"")),r++;n.push({kind:"blockquote",children:ha(e.join("\n"))});continue}if(fa(e)){const[e,o]=ma(t,r);n.push(e),r=o;continue}const a=[e];for(r++;r<t.length&&!/^\s*$/.test(t[r])&&!/^#{1,6}\s/.test(t[r])&&!/^\s*```/.test(t[r])&&!/^\s*>/.test(t[r])&&!fa(t[r])&&!/^\s*([-*_])\s*(?:\1\s*){2,}$/.test(t[r]);)a.push(t[r]),r++;n.push({kind:"paragraph",inline:ua(a.join(" "))})}return n}function fa(e){return/^(\s*)([-*+]|\d+[.)])\s+/.test(e)}function ma(e,t){const n=e[t].match(/^(\s*)([-*+]|\d+[.)])\s+/),r=n[1].length,o=/\d/.test(n[2]),i=[];let a=t;for(;a<e.length;){const t=e[a].match(/^(\s*)([-*+]|\d+[.)])\s+(.*)$/);if(!t||t[1].length!==r)break;const n=t[3];let o=null,l=n;const s=n.match(/^\[([ xX])\]\s+(.*)$/);s&&(o="x"===s[1].toLowerCase()?"checked":"unchecked",l=s[2]);const d=[l];for(a++;a<e.length;){if(/^\s*$/.test(e[a])){if(a+1<e.length&&/^\s+\S/.test(e[a+1])){d.push(""),a++;continue}break}const t=e[a].match(/^(\s*)(\S)/);if(!(t&&t[1].length>r))break;d.push(e[a].slice(r+2)),a++}i.push({blocks:ha(d.join("\n")),task:o})}return[{kind:"list",ordered:o,items:i},a]}function ga(e){return/^\s*\|.+\|\s*$/.test(e.trim())||e.includes("|")&&e.trim().startsWith("|")}function xa(e){return/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)+\|?\s*$/.test(e)}function ba(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())}function ya(e){return ba(e).map(e=>{const t=e.startsWith(":"),n=e.endsWith(":");return t&&n?"center":n?"right":t?"left":null})}function va(e,t,n="i"){return e.map((e,r)=>{const o=`${n}-${r}`;switch(e.kind){case"text":/* @__PURE__ */return x("span",{children:ke(e.value)},o);case"bold":/* @__PURE__ */return x("strong",{children:va(e.children,t,o)},o);case"italic":/* @__PURE__ */return x("em",{children:va(e.children,t,o)},o);case"strike":/* @__PURE__ */return x("s",{children:va(e.children,t,o)},o);case"code":/* @__PURE__ */return x("code",{style:{background:t.theme.surfaceAlt,border:`1px solid ${t.theme.border}`,borderRadius:4,padding:"0.15em 0.4em",fontSize:"0.9em",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",wordBreak:"break-word"},children:ke(e.value)},o);case"link":{const n=wa(e.href);if(!n)/* @__PURE__ */return x("span",{children:va(e.children,t,o)},o);const r=/^(https?:)?\/\//i.test(n)||n.startsWith("mailto:");/* @__PURE__ */
346
- return x("a",{href:n,target:r?t.externalLinkTarget:void 0,rel:r?t.externalLinkRel:void 0,onClick:e=>{!1===t.onLinkClick?.(n,e)&&e.preventDefault()},style:{color:t.theme.primary,textDecoration:"underline",wordBreak:"break-word"},children:va(e.children,t,o)},o)}case"image":/* @__PURE__ */return x("img",{src:wa(e.src)||"",alt:ke(e.alt),loading:"lazy",decoding:"async",style:{maxWidth:"100%",height:"auto",borderRadius:6,display:"inline-block"}},o)}})}function wa(e){const t=e.trim();return t?/^javascript:/i.test(t)||/^data:/i.test(t)&&!/^data:image\//i.test(t)||/^vbscript:/i.test(t)?null:t:null}function ka({text:e,theme:t}){const[n,r]=m(!1);/* @__PURE__ */
347
- return x("button",{type:"button",onClick:()=>{"undefined"!=typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},"aria-label":n?"Copied to clipboard":"Copy code",style:{position:"absolute",top:6,right:6,padding:"2px 8px",fontSize:11,background:t.surface,color:n?t.success:t.textMuted,border:`1px solid ${t.border}`,borderRadius:4,cursor:"pointer",fontFamily:"inherit",transition:"color 120ms"},children:n?"Copied":"Copy"})}function $a(e,t,n="b"){return e.map((e,r)=>{const o=`${n}-${r}`;switch(e.kind){case"heading":{const n=`h${e.level}`,r={1:{fs:t.compact?"1.75rem":"2rem",lh:"1.2",mt:"0.6em",mb:"0.5em",fw:700},2:{fs:t.compact?"1.4rem":"1.6rem",lh:"1.25",mt:"1em",mb:"0.5em",fw:700},3:{fs:t.compact?"1.2rem":"1.3rem",lh:"1.3",mt:"1em",mb:"0.4em",fw:600},4:{fs:"1.1rem",lh:"1.35",mt:"1em",mb:"0.4em",fw:600},5:{fs:"1rem",lh:"1.4",mt:"1em",mb:"0.3em",fw:600},6:{fs:"0.9rem",lh:"1.4",mt:"1em",mb:"0.3em",fw:600}}[e.level];/* @__PURE__ */
348
- return x(n,{style:{fontSize:r.fs,lineHeight:r.lh,marginTop:r.mt,marginBottom:r.mb,fontWeight:r.fw,color:t.theme.text,scrollMarginTop:"1em"},children:va(e.inline,t,o)},o)}case"paragraph":/* @__PURE__ */return x("p",{style:{margin:"0 0 "+(t.compact?"0.7em":"1em"),lineHeight:1.65,color:t.theme.text,wordBreak:"break-word"},children:va(e.inline,t,o)},o);case"blockquote":/* @__PURE__ */return x("blockquote",{style:{margin:"0 0 1em",padding:"0.5em 1em",borderLeft:`4px solid ${t.theme.primary}`,background:`${t.theme.surfaceAlt}`,color:t.theme.textMuted,borderRadius:"0 6px 6px 0"},children:$a(e.children,t,o)},o);case"code":{const n=e.value;/* @__PURE__ */
349
- return b("div",{style:{position:"relative",margin:"0 0 1em",border:`1px solid ${t.theme.border}`,borderRadius:8,background:t.theme.surfaceAlt,overflow:"hidden"},children:[e.language&&/* @__PURE__ */x("div",{style:{padding:"4px 10px",fontSize:11,color:t.theme.textMuted,borderBottom:`1px solid ${t.theme.border}`,textTransform:"uppercase",letterSpacing:"0.05em"},children:ke(e.language)}),t.copyableCode&&/* @__PURE__ */x(ka,{text:n,theme:t.theme}),
350
- /* @__PURE__ */x("pre",{style:{margin:0,padding:12,overflowX:"auto",fontSize:13,lineHeight:1.55,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",color:t.theme.text,whiteSpace:"pre"},children:/* @__PURE__ */x("code",{children:ke(n)})})]},o)}case"list":/* @__PURE__ */return x(e.ordered?"ol":"ul",{style:{margin:"0 0 1em",paddingLeft:"1.5em",color:t.theme.text,lineHeight:1.65},children:e.items.map((e,n)=>/* @__PURE__ */b("li",{style:{listStyle:null!==e.task?"none":void 0,marginLeft:null!==e.task?"-1.25em":void 0},children:[null!==e.task&&/* @__PURE__ */x("input",{type:"checkbox",disabled:!0,checked:"checked"===e.task,readOnly:!0,style:{marginRight:6,verticalAlign:"middle"},"aria-label":"checked"===e.task?"Completed task":"Uncompleted task"}),$a(e.blocks,t,`${o}-${n}`)]},`${o}-${n}`))},o);case"hr":/* @__PURE__ */return x("hr",{style:{border:"none",borderTop:`1px solid ${t.theme.border}`,margin:"1.5em 0"}},o);case"table":/* @__PURE__ */return x("div",{style:{overflowX:"auto",margin:"0 0 1em",border:`1px solid ${t.theme.border}`,borderRadius:6,WebkitOverflowScrolling:"touch"},children:/* @__PURE__ */b("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14,color:t.theme.text},children:[/* @__PURE__ */x("thead",{children:/* @__PURE__ */x("tr",{children:e.headers.map((n,r)=>/* @__PURE__ */x("th",{style:{padding:"8px 12px",textAlign:e.align[r]??"left",borderBottom:`2px solid ${t.theme.border}`,background:t.theme.surfaceAlt,fontWeight:600},children:va(n,t,`${o}-h-${r}`)},r))})}),/* @__PURE__ */x("tbody",{children:e.rows.map((n,r)=>/* @__PURE__ */x("tr",{children:n.map((n,i)=>/* @__PURE__ */x("td",{style:{padding:"8px 12px",textAlign:e.align[i]??"left",borderBottom:`1px solid ${t.theme.border}`},children:va(n,t,`${o}-r-${r}-${i}`)},i))},r))})]})},o)}})}function Sa({source:e,src:t,maxWidth:n="100%",compact:r=!1,copyableCode:o=!0,onLinkClick:i,externalLinkRel:a="noopener noreferrer",externalLinkTarget:l="_blank",loadingFallback:d,errorFallback:c,className:u,style:h}){const g=se(),[b,y]=m({text:null,error:null,loading:!!t&&void 0===e}),v=f(null);s(()=>{if(void 0!==e||!t)return;v.current?.abort();const n=new AbortController;return v.current=n,y({text:null,error:null,loading:!0}),fetch(t,{signal:n.signal}).then(async e=>{if(!e.ok)throw new Error(`Failed to load markdown (HTTP ${e.status})`);y({text:await e.text(),error:null,loading:!1})}).catch(e=>{"AbortError"!==e.name&&y({text:null,error:e.message,loading:!1})}),()=>n.abort()},[t,e]);const w=e??b.text??"",k=p(()=>w?ha(w):[],[w]),$={theme:g,compact:r,copyableCode:o,externalLinkRel:a,externalLinkTarget:l,onLinkClick:i},S={maxWidth:n,width:"100%",color:g.text,fontFamily:"inherit",fontSize:r?14:15,lineHeight:1.65,wordBreak:"break-word",overflowWrap:"anywhere",boxSizing:"border-box",...h};if(void 0===e&&t){if(b.loading)/* @__PURE__ */return x("div",{className:u,style:S,"aria-busy":"true","aria-live":"polite",children:d??/* @__PURE__ */x("span",{style:{color:g.textMuted},children:"Loading…"})});if(b.error)/* @__PURE__ */return x("div",{className:u,style:S,role:"alert",children:c?c(b.error):/* @__PURE__ */x("span",{style:{color:g.danger},children:ke(b.error)})})}/* @__PURE__ */
351
- return x("div",{className:u,style:S,children:$a(k,$)})}Sa.displayName="TkxMarkdown";var Ca=r(null),za={required:"This field is required",invalidFormat:"Invalid format",minLength:e=>`Must be at least ${e} characters`,maxLength:e=>`Must be no more than ${e} characters`,minValue:e=>`Must be at least ${e}`,maxValue:e=>`Must be no more than ${e}`};async function Ma(e,t,n=za){for(const r of t){if(r.required&&(null==e||""===e||Array.isArray(e)&&0===e.length))return r.message??n.required;if(null!=e&&""!==e){if(void 0!==r.min){if("string"==typeof e&&e.length<r.min)return r.message??n.minLength(r.min);if("number"==typeof e&&e<r.min)return r.message??n.minValue(r.min)}if(void 0!==r.max){if("string"==typeof e&&e.length>r.max)return r.message??n.maxLength(r.max);if("number"==typeof e&&e>r.max)return r.message??n.maxValue(r.max)}if(r.pattern&&"string"==typeof e&&!r.pattern.test(e))return r.message??n.invalidFormat;if(r.validator){const t=await r.validator(e);if(t)return t}}}return null}function Na(){const e=l(Ca),t=f({}),n=f({}),r=f({}),o=p(()=>({getFieldValue:e=>t.current[e],setFieldValue:(e,n)=>{t.current[e]=n},getFieldsValue:()=>({...t.current}),setFieldsValue:e=>{Object.assign(t.current,e)},validateFields:()=>Promise.resolve({...t.current}),validateField:e=>Promise.resolve(!0),resetFields:()=>{t.current={},n.current={},r.current={}},getFieldError:e=>n.current[e]??null,isFieldTouched:e=>r.current[e]??!1}),[]);return e?e.instance:o}function Da({onSubmit:e,onValuesChange:t,initialValues:n={},layout:r="vertical",disabled:o=!1,children:i,className:l,style:d,form:c}){const u=se(),h=yn(),g=p(()=>({required:h.fieldRequired??za.required,invalidFormat:h.invalidFormat??za.invalidFormat,minLength:h.minLength??za.minLength,maxLength:h.maxLength??za.maxLength,minValue:h.minValue??za.minValue,maxValue:h.maxValue??za.maxValue}),[h]),[b,y]=m({values:{...n},errors:{},touched:{}}),v=f(n),w=f({}),k=f(b);k.current=b;const $=a((e,t)=>{w.current[e]=t},[]),S=a(e=>{delete w.current[e]},[]),C=a((e,n)=>{y(r=>{const o={...r,values:{...r.values,[e]:n}};return t?.({[e]:n},o.values),o})},[t]),z=a((e,t)=>{y(n=>({...n,errors:{...n.errors,[e]:t}}))},[]),M=a(e=>{y(t=>({...t,touched:{...t.touched,[e]:!0}}))},[]),N=a(async e=>{const t=w.current[e];if(!t)return!0;const n=k.current.values[e],r=await Ma(n,t.rules,g);return y(t=>({...t,errors:{...t.errors,[e]:r},touched:{...t.touched,[e]:!0}})),null===r},[g]),D=a(async()=>{const e=Object.keys(w.current),t=await Promise.all(e.map(async e=>{const t=w.current[e],n=k.current.values[e];return{name:e,error:await Ma(n,t.rules,g)}})),n={},r={};let o=!1;for(const{name:i,error:a}of t)n[i]=a,r[i]=!0,a&&(o=!0);if(y(e=>({...e,errors:{...e.errors,...n},touched:{...e.touched,...r}})),o){const e=Object.fromEntries(t.filter(e=>e.error).map(e=>[e.name,e.error]));return Promise.reject(e)}return{...k.current.values}},[]),P=a(()=>{y({values:{...v.current},errors:{},touched:{}})},[]),R=p(()=>({getFieldValue:e=>k.current.values[e],setFieldValue:C,getFieldsValue:()=>({...k.current.values}),setFieldsValue:e=>{y(n=>{const r={...n.values,...e};return t?.(e,r),{...n,values:r}})},validateFields:D,validateField:N,resetFields:P,getFieldError:e=>k.current.errors[e]??null,isFieldTouched:e=>!!k.current.touched[e]}),[C,D,N,P,t]),F=a(async t=>{t.preventDefault();try{const t=await D();await(e?.(t))}catch{}},[D,e]),I=At("inline"===r?"flex flex-row flex-wrap items-end gap-4":"flex flex-col gap-5");s(()=>{if(!c)return;const e=c;e.getFieldValue=R.getFieldValue,e.setFieldValue=R.setFieldValue,e.getFieldsValue=R.getFieldsValue,e.setFieldsValue=R.setFieldsValue,e.validateFields=R.validateFields,e.validateField=R.validateField,e.resetFields=R.resetFields,e.getFieldError=R.getFieldError,e.isFieldTouched=R.isFieldTouched},[c,R]);const A=c??R,L=p(()=>({state:b,initialValues:v.current,layout:r,disabled:o,fieldMeta:w,setFieldValue:C,setFieldError:z,setFieldTouched:M,registerField:$,unregisterField:S,validateField:N,instance:A}),[b,r,o,C,z,M,$,S,N,A]);/* @__PURE__ */
352
- return x(Ca.Provider,{value:L,children:/* @__PURE__ */x("form",{noValidate:!0,role:"form","aria-label":"Form",onSubmit:F,className:jt(I,l),style:{color:u.text,...d},children:i})})}function Pa({name:e,label:t,rules:r,help:o,required:i,children:s,className:d,style:c}){const u=se(),h=function(){const e=l(Ca);if(!e)throw new Error("TkxFormField must be used inside a <TkxForm>. Wrap your fields in a TkxForm component.");return e}(),{state:m,layout:y,disabled:v}=h,w=p(()=>function(e,t,n=za.required){const r=e?[...e]:[];return t&&!r.some(e=>e.required)&&r.unshift({required:!0,message:n}),r}(r,i),[r,i]),k=function(e){return e.some(e=>e.required)}(w),$=f({rules:w});$.current.rules=w;const S=f(!1);S.current||(h.registerField(e,$.current),S.current=!0),p(()=>{h.registerField(e,$.current)},[w,e,h]);const C=m.values[e],z=m.touched[e]?m.errors[e]??null:null,M=z?ke(z):null,N=t?ke(t):void 0,D=o?ke(o):void 0,P=a(t=>{let n;if(null!==t&&"object"==typeof t&&"target"in t){const e=t.target;n="checkbox"===e.type?e.checked:e.value}else n=t;h.setFieldValue(e,n)},[h,e]),R=a(()=>{h.setFieldTouched(e),h.validateField(e)},[h,e]),F=n(s,{value:C??"",onChange:P,onBlur:R,error:M??void 0,isInvalid:!!M,isRequired:k,disabled:v||s.props.disabled,name:e}),I="horizontal"===y,A="inline"===y,L=/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),T=N?/* @__PURE__ */b("label",{className:At("text-sm font-medium font-sans",I?"min-w-[140px] pt-2.5":""),style:{color:u.text},children:[N,k&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:At("ml-1"),style:{color:u.danger},children:"*"})]}):null,W=/* @__PURE__ */b(g,{children:[D&&!M&&/* @__PURE__ */x("span",{className:At("text-xs mt-0.5"),style:{color:u.textMuted},children:D}),M&&/* @__PURE__ */b("span",{role:"alert",className:At("text-xs flex items-center gap-1 mt-0.5"),style:{color:u.danger,animation:"tkxFormErrorReveal 200ms ease-out"},children:[L,M]})]});/* @__PURE__ */
353
- return b("div",A?{className:jt(At("flex flex-col gap-1"),d),style:c,children:[T,F,W]}:I?{className:jt(At("flex flex-row gap-4 items-start"),d),style:c,children:[T,/* @__PURE__ */b("div",{className:At("flex flex-col gap-1 flex-1 min-w-0"),children:[F,W]})]}:{className:jt(At("flex flex-col gap-1"),d),style:c,children:[T,F,W]})}Da.displayName="TkxForm",Pa.displayName="TkxFormField";var Ra=!1;!function(){if(Ra)return;if("undefined"==typeof document)return;Ra=!0;const e=document.createElement("style");e.setAttribute("data-tkx-form",""),e.textContent="\n @keyframes tkxFormErrorReveal {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n ",document.head.appendChild(e)}();var Fa={sm:576,md:768,lg:992,xl:1200};function Ia(e){return"number"==typeof e?`${e}px`:e}var Aa=r({h:0,v:0}),La=i(({children:e,hasSider:t=!1,className:n,style:r,...o},i)=>{const a=se(),l=At("flex min-h-0 w-full font-sans"),s=t?{flexDirection:"row"}:{flexDirection:"column"};/* @__PURE__ */
354
- return x("section",{ref:i,className:jt("tkx-layout",l,n),style:{minHeight:"100%",color:a.text,backgroundColor:a.bg,...s,...r},...o,children:e})});La.displayName="TkxLayout";var Ta=i(({children:e,height:t=64,fixed:n=!1,className:r,style:o,...i},a)=>{const l=se(),s=Ia(t),d=At("flex items-center px-6 shrink-0 w-full"),c=n?{position:"fixed",top:0,left:0,right:0,zIndex:1e3}:{};/* @__PURE__ */
355
- return x("header",{ref:a,className:jt("tkx-layout-header",d,r),style:{height:s,minHeight:s,backgroundColor:l.surface,borderBottom:`1px solid ${l.border}`,...c,...o},...i,children:e})});function Wa({collapsed:e,onClick:t,color:n}){const r=et();/* @__PURE__ */
356
- return x("button",{type:"button","aria-label":e?"Expand sidebar":"Collapse sidebar",onClick:t,className:At("flex items-center justify-center w-full py-3 cursor-pointer","border-0 bg-transparent"),style:{color:n},children:/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{transform:e?"rotate(0deg)":"rotate(180deg)",transition:r?"none":"transform 200ms ease"},"aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M6 3l5 5-5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}Ta.displayName="TkxHeader";var ja=i(({children:e,width:t=240,collapsedWidth:n=64,collapsed:r,onCollapse:o,collapsible:i=!1,breakpoint:l,trigger:d,className:c,style:u,...p},h)=>{const f=se(),g=et(),[y,v]=m(!1),w=r??y,k=a(e=>{void 0===r&&v(e),o?.(e)},[r,o]);s(()=>{if(!l)return;const e=Fa[l];if(!e)return;const t=window.matchMedia(`(max-width: ${e-1}px)`),n=e=>{k(e.matches)};return k(t.matches),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[l,k]);const $=Ia(t),S=w?`${n}px`:$,C=i&&null!==d,z=g?"none":"width 200ms ease, min-width 200ms ease, max-width 200ms ease";/* @__PURE__ */
357
- return b("aside",{ref:h,className:jt("tkx-layout-sider",At("shrink-0 overflow-hidden flex flex-col"),c),style:{width:S,minWidth:S,maxWidth:S,backgroundColor:f.surface,borderRight:`1px solid ${f.border}`,transition:z,...u},...p,children:[/* @__PURE__ */x("div",{className:At("flex-1 overflow-y-auto overflow-x-hidden"),style:{width:S,transition:z},children:e}),C&&/* @__PURE__ */x("div",{className:At("shrink-0"),style:{borderTop:`1px solid ${f.border}`},children:void 0!==d?d:/* @__PURE__ */x(Wa,{collapsed:w,onClick:()=>k(!w),color:f.textMuted})})]})});ja.displayName="TkxSider";var Ea=i(({children:e,className:t,style:n,...r},o)=>{const i=se();/* @__PURE__ */
358
- return x("main",{ref:o,className:jt("tkx-layout-content",At("flex-1 min-w-0 min-h-0"),t),style:{backgroundColor:i.bg,padding:"24px",...n},...r,children:e})});Ea.displayName="TkxContent";var Ba=i(({children:e,className:t,style:n,...r},o)=>{const i=se();/* @__PURE__ */
359
- return x("footer",{ref:o,className:jt("tkx-layout-footer",At("flex items-center px-6 py-4 shrink-0"),t),style:{backgroundColor:i.surface,borderTop:`1px solid ${i.border}`,color:i.textMuted,...n},...r,children:e})});Ba.displayName="TkxFooter";var Va={start:"flex-start",center:"center",end:"flex-end","space-between":"space-between","space-around":"space-around","space-evenly":"space-evenly"},Ha={top:"flex-start",middle:"center",bottom:"flex-end",stretch:"stretch"},Oa=i(({children:e,gutter:t,justify:n="start",align:r="top",wrap:o=!0,className:i,style:a,...l},s)=>{const[d,c]=Array.isArray(t)?t:[t??0,0],u=d/2,p=c/2,h=d||c?{marginLeft:-u,marginRight:-u,marginTop:-p,marginBottom:-p}:{},f={h:u,v:p};/* @__PURE__ */
360
- return x(Aa.Provider,{value:f,children:/* @__PURE__ */x("div",{ref:s,className:jt("tkx-row",At("flex w-full"),i),style:{flexWrap:o?"wrap":"nowrap",justifyContent:Va[n]??"flex-start",alignItems:Ha[r]??"flex-start",...h,...a},...l,children:e})})});Oa.displayName="TkxRow";var qa=!1;function Ua(e){if(void 0!==e)return"number"==typeof e?{span:e}:e}var Ka=i(({children:e,span:t,offset:n=0,push:r,pull:o,order:i,sm:a,md:d,lg:c,xl:u,className:p,style:h,...f},m)=>{s(()=>{!function(){if(qa||"undefined"==typeof document)return;qa=!0;const e=[];for(const[n,r]of Object.entries(Fa)){for(let t=1;t<=24;t++){const o=t/24*100+"%";e.push(`@media (min-width: ${r}px) { .tkx-col-${n}-${t} { flex: 0 0 ${o} !important; max-width: ${o} !important; } }`)}for(let t=0;t<=24;t++){const o=t/24*100+"%";e.push(`@media (min-width: ${r}px) { .tkx-col-${n}-offset-${t} { margin-left: ${o} !important; } }`)}}const t=document.createElement("style");t.id="tkx-col-responsive",t.textContent=e.join("\n"),document.head.appendChild(t)}()},[]);const g=l(Aa),b=void 0!==t?t/24*100+"%":void 0,y=n?n/24*100+"%":void 0,v=[],w=[["sm",a],["md",d],["lg",c],["xl",u]];for(const[l,s]of w){const e=Ua(s);e&&(v.push(`tkx-col-${l}-${e.span}`),void 0!==e.offset&&e.offset>0&&v.push(`tkx-col-${l}-offset-${e.offset}`))}const k={};return void 0!==r&&(k.left=r/24*100+"%",k.position="relative"),void 0!==o&&(k.right=o/24*100+"%",k.position="relative"),void 0!==i&&(k.order=i),/* @__PURE__ */x("div",{ref:m,className:jt("tkx-col",At("box-border min-h-[1px]"),...v,p),style:{flex:b?`0 0 ${b}`:"1",maxWidth:b??"100%",marginLeft:y,paddingLeft:g.h||void 0,paddingRight:g.h||void 0,paddingTop:g.v||void 0,paddingBottom:g.v||void 0,...k,...h},...f,children:e})});Ka.displayName="TkxCol";var Ya=r({locale:"en-US",direction:"ltr",componentDefaults:{size:"md",variant:"default",animation:!0,bordered:!0},componentOverrides:{},prefixCls:"tkx",configured:!1,cls:e=>`tkx-${e}`,getSize:()=>"md",getAnimation:()=>!0,getBordered:()=>!0});function Xa({children:e,locale:t,direction:n,componentDefaults:r,componentOverrides:o,prefixCls:i}){const s=l(Ya),d=p(()=>({size:r?.size??s.componentDefaults.size,variant:r?.variant??s.componentDefaults.variant,animation:r?.animation??s.componentDefaults.animation,bordered:r?.bordered??s.componentDefaults.bordered}),[r,s.componentDefaults]),c=p(()=>{const e=s.componentOverrides,t=o??{};return{button:{...e.button,...t.button},input:{...e.input,...t.input},table:{...e.table,...t.table},modal:{...e.modal,...t.modal}}},[o,s.componentOverrides]),u=t??s.locale,h=n??s.direction,f=i??s.prefixCls,m=a(e=>`${f}-${e}`,[f]),g=a((e,t)=>{if(void 0!==t)return t;if(e){const t=c[e];if(t?.size)return t.size}return d.size},[d.size,c]),b=a(e=>void 0!==e?e:d.animation,[d.animation]),y=a((e,t)=>{if(void 0!==t)return t;if(e){const t=c[e];if(void 0!==t?.bordered)return t.bordered}return d.bordered},[d.bordered,c]),v=p(()=>({locale:u,direction:h,componentDefaults:d,componentOverrides:c,prefixCls:f,configured:!0,cls:m,getSize:g,getAnimation:b,getBordered:y}),[u,h,d,c,f,m,g,b,y]);/* @__PURE__ */
361
- return x(Ya.Provider,{value:v,children:/* @__PURE__ */x("div",{dir:h,lang:u,className:`${f}-config-root`,style:{direction:h},children:e})})}function Za(){return l(Ya)}function Ga(e,t){const{prefixCls:n}=Za();return`${t??n}-${e}`}function _a(e,t){const{getSize:n}=Za();return n(e,t)}Xa.displayName="TkxConfigProvider";var Ja={sm:32,md:40,lg:48},Qa={sm:"0.75rem",md:"0.875rem",lg:"1rem"},el={sm:8,md:12,lg:16},tl={sm:4,md:8,lg:12},nl={sm:4,md:6,lg:8},rl={sm:14,md:16,lg:20};function ol(){const{direction:e}=Za();if("rtl"===e)return{transform:"scaleX(-1)"}}function il(e,t=0){const{direction:n}=Za(),r="number"==typeof e?`${e}px`:e,o="number"==typeof t?`${t}px`:t;return"rtl"===n?{marginRight:r,marginLeft:o}:{marginLeft:r,marginRight:o}}var al={"en-US":"English (US)","en-GB":"English (UK)","es-ES":"Spanish","fr-FR":"French","de-DE":"German","ja-JP":"Japanese","ko-KR":"Korean","zh-CN":"Chinese (Simplified)","zh-TW":"Chinese (Traditional)","pt-BR":"Portuguese (Brazil)","ar-SA":"Arabic","hi-IN":"Hindi","ru-RU":"Russian","it-IT":"Italian","nl-NL":"Dutch","sv-SE":"Swedish","pl-PL":"Polish","tr-TR":"Turkish","th-TH":"Thai","vi-VN":"Vietnamese"},ll=new Set(["ar","ar-SA","ar-EG","ar-AE","he","he-IL","fa","fa-IR","ur","ur-PK","ps","ps-AF"]);function sl(e){return ll.has(e)||ll.has(e.split("-")[0])}function dl(e){if(al[e])return al[e];if("undefined"!=typeof Intl&&Intl.DisplayNames)try{return new Intl.DisplayNames(["en"],{type:"language"}).of(e)??e}catch{return e}return e}function cl(e){return"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(cl).join(""):e&&"object"==typeof e&&"props"in e?cl(e.props.children):""}function ul({text:e}){const t=se(),[n,r]=m(!1);return o("button",{type:"button",onClick:a(()=>{navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})},[e]),"aria-label":n?"Copied":"Copy to clipboard",style:{display:"inline-flex",alignItems:"center",marginLeft:"4px",padding:"2px 6px",border:"none",background:"transparent",color:n?t.success:t.textMuted,cursor:"pointer",fontSize:"0.8em",borderRadius:"4px",transition:"color 0.2s"}},n?"Copied!":"⎘")}function pl(e="default"){const t=se();return{default:t.text,secondary:t.textMuted,success:t.success,warning:t.warning,danger:t.danger}[e]}var hl={1:{fontSize:"2.25rem",lineHeight:"1.2",fontWeight:700},2:{fontSize:"1.875rem",lineHeight:"1.25",fontWeight:700},3:{fontSize:"1.5rem",lineHeight:"1.3",fontWeight:600},4:{fontSize:"1.25rem",lineHeight:"1.35",fontWeight:600},5:{fontSize:"1rem",lineHeight:"1.4",fontWeight:600}};function fl({level:e=1,children:t,copyable:n=!1,type:r="default",style:i}){const a=pl(r);se();const l=hl[e],s=`h${e}`,d="string"==typeof t?ke(t):t,c=cl(t);return o(s,{style:{color:a,fontSize:l.fontSize,lineHeight:l.lineHeight,fontWeight:l.fontWeight,margin:"0 0 0.5em 0",fontFamily:"inherit",...i}},d,n&&o(ul,{text:c}))}function ml({children:e,type:t="default",strong:n=!1,italic:r=!1,underline:i=!1,delete:a=!1,code:l=!1,mark:s=!1,copyable:d=!1,style:c}){const u=pl(t),p=se(),h=cl(e),f="string"==typeof e?ke(e):e,m=[];i&&m.push("underline"),a&&m.push("line-through");let g=f;return l&&(g=o("code",{style:{padding:"0.15em 0.4em",fontSize:"0.875em",backgroundColor:p.surfaceAlt,border:`1px solid ${p.border}`,borderRadius:"4px",fontFamily:"monospace"}},g)),s&&(g=o("mark",{style:{backgroundColor:`${p.warning}33`,color:u,padding:"0 2px",borderRadius:"2px"}},g)),o(n?"strong":r?"em":"span",{style:{color:u,fontStyle:r?"italic":"normal",textDecoration:m.length>0?m.join(" "):"none",...c}},g,d&&o(ul,{text:h}))}function gl({children:e,type:t="default",copyable:n=!1,ellipsis:r=!1,style:i}){const a=se(),l="secondary"===t?a.textMuted:a.text,s=cl(e),d="string"==typeof e?ke(e):e,c={};if(r){const e="object"==typeof r?r.rows??3:3;c.display="-webkit-box",c.WebkitLineClamp=e,c.WebkitBoxOrient="vertical",c.overflow="hidden"}return o("div",{style:{color:l,fontSize:"1rem",lineHeight:"1.6",margin:"0 0 1em 0",...c,...i}},d,n&&o(ul,{text:s}))}var xl={sm:{dimension:20,borderWidth:2,fontSize:"0.75rem"},md:{dimension:32,borderWidth:3,fontSize:"0.875rem"},lg:{dimension:48,borderWidth:4,fontSize:"1rem"}},bl=!1;function yl({size:e,color:t}){return o("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Loading"},o("circle",{cx:12,cy:12,r:10,stroke:`${t}33`,strokeWidth:2.5,fill:"none"}),o("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:t,strokeWidth:2.5,strokeLinecap:"round",fill:"none"}))}function vl({size:e,borderWidth:t,color:n,reducedMotion:r}){return r?o(yl,{size:e,color:n}):(function(){if(bl||"undefined"==typeof document)return;bl=!0;const e=document.createElement("style");e.id="tkx-spin-styles",e.textContent="\n @keyframes tkx-spin-rotate {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ",document.head.appendChild(e)}(),o("div",{role:"img","aria-label":"Loading",style:{width:`${e}px`,height:`${e}px`,border:`${t}px solid ${n}33`,borderTopColor:n,borderRadius:"50%",animation:"tkx-spin-rotate 0.8s linear infinite",boxSizing:"border-box"}}))}function wl({spinning:e=!0,size:t="md",tip:n,indicator:r,children:i,fullscreen:a=!1,delay:l=0,style:d}){const c=se(),u=et(),[p,h]=m(0===l&&e),g=f(null);if(s(()=>(e&&l>0?g.current=setTimeout(()=>h(!0),l):h(e),()=>{null!==g.current&&clearTimeout(g.current)}),[e,l]),!p)return i?o("div",{style:d},i):null;const x=xl[t],b=n?ke(n):void 0,y=o("div",{role:"status","aria-live":"polite","aria-label":b??"Loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},r??o(vl,{size:x.dimension,borderWidth:x.borderWidth,color:c.primary,reducedMotion:u}),b&&o("span",{style:{color:c.primary,fontSize:x.fontSize,marginTop:"4px"}},b));return a?o("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${c.bg}cc`,zIndex:9999,...d}},y):i?o("div",{style:{position:"relative",...d}},o("div",{style:{filter:"blur(1px)",opacity:.5,pointerEvents:"none",userSelect:"none",transition:u?"none":"opacity 0.2s, filter 0.2s"}},i),o("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${c.bg}66`,borderRadius:"4px"}},y)):o("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",...d}},y)}function kl({color:e,mutedColor:t}){return o("svg",{width:120,height:100,viewBox:"0 0 120 100",fill:"none","aria-hidden":"true"},o("path",{d:"M20 40 L60 20 L100 40 L60 60 Z",fill:`${t}18`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),o("path",{d:"M20 40 L20 65 L60 85 L60 60 Z",fill:`${t}10`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),o("path",{d:"M100 40 L100 65 L60 85 L60 60 Z",fill:`${t}0d`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),o("path",{d:"M20 40 L40 28 L60 40 L40 52 Z",fill:`${e}15`,stroke:e,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}),o("path",{d:"M60 40 L80 28 L100 40 L80 52 Z",fill:`${e}15`,stroke:e,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}))}function $l({mutedColor:e}){return o("svg",{width:64,height:64,viewBox:"0 0 64 64",fill:"none","aria-hidden":"true"},o("rect",{x:16,y:8,width:32,height:40,rx:3,fill:`${e}12`,stroke:e,strokeWidth:1.5}),o("line",{x1:24,y1:20,x2:40,y2:20,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),o("line",{x1:24,y1:28,x2:36,y2:28,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),o("line",{x1:24,y1:36,x2:32,y2:36,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),o("circle",{cx:32,cy:54,r:6,stroke:e,strokeWidth:1.2,fill:"none"}),o("line",{x1:28,y1:54,x2:36,y2:54,stroke:e,strokeWidth:1.2,strokeLinecap:"round"}))}function Sl({image:e="default",description:t="No data",children:n,style:r}){const i=se(),a="string"==typeof t?ke(t):t;let l;return l="default"===e?o(kl,{color:i.primary,mutedColor:i.textMuted}):"simple"===e?o($l,{mutedColor:i.textMuted}):e,o("div",{role:"status",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",textAlign:"center",...r}},o("div",{style:{marginBottom:"12px",opacity:.85}},l),a&&o("div",{style:{color:i.textMuted,fontSize:"0.875rem",lineHeight:"1.5",maxWidth:"320px"}},a),n&&o("div",{style:{marginTop:"16px"}},n))}function Cl({direction:e,color:t}){return o("svg",{width:16,height:14,viewBox:"0 0 20 14",fill:"none","aria-hidden":"true",style:{display:"inline-block",verticalAlign:"middle"}},o("path",{d:"up"===e?"M6 10 L10 4 L14 10":"M6 4 L10 10 L14 4",stroke:t,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}))}var zl=!1;function Ml({w:e,h:t,alt:n,bdr:r,rm:i}){return i||function(){if(zl||"undefined"==typeof document)return;zl=!0;const e=document.createElement("style");e.id="tkx-statistic-skeleton",e.textContent="@keyframes tkx-stat-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}",document.head.appendChild(e)}(),o("div",{"aria-hidden":"true",style:{width:e,height:t,borderRadius:"4px",background:i?n:`linear-gradient(90deg, ${n} 25%, ${r} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:i?"none":"tkx-stat-shimmer 1.5s ease-in-out infinite"}})}function Nl({title:e,value:t,prefix:n,suffix:r,precision:i,groupSeparator:a=",",valueStyle:l,loading:s=!1,trend:d,trendValue:c,style:u}){const p=se(),h=et(),f=ke(e),m=c?ke(c):void 0,g="up"===d?p.success:"down"===d?p.danger:void 0;return o("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...u}},o("div",{style:{color:p.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},f),s?o(Ml,{w:"120px",h:"32px",alt:p.surfaceAlt,bdr:p.border,rm:h}):o("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:p.text,fontVariantNumeric:"tabular-nums",...l}},n&&o("span",{style:{fontSize:"0.75em",fontWeight:400}},n),o("span",null,function(e,t,n=","){if("string"==typeof e)return e;const[r,o]=(void 0!==t?e.toFixed(t):String(e)).split("."),i=r.replace(/\B(?=(\d{3})+(?!\d))/g,n);return void 0!==o?`${i}.${o}`:i}(t,i,a)),r&&o("span",{style:{fontSize:"0.6em",fontWeight:400,color:p.textMuted}},r)),d&&o("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"0.8125rem",color:g,marginTop:"2px"}},o(Cl,{direction:d,color:g}),m&&o("span",null,m)))}function Dl({title:e,value:t,format:n="HH:mm:ss",onFinish:r,prefix:i,suffix:a,style:l}){const d=se(),c=ke(e),u=f(r);u.current=r;const p=f(!1),[h,g]=m(()=>Math.max(0,t-Date.now()));s(()=>{p.current=!1;const e=()=>{const e=Math.max(0,t-Date.now());g(e),e<=0&&!p.current&&(p.current=!0,u.current?.())};e();const n=setInterval(e,1e3);return()=>clearInterval(n)},[t]);const x=function(e,t){if(e<=0)return t.replace(/DD?/g,"0").replace(/HH?/g,"00").replace(/mm?/g,"00").replace(/ss?/g,"00");const n=Math.floor(e/1e3),r=Math.floor(n/86400),o=Math.floor(n%86400/3600),i=Math.floor(n%3600/60),a=n%60,l=e=>String(e).padStart(2,"0");return t.replace(/DD/g,l(r)).replace(/D/g,String(r)).replace(/HH/g,l(o)).replace(/H/g,String(o)).replace(/mm/g,l(i)).replace(/m/g,String(i)).replace(/ss/g,l(a)).replace(/s/g,String(a))}(h,n);return o("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...l}},o("div",{style:{color:d.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},c),o("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:h<=0?d.danger:d.text,fontVariantNumeric:"tabular-nums"}},i&&o("span",{style:{fontSize:"0.75em",fontWeight:400}},i),o("span",null,x),a&&o("span",{style:{fontSize:"0.6em",fontWeight:400,color:d.textMuted}},a)))}var Pl={sm:{height:28,fontSize:12,px:10},md:{height:36,fontSize:14,px:16},lg:{height:44,fontSize:16,px:20}};function Rl({options:e,value:t,onChange:n,size:r="md",block:o=!1}){const i=se(),l=et(),d=f(null),[c,u]=m(()=>Math.max(0,e.findIndex(e=>e.value===t))),[p,h]=m({}),g=Pl[r];s(()=>{const n=e.findIndex(e=>e.value===t);n>=0&&u(n)},[t,e]),s(()=>{const e=d.current;if(!e)return;const t=e.querySelectorAll("[data-seg-btn]")[c];t&&h({left:t.offsetLeft,width:t.offsetWidth,height:t.offsetHeight,transition:l?"none":"left 0.2s ease, width 0.2s ease"})},[c,e,l]);const y=a(t=>{const r=e[t];r&&!r.disabled&&(u(t),n?.(r.value))},[e,n]),v=a(t=>{let n=c;if("ArrowRight"===t.key||"ArrowDown"===t.key)for(t.preventDefault(),n=(c+1)%e.length;e[n]?.disabled&&n!==c;)n=(n+1)%e.length;else if("ArrowLeft"===t.key||"ArrowUp"===t.key)for(t.preventDefault(),n=(c-1+e.length)%e.length;e[n]?.disabled&&n!==c;)n=(n-1+e.length)%e.length;n!==c&&(y(n),(d.current?.querySelectorAll("[data-seg-btn]"))?.[n]?.focus())},[c,e,y]);/* @__PURE__ */
371
+ return b("figure",{className:At("m-0"),style:{marginTop:12,marginBottom:12},children:[/* @__PURE__ */x("img",{src:n,alt:r,loading:"lazy",className:At("rounded-lg"),style:{maxWidth:"100%",height:"auto",display:"block",border:`1px solid ${t.border}`}}),e.alt&&/* @__PURE__ */x("figcaption",{className:At("text-xs mt-2 text-center"),style:{color:t.textMuted},children:r})]})},callout:function({block:e}){const t=se(),n=e.variant??"info",r=ke(e.content??""),o={info:t.info,warning:t.warning,success:t.success,danger:t.danger}[n],i=xa[n];/* @__PURE__ */
372
+ return b("div",{role:{info:"note",warning:"alert",success:"status",danger:"alert"}[n],className:At("flex gap-3 px-4 py-3 rounded-lg"),style:{backgroundColor:`${o}12`,border:`1px solid ${o}33`,marginTop:12,marginBottom:12},children:[/* @__PURE__ */x("span",{className:At("shrink-0 mt-[2px]"),style:{color:o},children:i}),/* @__PURE__ */x("div",{className:At("flex-1"),style:{fontSize:"0.9rem",lineHeight:1.6,color:t.text},children:r})]})}};function va({blocks:e,className:t,style:n}){const r=se(),o=yn(),i=et(),a=p(()=>e.map((e,t)=>{const n=ya[e.type];return n?/* @__PURE__ */x("div",{style:i?void 0:{animation:"tkx-rich-text-fade-in 300ms ease both",animationDelay:`${Math.min(30*t,300)}ms`},children:/* @__PURE__ */x(n,{block:e,index:t})},t):null}),[e,i]);return p(()=>{if("undefined"==typeof document)return;if(document.getElementById("tkx-rich-text-kf"))return;const e=document.createElement("style");e.id="tkx-rich-text-kf",e.textContent="\n @keyframes tkx-rich-text-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n ",document.head.appendChild(e)},[]),/* @__PURE__ */x("article",{"aria-label":o.richTextContent??"Rich text content",className:At("font-sans",t??""),style:{color:r.text,maxWidth:720,...n},children:a})}function wa(e){const t=[];let n=0,r="";const o=()=>{r&&(t.push({kind:"text",value:r}),r="")};for(;n<e.length;){const i=e[n];if("\\"===i&&n+1<e.length)r+=e[n+1],n+=2;else{if("!"===i&&"["===e[n+1]){const r=e.indexOf("]",n+2);if(-1!==r&&"("===e[r+1]){const i=e.indexOf(")",r+2);if(-1!==i){o(),t.push({kind:"image",alt:e.slice(n+2,r),src:e.slice(r+2,i)}),n=i+1;continue}}}if("["===i){const r=ka(e,n,"[","]");if(-1!==r&&"("===e[r+1]){const i=e.indexOf(")",r+2);if(-1!==i){o(),t.push({kind:"link",href:e.slice(r+2,i).trim(),children:wa(e.slice(n+1,r))}),n=i+1;continue}}}if("<"===i){const r=e.indexOf(">",n+1);if(-1!==r){const i=e.slice(n+1,r);if(/^(https?:\/\/|mailto:)/i.test(i)||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)){o();const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)?`mailto:${i}`:i;t.push({kind:"link",href:e,children:[{kind:"text",value:i}]}),n=r+1;continue}}}if("`"===i){const r=e.indexOf("`",n+1);if(-1!==r){o(),t.push({kind:"code",value:e.slice(n+1,r)}),n=r+1;continue}}if("~"===i&&"~"===e[n+1]){const r=e.indexOf("~~",n+2);if(-1!==r){o(),t.push({kind:"strike",children:wa(e.slice(n+2,r))}),n=r+2;continue}}if("*"===i&&"*"===e[n+1]||"_"===i&&"_"===e[n+1]){const r=i+i,a=e.indexOf(r,n+2);if(-1!==a){o(),t.push({kind:"bold",children:wa(e.slice(n+2,a))}),n=a+2;continue}}if(("*"===i||"_"===i)&&e[n+1]!==i){const r=e.indexOf(i,n+1);if(-1!==r&&e.slice(n+1,r).trim().length>0){o(),t.push({kind:"italic",children:wa(e.slice(n+1,r))}),n=r+1;continue}}r+=i,n++}}return o(),t}function ka(e,t,n,r){let o=0;for(let i=t;i<e.length;i++)if("\\"!==e[i]){if(e[i]===n)o++;else if(e[i]===r&&(o--,0===o))return i}else i++;return-1}function $a(e){const t=e.replace(/^\uFEFF/,"").replace(/\r\n?/g,"\n").split("\n"),n=[];let r=0;for(;r<t.length;){const e=t[r];if(/^\s*$/.test(e)){r++;continue}const o=e.match(/^\s*```(.*)$/);if(o){const e=o[1].trim();r++;const i=[];for(;r<t.length&&!/^\s*```\s*$/.test(t[r]);)i.push(t[r]),r++;r<t.length&&r++,n.push({kind:"code",language:e,value:i.join("\n")});continue}const i=e.match(/^(#{1,6})\s+(.*?)\s*#*\s*$/);if(i){n.push({kind:"heading",level:i[1].length,inline:wa(i[2])}),r++;continue}if(/^\s*([-*_])\s*(?:\1\s*){2,}$/.test(e)){n.push({kind:"hr"}),r++;continue}if(za(e)&&r+1<t.length&&Ma(t[r+1])){const o=Na(e).map(wa),i=Da(t[r+1]);r+=2;const a=[];for(;r<t.length&&za(t[r]);)a.push(Na(t[r]).map(wa)),r++;n.push({kind:"table",headers:o,rows:a,align:i});continue}if(/^\s*>/.test(e)){const e=[];for(;r<t.length&&/^\s*>/.test(t[r]);)e.push(t[r].replace(/^\s*>\s?/,"")),r++;n.push({kind:"blockquote",children:$a(e.join("\n"))});continue}if(Sa(e)){const[e,o]=Ca(t,r);n.push(e),r=o;continue}const a=[e];for(r++;r<t.length&&!/^\s*$/.test(t[r])&&!/^#{1,6}\s/.test(t[r])&&!/^\s*```/.test(t[r])&&!/^\s*>/.test(t[r])&&!Sa(t[r])&&!/^\s*([-*_])\s*(?:\1\s*){2,}$/.test(t[r]);)a.push(t[r]),r++;n.push({kind:"paragraph",inline:wa(a.join(" "))})}return n}function Sa(e){return/^(\s*)([-*+]|\d+[.)])\s+/.test(e)}function Ca(e,t){const n=e[t].match(/^(\s*)([-*+]|\d+[.)])\s+/),r=n[1].length,o=/\d/.test(n[2]),i=[];let a=t;for(;a<e.length;){const t=e[a].match(/^(\s*)([-*+]|\d+[.)])\s+(.*)$/);if(!t||t[1].length!==r)break;const n=t[3];let o=null,l=n;const s=n.match(/^\[([ xX])\]\s+(.*)$/);s&&(o="x"===s[1].toLowerCase()?"checked":"unchecked",l=s[2]);const d=[l];for(a++;a<e.length;){if(/^\s*$/.test(e[a])){if(a+1<e.length&&/^\s+\S/.test(e[a+1])){d.push(""),a++;continue}break}const t=e[a].match(/^(\s*)(\S)/);if(!(t&&t[1].length>r))break;d.push(e[a].slice(r+2)),a++}i.push({blocks:$a(d.join("\n")),task:o})}return[{kind:"list",ordered:o,items:i},a]}function za(e){return/^\s*\|.+\|\s*$/.test(e.trim())||e.includes("|")&&e.trim().startsWith("|")}function Ma(e){return/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)+\|?\s*$/.test(e)}function Na(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())}function Da(e){return Na(e).map(e=>{const t=e.startsWith(":"),n=e.endsWith(":");return t&&n?"center":n?"right":t?"left":null})}function Ra(e,t,n="i"){return e.map((e,r)=>{const o=`${n}-${r}`;switch(e.kind){case"text":/* @__PURE__ */return x("span",{children:ke(e.value)},o);case"bold":/* @__PURE__ */return x("strong",{children:Ra(e.children,t,o)},o);case"italic":/* @__PURE__ */return x("em",{children:Ra(e.children,t,o)},o);case"strike":/* @__PURE__ */return x("s",{children:Ra(e.children,t,o)},o);case"code":/* @__PURE__ */return x("code",{style:{background:t.theme.surfaceAlt,border:`1px solid ${t.theme.border}`,borderRadius:4,padding:"0.15em 0.4em",fontSize:"0.9em",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",wordBreak:"break-word"},children:ke(e.value)},o);case"link":{const n=Pa(e.href);if(!n)/* @__PURE__ */return x("span",{children:Ra(e.children,t,o)},o);const r=/^(https?:)?\/\//i.test(n)||n.startsWith("mailto:");/* @__PURE__ */
373
+ return x("a",{href:n,target:r?t.externalLinkTarget:void 0,rel:r?t.externalLinkRel:void 0,onClick:e=>{!1===t.onLinkClick?.(n,e)&&e.preventDefault()},style:{color:t.theme.primary,textDecoration:"underline",wordBreak:"break-word"},children:Ra(e.children,t,o)},o)}case"image":/* @__PURE__ */return x("img",{src:Pa(e.src)||"",alt:ke(e.alt),loading:"lazy",decoding:"async",style:{maxWidth:"100%",height:"auto",borderRadius:6,display:"inline-block"}},o)}})}function Pa(e){const t=e.trim();return t?/^javascript:/i.test(t)||/^data:/i.test(t)&&!/^data:image\//i.test(t)||/^vbscript:/i.test(t)?null:t:null}function Fa({text:e,theme:t}){const[n,r]=m(!1);/* @__PURE__ */
374
+ return x("button",{type:"button",onClick:()=>{"undefined"!=typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},"aria-label":n?"Copied to clipboard":"Copy code",style:{position:"absolute",top:6,right:6,padding:"2px 8px",fontSize:11,background:t.surface,color:n?t.success:t.textMuted,border:`1px solid ${t.border}`,borderRadius:4,cursor:"pointer",fontFamily:"inherit",transition:"color 120ms"},children:n?"Copied":"Copy"})}function Ia(e,t,n="b"){return e.map((e,r)=>{const o=`${n}-${r}`;switch(e.kind){case"heading":{const n=`h${e.level}`,r={1:{fs:t.compact?"1.75rem":"2rem",lh:"1.2",mt:"0.6em",mb:"0.5em",fw:700},2:{fs:t.compact?"1.4rem":"1.6rem",lh:"1.25",mt:"1em",mb:"0.5em",fw:700},3:{fs:t.compact?"1.2rem":"1.3rem",lh:"1.3",mt:"1em",mb:"0.4em",fw:600},4:{fs:"1.1rem",lh:"1.35",mt:"1em",mb:"0.4em",fw:600},5:{fs:"1rem",lh:"1.4",mt:"1em",mb:"0.3em",fw:600},6:{fs:"0.9rem",lh:"1.4",mt:"1em",mb:"0.3em",fw:600}}[e.level];/* @__PURE__ */
375
+ return x(n,{style:{fontSize:r.fs,lineHeight:r.lh,marginTop:r.mt,marginBottom:r.mb,fontWeight:r.fw,color:t.theme.text,scrollMarginTop:"1em"},children:Ra(e.inline,t,o)},o)}case"paragraph":/* @__PURE__ */return x("p",{style:{margin:"0 0 "+(t.compact?"0.7em":"1em"),lineHeight:1.65,color:t.theme.text,wordBreak:"break-word"},children:Ra(e.inline,t,o)},o);case"blockquote":/* @__PURE__ */return x("blockquote",{style:{margin:"0 0 1em",padding:"0.5em 1em",borderLeft:`4px solid ${t.theme.primary}`,background:`${t.theme.surfaceAlt}`,color:t.theme.textMuted,borderRadius:"0 6px 6px 0"},children:Ia(e.children,t,o)},o);case"code":{const n=e.value;/* @__PURE__ */
376
+ return b("div",{style:{position:"relative",margin:"0 0 1em",border:`1px solid ${t.theme.border}`,borderRadius:8,background:t.theme.surfaceAlt,overflow:"hidden"},children:[e.language&&/* @__PURE__ */x("div",{style:{padding:"4px 10px",fontSize:11,color:t.theme.textMuted,borderBottom:`1px solid ${t.theme.border}`,textTransform:"uppercase",letterSpacing:"0.05em"},children:ke(e.language)}),t.copyableCode&&/* @__PURE__ */x(Fa,{text:n,theme:t.theme}),
377
+ /* @__PURE__ */x("pre",{style:{margin:0,padding:12,overflowX:"auto",fontSize:13,lineHeight:1.55,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",color:t.theme.text,whiteSpace:"pre"},children:/* @__PURE__ */x("code",{children:ke(n)})})]},o)}case"list":/* @__PURE__ */return x(e.ordered?"ol":"ul",{style:{margin:"0 0 1em",paddingLeft:"1.5em",color:t.theme.text,lineHeight:1.65},children:e.items.map((e,n)=>/* @__PURE__ */b("li",{style:{listStyle:null!==e.task?"none":void 0,marginLeft:null!==e.task?"-1.25em":void 0},children:[null!==e.task&&/* @__PURE__ */x("input",{type:"checkbox",disabled:!0,checked:"checked"===e.task,readOnly:!0,style:{marginRight:6,verticalAlign:"middle"},"aria-label":"checked"===e.task?"Completed task":"Uncompleted task"}),Ia(e.blocks,t,`${o}-${n}`)]},`${o}-${n}`))},o);case"hr":/* @__PURE__ */return x("hr",{style:{border:"none",borderTop:`1px solid ${t.theme.border}`,margin:"1.5em 0"}},o);case"table":/* @__PURE__ */return x("div",{style:{overflowX:"auto",margin:"0 0 1em",border:`1px solid ${t.theme.border}`,borderRadius:6,WebkitOverflowScrolling:"touch"},children:/* @__PURE__ */b("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14,color:t.theme.text},children:[/* @__PURE__ */x("thead",{children:/* @__PURE__ */x("tr",{children:e.headers.map((n,r)=>/* @__PURE__ */x("th",{style:{padding:"8px 12px",textAlign:e.align[r]??"left",borderBottom:`2px solid ${t.theme.border}`,background:t.theme.surfaceAlt,fontWeight:600},children:Ra(n,t,`${o}-h-${r}`)},r))})}),/* @__PURE__ */x("tbody",{children:e.rows.map((n,r)=>/* @__PURE__ */x("tr",{children:n.map((n,i)=>/* @__PURE__ */x("td",{style:{padding:"8px 12px",textAlign:e.align[i]??"left",borderBottom:`1px solid ${t.theme.border}`},children:Ra(n,t,`${o}-r-${r}-${i}`)},i))},r))})]})},o)}})}function Aa({source:e,src:t,maxWidth:n="100%",compact:r=!1,copyableCode:o=!0,onLinkClick:i,externalLinkRel:a="noopener noreferrer",externalLinkTarget:l="_blank",loadingFallback:d,errorFallback:c,className:u,style:h}){const g=se(),[b,y]=m({text:null,error:null,loading:!!t&&void 0===e}),v=f(null);s(()=>{if(void 0!==e||!t)return;v.current?.abort();const n=new AbortController;return v.current=n,y({text:null,error:null,loading:!0}),fetch(t,{signal:n.signal}).then(async e=>{if(!e.ok)throw new Error(`Failed to load markdown (HTTP ${e.status})`);y({text:await e.text(),error:null,loading:!1})}).catch(e=>{"AbortError"!==e.name&&y({text:null,error:e.message,loading:!1})}),()=>n.abort()},[t,e]);const w=e??b.text??"",k=p(()=>w?$a(w):[],[w]),$={theme:g,compact:r,copyableCode:o,externalLinkRel:a,externalLinkTarget:l,onLinkClick:i},S={maxWidth:n,width:"100%",color:g.text,fontFamily:"inherit",fontSize:r?14:15,lineHeight:1.65,wordBreak:"break-word",overflowWrap:"anywhere",boxSizing:"border-box",...h};if(void 0===e&&t){if(b.loading)/* @__PURE__ */return x("div",{className:u,style:S,"aria-busy":"true","aria-live":"polite",children:d??/* @__PURE__ */x("span",{style:{color:g.textMuted},children:"Loading…"})});if(b.error)/* @__PURE__ */return x("div",{className:u,style:S,role:"alert",children:c?c(b.error):/* @__PURE__ */x("span",{style:{color:g.danger},children:ke(b.error)})})}/* @__PURE__ */
378
+ return x("div",{className:u,style:S,children:Ia(k,$)})}Aa.displayName="TkxMarkdown";var La=r(null),Ta={required:"This field is required",invalidFormat:"Invalid format",minLength:e=>`Must be at least ${e} characters`,maxLength:e=>`Must be no more than ${e} characters`,minValue:e=>`Must be at least ${e}`,maxValue:e=>`Must be no more than ${e}`};async function Wa(e,t,n=Ta){for(const r of t){if(r.required&&(null==e||""===e||Array.isArray(e)&&0===e.length))return r.message??n.required;if(null!=e&&""!==e){if(void 0!==r.min){if("string"==typeof e&&e.length<r.min)return r.message??n.minLength(r.min);if("number"==typeof e&&e<r.min)return r.message??n.minValue(r.min)}if(void 0!==r.max){if("string"==typeof e&&e.length>r.max)return r.message??n.maxLength(r.max);if("number"==typeof e&&e>r.max)return r.message??n.maxValue(r.max)}if(r.pattern&&"string"==typeof e&&!r.pattern.test(e))return r.message??n.invalidFormat;if(r.validator){const t=await r.validator(e);if(t)return t}}}return null}function ja(){const e=l(La),t=f({}),n=f({}),r=f({}),o=p(()=>({getFieldValue:e=>t.current[e],setFieldValue:(e,n)=>{t.current[e]=n},getFieldsValue:()=>({...t.current}),setFieldsValue:e=>{Object.assign(t.current,e)},validateFields:()=>Promise.resolve({...t.current}),validateField:e=>Promise.resolve(!0),resetFields:()=>{t.current={},n.current={},r.current={}},getFieldError:e=>n.current[e]??null,isFieldTouched:e=>r.current[e]??!1}),[]);return e?e.instance:o}function Ea({onSubmit:e,onValuesChange:t,initialValues:n={},layout:r="vertical",disabled:o=!1,children:i,className:l,style:d,form:c}){const u=se(),h=yn(),g=p(()=>({required:h.fieldRequired??Ta.required,invalidFormat:h.invalidFormat??Ta.invalidFormat,minLength:h.minLength??Ta.minLength,maxLength:h.maxLength??Ta.maxLength,minValue:h.minValue??Ta.minValue,maxValue:h.maxValue??Ta.maxValue}),[h]),[b,y]=m({values:{...n},errors:{},touched:{}}),v=f(n),w=f({}),k=f(b);k.current=b;const $=a((e,t)=>{w.current[e]=t},[]),S=a(e=>{delete w.current[e]},[]),C=a((e,n)=>{y(r=>{const o={...r,values:{...r.values,[e]:n}};return t?.({[e]:n},o.values),o})},[t]),z=a((e,t)=>{y(n=>({...n,errors:{...n.errors,[e]:t}}))},[]),M=a(e=>{y(t=>({...t,touched:{...t.touched,[e]:!0}}))},[]),N=a(async e=>{const t=w.current[e];if(!t)return!0;const n=k.current.values[e],r=await Wa(n,t.rules,g);return y(t=>({...t,errors:{...t.errors,[e]:r},touched:{...t.touched,[e]:!0}})),null===r},[g]),D=a(async()=>{const e=Object.keys(w.current),t=await Promise.all(e.map(async e=>{const t=w.current[e],n=k.current.values[e];return{name:e,error:await Wa(n,t.rules,g)}})),n={},r={};let o=!1;for(const{name:i,error:a}of t)n[i]=a,r[i]=!0,a&&(o=!0);if(y(e=>({...e,errors:{...e.errors,...n},touched:{...e.touched,...r}})),o){const e=Object.fromEntries(t.filter(e=>e.error).map(e=>[e.name,e.error]));return Promise.reject(e)}return{...k.current.values}},[]),R=a(()=>{y({values:{...v.current},errors:{},touched:{}})},[]),P=p(()=>({getFieldValue:e=>k.current.values[e],setFieldValue:C,getFieldsValue:()=>({...k.current.values}),setFieldsValue:e=>{y(n=>{const r={...n.values,...e};return t?.(e,r),{...n,values:r}})},validateFields:D,validateField:N,resetFields:R,getFieldError:e=>k.current.errors[e]??null,isFieldTouched:e=>!!k.current.touched[e]}),[C,D,N,R,t]),F=a(async t=>{t.preventDefault();try{const t=await D();await(e?.(t))}catch{}},[D,e]),I=At("inline"===r?"flex flex-row flex-wrap items-end gap-4":"flex flex-col gap-5");s(()=>{if(!c)return;const e=c;e.getFieldValue=P.getFieldValue,e.setFieldValue=P.setFieldValue,e.getFieldsValue=P.getFieldsValue,e.setFieldsValue=P.setFieldsValue,e.validateFields=P.validateFields,e.validateField=P.validateField,e.resetFields=P.resetFields,e.getFieldError=P.getFieldError,e.isFieldTouched=P.isFieldTouched},[c,P]);const A=c??P,L=p(()=>({state:b,initialValues:v.current,layout:r,disabled:o,fieldMeta:w,setFieldValue:C,setFieldError:z,setFieldTouched:M,registerField:$,unregisterField:S,validateField:N,instance:A}),[b,r,o,C,z,M,$,S,N,A]);/* @__PURE__ */
379
+ return x(La.Provider,{value:L,children:/* @__PURE__ */x("form",{noValidate:!0,role:"form","aria-label":"Form",onSubmit:F,className:jt(I,l),style:{color:u.text,...d},children:i})})}function Ba({name:e,label:t,rules:r,help:o,required:i,children:s,className:d,style:c}){const u=se(),h=function(){const e=l(La);if(!e)throw new Error("TkxFormField must be used inside a <TkxForm>. Wrap your fields in a TkxForm component.");return e}(),{state:m,layout:y,disabled:v}=h,w=p(()=>function(e,t,n=Ta.required){const r=e?[...e]:[];return t&&!r.some(e=>e.required)&&r.unshift({required:!0,message:n}),r}(r,i),[r,i]),k=function(e){return e.some(e=>e.required)}(w),$=f({rules:w});$.current.rules=w;const S=f(!1);S.current||(h.registerField(e,$.current),S.current=!0),p(()=>{h.registerField(e,$.current)},[w,e,h]);const C=m.values[e],z=m.touched[e]?m.errors[e]??null:null,M=z?ke(z):null,N=t?ke(t):void 0,D=o?ke(o):void 0,R=a(t=>{let n;if(null!==t&&"object"==typeof t&&"target"in t){const e=t.target;n="checkbox"===e.type?e.checked:e.value}else n=t;h.setFieldValue(e,n)},[h,e]),P=a(()=>{h.setFieldTouched(e),h.validateField(e)},[h,e]),F=n(s,{value:C??"",onChange:R,onBlur:P,error:M??void 0,isInvalid:!!M,isRequired:k,disabled:v||s.props.disabled,name:e}),I="horizontal"===y,A="inline"===y,L=/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),T=N?/* @__PURE__ */b("label",{className:At("text-sm font-medium font-sans",I?"min-w-[140px] pt-2.5":""),style:{color:u.text},children:[N,k&&/* @__PURE__ */x("span",{"aria-hidden":"true",className:At("ml-1"),style:{color:u.danger},children:"*"})]}):null,W=/* @__PURE__ */b(g,{children:[D&&!M&&/* @__PURE__ */x("span",{className:At("text-xs mt-0.5"),style:{color:u.textMuted},children:D}),M&&/* @__PURE__ */b("span",{role:"alert",className:At("text-xs flex items-center gap-1 mt-0.5"),style:{color:u.danger,animation:"tkxFormErrorReveal 200ms ease-out"},children:[L,M]})]});/* @__PURE__ */
380
+ return b("div",A?{className:jt(At("flex flex-col gap-1"),d),style:c,children:[T,F,W]}:I?{className:jt(At("flex flex-row gap-4 items-start"),d),style:c,children:[T,/* @__PURE__ */b("div",{className:At("flex flex-col gap-1 flex-1 min-w-0"),children:[F,W]})]}:{className:jt(At("flex flex-col gap-1"),d),style:c,children:[T,F,W]})}Ea.displayName="TkxForm",Ba.displayName="TkxFormField";var Va=!1;!function(){if(Va)return;if("undefined"==typeof document)return;Va=!0;const e=document.createElement("style");e.setAttribute("data-tkx-form",""),e.textContent="\n @keyframes tkxFormErrorReveal {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n ",document.head.appendChild(e)}();var Ha={sm:576,md:768,lg:992,xl:1200};function Oa(e){return"number"==typeof e?`${e}px`:e}var qa=r({h:0,v:0}),Ua=i(({children:e,hasSider:t=!1,className:n,style:r,...o},i)=>{const a=se(),l=At("flex min-h-0 w-full font-sans"),s=t?{flexDirection:"row"}:{flexDirection:"column"};/* @__PURE__ */
381
+ return x("section",{ref:i,className:jt("tkx-layout",l,n),style:{minHeight:"100%",color:a.text,backgroundColor:a.bg,...s,...r},...o,children:e})});Ua.displayName="TkxLayout";var Ka=i(({children:e,height:t=64,fixed:n=!1,className:r,style:o,...i},a)=>{const l=se(),s=Oa(t),d=At("flex items-center px-6 shrink-0 w-full"),c=n?{position:"fixed",top:0,left:0,right:0,zIndex:1e3}:{};/* @__PURE__ */
382
+ return x("header",{ref:a,className:jt("tkx-layout-header",d,r),style:{height:s,minHeight:s,backgroundColor:l.surface,borderBottom:`1px solid ${l.border}`,...c,...o},...i,children:e})});function Ya({collapsed:e,onClick:t,color:n}){const r=et();/* @__PURE__ */
383
+ return x("button",{type:"button","aria-label":e?"Expand sidebar":"Collapse sidebar",onClick:t,className:At("flex items-center justify-center w-full py-3 cursor-pointer","border-0 bg-transparent"),style:{color:n},children:/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{transform:e?"rotate(0deg)":"rotate(180deg)",transition:r?"none":"transform 200ms ease"},"aria-hidden":"true",children:/* @__PURE__ */x("path",{d:"M6 3l5 5-5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}Ka.displayName="TkxHeader";var Xa=i(({children:e,width:t=240,collapsedWidth:n=64,collapsed:r,onCollapse:o,collapsible:i=!1,breakpoint:l,trigger:d,className:c,style:u,...p},h)=>{const f=se(),g=et(),[y,v]=m(!1),w=r??y,k=a(e=>{void 0===r&&v(e),o?.(e)},[r,o]);s(()=>{if(!l)return;const e=Ha[l];if(!e)return;const t=window.matchMedia(`(max-width: ${e-1}px)`),n=e=>{k(e.matches)};return k(t.matches),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[l,k]);const $=Oa(t),S=w?`${n}px`:$,C=i&&null!==d,z=g?"none":"width 200ms ease, min-width 200ms ease, max-width 200ms ease";/* @__PURE__ */
384
+ return b("aside",{ref:h,className:jt("tkx-layout-sider",At("shrink-0 overflow-hidden flex flex-col"),c),style:{width:S,minWidth:S,maxWidth:S,backgroundColor:f.surface,borderRight:`1px solid ${f.border}`,transition:z,...u},...p,children:[/* @__PURE__ */x("div",{className:At("flex-1 overflow-y-auto overflow-x-hidden"),style:{width:S,transition:z},children:e}),C&&/* @__PURE__ */x("div",{className:At("shrink-0"),style:{borderTop:`1px solid ${f.border}`},children:void 0!==d?d:/* @__PURE__ */x(Ya,{collapsed:w,onClick:()=>k(!w),color:f.textMuted})})]})});Xa.displayName="TkxSider";var Za=i(({children:e,className:t,style:n,...r},o)=>{const i=se();/* @__PURE__ */
385
+ return x("main",{ref:o,className:jt("tkx-layout-content",At("flex-1 min-w-0 min-h-0"),t),style:{backgroundColor:i.bg,padding:"24px",...n},...r,children:e})});Za.displayName="TkxContent";var Ga=i(({children:e,className:t,style:n,...r},o)=>{const i=se();/* @__PURE__ */
386
+ return x("footer",{ref:o,className:jt("tkx-layout-footer",At("flex items-center px-6 py-4 shrink-0"),t),style:{backgroundColor:i.surface,borderTop:`1px solid ${i.border}`,color:i.textMuted,...n},...r,children:e})});Ga.displayName="TkxFooter";var _a={start:"flex-start",center:"center",end:"flex-end","space-between":"space-between","space-around":"space-around","space-evenly":"space-evenly"},Ja={top:"flex-start",middle:"center",bottom:"flex-end",stretch:"stretch"},Qa=i(({children:e,gutter:t,justify:n="start",align:r="top",wrap:o=!0,className:i,style:a,...l},s)=>{const[d,c]=Array.isArray(t)?t:[t??0,0],u=d/2,p=c/2,h=d||c?{marginLeft:-u,marginRight:-u,marginTop:-p,marginBottom:-p}:{},f={h:u,v:p};/* @__PURE__ */
387
+ return x(qa.Provider,{value:f,children:/* @__PURE__ */x("div",{ref:s,className:jt("tkx-row",At("flex w-full"),i),style:{flexWrap:o?"wrap":"nowrap",justifyContent:_a[n]??"flex-start",alignItems:Ja[r]??"flex-start",...h,...a},...l,children:e})})});Qa.displayName="TkxRow";var el=!1;function tl(e){if(void 0!==e)return"number"==typeof e?{span:e}:e}var nl=i(({children:e,span:t,offset:n=0,push:r,pull:o,order:i,sm:a,md:d,lg:c,xl:u,className:p,style:h,...f},m)=>{s(()=>{!function(){if(el||"undefined"==typeof document)return;el=!0;const e=[];for(const[n,r]of Object.entries(Ha)){for(let t=1;t<=24;t++){const o=t/24*100+"%";e.push(`@media (min-width: ${r}px) { .tkx-col-${n}-${t} { flex: 0 0 ${o} !important; max-width: ${o} !important; } }`)}for(let t=0;t<=24;t++){const o=t/24*100+"%";e.push(`@media (min-width: ${r}px) { .tkx-col-${n}-offset-${t} { margin-left: ${o} !important; } }`)}}const t=document.createElement("style");t.id="tkx-col-responsive",t.textContent=e.join("\n"),document.head.appendChild(t)}()},[]);const g=l(qa),b=void 0!==t?t/24*100+"%":void 0,y=n?n/24*100+"%":void 0,v=[],w=[["sm",a],["md",d],["lg",c],["xl",u]];for(const[l,s]of w){const e=tl(s);e&&(v.push(`tkx-col-${l}-${e.span}`),void 0!==e.offset&&e.offset>0&&v.push(`tkx-col-${l}-offset-${e.offset}`))}const k={};return void 0!==r&&(k.left=r/24*100+"%",k.position="relative"),void 0!==o&&(k.right=o/24*100+"%",k.position="relative"),void 0!==i&&(k.order=i),/* @__PURE__ */x("div",{ref:m,className:jt("tkx-col",At("box-border min-h-[1px]"),...v,p),style:{flex:b?`0 0 ${b}`:"1",maxWidth:b??"100%",marginLeft:y,paddingLeft:g.h||void 0,paddingRight:g.h||void 0,paddingTop:g.v||void 0,paddingBottom:g.v||void 0,...k,...h},...f,children:e})});nl.displayName="TkxCol";var rl=r({locale:"en-US",direction:"ltr",componentDefaults:{size:"md",variant:"default",animation:!0,bordered:!0},componentOverrides:{},prefixCls:"tkx",configured:!1,cls:e=>`tkx-${e}`,getSize:()=>"md",getAnimation:()=>!0,getBordered:()=>!0});function ol({children:e,locale:t,direction:n,componentDefaults:r,componentOverrides:o,prefixCls:i}){const s=l(rl),d=p(()=>({size:r?.size??s.componentDefaults.size,variant:r?.variant??s.componentDefaults.variant,animation:r?.animation??s.componentDefaults.animation,bordered:r?.bordered??s.componentDefaults.bordered}),[r,s.componentDefaults]),c=p(()=>{const e=s.componentOverrides,t=o??{};return{button:{...e.button,...t.button},input:{...e.input,...t.input},table:{...e.table,...t.table},modal:{...e.modal,...t.modal}}},[o,s.componentOverrides]),u=t??s.locale,h=n??s.direction,f=i??s.prefixCls,m=a(e=>`${f}-${e}`,[f]),g=a((e,t)=>{if(void 0!==t)return t;if(e){const t=c[e];if(t?.size)return t.size}return d.size},[d.size,c]),b=a(e=>void 0!==e?e:d.animation,[d.animation]),y=a((e,t)=>{if(void 0!==t)return t;if(e){const t=c[e];if(void 0!==t?.bordered)return t.bordered}return d.bordered},[d.bordered,c]),v=p(()=>({locale:u,direction:h,componentDefaults:d,componentOverrides:c,prefixCls:f,configured:!0,cls:m,getSize:g,getAnimation:b,getBordered:y}),[u,h,d,c,f,m,g,b,y]);/* @__PURE__ */
388
+ return x(rl.Provider,{value:v,children:/* @__PURE__ */x("div",{dir:h,lang:u,className:`${f}-config-root`,style:{direction:h},children:e})})}function il(){return l(rl)}function al(e,t){const{prefixCls:n}=il();return`${t??n}-${e}`}function ll(e,t){const{getSize:n}=il();return n(e,t)}ol.displayName="TkxConfigProvider";var sl={sm:32,md:40,lg:48},dl={sm:"0.75rem",md:"0.875rem",lg:"1rem"},cl={sm:8,md:12,lg:16},ul={sm:4,md:8,lg:12},pl={sm:4,md:6,lg:8},hl={sm:14,md:16,lg:20};function fl(){const{direction:e}=il();if("rtl"===e)return{transform:"scaleX(-1)"}}function ml(e,t=0){const{direction:n}=il(),r="number"==typeof e?`${e}px`:e,o="number"==typeof t?`${t}px`:t;return"rtl"===n?{marginRight:r,marginLeft:o}:{marginLeft:r,marginRight:o}}var gl={"en-US":"English (US)","en-GB":"English (UK)","es-ES":"Spanish","fr-FR":"French","de-DE":"German","ja-JP":"Japanese","ko-KR":"Korean","zh-CN":"Chinese (Simplified)","zh-TW":"Chinese (Traditional)","pt-BR":"Portuguese (Brazil)","ar-SA":"Arabic","hi-IN":"Hindi","ru-RU":"Russian","it-IT":"Italian","nl-NL":"Dutch","sv-SE":"Swedish","pl-PL":"Polish","tr-TR":"Turkish","th-TH":"Thai","vi-VN":"Vietnamese"},xl=new Set(["ar","ar-SA","ar-EG","ar-AE","he","he-IL","fa","fa-IR","ur","ur-PK","ps","ps-AF"]);function bl(e){return xl.has(e)||xl.has(e.split("-")[0])}function yl(e){if(gl[e])return gl[e];if("undefined"!=typeof Intl&&Intl.DisplayNames)try{return new Intl.DisplayNames(["en"],{type:"language"}).of(e)??e}catch{return e}return e}function vl(e){return"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(vl).join(""):e&&"object"==typeof e&&"props"in e?vl(e.props.children):""}function wl({text:e}){const t=se(),[n,r]=m(!1);return o("button",{type:"button",onClick:a(()=>{navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})},[e]),"aria-label":n?"Copied":"Copy to clipboard",style:{display:"inline-flex",alignItems:"center",marginLeft:"4px",padding:"2px 6px",border:"none",background:"transparent",color:n?t.success:t.textMuted,cursor:"pointer",fontSize:"0.8em",borderRadius:"4px",transition:"color 0.2s"}},n?"Copied!":"⎘")}function kl(e="default"){const t=se();return{default:t.text,secondary:t.textMuted,success:t.success,warning:t.warning,danger:t.danger}[e]}var $l={1:{fontSize:"2.25rem",lineHeight:"1.2",fontWeight:700},2:{fontSize:"1.875rem",lineHeight:"1.25",fontWeight:700},3:{fontSize:"1.5rem",lineHeight:"1.3",fontWeight:600},4:{fontSize:"1.25rem",lineHeight:"1.35",fontWeight:600},5:{fontSize:"1rem",lineHeight:"1.4",fontWeight:600}};function Sl({level:e=1,children:t,copyable:n=!1,type:r="default",style:i}){const a=kl(r);se();const l=$l[e],s=`h${e}`,d="string"==typeof t?ke(t):t,c=vl(t);return o(s,{style:{color:a,fontSize:l.fontSize,lineHeight:l.lineHeight,fontWeight:l.fontWeight,margin:"0 0 0.5em 0",fontFamily:"inherit",...i}},d,n&&o(wl,{text:c}))}function Cl({children:e,type:t="default",strong:n=!1,italic:r=!1,underline:i=!1,delete:a=!1,code:l=!1,mark:s=!1,copyable:d=!1,style:c}){const u=kl(t),p=se(),h=vl(e),f="string"==typeof e?ke(e):e,m=[];i&&m.push("underline"),a&&m.push("line-through");let g=f;return l&&(g=o("code",{style:{padding:"0.15em 0.4em",fontSize:"0.875em",backgroundColor:p.surfaceAlt,border:`1px solid ${p.border}`,borderRadius:"4px",fontFamily:"monospace"}},g)),s&&(g=o("mark",{style:{backgroundColor:`${p.warning}33`,color:u,padding:"0 2px",borderRadius:"2px"}},g)),o(n?"strong":r?"em":"span",{style:{color:u,fontStyle:r?"italic":"normal",textDecoration:m.length>0?m.join(" "):"none",...c}},g,d&&o(wl,{text:h}))}function zl({children:e,type:t="default",copyable:n=!1,ellipsis:r=!1,style:i}){const a=se(),l="secondary"===t?a.textMuted:a.text,s=vl(e),d="string"==typeof e?ke(e):e,c={};if(r){const e="object"==typeof r?r.rows??3:3;c.display="-webkit-box",c.WebkitLineClamp=e,c.WebkitBoxOrient="vertical",c.overflow="hidden"}return o("div",{style:{color:l,fontSize:"1rem",lineHeight:"1.6",margin:"0 0 1em 0",...c,...i}},d,n&&o(wl,{text:s}))}var Ml={sm:{dimension:20,borderWidth:2,fontSize:"0.75rem"},md:{dimension:32,borderWidth:3,fontSize:"0.875rem"},lg:{dimension:48,borderWidth:4,fontSize:"1rem"}},Nl=!1;function Dl({size:e,color:t}){return o("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Loading"},o("circle",{cx:12,cy:12,r:10,stroke:`${t}33`,strokeWidth:2.5,fill:"none"}),o("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:t,strokeWidth:2.5,strokeLinecap:"round",fill:"none"}))}function Rl({size:e,borderWidth:t,color:n,reducedMotion:r}){return r?o(Dl,{size:e,color:n}):(function(){if(Nl||"undefined"==typeof document)return;Nl=!0;const e=document.createElement("style");e.id="tkx-spin-styles",e.textContent="\n @keyframes tkx-spin-rotate {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ",document.head.appendChild(e)}(),o("div",{role:"img","aria-label":"Loading",style:{width:`${e}px`,height:`${e}px`,border:`${t}px solid ${n}33`,borderTopColor:n,borderRadius:"50%",animation:"tkx-spin-rotate 0.8s linear infinite",boxSizing:"border-box"}}))}function Pl({spinning:e=!0,size:t="md",tip:n,indicator:r,children:i,fullscreen:a=!1,delay:l=0,style:d}){const c=se(),u=et(),[p,h]=m(0===l&&e),g=f(null);if(s(()=>(e&&l>0?g.current=setTimeout(()=>h(!0),l):h(e),()=>{null!==g.current&&clearTimeout(g.current)}),[e,l]),!p)return i?o("div",{style:d},i):null;const x=Ml[t],b=n?ke(n):void 0,y=o("div",{role:"status","aria-live":"polite","aria-label":b??"Loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},r??o(Rl,{size:x.dimension,borderWidth:x.borderWidth,color:c.primary,reducedMotion:u}),b&&o("span",{style:{color:c.primary,fontSize:x.fontSize,marginTop:"4px"}},b));return a?o("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${c.bg}cc`,zIndex:9999,...d}},y):i?o("div",{style:{position:"relative",...d}},o("div",{style:{filter:"blur(1px)",opacity:.5,pointerEvents:"none",userSelect:"none",transition:u?"none":"opacity 0.2s, filter 0.2s"}},i),o("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${c.bg}66`,borderRadius:"4px"}},y)):o("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",...d}},y)}function Fl({color:e,mutedColor:t}){return o("svg",{width:120,height:100,viewBox:"0 0 120 100",fill:"none","aria-hidden":"true"},o("path",{d:"M20 40 L60 20 L100 40 L60 60 Z",fill:`${t}18`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),o("path",{d:"M20 40 L20 65 L60 85 L60 60 Z",fill:`${t}10`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),o("path",{d:"M100 40 L100 65 L60 85 L60 60 Z",fill:`${t}0d`,stroke:t,strokeWidth:1.5,strokeLinejoin:"round"}),o("path",{d:"M20 40 L40 28 L60 40 L40 52 Z",fill:`${e}15`,stroke:e,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}),o("path",{d:"M60 40 L80 28 L100 40 L80 52 Z",fill:`${e}15`,stroke:e,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}))}function Il({mutedColor:e}){return o("svg",{width:64,height:64,viewBox:"0 0 64 64",fill:"none","aria-hidden":"true"},o("rect",{x:16,y:8,width:32,height:40,rx:3,fill:`${e}12`,stroke:e,strokeWidth:1.5}),o("line",{x1:24,y1:20,x2:40,y2:20,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),o("line",{x1:24,y1:28,x2:36,y2:28,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),o("line",{x1:24,y1:36,x2:32,y2:36,stroke:e,strokeWidth:1.5,strokeLinecap:"round"}),o("circle",{cx:32,cy:54,r:6,stroke:e,strokeWidth:1.2,fill:"none"}),o("line",{x1:28,y1:54,x2:36,y2:54,stroke:e,strokeWidth:1.2,strokeLinecap:"round"}))}function Al({image:e="default",description:t="No data",children:n,style:r}){const i=se(),a="string"==typeof t?ke(t):t;let l;return l="default"===e?o(Fl,{color:i.primary,mutedColor:i.textMuted}):"simple"===e?o(Il,{mutedColor:i.textMuted}):e,o("div",{role:"status",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",textAlign:"center",...r}},o("div",{style:{marginBottom:"12px",opacity:.85}},l),a&&o("div",{style:{color:i.textMuted,fontSize:"0.875rem",lineHeight:"1.5",maxWidth:"320px"}},a),n&&o("div",{style:{marginTop:"16px"}},n))}function Ll({direction:e,color:t}){return o("svg",{width:16,height:14,viewBox:"0 0 20 14",fill:"none","aria-hidden":"true",style:{display:"inline-block",verticalAlign:"middle"}},o("path",{d:"up"===e?"M6 10 L10 4 L14 10":"M6 4 L10 10 L14 4",stroke:t,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}))}var Tl=!1;function Wl({w:e,h:t,alt:n,bdr:r,rm:i}){return i||function(){if(Tl||"undefined"==typeof document)return;Tl=!0;const e=document.createElement("style");e.id="tkx-statistic-skeleton",e.textContent="@keyframes tkx-stat-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}",document.head.appendChild(e)}(),o("div",{"aria-hidden":"true",style:{width:e,height:t,borderRadius:"4px",background:i?n:`linear-gradient(90deg, ${n} 25%, ${r} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:i?"none":"tkx-stat-shimmer 1.5s ease-in-out infinite"}})}function jl({title:e,value:t,prefix:n,suffix:r,precision:i,groupSeparator:a=",",valueStyle:l,loading:s=!1,trend:d,trendValue:c,style:u}){const p=se(),h=et(),f=ke(e),m=c?ke(c):void 0,g="up"===d?p.success:"down"===d?p.danger:void 0;return o("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...u}},o("div",{style:{color:p.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},f),s?o(Wl,{w:"120px",h:"32px",alt:p.surfaceAlt,bdr:p.border,rm:h}):o("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:p.text,fontVariantNumeric:"tabular-nums",...l}},n&&o("span",{style:{fontSize:"0.75em",fontWeight:400}},n),o("span",null,function(e,t,n=","){if("string"==typeof e)return e;const[r,o]=(void 0!==t?e.toFixed(t):String(e)).split("."),i=r.replace(/\B(?=(\d{3})+(?!\d))/g,n);return void 0!==o?`${i}.${o}`:i}(t,i,a)),r&&o("span",{style:{fontSize:"0.6em",fontWeight:400,color:p.textMuted}},r)),d&&o("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"0.8125rem",color:g,marginTop:"2px"}},o(Ll,{direction:d,color:g}),m&&o("span",null,m)))}function El({title:e,value:t,format:n="HH:mm:ss",onFinish:r,prefix:i,suffix:a,style:l}){const d=se(),c=ke(e),u=f(r);u.current=r;const p=f(!1),[h,g]=m(()=>Math.max(0,t-Date.now()));s(()=>{p.current=!1;const e=()=>{const e=Math.max(0,t-Date.now());g(e),e<=0&&!p.current&&(p.current=!0,u.current?.())};e();const n=setInterval(e,1e3);return()=>clearInterval(n)},[t]);const x=function(e,t){if(e<=0)return t.replace(/DD?/g,"0").replace(/HH?/g,"00").replace(/mm?/g,"00").replace(/ss?/g,"00");const n=Math.floor(e/1e3),r=Math.floor(n/86400),o=Math.floor(n%86400/3600),i=Math.floor(n%3600/60),a=n%60,l=e=>String(e).padStart(2,"0");return t.replace(/DD/g,l(r)).replace(/D/g,String(r)).replace(/HH/g,l(o)).replace(/H/g,String(o)).replace(/mm/g,l(i)).replace(/m/g,String(i)).replace(/ss/g,l(a)).replace(/s/g,String(a))}(h,n);return o("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...l}},o("div",{style:{color:d.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},c),o("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:h<=0?d.danger:d.text,fontVariantNumeric:"tabular-nums"}},i&&o("span",{style:{fontSize:"0.75em",fontWeight:400}},i),o("span",null,x),a&&o("span",{style:{fontSize:"0.6em",fontWeight:400,color:d.textMuted}},a)))}var Bl={sm:{height:28,fontSize:12,px:10},md:{height:36,fontSize:14,px:16},lg:{height:44,fontSize:16,px:20}};function Vl({options:e,value:t,onChange:n,size:r="md",block:o=!1}){const i=se(),l=et(),d=f(null),[c,u]=m(()=>Math.max(0,e.findIndex(e=>e.value===t))),[p,h]=m({}),g=Bl[r];s(()=>{const n=e.findIndex(e=>e.value===t);n>=0&&u(n)},[t,e]),s(()=>{const e=d.current;if(!e)return;const t=e.querySelectorAll("[data-seg-btn]")[c];t&&h({left:t.offsetLeft,width:t.offsetWidth,height:t.offsetHeight,transition:l?"none":"left 0.2s ease, width 0.2s ease"})},[c,e,l]);const y=a(t=>{const r=e[t];r&&!r.disabled&&(u(t),n?.(r.value))},[e,n]),v=a(t=>{let n=c;if("ArrowRight"===t.key||"ArrowDown"===t.key)for(t.preventDefault(),n=(c+1)%e.length;e[n]?.disabled&&n!==c;)n=(n+1)%e.length;else if("ArrowLeft"===t.key||"ArrowUp"===t.key)for(t.preventDefault(),n=(c-1+e.length)%e.length;e[n]?.disabled&&n!==c;)n=(n-1+e.length)%e.length;n!==c&&(y(n),(d.current?.querySelectorAll("[data-seg-btn]"))?.[n]?.focus())},[c,e,y]);/* @__PURE__ */
362
389
  return b("div",{ref:d,role:"radiogroup","aria-label":"Segmented control",className:At("relative inline-flex items-center rounded-lg p-1"),style:{backgroundColor:i.surfaceAlt,border:`1px solid ${i.border}`,width:o?"100%":void 0},onKeyDown:v,children:[/* @__PURE__ */x("div",{"aria-hidden":"true",className:At("absolute top-1 rounded-md"),style:{...p,backgroundColor:i.surface,boxShadow:`0 1px 3px ${i.border}`,zIndex:0}}),e.map((e,t)=>{const n=t===c,r=ke(e.label);/* @__PURE__ */
363
- return b("button",{"data-seg-btn":!0,type:"button",role:"radio","aria-checked":n,"aria-disabled":e.disabled||void 0,disabled:e.disabled,tabIndex:n?0:-1,className:At("relative z-10 flex items-center justify-center gap-1 rounded-md border-0 cursor-pointer","font-sans whitespace-nowrap select-none"),style:{height:g.height,fontSize:g.fontSize,padding:`0 ${g.px}px`,flex:o?1:void 0,color:n?i.text:i.textMuted,backgroundColor:"transparent",opacity:e.disabled?.4:1,fontWeight:n?600:400,transition:l?"none":"color 0.15s ease"},onClick:()=>y(t),children:[e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",children:e.icon}),r]},e.value)})]})}function Fl({options:e,value:t="",onChange:n,trigger:r="@",placeholder:o,label:i}){const l=se(),d=et(),c=f(null),u=f(null),[p,h]=m(t),[g,y]=m(!1),[v,w]=m(""),[k,$]=m(0),[S,C]=m(-1);s(()=>{void 0!==t&&h(t)},[t]);const z=e.filter(e=>e.label.toLowerCase().includes(v.toLowerCase())),M=a(e=>{const t=He(e.target.value);h(t),n?.(t);const o=e.target.selectionStart??t.length,i=t.slice(0,o),a=i.lastIndexOf(r);if(a>=0){const e=i.slice(a+r.length);if(!/\s/.test(e))return w(e),C(a),y(!0),void $(0)}y(!1)},[r,n]),N=a(e=>{const t=p.slice(0,S),o=p.slice(S+r.length+v.length),i=`${t}${r}${e.value} ${o}`;h(i),n?.(i),y(!1),c.current?.focus()},[p,S,r,v,n]),D=a(e=>{g&&("ArrowDown"===e.key?(e.preventDefault(),$(e=>(e+1)%z.length)):"ArrowUp"===e.key?(e.preventDefault(),$(e=>(e-1+z.length)%z.length)):"Enter"===e.key&&z[k]?(e.preventDefault(),N(z[k])):"Escape"===e.key&&y(!1))},[g,z,k,N]);s(()=>{g&&u.current&&u.current.children[k]?.scrollIntoView({block:"nearest"})},[k,g]);const P=i?ke(i):void 0,R=o?ke(o):void 0;/* @__PURE__ */
364
- return b("div",{className:At("relative font-sans"),style:{width:"100%"},children:[P&&/* @__PURE__ */x("label",{className:At("block text-sm font-medium mb-1"),style:{color:l.text},children:P}),
365
- /* @__PURE__ */x("textarea",{ref:c,role:"combobox","aria-expanded":g,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-label":P??"Mentions input",value:p,placeholder:R,onChange:M,onKeyDown:D,onBlur:()=>setTimeout(()=>y(!1),200),className:At("w-full rounded-lg border px-3 py-2 text-sm resize-y"),style:{backgroundColor:l.surface,borderColor:l.border,color:l.text,minHeight:80,outline:"none"},rows:3}),g&&z.length>0&&/* @__PURE__ */x("ul",{ref:u,role:"listbox","aria-label":"Mention suggestions",className:At("absolute left-0 right-0 z-50 rounded-lg border overflow-auto"),style:{backgroundColor:l.surface,borderColor:l.border,maxHeight:200,top:"100%",marginTop:4,listStyle:"none",padding:0,boxShadow:`0 4px 12px ${l.bg}80`,animation:d?"none":"tkxFadeIn 0.15s ease"},children:z.map((e,t)=>/* @__PURE__ */b("li",{role:"option","aria-selected":t===k,className:At("flex items-center gap-3 px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:t===k?l.surfaceAlt:"transparent",color:l.text},onMouseDown:t=>{t.preventDefault(),N(e)},onMouseEnter:()=>$(t),children:[e.avatar&&/* @__PURE__ */x("img",{src:ke(e.avatar),alt:"","aria-hidden":"true",width:24,height:24,className:At("rounded-full"),style:{objectFit:"cover"}}),
390
+ return b("button",{"data-seg-btn":!0,type:"button",role:"radio","aria-checked":n,"aria-disabled":e.disabled||void 0,disabled:e.disabled,tabIndex:n?0:-1,className:At("relative z-10 flex items-center justify-center gap-1 rounded-md border-0 cursor-pointer","font-sans whitespace-nowrap select-none"),style:{height:g.height,fontSize:g.fontSize,padding:`0 ${g.px}px`,flex:o?1:void 0,color:n?i.text:i.textMuted,backgroundColor:"transparent",opacity:e.disabled?.4:1,fontWeight:n?600:400,transition:l?"none":"color 0.15s ease"},onClick:()=>y(t),children:[e.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",children:e.icon}),r]},e.value)})]})}function Hl({options:e,value:t="",onChange:n,trigger:r="@",placeholder:o,label:i}){const l=se(),d=et(),c=f(null),u=f(null),[p,h]=m(t),[g,y]=m(!1),[v,w]=m(""),[k,$]=m(0),[S,C]=m(-1);s(()=>{void 0!==t&&h(t)},[t]);const z=e.filter(e=>e.label.toLowerCase().includes(v.toLowerCase())),M=a(e=>{const t=He(e.target.value);h(t),n?.(t);const o=e.target.selectionStart??t.length,i=t.slice(0,o),a=i.lastIndexOf(r);if(a>=0){const e=i.slice(a+r.length);if(!/\s/.test(e))return w(e),C(a),y(!0),void $(0)}y(!1)},[r,n]),N=a(e=>{const t=p.slice(0,S),o=p.slice(S+r.length+v.length),i=`${t}${r}${e.value} ${o}`;h(i),n?.(i),y(!1),c.current?.focus()},[p,S,r,v,n]),D=a(e=>{g&&("ArrowDown"===e.key?(e.preventDefault(),$(e=>(e+1)%z.length)):"ArrowUp"===e.key?(e.preventDefault(),$(e=>(e-1+z.length)%z.length)):"Enter"===e.key&&z[k]?(e.preventDefault(),N(z[k])):"Escape"===e.key&&y(!1))},[g,z,k,N]);s(()=>{g&&u.current&&u.current.children[k]?.scrollIntoView({block:"nearest"})},[k,g]);const R=i?ke(i):void 0,P=o?ke(o):void 0;/* @__PURE__ */
391
+ return b("div",{className:At("relative font-sans"),style:{width:"100%"},children:[R&&/* @__PURE__ */x("label",{className:At("block text-sm font-medium mb-1"),style:{color:l.text},children:R}),
392
+ /* @__PURE__ */x("textarea",{ref:c,role:"combobox","aria-expanded":g,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-label":R??"Mentions input",value:p,placeholder:P,onChange:M,onKeyDown:D,onBlur:()=>setTimeout(()=>y(!1),200),className:At("w-full rounded-lg border px-3 py-2 text-sm resize-y"),style:{backgroundColor:l.surface,borderColor:l.border,color:l.text,minHeight:80,outline:"none"},rows:3}),g&&z.length>0&&/* @__PURE__ */x("ul",{ref:u,role:"listbox","aria-label":"Mention suggestions",className:At("absolute left-0 right-0 z-50 rounded-lg border overflow-auto"),style:{backgroundColor:l.surface,borderColor:l.border,maxHeight:200,top:"100%",marginTop:4,listStyle:"none",padding:0,boxShadow:`0 4px 12px ${l.bg}80`,animation:d?"none":"tkxFadeIn 0.15s ease"},children:z.map((e,t)=>/* @__PURE__ */b("li",{role:"option","aria-selected":t===k,className:At("flex items-center gap-3 px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:t===k?l.surfaceAlt:"transparent",color:l.text},onMouseDown:t=>{t.preventDefault(),N(e)},onMouseEnter:()=>$(t),children:[e.avatar&&/* @__PURE__ */x("img",{src:ke(e.avatar),alt:"","aria-hidden":"true",width:24,height:24,className:At("rounded-full"),style:{objectFit:"cover"}}),
366
393
  /* @__PURE__ */x("span",{children:ke(e.label)}),
367
- /* @__PURE__ */b("span",{style:{color:l.textMuted,marginLeft:"auto"},children:[r,ke(e.value)]})]},e.value))})]})}var Il={L:.38,M:.42,Q:.48,H:.55};function Al({value:e,size:t=160,color:n,bgColor:r,errorLevel:o="M",icon:i,bordered:a=!0}){const l=se(),d=et(),c=f(null),u=ke(e),h=n??l.text,m=r??l.surface,g=p(()=>function(e,t,n){const r=function(e){let t=e;return()=>(t=1664525*t+1013904223|0,(t>>>0)/4294967295)}(function(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return Math.abs(t)}(e)),o=Il[n]??.42,i=Array.from({length:t},()=>Array.from({length:t},()=>!1)),a=(e,t)=>{for(let n=0;n<7;n++)for(let r=0;r<7;r++){const o=0===n||6===n||0===r||6===r,a=n>=2&&n<=4&&r>=2&&r<=4;i[e+n][t+r]=o||a}};a(0,0),a(0,18),a(18,0);for(let l=7;l<18;l++)i[6][l]=l%2==0,i[l][6]=l%2==0;for(let l=0;l<t;l++)for(let e=0;e<t;e++)l<8&&e<8||l<8&&e>=17||l>=17&&e<8||6===l||6===e||(i[l][e]=r()<o);return i}(u,25,o),[u,o]);return s(()=>{const e=c.current;if(!e)return;const n=e.getContext("2d");if(!n)return;const r=window.devicePixelRatio||1;e.width=t*r,e.height=t*r,n.scale(r,r);const o=t/25;n.fillStyle=m,n.fillRect(0,0,t,t),n.fillStyle=h;for(let t=0;t<25;t++)for(let e=0;e<25;e++)g[t][e]&&n.fillRect(e*o,t*o,o,o);if(i){const e=.22*t,r=(t-e)/2;n.fillStyle=m,n.fillRect(r-2,r-2,e+4,e+4);const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{n.drawImage(o,r,r,e,e)},o.src=ke(i)}},[g,t,h,m,i]),/* @__PURE__ */x("div",{role:"img","aria-label":`QR code for: ${u}`,className:At("inline-block rounded-lg"),style:{padding:a?12:0,backgroundColor:a?m:"transparent",border:a?`1px solid ${l.border}`:"none",lineHeight:0,animation:d?"none":"tkxFadeIn 0.2s ease"},children:/* @__PURE__ */x("canvas",{ref:c,"aria-hidden":"true",style:{width:t,height:t,display:"block"}})})}var Ll={success:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),/* @__PURE__ */x("path",{d:"M22 37l9 9 19-19",stroke:e,strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),error:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),/* @__PURE__ */x("path",{d:"M26 26l20 20M46 26L26 46",stroke:e,strokeWidth:"4",strokeLinecap:"round"})]}),warning:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[
394
+ /* @__PURE__ */b("span",{style:{color:l.textMuted,marginLeft:"auto"},children:[r,ke(e.value)]})]},e.value))})]})}var Ol={L:.38,M:.42,Q:.48,H:.55};function ql({value:e,size:t=160,color:n,bgColor:r,errorLevel:o="M",icon:i,bordered:a=!0}){const l=se(),d=et(),c=f(null),u=ke(e),h=n??l.text,m=r??l.surface,g=p(()=>function(e,t,n){const r=function(e){let t=e;return()=>(t=1664525*t+1013904223|0,(t>>>0)/4294967295)}(function(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return Math.abs(t)}(e)),o=Ol[n]??.42,i=Array.from({length:t},()=>Array.from({length:t},()=>!1)),a=(e,t)=>{for(let n=0;n<7;n++)for(let r=0;r<7;r++){const o=0===n||6===n||0===r||6===r,a=n>=2&&n<=4&&r>=2&&r<=4;i[e+n][t+r]=o||a}};a(0,0),a(0,18),a(18,0);for(let l=7;l<18;l++)i[6][l]=l%2==0,i[l][6]=l%2==0;for(let l=0;l<t;l++)for(let e=0;e<t;e++)l<8&&e<8||l<8&&e>=17||l>=17&&e<8||6===l||6===e||(i[l][e]=r()<o);return i}(u,25,o),[u,o]);return s(()=>{const e=c.current;if(!e)return;const n=e.getContext("2d");if(!n)return;const r=window.devicePixelRatio||1;e.width=t*r,e.height=t*r,n.scale(r,r);const o=t/25;n.fillStyle=m,n.fillRect(0,0,t,t),n.fillStyle=h;for(let t=0;t<25;t++)for(let e=0;e<25;e++)g[t][e]&&n.fillRect(e*o,t*o,o,o);if(i){const e=.22*t,r=(t-e)/2;n.fillStyle=m,n.fillRect(r-2,r-2,e+4,e+4);const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{n.drawImage(o,r,r,e,e)},o.src=ke(i)}},[g,t,h,m,i]),/* @__PURE__ */x("div",{role:"img","aria-label":`QR code for: ${u}`,className:At("inline-block rounded-lg"),style:{padding:a?12:0,backgroundColor:a?m:"transparent",border:a?`1px solid ${l.border}`:"none",lineHeight:0,animation:d?"none":"tkxFadeIn 0.2s ease"},children:/* @__PURE__ */x("canvas",{ref:c,"aria-hidden":"true",style:{width:t,height:t,display:"block"}})})}var Ul={success:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),/* @__PURE__ */x("path",{d:"M22 37l9 9 19-19",stroke:e,strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),error:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),/* @__PURE__ */x("path",{d:"M26 26l20 20M46 26L26 46",stroke:e,strokeWidth:"4",strokeLinecap:"round"})]}),warning:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[
368
395
  /* @__PURE__ */x("path",{d:"M36 6L4 64h64L36 6z",stroke:e,strokeWidth:"3",fill:`${e}18`}),
369
396
  /* @__PURE__ */x("path",{d:"M36 30v16",stroke:e,strokeWidth:"4",strokeLinecap:"round"}),
370
397
  /* @__PURE__ */x("circle",{cx:"36",cy:"54",r:"2.5",fill:e})]}),info:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[
@@ -373,38 +400,38 @@ return b("div",{className:At("relative font-sans"),style:{width:"100%"},children
373
400
  /* @__PURE__ */x("circle",{cx:"36",cy:"22",r:"2.5",fill:e})]}),404:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),/* @__PURE__ */x("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:e,children:"404"})]}),403:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[
374
401
  /* @__PURE__ */x("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),
375
402
  /* @__PURE__ */x("path",{d:"M28 30h16v16H28z",stroke:e,strokeWidth:"3",fill:"none"}),
376
- /* @__PURE__ */x("path",{d:"M32 30v-4a4 4 0 018 0v4",stroke:e,strokeWidth:"3",fill:"none"})]}),500:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),/* @__PURE__ */x("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:e,children:"500"})]})};function Tl({status:e,title:t,subTitle:n,icon:r,extra:o}){const i=se(),a=et(),l=function(e,t){switch(e){case"success":return t.success;case"error":case"500":return t.danger;case"warning":return t.warning;case"info":return t.info;case"404":case"403":return t.textMuted}}(e,i),s=ke(t),d=n?ke(n):void 0;/* @__PURE__ */
403
+ /* @__PURE__ */x("path",{d:"M32 30v-4a4 4 0 018 0v4",stroke:e,strokeWidth:"3",fill:"none"})]}),500:e=>/* @__PURE__ */b("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[/* @__PURE__ */x("circle",{cx:"36",cy:"36",r:"34",stroke:e,strokeWidth:"3",fill:`${e}18`}),/* @__PURE__ */x("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:e,children:"500"})]})};function Kl({status:e,title:t,subTitle:n,icon:r,extra:o}){const i=se(),a=et(),l=function(e,t){switch(e){case"success":return t.success;case"error":case"500":return t.danger;case"warning":return t.warning;case"info":return t.info;case"404":case"403":return t.textMuted}}(e,i),s=ke(t),d=n?ke(n):void 0;/* @__PURE__ */
377
404
  return b("div",{role:"status","aria-live":"polite",className:At("flex flex-col items-center text-center px-6 py-12 font-sans"),style:{animation:a?"none":"tkxFadeIn 0.3s ease"},children:[
378
- /* @__PURE__ */x("div",{className:At("mb-6"),children:r??Ll[e](l)}),
379
- /* @__PURE__ */x("h2",{className:At("text-xl font-semibold m-0 mb-2"),style:{color:i.text},children:s}),d&&/* @__PURE__ */x("p",{className:At("text-sm m-0 mb-6 max-w-md leading-relaxed"),style:{color:i.textMuted},children:d}),o&&/* @__PURE__ */x("div",{className:At("flex items-center gap-3 mt-4"),children:o})]})}function Wl({steps:e,isOpen:t=!1,onClose:n,current:r,onChange:o}){const i=se(),l=et(),[d,c]=m(0),u=r??d,p=f(null),[h,g]=m({top:0,left:0}),[v,w]=m(null),k=e[u],$=a(()=>{if(!k)return;const e=function(e){const t=document.querySelector(e);return t?t.getBoundingClientRect():null}(k.target);if(w(e),e&&p.current){const t=p.current.offsetWidth,n=p.current.offsetHeight;g(function(e,t,n,r){switch(t){case"top":return{top:e.top-r-12+window.scrollY,left:e.left+e.width/2-n/2+window.scrollX};case"bottom":return{top:e.bottom+12+window.scrollY,left:e.left+e.width/2-n/2+window.scrollX};case"left":return{top:e.top+e.height/2-r/2+window.scrollY,left:e.left-n-12+window.scrollX};case"right":return{top:e.top+e.height/2-r/2+window.scrollY,left:e.right+12+window.scrollX};default:return{top:e.bottom+12+window.scrollY,left:e.left+window.scrollX}}}(e,k.placement??"bottom",t,n))}},[k]);s(()=>{if(t)return $(),window.addEventListener("resize",$),window.addEventListener("scroll",$,!0),()=>{window.removeEventListener("resize",$),window.removeEventListener("scroll",$,!0)}},[t,u,$]),s(()=>{t&&p.current?.focus()},[t,u]);const S=a(e=>{c(e),o?.(e)},[o]),C=a(()=>{u<e.length-1?S(u+1):n?.()},[u,e.length,S,n]),z=a(()=>{u>0&&S(u-1)},[u,S]);if(!t||!k)return null;const M=ke(k.title),N=ke(k.description);return y(/* @__PURE__ */b("div",{"aria-hidden":"true",children:[/* @__PURE__ */x("div",{style:{position:"fixed",inset:0,zIndex:9998,backgroundColor:"rgba(0,0,0,0.55)",clipPath:v?`polygon(0% 0%, 0% 100%, ${v.left-6}px 100%, ${v.left-6}px ${v.top-6}px, ${v.right+6}px ${v.top-6}px, ${v.right+6}px ${v.bottom+6}px, ${v.left-6}px ${v.bottom+6}px, ${v.left-6}px 100%, 100% 100%, 100% 0%)`:void 0,transition:l?"none":"clip-path 0.25s ease"},onClick:n}),/* @__PURE__ */b("div",{ref:p,role:"dialog","aria-modal":"true","aria-label":`Tour step ${u+1} of ${e.length}`,tabIndex:-1,style:{position:"absolute",zIndex:9999,top:h.top,left:h.left,width:300,backgroundColor:i.surface,border:`1px solid ${i.border}`,borderRadius:10,padding:20,boxShadow:`0 8px 24px ${i.bg}80`,animation:l?"none":"tkxFadeIn 0.2s ease",fontFamily:"inherit"},onKeyDown:e=>{"Escape"===e.key&&n?.()},children:[
405
+ /* @__PURE__ */x("div",{className:At("mb-6"),children:r??Ul[e](l)}),
406
+ /* @__PURE__ */x("h2",{className:At("text-xl font-semibold m-0 mb-2"),style:{color:i.text},children:s}),d&&/* @__PURE__ */x("p",{className:At("text-sm m-0 mb-6 max-w-md leading-relaxed"),style:{color:i.textMuted},children:d}),o&&/* @__PURE__ */x("div",{className:At("flex items-center gap-3 mt-4"),children:o})]})}function Yl({steps:e,isOpen:t=!1,onClose:n,current:r,onChange:o}){const i=se(),l=et(),[d,c]=m(0),u=r??d,p=f(null),[h,g]=m({top:0,left:0}),[v,w]=m(null),k=e[u],$=a(()=>{if(!k)return;const e=function(e){const t=document.querySelector(e);return t?t.getBoundingClientRect():null}(k.target);if(w(e),e&&p.current){const t=p.current.offsetWidth,n=p.current.offsetHeight;g(function(e,t,n,r){switch(t){case"top":return{top:e.top-r-12+window.scrollY,left:e.left+e.width/2-n/2+window.scrollX};case"bottom":return{top:e.bottom+12+window.scrollY,left:e.left+e.width/2-n/2+window.scrollX};case"left":return{top:e.top+e.height/2-r/2+window.scrollY,left:e.left-n-12+window.scrollX};case"right":return{top:e.top+e.height/2-r/2+window.scrollY,left:e.right+12+window.scrollX};default:return{top:e.bottom+12+window.scrollY,left:e.left+window.scrollX}}}(e,k.placement??"bottom",t,n))}},[k]);s(()=>{if(t)return $(),window.addEventListener("resize",$),window.addEventListener("scroll",$,!0),()=>{window.removeEventListener("resize",$),window.removeEventListener("scroll",$,!0)}},[t,u,$]),s(()=>{t&&p.current?.focus()},[t,u]);const S=a(e=>{c(e),o?.(e)},[o]),C=a(()=>{u<e.length-1?S(u+1):n?.()},[u,e.length,S,n]),z=a(()=>{u>0&&S(u-1)},[u,S]);if(!t||!k)return null;const M=ke(k.title),N=ke(k.description);return y(/* @__PURE__ */b("div",{"aria-hidden":"true",children:[/* @__PURE__ */x("div",{style:{position:"fixed",inset:0,zIndex:9998,backgroundColor:"rgba(0,0,0,0.55)",clipPath:v?`polygon(0% 0%, 0% 100%, ${v.left-6}px 100%, ${v.left-6}px ${v.top-6}px, ${v.right+6}px ${v.top-6}px, ${v.right+6}px ${v.bottom+6}px, ${v.left-6}px ${v.bottom+6}px, ${v.left-6}px 100%, 100% 100%, 100% 0%)`:void 0,transition:l?"none":"clip-path 0.25s ease"},onClick:n}),/* @__PURE__ */b("div",{ref:p,role:"dialog","aria-modal":"true","aria-label":`Tour step ${u+1} of ${e.length}`,tabIndex:-1,style:{position:"absolute",zIndex:9999,top:h.top,left:h.left,width:300,backgroundColor:i.surface,border:`1px solid ${i.border}`,borderRadius:10,padding:20,boxShadow:`0 8px 24px ${i.bg}80`,animation:l?"none":"tkxFadeIn 0.2s ease",fontFamily:"inherit"},onKeyDown:e=>{"Escape"===e.key&&n?.()},children:[
380
407
  /* @__PURE__ */x("h3",{className:At("m-0 mb-2 text-base font-semibold"),style:{color:i.text},children:M}),
381
408
  /* @__PURE__ */x("p",{className:At("m-0 mb-4 text-sm leading-relaxed"),style:{color:i.textMuted},children:N}),
382
409
  /* @__PURE__ */x("div",{className:At("flex items-center gap-1 mb-4"),"aria-label":"Tour progress",children:e.map((e,t)=>/* @__PURE__ */x("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",backgroundColor:t===u?i.primary:i.border,transition:l?"none":"background-color 0.2s"}},t))}),
383
- /* @__PURE__ */b("div",{className:At("flex items-center justify-between gap-2"),children:[/* @__PURE__ */x("button",{type:"button","aria-label":"Skip tour",onClick:n,className:At("border-0 bg-transparent cursor-pointer text-sm px-2 py-1"),style:{color:i.textMuted},children:"Skip"}),/* @__PURE__ */b("div",{className:At("flex gap-2"),children:[u>0&&/* @__PURE__ */x("button",{type:"button","aria-label":"Previous step",onClick:z,className:At("rounded-md border px-3 py-1 text-sm cursor-pointer bg-transparent"),style:{borderColor:i.border,color:i.text},children:"Prev"}),/* @__PURE__ */x("button",{type:"button","aria-label":u===e.length-1?"Finish tour":"Next step",onClick:C,className:At("rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium"),style:{backgroundColor:i.primary,color:"#fff"},children:u===e.length-1?"Finish":"Next"})]})]})]})]}),document.body)}function jl(){if("undefined"==typeof window)return!1;const e=window.outerWidth-window.innerWidth,t=window.outerHeight-window.innerHeight;return e>160||t>160}function El(){const[e,t]=m(!1);return s(()=>{if("undefined"==typeof window)return;t(jl());const e=()=>t(jl());window.addEventListener("resize",e);const n=window.setInterval(e,1e3);return()=>{window.removeEventListener("resize",e),window.clearInterval(n)}},[]),e}function Bl({text:e,children:t,rotate:n=-22,gap:r=[100,100],fontSize:o=14,color:i,zIndex:l=10,pattern:d="tiled",dynamic:c=!1,refreshMs:u=0,intensifyOnDevtools:h=!1,fingerprintId:g}){const y=se(),v=et(),w=f(null),[k,$]=m(""),[S,C]=m(0),z=El(),M=p(()=>{const t=(Array.isArray(e)?e:[e]).map(e=>ke(e));return"fingerprint"===d?function(e,t){return[...e,`id:${t||("undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10))} • ${/* @__PURE__ */(new Date).toISOString().slice(0,16).replace("T"," ")}`]}(t,g):t},[e,d,g,S]),N=h&&z?"66":"22",D=i??`${y.textMuted}${N}`,P=a(()=>function(e,t,n,r,o,i){if("undefined"==typeof document)return"";const a=document.createElement("canvas"),l=a.getContext("2d");if(!l)return"";const s=1.5*r,d=e.length*s,c=Math.max(...e.map(e=>e.length))*r*.6;let u,p;return"single"===i?(u=Math.max(800,1.6*c),p=Math.max(600,4*d)):(u=n[0]+c,p=n[1]+d),a.width=2*u,a.height=2*p,l.scale(2,2),l.translate(u/2,p/2),l.rotate(t*Math.PI/180),l.font=`${r}px sans-serif`,l.fillStyle=o,l.textAlign="center",l.textBaseline="middle",e.forEach((t,n)=>{const r=(n-(e.length-1)/2)*s;l.fillText(t,0,r)}),a.toDataURL()}(M,n,r,o,D,d),[M,n,r,o,D,d]);s(()=>{const e=P();e&&$(`url(${e})`)},[P]),s(()=>{if(!u||u<=0)return;const e=window.setInterval(()=>C(e=>e+1),u);return()=>window.clearInterval(e)},[u]),s(()=>{if(!c||"undefined"==typeof document)return;const e=()=>{"visible"===document.visibilityState&&C(e=>e+1)};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[c]),s(()=>{const e=w.current?.querySelector("[data-watermark]");if(!e)return;const t=new MutationObserver(()=>{const t=P();t&&(e.style.backgroundImage=`url(${t})`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[P]);const R={zIndex:l,backgroundImage:k,backgroundRepeat:"single"===d?"no-repeat":"repeat",backgroundPosition:"single"===d?"center center":void 0,animation:v?"none":"tkxFadeIn 0.3s ease"},F=h&&z?{filter:"blur(4px)",transition:"filter 0.2s"}:{};/* @__PURE__ */
410
+ /* @__PURE__ */b("div",{className:At("flex items-center justify-between gap-2"),children:[/* @__PURE__ */x("button",{type:"button","aria-label":"Skip tour",onClick:n,className:At("border-0 bg-transparent cursor-pointer text-sm px-2 py-1"),style:{color:i.textMuted},children:"Skip"}),/* @__PURE__ */b("div",{className:At("flex gap-2"),children:[u>0&&/* @__PURE__ */x("button",{type:"button","aria-label":"Previous step",onClick:z,className:At("rounded-md border px-3 py-1 text-sm cursor-pointer bg-transparent"),style:{borderColor:i.border,color:i.text},children:"Prev"}),/* @__PURE__ */x("button",{type:"button","aria-label":u===e.length-1?"Finish tour":"Next step",onClick:C,className:At("rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium"),style:{backgroundColor:i.primary,color:"#fff"},children:u===e.length-1?"Finish":"Next"})]})]})]})]}),document.body)}function Xl(){if("undefined"==typeof window)return!1;const e=window.outerWidth-window.innerWidth,t=window.outerHeight-window.innerHeight;return e>160||t>160}function Zl(){const[e,t]=m(!1);return s(()=>{if("undefined"==typeof window)return;t(Xl());const e=()=>t(Xl());window.addEventListener("resize",e);const n=window.setInterval(e,1e3);return()=>{window.removeEventListener("resize",e),window.clearInterval(n)}},[]),e}function Gl({text:e,children:t,rotate:n=-22,gap:r=[100,100],fontSize:o=14,color:i,zIndex:l=10,pattern:d="tiled",dynamic:c=!1,refreshMs:u=0,intensifyOnDevtools:h=!1,fingerprintId:g}){const y=se(),v=et(),w=f(null),[k,$]=m(""),[S,C]=m(0),z=Zl(),M=p(()=>{const t=(Array.isArray(e)?e:[e]).map(e=>ke(e));return"fingerprint"===d?function(e,t){return[...e,`id:${t||("undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10))} • ${/* @__PURE__ */(new Date).toISOString().slice(0,16).replace("T"," ")}`]}(t,g):t},[e,d,g,S]),N=h&&z?"66":"22",D=i??`${y.textMuted}${N}`,R=a(()=>function(e,t,n,r,o,i){if("undefined"==typeof document)return"";const a=document.createElement("canvas"),l=a.getContext("2d");if(!l)return"";const s=1.5*r,d=e.length*s,c=Math.max(...e.map(e=>e.length))*r*.6;let u,p;return"single"===i?(u=Math.max(800,1.6*c),p=Math.max(600,4*d)):(u=n[0]+c,p=n[1]+d),a.width=2*u,a.height=2*p,l.scale(2,2),l.translate(u/2,p/2),l.rotate(t*Math.PI/180),l.font=`${r}px sans-serif`,l.fillStyle=o,l.textAlign="center",l.textBaseline="middle",e.forEach((t,n)=>{const r=(n-(e.length-1)/2)*s;l.fillText(t,0,r)}),a.toDataURL()}(M,n,r,o,D,d),[M,n,r,o,D,d]);s(()=>{const e=R();e&&$(`url(${e})`)},[R]),s(()=>{if(!u||u<=0)return;const e=window.setInterval(()=>C(e=>e+1),u);return()=>window.clearInterval(e)},[u]),s(()=>{if(!c||"undefined"==typeof document)return;const e=()=>{"visible"===document.visibilityState&&C(e=>e+1)};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[c]),s(()=>{const e=w.current?.querySelector("[data-watermark]");if(!e)return;const t=new MutationObserver(()=>{const t=R();t&&(e.style.backgroundImage=`url(${t})`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[R]);const P={zIndex:l,backgroundImage:k,backgroundRepeat:"single"===d?"no-repeat":"repeat",backgroundPosition:"single"===d?"center center":void 0,animation:v?"none":"tkxFadeIn 0.3s ease"},F=h&&z?{filter:"blur(4px)",transition:"filter 0.2s"}:{};/* @__PURE__ */
384
411
  return b("div",{ref:w,className:At("relative"),style:{overflow:"hidden"},children:[
385
412
  /* @__PURE__ */x("div",{style:F,children:t}),
386
- /* @__PURE__ */x("div",{"data-watermark":!0,"aria-hidden":"true",className:At("absolute inset-0 pointer-events-none"),style:R}),h&&z&&/* @__PURE__ */x("div",{"aria-live":"polite",style:{position:"absolute",top:12,right:12,padding:"6px 12px",background:y.danger,color:"#fff",fontSize:12,fontWeight:600,borderRadius:6,zIndex:l+1,pointerEvents:"none"},children:"Developer Tools detected — content protected"})]})}function Vl(e){if(e)try{return e()}catch{return window}return window}function Hl({children:e,offsetTop:t,offsetBottom:n,onChange:r,target:o}){const i=se(),l=et(),d=f(null),c=f(null),[u,h]=m(!1),[y,v]=m({width:0,height:0}),w=f(!1),k=p(()=>ke("Sticky content"),[]),$=a(()=>{const e=d.current;if(!e)return;const i=e.getBoundingClientRect(),a=function(e){if(e instanceof Window)return{top:0,bottom:e.innerHeight};const t=e.getBoundingClientRect();return{top:t.top,bottom:t.bottom}}(Vl(o));let l=!1;void 0!==t?l=i.top-a.top<=t:void 0!==n&&(l=a.bottom-i.bottom<=n),l!==w.current&&(w.current=l,h(l),v({width:i.width,height:i.height}),r?.(l))},[t,n,r,o]);s(()=>{const e=Vl(o);return $(),e.addEventListener("scroll",$,{passive:!0}),window.addEventListener("resize",$),()=>{e.removeEventListener("scroll",$),window.removeEventListener("resize",$)}},[$,o]);const S=u?{position:"fixed",zIndex:100,...void 0!==t?{top:t}:{},...void 0!==n?{bottom:n}:{},width:y.width||void 0,transition:l?"none":"box-shadow 0.2s ease",boxShadow:`0 2px 8px ${i.border}`}:{};/* @__PURE__ */
387
- return b(g,{children:[/* @__PURE__ */x("div",{ref:d,"aria-hidden":u,style:u?{height:y.height,width:y.width}:{}}),/* @__PURE__ */x("div",{ref:c,role:"region","aria-label":k,className:At(u?"tkx-affixed":""),style:S,children:e})]})}function Ol(e){const t=[];for(const n of e)t.push(n),n.children&&t.push(...Ol(n.children));return t}function ql(e){return e.startsWith("#")?e.slice(1):e}function Ul({item:e,activeKey:t,depth:n,onClick:r,theme:o,reducedMotion:i}){const a=e.key===t,l=ke(e.title);/* @__PURE__ */
388
- return b("li",{role:"none",style:{listStyle:"none"},children:[/* @__PURE__ */x("a",{role:"treeitem","aria-current":a?"location":void 0,href:e.href,onClick:t=>{t.preventDefault(),r(e.href)},className:At("block text-sm py-1 no-underline"),style:{paddingLeft:12+16*n,color:a?o.primary:o.textMuted,fontWeight:a?600:400,borderLeft:`2px solid ${a?o.primary:"transparent"}`,transition:i?"none":"color 0.15s ease, border-color 0.15s ease"},children:l}),e.children&&e.children.length>0&&/* @__PURE__ */x("ul",{role:"group",style:{margin:0,padding:0},children:e.children.map(e=>/* @__PURE__ */x(Ul,{item:e,activeKey:t,depth:n+1,onClick:r,theme:o,reducedMotion:i},e.key))})]})}function Kl({items:e,offsetTop:t=0,getCurrentAnchor:n,onChange:r}){const o=se(),i=et(),[l,d]=m(e[0]?.key??""),c=f(!1),u=Ol(e),p=a(()=>{if(c.current)return;let e=u[0]?.key??"";for(const n of u){const r=ql(n.href),o=document.getElementById(r);o&&o.getBoundingClientRect().top<=t+10&&(e=n.key)}n&&(e=n(e)),e!==l&&(d(e),r?.(e))},[u,t,n,l,r]);s(()=>(window.addEventListener("scroll",p,{passive:!0}),p(),()=>window.removeEventListener("scroll",p)),[p]);const h=a(e=>{const n=ql(e),o=document.getElementById(n);if(!o)return;c.current=!0;const a=o.getBoundingClientRect().top+window.scrollY-t;window.scrollTo({top:a,behavior:i?"auto":"smooth"});const l=u.find(t=>t.href===e);l&&(d(l.key),r?.(l.key)),setTimeout(()=>{c.current=!1},800)},[u,t,i,r]);/* @__PURE__ */
389
- return x("nav",{role:"tree","aria-label":"Anchor navigation",className:At("font-sans"),style:{borderLeft:`1px solid ${o.border}`,padding:"4px 0"},children:/* @__PURE__ */x("ul",{role:"group",style:{margin:0,padding:0},children:e.map(e=>/* @__PURE__ */x(Ul,{item:e,activeKey:l,depth:0,onClick:h,theme:o,reducedMotion:i},e.key))})})}function Yl(e,t){const n=[];let r=e;for(const o of t){const e=r.find(e=>e.value===o);if(!e)break;n.push(e),r=e.children??[]}return n}function Xl({options:e,value:t=[],onChange:n,placeholder:r="Select...",label:o,multiple:i=!1}){const l=se(),d=et(),c=f(null),u=f(null),[p,h]=m(!1),[g,v]=m(t),[w,k]=m({top:0,left:0,width:0}),$=o?ke(o):void 0,S=ke(r),C=t.length>0?function(e,t){return Yl(e,t).map(e=>ke(e.label)).join(" / ")}(e,t):"";s(()=>{if(!p||!c.current)return;const e=c.current.getBoundingClientRect();k({top:e.bottom+4+window.scrollY,left:e.left+window.scrollX,width:Math.max(e.width,200)})},[p]),s(()=>{if(!p)return;const e=e=>{c.current?.contains(e.target)||u.current?.contains(e.target)||h(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[p]);const z=a((t,r)=>{if(r.disabled)return;const o=[...g.slice(0,t),r.value];if(v(o),!r.children?.length){const t=Yl(e,o);n?.(o,t),i||h(!1)}},[g,e,n,i]),M=a(e=>{"Escape"===e.key?(h(!1),c.current?.focus()):"Enter"!==e.key&&" "!==e.key||p||(e.preventDefault(),h(!0))},[p]),N=function(e,t){const n=[e];let r=e;for(const o of t){const e=r.find(e=>e.value===o);if(!e?.children?.length)break;n.push(e.children),r=e.children}return n}(e,g),D=p?y(/* @__PURE__ */x("div",{ref:u,role:"tree","aria-label":$??"Cascader options",className:At("flex rounded-lg border overflow-hidden"),style:{position:"absolute",zIndex:9999,top:w.top,left:w.left,backgroundColor:l.surface,borderColor:l.border,boxShadow:`0 4px 16px ${l.bg}80`,animation:d?"none":"tkxFadeIn 0.15s ease"},children:N.map((e,t)=>/* @__PURE__ */x("ul",{role:"group",className:At("m-0 p-0 overflow-auto"),style:{listStyle:"none",minWidth:160,maxHeight:260,borderRight:t<N.length-1?`1px solid ${l.border}`:"none"},children:e.map(e=>{const n=g[t]===e.value,r=ke(e.label);/* @__PURE__ */
413
+ /* @__PURE__ */x("div",{"data-watermark":!0,"aria-hidden":"true",className:At("absolute inset-0 pointer-events-none"),style:P}),h&&z&&/* @__PURE__ */x("div",{"aria-live":"polite",style:{position:"absolute",top:12,right:12,padding:"6px 12px",background:y.danger,color:"#fff",fontSize:12,fontWeight:600,borderRadius:6,zIndex:l+1,pointerEvents:"none"},children:"Developer Tools detected — content protected"})]})}function _l(e){if(e)try{return e()}catch{return window}return window}function Jl({children:e,offsetTop:t,offsetBottom:n,onChange:r,target:o}){const i=se(),l=et(),d=f(null),c=f(null),[u,h]=m(!1),[y,v]=m({width:0,height:0}),w=f(!1),k=p(()=>ke("Sticky content"),[]),$=a(()=>{const e=d.current;if(!e)return;const i=e.getBoundingClientRect(),a=function(e){if(e instanceof Window)return{top:0,bottom:e.innerHeight};const t=e.getBoundingClientRect();return{top:t.top,bottom:t.bottom}}(_l(o));let l=!1;void 0!==t?l=i.top-a.top<=t:void 0!==n&&(l=a.bottom-i.bottom<=n),l!==w.current&&(w.current=l,h(l),v({width:i.width,height:i.height}),r?.(l))},[t,n,r,o]);s(()=>{const e=_l(o);return $(),e.addEventListener("scroll",$,{passive:!0}),window.addEventListener("resize",$),()=>{e.removeEventListener("scroll",$),window.removeEventListener("resize",$)}},[$,o]);const S=u?{position:"fixed",zIndex:100,...void 0!==t?{top:t}:{},...void 0!==n?{bottom:n}:{},width:y.width||void 0,transition:l?"none":"box-shadow 0.2s ease",boxShadow:`0 2px 8px ${i.border}`}:{};/* @__PURE__ */
414
+ return b(g,{children:[/* @__PURE__ */x("div",{ref:d,"aria-hidden":u,style:u?{height:y.height,width:y.width}:{}}),/* @__PURE__ */x("div",{ref:c,role:"region","aria-label":k,className:At(u?"tkx-affixed":""),style:S,children:e})]})}function Ql(e){const t=[];for(const n of e)t.push(n),n.children&&t.push(...Ql(n.children));return t}function es(e){return e.startsWith("#")?e.slice(1):e}function ts({item:e,activeKey:t,depth:n,onClick:r,theme:o,reducedMotion:i}){const a=e.key===t,l=ke(e.title);/* @__PURE__ */
415
+ return b("li",{role:"none",style:{listStyle:"none"},children:[/* @__PURE__ */x("a",{role:"treeitem","aria-current":a?"location":void 0,href:e.href,onClick:t=>{t.preventDefault(),r(e.href)},className:At("block text-sm py-1 no-underline"),style:{paddingLeft:12+16*n,color:a?o.primary:o.textMuted,fontWeight:a?600:400,borderLeft:`2px solid ${a?o.primary:"transparent"}`,transition:i?"none":"color 0.15s ease, border-color 0.15s ease"},children:l}),e.children&&e.children.length>0&&/* @__PURE__ */x("ul",{role:"group",style:{margin:0,padding:0},children:e.children.map(e=>/* @__PURE__ */x(ts,{item:e,activeKey:t,depth:n+1,onClick:r,theme:o,reducedMotion:i},e.key))})]})}function ns({items:e,offsetTop:t=0,getCurrentAnchor:n,onChange:r}){const o=se(),i=et(),[l,d]=m(e[0]?.key??""),c=f(!1),u=Ql(e),p=a(()=>{if(c.current)return;let e=u[0]?.key??"";for(const n of u){const r=es(n.href),o=document.getElementById(r);o&&o.getBoundingClientRect().top<=t+10&&(e=n.key)}n&&(e=n(e)),e!==l&&(d(e),r?.(e))},[u,t,n,l,r]);s(()=>(window.addEventListener("scroll",p,{passive:!0}),p(),()=>window.removeEventListener("scroll",p)),[p]);const h=a(e=>{const n=es(e),o=document.getElementById(n);if(!o)return;c.current=!0;const a=o.getBoundingClientRect().top+window.scrollY-t;window.scrollTo({top:a,behavior:i?"auto":"smooth"});const l=u.find(t=>t.href===e);l&&(d(l.key),r?.(l.key)),setTimeout(()=>{c.current=!1},800)},[u,t,i,r]);/* @__PURE__ */
416
+ return x("nav",{role:"tree","aria-label":"Anchor navigation",className:At("font-sans"),style:{borderLeft:`1px solid ${o.border}`,padding:"4px 0"},children:/* @__PURE__ */x("ul",{role:"group",style:{margin:0,padding:0},children:e.map(e=>/* @__PURE__ */x(ts,{item:e,activeKey:l,depth:0,onClick:h,theme:o,reducedMotion:i},e.key))})})}function rs(e,t){const n=[];let r=e;for(const o of t){const e=r.find(e=>e.value===o);if(!e)break;n.push(e),r=e.children??[]}return n}function os({options:e,value:t=[],onChange:n,placeholder:r="Select...",label:o,multiple:i=!1}){const l=se(),d=et(),c=f(null),u=f(null),[p,h]=m(!1),[g,v]=m(t),[w,k]=m({top:0,left:0,width:0}),$=o?ke(o):void 0,S=ke(r),C=t.length>0?function(e,t){return rs(e,t).map(e=>ke(e.label)).join(" / ")}(e,t):"";s(()=>{if(!p||!c.current)return;const e=c.current.getBoundingClientRect();k({top:e.bottom+4+window.scrollY,left:e.left+window.scrollX,width:Math.max(e.width,200)})},[p]),s(()=>{if(!p)return;const e=e=>{c.current?.contains(e.target)||u.current?.contains(e.target)||h(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[p]);const z=a((t,r)=>{if(r.disabled)return;const o=[...g.slice(0,t),r.value];if(v(o),!r.children?.length){const t=rs(e,o);n?.(o,t),i||h(!1)}},[g,e,n,i]),M=a(e=>{"Escape"===e.key?(h(!1),c.current?.focus()):"Enter"!==e.key&&" "!==e.key||p||(e.preventDefault(),h(!0))},[p]),N=function(e,t){const n=[e];let r=e;for(const o of t){const e=r.find(e=>e.value===o);if(!e?.children?.length)break;n.push(e.children),r=e.children}return n}(e,g),D=p?y(/* @__PURE__ */x("div",{ref:u,role:"tree","aria-label":$??"Cascader options",className:At("flex rounded-lg border overflow-hidden"),style:{position:"absolute",zIndex:9999,top:w.top,left:w.left,backgroundColor:l.surface,borderColor:l.border,boxShadow:`0 4px 16px ${l.bg}80`,animation:d?"none":"tkxFadeIn 0.15s ease"},children:N.map((e,t)=>/* @__PURE__ */x("ul",{role:"group",className:At("m-0 p-0 overflow-auto"),style:{listStyle:"none",minWidth:160,maxHeight:260,borderRight:t<N.length-1?`1px solid ${l.border}`:"none"},children:e.map(e=>{const n=g[t]===e.value,r=ke(e.label);/* @__PURE__ */
390
417
  return b("li",{role:"treeitem","aria-selected":n,"aria-disabled":e.disabled||void 0,"aria-expanded":e.children?.length?n:void 0,className:At("flex items-center justify-between px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:n?l.surfaceAlt:"transparent",color:e.disabled?l.textMuted:l.text,opacity:e.disabled?.5:1,cursor:e.disabled?"not-allowed":"pointer"},onClick:()=>z(t,e),onMouseEnter:()=>{e.disabled||v(n=>[...n.slice(0,t),e.value])},children:[/* @__PURE__ */x("span",{children:r}),e.children&&e.children.length>0&&/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:l.textMuted,flexShrink:0},children:/* @__PURE__ */x("path",{d:"M10 6l6 6-6 6V6z"})})]},e.value)})},t))}),document.body):null;/* @__PURE__ */
391
418
  return b("div",{className:At("relative font-sans"),onKeyDown:M,children:[$&&/* @__PURE__ */x("label",{className:At("block text-sm font-medium mb-1"),style:{color:l.text},children:$}),
392
- /* @__PURE__ */b("button",{ref:c,type:"button",role:"combobox","aria-expanded":p,"aria-haspopup":"tree","aria-label":$??"Cascader",className:At("w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer"),style:{backgroundColor:l.surface,borderColor:p?l.primary:l.border,color:C?l.text:l.textMuted,outline:"none",minHeight:38,textAlign:"left"},onClick:()=>h(e=>!e),children:[/* @__PURE__ */x("span",{className:At("truncate"),children:C||S}),/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:l.textMuted,transform:p?"rotate(180deg)":"rotate(0deg)",transition:d?"none":"transform 0.2s ease",flexShrink:0},children:/* @__PURE__ */x("path",{d:"M7 10l5 5 5-5H7z"})})]}),D]})}var Zl={sm:"8px 12px",md:"12px 16px",lg:"16px 20px"};function Gl({theme:e,reducedMotion:t}){/* @__PURE__ */
393
- return b("div",{className:At("flex items-center gap-3 px-4 py-3"),"aria-hidden":"true",children:[/* @__PURE__ */x("div",{style:{width:40,height:40,borderRadius:"50%",backgroundColor:e.surfaceAlt,animation:t?"none":"tkxPulse 1.5s ease infinite"}}),/* @__PURE__ */b("div",{className:At("flex-1"),children:[/* @__PURE__ */x("div",{style:{width:"60%",height:14,borderRadius:4,backgroundColor:e.surfaceAlt,marginBottom:8,animation:t?"none":"tkxPulse 1.5s ease infinite"}}),/* @__PURE__ */x("div",{style:{width:"40%",height:12,borderRadius:4,backgroundColor:e.surfaceAlt,animation:t?"none":"tkxPulse 1.5s ease infinite"}})]})]})}function _l({items:e,header:t,footer:n,bordered:r=!0,size:o="md",loading:i=!1,emptyText:a="No data",grid:l}){const s=se(),d=et(),c=ke(a),u=Zl[o],p=!!l,h=l?.column??1,f=l?.gutter??16;/* @__PURE__ */
394
- return b("div",{role:"list","aria-label":"List","aria-busy":i,className:At("font-sans rounded-lg overflow-hidden"),style:{border:r?`1px solid ${s.border}`:"none",backgroundColor:s.surface},children:[t&&/* @__PURE__ */x("div",{className:At("font-semibold text-sm"),style:{padding:u,color:s.text,borderBottom:`1px solid ${s.border}`,backgroundColor:s.surfaceAlt},children:t}),i&&/* @__PURE__ */x("div",{children:Array.from({length:3}).map((e,t)=>/* @__PURE__ */x(Gl,{theme:s,reducedMotion:d},t))}),!i&&0===e.length&&/* @__PURE__ */x("div",{role:"status",className:At("text-center py-12 text-sm"),style:{color:s.textMuted},children:c}),!i&&e.length>0&&/* @__PURE__ */x("div",{style:p?{display:"grid",gridTemplateColumns:`repeat(${h}, 1fr)`,gap:f,padding:f}:void 0,children:e.map((t,n)=>{const r=ke(t.title),o=t.description?ke(t.description):void 0;/* @__PURE__ */
419
+ /* @__PURE__ */b("button",{ref:c,type:"button",role:"combobox","aria-expanded":p,"aria-haspopup":"tree","aria-label":$??"Cascader",className:At("w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer"),style:{backgroundColor:l.surface,borderColor:p?l.primary:l.border,color:C?l.text:l.textMuted,outline:"none",minHeight:38,textAlign:"left"},onClick:()=>h(e=>!e),children:[/* @__PURE__ */x("span",{className:At("truncate"),children:C||S}),/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:l.textMuted,transform:p?"rotate(180deg)":"rotate(0deg)",transition:d?"none":"transform 0.2s ease",flexShrink:0},children:/* @__PURE__ */x("path",{d:"M7 10l5 5 5-5H7z"})})]}),D]})}var is={sm:"8px 12px",md:"12px 16px",lg:"16px 20px"};function as({theme:e,reducedMotion:t}){/* @__PURE__ */
420
+ return b("div",{className:At("flex items-center gap-3 px-4 py-3"),"aria-hidden":"true",children:[/* @__PURE__ */x("div",{style:{width:40,height:40,borderRadius:"50%",backgroundColor:e.surfaceAlt,animation:t?"none":"tkxPulse 1.5s ease infinite"}}),/* @__PURE__ */b("div",{className:At("flex-1"),children:[/* @__PURE__ */x("div",{style:{width:"60%",height:14,borderRadius:4,backgroundColor:e.surfaceAlt,marginBottom:8,animation:t?"none":"tkxPulse 1.5s ease infinite"}}),/* @__PURE__ */x("div",{style:{width:"40%",height:12,borderRadius:4,backgroundColor:e.surfaceAlt,animation:t?"none":"tkxPulse 1.5s ease infinite"}})]})]})}function ls({items:e,header:t,footer:n,bordered:r=!0,size:o="md",loading:i=!1,emptyText:a="No data",grid:l}){const s=se(),d=et(),c=ke(a),u=is[o],p=!!l,h=l?.column??1,f=l?.gutter??16;/* @__PURE__ */
421
+ return b("div",{role:"list","aria-label":"List","aria-busy":i,className:At("font-sans rounded-lg overflow-hidden"),style:{border:r?`1px solid ${s.border}`:"none",backgroundColor:s.surface},children:[t&&/* @__PURE__ */x("div",{className:At("font-semibold text-sm"),style:{padding:u,color:s.text,borderBottom:`1px solid ${s.border}`,backgroundColor:s.surfaceAlt},children:t}),i&&/* @__PURE__ */x("div",{children:Array.from({length:3}).map((e,t)=>/* @__PURE__ */x(as,{theme:s,reducedMotion:d},t))}),!i&&0===e.length&&/* @__PURE__ */x("div",{role:"status",className:At("text-center py-12 text-sm"),style:{color:s.textMuted},children:c}),!i&&e.length>0&&/* @__PURE__ */x("div",{style:p?{display:"grid",gridTemplateColumns:`repeat(${h}, 1fr)`,gap:f,padding:f}:void 0,children:e.map((t,n)=>{const r=ke(t.title),o=t.description?ke(t.description):void 0;/* @__PURE__ */
395
422
  return b("div",{role:"listitem",className:At("flex items-start gap-3"),style:{padding:u,borderBottom:!p&&n<e.length-1?`1px solid ${s.border}`:"none",...p?{border:`1px solid ${s.border}`,borderRadius:8,backgroundColor:s.surface}:{},animation:d?"none":`tkxFadeIn 0.2s ease ${.03*n}s both`},children:[t.avatar&&/* @__PURE__ */x("div",{"aria-hidden":"true",className:At("shrink-0"),children:t.avatar}),
396
- /* @__PURE__ */b("div",{className:At("flex-1 min-w-0"),children:[/* @__PURE__ */x("div",{className:At("text-sm font-medium"),style:{color:s.text},children:r}),o&&/* @__PURE__ */x("div",{className:At("text-xs mt-1 leading-relaxed"),style:{color:s.textMuted},children:o})]}),t.extra&&/* @__PURE__ */x("div",{className:At("shrink-0 ml-auto"),style:{color:s.textMuted},children:t.extra}),t.actions&&/* @__PURE__ */x("div",{className:At("shrink-0 flex items-center gap-2"),children:t.actions})]},t.key)})}),n&&/* @__PURE__ */x("div",{className:At("text-sm"),style:{padding:u,color:s.textMuted,borderTop:`1px solid ${s.border}`,backgroundColor:s.surfaceAlt},children:n})]})}var Jl={turnstile:"https://challenges.cloudflare.com/turnstile/v0/api.js",hcaptcha:"https://js.hcaptcha.com/1/api.js",recaptcha:"https://www.google.com/recaptcha/api.js"},Ql={turnstile:"turnstile",hcaptcha:"hcaptcha",recaptcha:"grecaptcha"},es=/^[A-Za-z0-9_-]{20,80}$/,ts={},ns=i(function({provider:e="turnstile",sitekey:t,theme:n="auto",size:r="normal",language:o,execution:i="render",onVerify:a,onExpire:l,onError:d,className:u,style:p,testMode:h=!1},m){const g=f(null),b=f(null),y=f(null);return"string"!=typeof t||es.test(t),c(m,()=>({reset:()=>{if(h)return void(y.current=null);const t=window[Ql[e]];if(t&&null!=b.current){try{t.reset?.(b.current)}catch{}y.current=null}},execute:()=>{if(h)return void setTimeout(()=>{y.current="TEST_TOKEN",a("TEST_TOKEN")},200);const t=window[Ql[e]];if(t&&null!=b.current)try{t.execute?.(b.current)}catch{}},getResponse:()=>y.current}),[e,a,h]),s(()=>{if(h){const e=window.setTimeout(()=>{y.current="TEST_TOKEN",a("TEST_TOKEN")},200);return()=>window.clearTimeout(e)}let s=!1,c=null;const u=g.current;if(u)return function(e,t){if("undefined"==typeof window)return Promise.resolve();if(window[Ql[e]])return Promise.resolve();if(ts[e])return ts[e];const n=new Promise((n,r)=>{const o=document.querySelector(`script[data-tkx-captcha="${e}"]`);if(o)return o.addEventListener("load",()=>n()),void o.addEventListener("error",()=>r(/* @__PURE__ */new Error("script-load-failed")));const i=document.createElement("script");let a=Jl[e];t&&"turnstile"!==e&&(a+=`?hl=${encodeURIComponent(t)}`),i.src=a,i.async=!0,i.defer=!0,i.dataset.tkxCaptcha=e,i.addEventListener("load",()=>n()),i.addEventListener("error",()=>r(/* @__PURE__ */new Error("script-load-failed"))),document.head.appendChild(i)});return ts[e]=n,n}(e,o).then(()=>{if(s||!u)return;const p=window[Ql[e]];if(!p)return;const h={callback:e=>{y.current=e,a(e)},"expired-callback":()=>{y.current=null,l?.()},"error-callback":e=>{y.current=null,d?.("string"==typeof e?e:"unknown")}};try{"turnstile"===e?c=p.render(u,{sitekey:t,theme:n,size:"flexible"===r?"flexible":"compact"===r?"compact":"normal",execution:i,language:o||"auto",...h}):"hcaptcha"===e?c=p.render(u,{sitekey:t,theme:"auto"===n?"light":n,size:"invisible"===r?"invisible":"compact"===r?"compact":"normal",...h}):"recaptcha"===e&&(c=p.render(u,{sitekey:t,theme:"auto"===n?"light":n,size:"invisible"===r?"invisible":"normal",...h})),b.current=c}catch(f){d?.(f?.message||"render-failed")}}).catch(()=>{s||d?.("script-load-failed")}),()=>{s=!0;const t=window[Ql[e]];if(t&&null!=c)try{t.remove?.(c)}catch{}b.current=null,y.current=null}},[]),/* @__PURE__ */x("div",{ref:g,className:u,style:p,"data-tkx-captcha-provider":e,children:h&&/* @__PURE__ */x("div",{"aria-live":"polite",style:{padding:"12px 16px",border:"1px dashed currentColor",borderRadius:8,fontSize:13,opacity:.7,display:"inline-block"},children:"[TkxCaptcha test mode — auto-verifying with TEST_TOKEN]"})})});ns.displayName="TkxCaptcha";var rs={latin:{id:"tkx-font-latin",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap"},"latin-ext":{id:"tkx-font-latin-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=latin-ext"},devanagari:{id:"tkx-font-devanagari",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap"},tamil:{id:"tkx-font-tamil",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;500;600;700&display=swap"},telugu:{id:"tkx-font-telugu",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Telugu:wght@400;500;600;700&display=swap"},kannada:{id:"tkx-font-kannada",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Kannada:wght@400;500;600;700&display=swap"},malayalam:{id:"tkx-font-malayalam",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Malayalam:wght@400;500;600;700&display=swap"},bengali:{id:"tkx-font-bengali",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@400;500;600;700&display=swap"},gujarati:{id:"tkx-font-gujarati",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Gujarati:wght@400;500;600;700&display=swap"},gurmukhi:{id:"tkx-font-gurmukhi",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Gurmukhi:wght@400;500;600;700&display=swap"},oriya:{id:"tkx-font-oriya",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Oriya:wght@400;500;600;700&display=swap"},sinhala:{id:"tkx-font-sinhala",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Sinhala:wght@400;500;600;700&display=swap"},arabic:{id:"tkx-font-arabic",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap"},hebrew:{id:"tkx-font-hebrew",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Hebrew:wght@400;500;600;700&display=swap"},thai:{id:"tkx-font-thai",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700&display=swap"},vietnamese:{id:"tkx-font-vietnamese",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=vietnamese"},cyrillic:{id:"tkx-font-cyrillic",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=cyrillic"},"cyrillic-ext":{id:"tkx-font-cyrillic-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=cyrillic-ext"},greek:{id:"tkx-font-greek",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=greek"},"greek-ext":{id:"tkx-font-greek-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=greek-ext"},jp:{id:"tkx-font-jp",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&display=swap"},kr:{id:"tkx-font-kr",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&display=swap"},sc:{id:"tkx-font-sc",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap"},tc:{id:"tkx-font-tc",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700&display=swap"}},os={en:["latin"],hi:["devanagari"],mr:["devanagari"],sa:["devanagari"],ne:["devanagari"],ta:["tamil"],te:["telugu"],kn:["kannada"],ml:["malayalam"],bn:["bengali"],as:["bengali"],gu:["gujarati"],pa:["gurmukhi"],or:["oriya"],si:["sinhala"],ar:["arabic"],ur:["arabic"],fa:["arabic"],he:["hebrew"],th:["thai"],vi:["vietnamese","latin"],ru:["cyrillic"],uk:["cyrillic"],bg:["cyrillic"],el:["greek"],ja:["jp"],ko:["kr"],zh:["sc"],"zh-CN":["sc"],"zh-TW":["tc"],"zh-HK":["tc"]},is=!1;function as(e){if("undefined"==typeof document)return;const t=rs[e];if(!t)return;if(document.getElementById(t.id))return;const n=document.createElement("link");n.id=t.id,n.rel="stylesheet",n.href=t.href,document.head.appendChild(n)}function ls(e){return e&&(os[e]||os[e.split("-")[0]])||["latin"]}function ss({scripts:e,language:t,preconnect:n=!0,children:r}){const o=e&&e.length>0?e:t?ls(t):["latin"];return s(()=>{n&&function(){if(is||"undefined"==typeof document)return;const e=document.head,t=(t,n)=>{if(e.querySelector(`link[rel="preconnect"][href="${t}"]`))return;const r=document.createElement("link");r.rel="preconnect",r.href=t,n&&(r.crossOrigin="anonymous"),e.appendChild(r)};t("https://fonts.googleapis.com"),t("https://fonts.gstatic.com",!0),is=!0}(),o.forEach(as)},[o.join(","),n]),null==r?null:/* @__PURE__ */x(g,{children:r})}function ds(e){as(e)}function cs(e){!function(e){if("undefined"==typeof document)return;const t=rs[e];if(!t)return;const n=document.getElementById(t.id);n&&n.remove()}(e)}var us=[{iso2:"in",name:"India",dial:"91",length:10,format:"##### #####",flag:"🇮🇳"},{iso2:"us",name:"United States",dial:"1",length:10,format:"(###) ###-####",flag:"🇺🇸"},{iso2:"gb",name:"United Kingdom",dial:"44",length:[9,10],format:"#### ######",flag:"🇬🇧"},{iso2:"ca",name:"Canada",dial:"1",length:10,format:"(###) ###-####",flag:"🇨🇦"},{iso2:"au",name:"Australia",dial:"61",length:9,format:"### ### ###",flag:"🇦🇺"},{iso2:"de",name:"Germany",dial:"49",length:[10,11],format:"#### ########",flag:"🇩🇪"},{iso2:"fr",name:"France",dial:"33",length:9,format:"# ## ## ## ##",flag:"🇫🇷"},{iso2:"es",name:"Spain",dial:"34",length:9,format:"### ### ###",flag:"🇪🇸"},{iso2:"it",name:"Italy",dial:"39",length:[9,10],format:"### ### ####",flag:"🇮🇹"},{iso2:"nl",name:"Netherlands",dial:"31",length:9,format:"# #### ####",flag:"🇳🇱"},{iso2:"se",name:"Sweden",dial:"46",length:[7,9],format:"## ### ## ##",flag:"🇸🇪"},{iso2:"no",name:"Norway",dial:"47",length:8,format:"### ## ###",flag:"🇳🇴"},{iso2:"dk",name:"Denmark",dial:"45",length:8,format:"## ## ## ##",flag:"🇩🇰"},{iso2:"fi",name:"Finland",dial:"358",length:[9,10],format:"## ### ####",flag:"🇫🇮"},{iso2:"pl",name:"Poland",dial:"48",length:9,format:"### ### ###",flag:"🇵🇱"},{iso2:"ie",name:"Ireland",dial:"353",length:9,format:"## ### ####",flag:"🇮🇪"},{iso2:"pt",name:"Portugal",dial:"351",length:9,format:"### ### ###",flag:"🇵🇹"},{iso2:"ch",name:"Switzerland",dial:"41",length:9,format:"## ### ## ##",flag:"🇨🇭"},{iso2:"at",name:"Austria",dial:"43",length:[10,11],format:"### ### ####",flag:"🇦🇹"},{iso2:"be",name:"Belgium",dial:"32",length:9,format:"### ## ## ##",flag:"🇧🇪"},{iso2:"jp",name:"Japan",dial:"81",length:10,format:"## #### ####",flag:"🇯🇵"},{iso2:"kr",name:"South Korea",dial:"82",length:[9,10],format:"## #### ####",flag:"🇰🇷"},{iso2:"cn",name:"China",dial:"86",length:11,format:"### #### ####",flag:"🇨🇳"},{iso2:"hk",name:"Hong Kong",dial:"852",length:8,format:"#### ####",flag:"🇭🇰"},{iso2:"sg",name:"Singapore",dial:"65",length:8,format:"#### ####",flag:"🇸🇬"},{iso2:"my",name:"Malaysia",dial:"60",length:[9,10],format:"## ### ####",flag:"🇲🇾"},{iso2:"id",name:"Indonesia",dial:"62",length:[9,12],format:"### ### ####",flag:"🇮🇩"},{iso2:"th",name:"Thailand",dial:"66",length:9,format:"## ### ####",flag:"🇹🇭"},{iso2:"vn",name:"Vietnam",dial:"84",length:[9,10],format:"### ### ####",flag:"🇻🇳"},{iso2:"ph",name:"Philippines",dial:"63",length:10,format:"### ### ####",flag:"🇵🇭"},{iso2:"pk",name:"Pakistan",dial:"92",length:10,format:"### #######",flag:"🇵🇰"},{iso2:"bd",name:"Bangladesh",dial:"880",length:10,format:"#### ######",flag:"🇧🇩"},{iso2:"lk",name:"Sri Lanka",dial:"94",length:9,format:"## ### ####",flag:"🇱🇰"},{iso2:"np",name:"Nepal",dial:"977",length:10,format:"###-#######",flag:"🇳🇵"},{iso2:"ae",name:"UAE",dial:"971",length:9,format:"## ### ####",flag:"🇦🇪"},{iso2:"sa",name:"Saudi Arabia",dial:"966",length:9,format:"## ### ####",flag:"🇸🇦"},{iso2:"qa",name:"Qatar",dial:"974",length:8,format:"#### ####",flag:"🇶🇦"},{iso2:"kw",name:"Kuwait",dial:"965",length:8,format:"#### ####",flag:"🇰🇼"},{iso2:"om",name:"Oman",dial:"968",length:8,format:"#### ####",flag:"🇴🇲"},{iso2:"bh",name:"Bahrain",dial:"973",length:8,format:"#### ####",flag:"🇧🇭"},{iso2:"il",name:"Israel",dial:"972",length:9,format:"## ### ####",flag:"🇮🇱"},{iso2:"tr",name:"Turkey",dial:"90",length:10,format:"### ### ####",flag:"🇹🇷"},{iso2:"ru",name:"Russia",dial:"7",length:10,format:"### ### ####",flag:"🇷🇺"},{iso2:"ua",name:"Ukraine",dial:"380",length:9,format:"## ### ####",flag:"🇺🇦"},{iso2:"br",name:"Brazil",dial:"55",length:[10,11],format:"## ##### ####",flag:"🇧🇷"},{iso2:"mx",name:"Mexico",dial:"52",length:10,format:"## #### ####",flag:"🇲🇽"},{iso2:"ar",name:"Argentina",dial:"54",length:10,format:"## #### ####",flag:"🇦🇷"},{iso2:"cl",name:"Chile",dial:"56",length:9,format:"# #### ####",flag:"🇨🇱"},{iso2:"co",name:"Colombia",dial:"57",length:10,format:"### ### ####",flag:"🇨🇴"},{iso2:"pe",name:"Peru",dial:"51",length:9,format:"### ### ###",flag:"🇵🇪"},{iso2:"za",name:"South Africa",dial:"27",length:9,format:"## ### ####",flag:"🇿🇦"},{iso2:"ng",name:"Nigeria",dial:"234",length:10,format:"### ### ####",flag:"🇳🇬"},{iso2:"ke",name:"Kenya",dial:"254",length:9,format:"### ### ###",flag:"🇰🇪"},{iso2:"eg",name:"Egypt",dial:"20",length:10,format:"### ### ####",flag:"🇪🇬"},{iso2:"ma",name:"Morocco",dial:"212",length:9,format:"## ### ####",flag:"🇲🇦"},{iso2:"nz",name:"New Zealand",dial:"64",length:[8,9],format:"## ### ####",flag:"🇳🇿"}];function ps(e){return e.replace(/\D+/g,"")}function hs(e,t){if(!t)return e;let n="",r=0;for(const o of t)if("#"===o){if(r>=e.length)break;n+=e[r++]}else r<e.length&&(n+=o);return r<e.length&&(n+=e.slice(r)),n}function fs(e,t){return Array.isArray(t)?e.length>=t[0]&&e.length<=t[1]:e.length===t}function ms(e){return Array.isArray(e)?`${e[0]}–${e[1]}`:`${e}`}var gs=i(function({defaultCountry:e="in",value:t,defaultValue:n,onChange:r,onValid:o,label:i,placeholder:a,disabled:l,required:c,id:u,name:h,extraCountries:g=[],className:y,style:v},w){const k=se(),$=d(),S=d(),C=p(()=>[...us,...g].sort((e,t)=>e.name.localeCompare(t.name)),[g]),z=e=>C.find(t=>t.iso2===e.toLowerCase())||C[0],M=t=>{if(!t.startsWith("+"))return{country:z(e),digits:ps(t)};const n=ps(t);for(const e of[4,3,2,1]){const t=n.slice(0,e),r=C.find(e=>e.dial===t);if(r)return{country:r,digits:n.slice(e)}}return{country:z(e),digits:n}},N=t?M(t):{country:z(e),digits:ps(n||"")},[D,P]=m(N.country),[R,F]=m(N.digits),[I,A]=m(!1),[L,T]=m(""),[W,j]=m(0),E=f(null),B=f(null);s(()=>{if(void 0===t)return;const e=M(t);P(e.country),F(e.digits)},[t]);const V=hs(R,D.format),H=fs(R,D.length),O=R?`+${D.dial}${R}`:"",q=(e,t)=>{const n={raw:hs(e,t.format),digits:e,e164:e?`+${t.dial}${e}`:"",country:t,valid:fs(e,t.length)};r?.(n)},U=e=>{P(e),A(!1),q(R,e),E.current?.focus()},K=p(()=>{const e=L.trim().toLowerCase();return e?C.filter(t=>t.name.toLowerCase().includes(e)||t.iso2.includes(e)||t.dial.includes(e.replace(/^\+/,""))):C},[C,L]);s(()=>{j(0)},[L]),s(()=>{if(I){const e=setTimeout(()=>B.current?.focus(),0);return()=>clearTimeout(e)}},[I]);const Y=a??ms(D.length).replace(/\d/g,"#"),X={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:360,...v},Z={fontSize:13,fontWeight:600,color:k.text},G={display:"flex",alignItems:"stretch",border:`1px solid ${k.border}`,borderRadius:8,background:k.surface,overflow:"visible",position:"relative"},_={display:"inline-flex",alignItems:"center",gap:6,padding:"0 10px",background:"transparent",border:"none",borderRight:`1px solid ${k.border}`,cursor:l?"not-allowed":"pointer",color:k.text,fontSize:14,minHeight:40,fontWeight:500},J={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:k.text,background:"transparent",minHeight:40,minWidth:0},Q={position:"absolute",top:"calc(100% + 4px)",left:0,right:0,maxHeight:280,overflow:"auto",background:k.surface,border:`1px solid ${k.border}`,borderRadius:8,zIndex:1e3,padding:6,boxShadow:"0 8px 24px rgba(0,0,0,0.18)"},ee={width:"100%",padding:"8px 10px",border:`1px solid ${k.border}`,borderRadius:6,background:k.bg,color:k.text,fontSize:13,marginBottom:6,outline:"none"},te={fontSize:12,color:k.danger,marginTop:2};/* @__PURE__ */
423
+ /* @__PURE__ */b("div",{className:At("flex-1 min-w-0"),children:[/* @__PURE__ */x("div",{className:At("text-sm font-medium"),style:{color:s.text},children:r}),o&&/* @__PURE__ */x("div",{className:At("text-xs mt-1 leading-relaxed"),style:{color:s.textMuted},children:o})]}),t.extra&&/* @__PURE__ */x("div",{className:At("shrink-0 ml-auto"),style:{color:s.textMuted},children:t.extra}),t.actions&&/* @__PURE__ */x("div",{className:At("shrink-0 flex items-center gap-2"),children:t.actions})]},t.key)})}),n&&/* @__PURE__ */x("div",{className:At("text-sm"),style:{padding:u,color:s.textMuted,borderTop:`1px solid ${s.border}`,backgroundColor:s.surfaceAlt},children:n})]})}var ss={turnstile:"https://challenges.cloudflare.com/turnstile/v0/api.js",hcaptcha:"https://js.hcaptcha.com/1/api.js",recaptcha:"https://www.google.com/recaptcha/api.js"},ds={turnstile:"turnstile",hcaptcha:"hcaptcha",recaptcha:"grecaptcha"},cs=/^[A-Za-z0-9_-]{20,80}$/,us={},ps=i(function({provider:e="turnstile",sitekey:t,theme:n="auto",size:r="normal",language:o,execution:i="render",onVerify:a,onExpire:l,onError:d,className:u,style:p,testMode:h=!1},m){const g=f(null),b=f(null),y=f(null);return"string"!=typeof t||cs.test(t),c(m,()=>({reset:()=>{if(h)return void(y.current=null);const t=window[ds[e]];if(t&&null!=b.current){try{t.reset?.(b.current)}catch{}y.current=null}},execute:()=>{if(h)return void setTimeout(()=>{y.current="TEST_TOKEN",a("TEST_TOKEN")},200);const t=window[ds[e]];if(t&&null!=b.current)try{t.execute?.(b.current)}catch{}},getResponse:()=>y.current}),[e,a,h]),s(()=>{if(h){const e=window.setTimeout(()=>{y.current="TEST_TOKEN",a("TEST_TOKEN")},200);return()=>window.clearTimeout(e)}let s=!1,c=null;const u=g.current;if(u)return function(e,t){if("undefined"==typeof window)return Promise.resolve();if(window[ds[e]])return Promise.resolve();if(us[e])return us[e];const n=new Promise((n,r)=>{const o=document.querySelector(`script[data-tkx-captcha="${e}"]`);if(o)return o.addEventListener("load",()=>n()),void o.addEventListener("error",()=>r(/* @__PURE__ */new Error("script-load-failed")));const i=document.createElement("script");let a=ss[e];t&&"turnstile"!==e&&(a+=`?hl=${encodeURIComponent(t)}`),i.src=a,i.async=!0,i.defer=!0,i.dataset.tkxCaptcha=e,i.addEventListener("load",()=>n()),i.addEventListener("error",()=>r(/* @__PURE__ */new Error("script-load-failed"))),document.head.appendChild(i)});return us[e]=n,n}(e,o).then(()=>{if(s||!u)return;const p=window[ds[e]];if(!p)return;const h={callback:e=>{y.current=e,a(e)},"expired-callback":()=>{y.current=null,l?.()},"error-callback":e=>{y.current=null,d?.("string"==typeof e?e:"unknown")}};try{"turnstile"===e?c=p.render(u,{sitekey:t,theme:n,size:"flexible"===r?"flexible":"compact"===r?"compact":"normal",execution:i,language:o||"auto",...h}):"hcaptcha"===e?c=p.render(u,{sitekey:t,theme:"auto"===n?"light":n,size:"invisible"===r?"invisible":"compact"===r?"compact":"normal",...h}):"recaptcha"===e&&(c=p.render(u,{sitekey:t,theme:"auto"===n?"light":n,size:"invisible"===r?"invisible":"normal",...h})),b.current=c}catch(f){d?.(f?.message||"render-failed")}}).catch(()=>{s||d?.("script-load-failed")}),()=>{s=!0;const t=window[ds[e]];if(t&&null!=c)try{t.remove?.(c)}catch{}b.current=null,y.current=null}},[]),/* @__PURE__ */x("div",{ref:g,className:u,style:p,"data-tkx-captcha-provider":e,children:h&&/* @__PURE__ */x("div",{"aria-live":"polite",style:{padding:"12px 16px",border:"1px dashed currentColor",borderRadius:8,fontSize:13,opacity:.7,display:"inline-block"},children:"[TkxCaptcha test mode — auto-verifying with TEST_TOKEN]"})})});ps.displayName="TkxCaptcha";var hs={latin:{id:"tkx-font-latin",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap"},"latin-ext":{id:"tkx-font-latin-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=latin-ext"},devanagari:{id:"tkx-font-devanagari",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap"},tamil:{id:"tkx-font-tamil",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;500;600;700&display=swap"},telugu:{id:"tkx-font-telugu",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Telugu:wght@400;500;600;700&display=swap"},kannada:{id:"tkx-font-kannada",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Kannada:wght@400;500;600;700&display=swap"},malayalam:{id:"tkx-font-malayalam",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Malayalam:wght@400;500;600;700&display=swap"},bengali:{id:"tkx-font-bengali",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@400;500;600;700&display=swap"},gujarati:{id:"tkx-font-gujarati",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Gujarati:wght@400;500;600;700&display=swap"},gurmukhi:{id:"tkx-font-gurmukhi",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Gurmukhi:wght@400;500;600;700&display=swap"},oriya:{id:"tkx-font-oriya",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Oriya:wght@400;500;600;700&display=swap"},sinhala:{id:"tkx-font-sinhala",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Sinhala:wght@400;500;600;700&display=swap"},arabic:{id:"tkx-font-arabic",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap"},hebrew:{id:"tkx-font-hebrew",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Hebrew:wght@400;500;600;700&display=swap"},thai:{id:"tkx-font-thai",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700&display=swap"},vietnamese:{id:"tkx-font-vietnamese",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=vietnamese"},cyrillic:{id:"tkx-font-cyrillic",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=cyrillic"},"cyrillic-ext":{id:"tkx-font-cyrillic-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=cyrillic-ext"},greek:{id:"tkx-font-greek",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=greek"},"greek-ext":{id:"tkx-font-greek-ext",href:"https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap&subset=greek-ext"},jp:{id:"tkx-font-jp",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&display=swap"},kr:{id:"tkx-font-kr",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&display=swap"},sc:{id:"tkx-font-sc",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap"},tc:{id:"tkx-font-tc",href:"https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700&display=swap"}},fs={en:["latin"],hi:["devanagari"],mr:["devanagari"],sa:["devanagari"],ne:["devanagari"],ta:["tamil"],te:["telugu"],kn:["kannada"],ml:["malayalam"],bn:["bengali"],as:["bengali"],gu:["gujarati"],pa:["gurmukhi"],or:["oriya"],si:["sinhala"],ar:["arabic"],ur:["arabic"],fa:["arabic"],he:["hebrew"],th:["thai"],vi:["vietnamese","latin"],ru:["cyrillic"],uk:["cyrillic"],bg:["cyrillic"],el:["greek"],ja:["jp"],ko:["kr"],zh:["sc"],"zh-CN":["sc"],"zh-TW":["tc"],"zh-HK":["tc"]},ms=!1;function gs(e){if("undefined"==typeof document)return;const t=hs[e];if(!t)return;if(document.getElementById(t.id))return;const n=document.createElement("link");n.id=t.id,n.rel="stylesheet",n.href=t.href,document.head.appendChild(n)}function xs(e){return e&&(fs[e]||fs[e.split("-")[0]])||["latin"]}function bs({scripts:e,language:t,preconnect:n=!0,children:r}){const o=e&&e.length>0?e:t?xs(t):["latin"];return s(()=>{n&&function(){if(ms||"undefined"==typeof document)return;const e=document.head,t=(t,n)=>{if(e.querySelector(`link[rel="preconnect"][href="${t}"]`))return;const r=document.createElement("link");r.rel="preconnect",r.href=t,n&&(r.crossOrigin="anonymous"),e.appendChild(r)};t("https://fonts.googleapis.com"),t("https://fonts.gstatic.com",!0),ms=!0}(),o.forEach(gs)},[o.join(","),n]),null==r?null:/* @__PURE__ */x(g,{children:r})}function ys(e){gs(e)}function vs(e){!function(e){if("undefined"==typeof document)return;const t=hs[e];if(!t)return;const n=document.getElementById(t.id);n&&n.remove()}(e)}var ws=[{iso2:"in",name:"India",dial:"91",length:10,format:"##### #####",flag:"🇮🇳"},{iso2:"us",name:"United States",dial:"1",length:10,format:"(###) ###-####",flag:"🇺🇸"},{iso2:"gb",name:"United Kingdom",dial:"44",length:[9,10],format:"#### ######",flag:"🇬🇧"},{iso2:"ca",name:"Canada",dial:"1",length:10,format:"(###) ###-####",flag:"🇨🇦"},{iso2:"au",name:"Australia",dial:"61",length:9,format:"### ### ###",flag:"🇦🇺"},{iso2:"de",name:"Germany",dial:"49",length:[10,11],format:"#### ########",flag:"🇩🇪"},{iso2:"fr",name:"France",dial:"33",length:9,format:"# ## ## ## ##",flag:"🇫🇷"},{iso2:"es",name:"Spain",dial:"34",length:9,format:"### ### ###",flag:"🇪🇸"},{iso2:"it",name:"Italy",dial:"39",length:[9,10],format:"### ### ####",flag:"🇮🇹"},{iso2:"nl",name:"Netherlands",dial:"31",length:9,format:"# #### ####",flag:"🇳🇱"},{iso2:"se",name:"Sweden",dial:"46",length:[7,9],format:"## ### ## ##",flag:"🇸🇪"},{iso2:"no",name:"Norway",dial:"47",length:8,format:"### ## ###",flag:"🇳🇴"},{iso2:"dk",name:"Denmark",dial:"45",length:8,format:"## ## ## ##",flag:"🇩🇰"},{iso2:"fi",name:"Finland",dial:"358",length:[9,10],format:"## ### ####",flag:"🇫🇮"},{iso2:"pl",name:"Poland",dial:"48",length:9,format:"### ### ###",flag:"🇵🇱"},{iso2:"ie",name:"Ireland",dial:"353",length:9,format:"## ### ####",flag:"🇮🇪"},{iso2:"pt",name:"Portugal",dial:"351",length:9,format:"### ### ###",flag:"🇵🇹"},{iso2:"ch",name:"Switzerland",dial:"41",length:9,format:"## ### ## ##",flag:"🇨🇭"},{iso2:"at",name:"Austria",dial:"43",length:[10,11],format:"### ### ####",flag:"🇦🇹"},{iso2:"be",name:"Belgium",dial:"32",length:9,format:"### ## ## ##",flag:"🇧🇪"},{iso2:"jp",name:"Japan",dial:"81",length:10,format:"## #### ####",flag:"🇯🇵"},{iso2:"kr",name:"South Korea",dial:"82",length:[9,10],format:"## #### ####",flag:"🇰🇷"},{iso2:"cn",name:"China",dial:"86",length:11,format:"### #### ####",flag:"🇨🇳"},{iso2:"hk",name:"Hong Kong",dial:"852",length:8,format:"#### ####",flag:"🇭🇰"},{iso2:"sg",name:"Singapore",dial:"65",length:8,format:"#### ####",flag:"🇸🇬"},{iso2:"my",name:"Malaysia",dial:"60",length:[9,10],format:"## ### ####",flag:"🇲🇾"},{iso2:"id",name:"Indonesia",dial:"62",length:[9,12],format:"### ### ####",flag:"🇮🇩"},{iso2:"th",name:"Thailand",dial:"66",length:9,format:"## ### ####",flag:"🇹🇭"},{iso2:"vn",name:"Vietnam",dial:"84",length:[9,10],format:"### ### ####",flag:"🇻🇳"},{iso2:"ph",name:"Philippines",dial:"63",length:10,format:"### ### ####",flag:"🇵🇭"},{iso2:"pk",name:"Pakistan",dial:"92",length:10,format:"### #######",flag:"🇵🇰"},{iso2:"bd",name:"Bangladesh",dial:"880",length:10,format:"#### ######",flag:"🇧🇩"},{iso2:"lk",name:"Sri Lanka",dial:"94",length:9,format:"## ### ####",flag:"🇱🇰"},{iso2:"np",name:"Nepal",dial:"977",length:10,format:"###-#######",flag:"🇳🇵"},{iso2:"ae",name:"UAE",dial:"971",length:9,format:"## ### ####",flag:"🇦🇪"},{iso2:"sa",name:"Saudi Arabia",dial:"966",length:9,format:"## ### ####",flag:"🇸🇦"},{iso2:"qa",name:"Qatar",dial:"974",length:8,format:"#### ####",flag:"🇶🇦"},{iso2:"kw",name:"Kuwait",dial:"965",length:8,format:"#### ####",flag:"🇰🇼"},{iso2:"om",name:"Oman",dial:"968",length:8,format:"#### ####",flag:"🇴🇲"},{iso2:"bh",name:"Bahrain",dial:"973",length:8,format:"#### ####",flag:"🇧🇭"},{iso2:"il",name:"Israel",dial:"972",length:9,format:"## ### ####",flag:"🇮🇱"},{iso2:"tr",name:"Turkey",dial:"90",length:10,format:"### ### ####",flag:"🇹🇷"},{iso2:"ru",name:"Russia",dial:"7",length:10,format:"### ### ####",flag:"🇷🇺"},{iso2:"ua",name:"Ukraine",dial:"380",length:9,format:"## ### ####",flag:"🇺🇦"},{iso2:"br",name:"Brazil",dial:"55",length:[10,11],format:"## ##### ####",flag:"🇧🇷"},{iso2:"mx",name:"Mexico",dial:"52",length:10,format:"## #### ####",flag:"🇲🇽"},{iso2:"ar",name:"Argentina",dial:"54",length:10,format:"## #### ####",flag:"🇦🇷"},{iso2:"cl",name:"Chile",dial:"56",length:9,format:"# #### ####",flag:"🇨🇱"},{iso2:"co",name:"Colombia",dial:"57",length:10,format:"### ### ####",flag:"🇨🇴"},{iso2:"pe",name:"Peru",dial:"51",length:9,format:"### ### ###",flag:"🇵🇪"},{iso2:"za",name:"South Africa",dial:"27",length:9,format:"## ### ####",flag:"🇿🇦"},{iso2:"ng",name:"Nigeria",dial:"234",length:10,format:"### ### ####",flag:"🇳🇬"},{iso2:"ke",name:"Kenya",dial:"254",length:9,format:"### ### ###",flag:"🇰🇪"},{iso2:"eg",name:"Egypt",dial:"20",length:10,format:"### ### ####",flag:"🇪🇬"},{iso2:"ma",name:"Morocco",dial:"212",length:9,format:"## ### ####",flag:"🇲🇦"},{iso2:"nz",name:"New Zealand",dial:"64",length:[8,9],format:"## ### ####",flag:"🇳🇿"}];function ks(e){return e.replace(/\D+/g,"")}function $s(e,t){if(!t)return e;let n="",r=0;for(const o of t)if("#"===o){if(r>=e.length)break;n+=e[r++]}else r<e.length&&(n+=o);return r<e.length&&(n+=e.slice(r)),n}function Ss(e,t){return Array.isArray(t)?e.length>=t[0]&&e.length<=t[1]:e.length===t}function Cs(e){return Array.isArray(e)?`${e[0]}–${e[1]}`:`${e}`}var zs=i(function({defaultCountry:e="in",value:t,defaultValue:n,onChange:r,onValid:o,label:i,placeholder:a,disabled:l,required:c,id:u,name:h,extraCountries:g=[],className:y,style:v},w){const k=se(),$=d(),S=d(),C=p(()=>[...ws,...g].sort((e,t)=>e.name.localeCompare(t.name)),[g]),z=e=>C.find(t=>t.iso2===e.toLowerCase())||C[0],M=t=>{if(!t.startsWith("+"))return{country:z(e),digits:ks(t)};const n=ks(t);for(const e of[4,3,2,1]){const t=n.slice(0,e),r=C.find(e=>e.dial===t);if(r)return{country:r,digits:n.slice(e)}}return{country:z(e),digits:n}},N=t?M(t):{country:z(e),digits:ks(n||"")},[D,R]=m(N.country),[P,F]=m(N.digits),[I,A]=m(!1),[L,T]=m(""),[W,j]=m(0),E=f(null),B=f(null);s(()=>{if(void 0===t)return;const e=M(t);R(e.country),F(e.digits)},[t]);const V=$s(P,D.format),H=Ss(P,D.length),O=P?`+${D.dial}${P}`:"",q=(e,t)=>{const n={raw:$s(e,t.format),digits:e,e164:e?`+${t.dial}${e}`:"",country:t,valid:Ss(e,t.length)};r?.(n)},U=e=>{R(e),A(!1),q(P,e),E.current?.focus()},K=p(()=>{const e=L.trim().toLowerCase();return e?C.filter(t=>t.name.toLowerCase().includes(e)||t.iso2.includes(e)||t.dial.includes(e.replace(/^\+/,""))):C},[C,L]);s(()=>{j(0)},[L]),s(()=>{if(I){const e=setTimeout(()=>B.current?.focus(),0);return()=>clearTimeout(e)}},[I]);const Y=a??Cs(D.length).replace(/\d/g,"#"),X={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:360,...v},Z={fontSize:13,fontWeight:600,color:k.text},G={display:"flex",alignItems:"stretch",border:`1px solid ${k.border}`,borderRadius:8,background:k.surface,overflow:"visible",position:"relative"},_={display:"inline-flex",alignItems:"center",gap:6,padding:"0 10px",background:"transparent",border:"none",borderRight:`1px solid ${k.border}`,cursor:l?"not-allowed":"pointer",color:k.text,fontSize:14,minHeight:40,fontWeight:500},J={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:k.text,background:"transparent",minHeight:40,minWidth:0},Q={position:"absolute",top:"calc(100% + 4px)",left:0,right:0,maxHeight:280,overflow:"auto",background:k.surface,border:`1px solid ${k.border}`,borderRadius:8,zIndex:1e3,padding:6,boxShadow:"0 8px 24px rgba(0,0,0,0.18)"},ee={width:"100%",padding:"8px 10px",border:`1px solid ${k.border}`,borderRadius:6,background:k.bg,color:k.text,fontSize:13,marginBottom:6,outline:"none"},te={fontSize:12,color:k.danger,marginTop:2};/* @__PURE__ */
397
424
  return b("div",{className:y,style:X,onKeyDown:e=>{I&&("ArrowDown"===e.key?(e.preventDefault(),j(e=>Math.min(K.length-1,e+1))):"ArrowUp"===e.key?(e.preventDefault(),j(e=>Math.max(0,e-1))):"Enter"===e.key?(e.preventDefault(),K[W]&&U(K[W])):"Escape"===e.key&&(e.preventDefault(),A(!1),E.current?.focus()))},children:[i&&/* @__PURE__ */b("label",{htmlFor:u||$,style:Z,children:[i,c&&/* @__PURE__ */x("span",{style:{color:k.danger,marginLeft:4},"aria-hidden":"true",children:"*"})]}),
398
425
  /* @__PURE__ */b("div",{style:G,children:[
399
426
  /* @__PURE__ */b("button",{ref:E,type:"button",style:_,onClick:()=>!l&&A(e=>!e),"aria-haspopup":"listbox","aria-expanded":I,"aria-controls":S,"aria-label":`Country: ${D.name}, dial code +${D.dial}`,disabled:l,children:[
400
427
  /* @__PURE__ */x("span",{"aria-hidden":"true",style:{fontSize:18,lineHeight:1},children:D.flag}),
401
428
  /* @__PURE__ */b("span",{"aria-hidden":"true",children:["+",D.dial]}),
402
429
  /* @__PURE__ */x("span",{"aria-hidden":"true",style:{fontSize:10,opacity:.6,marginLeft:2},children:"▾"})]}),
403
- /* @__PURE__ */x("input",{ref:w,id:u||$,name:h,type:"tel",inputMode:"tel",autoComplete:"tel-national",value:V,onChange:e=>{const t=ps(e.target.value).slice(0,15);F(t),q(t,D)},onBlur:()=>{H&&o&&o({raw:V,digits:R,e164:O,country:D,valid:!0})},placeholder:Y,disabled:l,required:c,"aria-invalid":R.length>0&&!H,"aria-describedby":R.length>0&&!H?`${$}-err`:void 0,style:J}),I&&!l&&/* @__PURE__ */b("div",{id:S,role:"listbox","aria-label":"Select country",style:Q,children:[
430
+ /* @__PURE__ */x("input",{ref:w,id:u||$,name:h,type:"tel",inputMode:"tel",autoComplete:"tel-national",value:V,onChange:e=>{const t=ks(e.target.value).slice(0,15);F(t),q(t,D)},onBlur:()=>{H&&o&&o({raw:V,digits:P,e164:O,country:D,valid:!0})},placeholder:Y,disabled:l,required:c,"aria-invalid":P.length>0&&!H,"aria-describedby":P.length>0&&!H?`${$}-err`:void 0,style:J}),I&&!l&&/* @__PURE__ */b("div",{id:S,role:"listbox","aria-label":"Select country",style:Q,children:[
404
431
  /* @__PURE__ */x("input",{ref:B,type:"text",placeholder:"Search country or dial code…",value:L,onChange:e=>T(e.target.value),style:ee,"aria-label":"Filter countries"}),0===K.length&&/* @__PURE__ */b("div",{style:{padding:"12px 10px",fontSize:13,color:k.textMuted},children:['No country matches "',L,'"']}),K.map((e,t)=>{/* @__PURE__ */return b("div",{role:"option","aria-selected":t===W,onMouseEnter:()=>j(t),onClick:()=>U(e),style:(n=t===W,{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:"pointer",background:n?k.surfaceAlt:"transparent",color:k.text,fontSize:13}),children:[
405
432
  /* @__PURE__ */x("span",{"aria-hidden":"true",style:{fontSize:16},children:e.flag}),
406
433
  /* @__PURE__ */x("span",{style:{flex:1},children:e.name}),
407
- /* @__PURE__ */b("span",{style:{color:k.textMuted,fontVariantNumeric:"tabular-nums"},children:["+",e.dial]})]},e.iso2);var n})]})]}),R.length>0&&!H&&/* @__PURE__ */b("div",{id:`${$}-err`,role:"alert",style:te,children:["Expected ",ms(D.length)," digits for ",D.name,"."]})]})});gs.displayName="TkxPhoneInput";var xs={free:null,"1:1":1,"3:4":3/4,"4:5":.8,"16:9":16/9,"4:3":4/3,"3:2":1.5},bs={drop:"Drop an image here, or",browse:"browse",rotate:"Rotate",apply:"Apply",cancel:"Cancel",brightness:"Brightness",contrast:"Contrast",aspect:"Aspect",free:"Free"},ys=i(function({src:e,aspectRatio:t="free",ratios:n=["free","1:1","3:4","4:5","16:9"],mimeType:r="image/png",quality:o=.92,maxOutputSize:i=2048,outputFilename:l="edited.png",onChange:d,onResult:u,onCancel:h,className:g,style:y,labels:v},w){const k={...bs,...v},$=se(),S=f(null),C=f(null),z=f(null),M=f(null),[N,D]=m(e??null),[P,R]=m(null),[F,I]=m(t),[A,L]=m(0),[T,W]=m(100),[j,E]=m(100),[B,V]=m({x:0,y:0,w:0,h:0}),[H,O]=m(!1),q=f({mode:null,startX:0,startY:0,startCrop:{x:0,y:0,w:0,h:0}});s(()=>{if(!N)return M.current=null,void R(null);const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{M.current=e,R({w:e.naturalWidth,h:e.naturalHeight});const t=xs[F];if(t){const n=Math.min(e.naturalWidth,e.naturalHeight*t),r=n/t;V({x:(e.naturalWidth-n)/2,y:(e.naturalHeight-r)/2,w:n,h:r})}else V({x:0,y:0,w:e.naturalWidth,h:e.naturalHeight})},e.src=N},[N,F]),s(()=>{d?.({rotation:A,brightness:T,contrast:j})},[A,T,j,d]);const U=a(()=>{const e=C.current,t=M.current,n=P;if(!e||!t||!n)return;const r=e.getContext("2d");if(!r)return;const o=z.current,i=o?Math.min(o.clientWidth,800):600,a=A%180!=0,l=a?n.h:n.w,s=a?n.w:n.h,d=Math.min(i/l,600/s,1),c=Math.floor(l*d),u=Math.floor(s*d);e.width=c,e.height=u,r.save(),r.filter=`brightness(${T}%) contrast(${j}%)`,r.translate(c/2,u/2),r.rotate(A*Math.PI/180),r.drawImage(t,-n.w*d/2,-n.h*d/2,n.w*d,n.h*d),r.restore()},[A,T,j,P]);s(()=>{U()},[U]),s(()=>{const e=P;if(!e)return;const t=xs[F];t&&V(n=>{const r=n.x+n.w/2,o=n.y+n.h/2;let i=n.w,a=i/t;return a>e.h&&(a=e.h,i=a*t),i>e.w&&(i=e.w,a=i/t),{x:Math.max(0,Math.min(e.w-i,r-i/2)),y:Math.max(0,Math.min(e.h-a,o-a/2)),w:i,h:a}})},[F,P]);const K=e=>{const t=new FileReader;t.onload=()=>{"string"==typeof t.result&&(D(t.result),L(0),W(100),E(100))},t.readAsDataURL(e)},Y=e=>t=>{t.preventDefault(),t.stopPropagation();const n="touches"in t?t.touches[0]:t;q.current={mode:e,startX:n.clientX,startY:n.clientY,startCrop:{...B}};const r=e=>{e.preventDefault();const t="touches"in e?e.touches[0]:e,n=t.clientX-q.current.startX,r=t.clientY-q.current.startY,o=P;if(!o)return;const i=C.current;if(!i)return;const a=n*(o.w/i.width),l=r*(o.h/i.height),s=q.current.startCrop,d=xs[F];let c={...s};if("move"===q.current.mode)c.x=Math.max(0,Math.min(o.w-s.w,s.x+a)),c.y=Math.max(0,Math.min(o.h-s.h,s.y+l));else{const e=q.current.mode;if("se"===e)c.w=Math.max(20,Math.min(o.w-s.x,s.w+a)),c.h=d?c.w/d:Math.max(20,Math.min(o.h-s.y,s.h+l));else if("sw"===e){const e=Math.max(20,s.w-a);c.x=Math.max(0,s.x+s.w-e),c.w=s.x+s.w-c.x,c.h=d?c.w/d:Math.max(20,Math.min(o.h-s.y,s.h+l))}else if("ne"===e){c.w=Math.max(20,Math.min(o.w-s.x,s.w+a));const e=d?c.w/d:Math.max(20,s.h-l);c.y=Math.max(0,s.y+s.h-e),c.h=s.y+s.h-c.y}else if("nw"===e){const e=Math.max(20,s.w-a);c.x=Math.max(0,s.x+s.w-e),c.w=s.x+s.w-c.x;const t=d?c.w/d:Math.max(20,s.h-l);c.y=Math.max(0,s.y+s.h-t),c.h=s.y+s.h-c.y}}V(c)},o=()=>{q.current.mode=null,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o),window.removeEventListener("touchmove",r),window.removeEventListener("touchend",o)};window.addEventListener("mousemove",r,{passive:!1}),window.addEventListener("mouseup",o),window.addEventListener("touchmove",r,{passive:!1}),window.addEventListener("touchend",o)},X=a(()=>new Promise(e=>{const t=M.current,n=P;if(!t||!n)return e(null);const a=document.createElement("canvas"),s=A%180!=0,d=s?B.h:B.w,c=s?B.w:B.h,u=Math.min(1,i/Math.max(d,c));a.width=Math.round(d*u),a.height=Math.round(c*u);const p=a.getContext("2d");if(!p)return e(null);p.filter=`brightness(${T}%) contrast(${j}%)`;const h=document.createElement("canvas");h.width=s?n.h:n.w,h.height=s?n.w:n.h;const f=h.getContext("2d");if(!f)return e(null);f.translate(h.width/2,h.height/2),f.rotate(A*Math.PI/180),f.drawImage(t,-n.w/2,-n.h/2,n.w,n.h),p.drawImage(h,B.x,B.y,B.w,B.h,0,0,a.width,a.height),a.toBlob(t=>{if(!t)return e(null);const n="image/jpeg"===r?"jpg":"image/webp"===r?"webp":"png",o=l.endsWith(`.${n}`)?l:l.replace(/\.\w+$/,"")+`.${n}`;e({blob:t,file:new File([t],o,{type:r,lastModified:Date.now()}),url:URL.createObjectURL(t),width:a.width,height:a.height})},r,o)}),[B,A,T,j,P,r,o,i,l]);c(w,()=>({getResult:X,reset:()=>{if(L(0),W(100),E(100),P){const e=xs[F];if(e){const t=Math.min(P.w,P.h*e),n=t/e;V({x:(P.w-t)/2,y:(P.h-n)/2,w:t,h:n})}else V({x:0,y:0,w:P.w,h:P.h})}},loadSource:e=>D(e)}),[X,F,P]);const Z={border:`1px solid ${$.border}`,borderRadius:12,background:$.surface,padding:16,...y},G={border:`2px dashed ${H?$.primary:$.border}`,borderRadius:10,padding:48,textAlign:"center",color:$.textMuted,cursor:"pointer",transition:"border-color 0.15s",background:H?`${$.primary}10`:"transparent"},_={padding:"8px 14px",border:`1px solid ${$.border}`,borderRadius:6,background:$.bg,color:$.text,cursor:"pointer",fontSize:13,fontWeight:600,minHeight:36},J=p(()=>{const e=C.current,t=P;if(!e||!t)return null;const n=A%180!=0,r=n?t.h:t.w,o=n?t.w:t.h,i=e.width/r,a=e.height/o;return{left:B.x*i,top:B.y*a,width:B.w*i,height:B.h*a}},[B,P,A]);return N?/* @__PURE__ */b("div",{ref:z,className:g,style:Z,children:[
434
+ /* @__PURE__ */b("span",{style:{color:k.textMuted,fontVariantNumeric:"tabular-nums"},children:["+",e.dial]})]},e.iso2);var n})]})]}),P.length>0&&!H&&/* @__PURE__ */b("div",{id:`${$}-err`,role:"alert",style:te,children:["Expected ",Cs(D.length)," digits for ",D.name,"."]})]})});zs.displayName="TkxPhoneInput";var Ms={free:null,"1:1":1,"3:4":3/4,"4:5":.8,"16:9":16/9,"4:3":4/3,"3:2":1.5},Ns={drop:"Drop an image here, or",browse:"browse",rotate:"Rotate",apply:"Apply",cancel:"Cancel",brightness:"Brightness",contrast:"Contrast",aspect:"Aspect",free:"Free"},Ds=i(function({src:e,aspectRatio:t="free",ratios:n=["free","1:1","3:4","4:5","16:9"],mimeType:r="image/png",quality:o=.92,maxOutputSize:i=2048,outputFilename:l="edited.png",onChange:d,onResult:u,onCancel:h,className:g,style:y,labels:v},w){const k={...Ns,...v},$=se(),S=f(null),C=f(null),z=f(null),M=f(null),[N,D]=m(e??null),[R,P]=m(null),[F,I]=m(t),[A,L]=m(0),[T,W]=m(100),[j,E]=m(100),[B,V]=m({x:0,y:0,w:0,h:0}),[H,O]=m(!1),q=f({mode:null,startX:0,startY:0,startCrop:{x:0,y:0,w:0,h:0}});s(()=>{if(!N)return M.current=null,void P(null);const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{M.current=e,P({w:e.naturalWidth,h:e.naturalHeight});const t=Ms[F];if(t){const n=Math.min(e.naturalWidth,e.naturalHeight*t),r=n/t;V({x:(e.naturalWidth-n)/2,y:(e.naturalHeight-r)/2,w:n,h:r})}else V({x:0,y:0,w:e.naturalWidth,h:e.naturalHeight})},e.src=N},[N,F]),s(()=>{d?.({rotation:A,brightness:T,contrast:j})},[A,T,j,d]);const U=a(()=>{const e=C.current,t=M.current,n=R;if(!e||!t||!n)return;const r=e.getContext("2d");if(!r)return;const o=z.current,i=o?Math.min(o.clientWidth,800):600,a=A%180!=0,l=a?n.h:n.w,s=a?n.w:n.h,d=Math.min(i/l,600/s,1),c=Math.floor(l*d),u=Math.floor(s*d);e.width=c,e.height=u,r.save(),r.filter=`brightness(${T}%) contrast(${j}%)`,r.translate(c/2,u/2),r.rotate(A*Math.PI/180),r.drawImage(t,-n.w*d/2,-n.h*d/2,n.w*d,n.h*d),r.restore()},[A,T,j,R]);s(()=>{U()},[U]),s(()=>{const e=R;if(!e)return;const t=Ms[F];t&&V(n=>{const r=n.x+n.w/2,o=n.y+n.h/2;let i=n.w,a=i/t;return a>e.h&&(a=e.h,i=a*t),i>e.w&&(i=e.w,a=i/t),{x:Math.max(0,Math.min(e.w-i,r-i/2)),y:Math.max(0,Math.min(e.h-a,o-a/2)),w:i,h:a}})},[F,R]);const K=e=>{const t=new FileReader;t.onload=()=>{"string"==typeof t.result&&(D(t.result),L(0),W(100),E(100))},t.readAsDataURL(e)},Y=e=>t=>{t.preventDefault(),t.stopPropagation();const n="touches"in t?t.touches[0]:t;q.current={mode:e,startX:n.clientX,startY:n.clientY,startCrop:{...B}};const r=e=>{e.preventDefault();const t="touches"in e?e.touches[0]:e,n=t.clientX-q.current.startX,r=t.clientY-q.current.startY,o=R;if(!o)return;const i=C.current;if(!i)return;const a=n*(o.w/i.width),l=r*(o.h/i.height),s=q.current.startCrop,d=Ms[F];let c={...s};if("move"===q.current.mode)c.x=Math.max(0,Math.min(o.w-s.w,s.x+a)),c.y=Math.max(0,Math.min(o.h-s.h,s.y+l));else{const e=q.current.mode;if("se"===e)c.w=Math.max(20,Math.min(o.w-s.x,s.w+a)),c.h=d?c.w/d:Math.max(20,Math.min(o.h-s.y,s.h+l));else if("sw"===e){const e=Math.max(20,s.w-a);c.x=Math.max(0,s.x+s.w-e),c.w=s.x+s.w-c.x,c.h=d?c.w/d:Math.max(20,Math.min(o.h-s.y,s.h+l))}else if("ne"===e){c.w=Math.max(20,Math.min(o.w-s.x,s.w+a));const e=d?c.w/d:Math.max(20,s.h-l);c.y=Math.max(0,s.y+s.h-e),c.h=s.y+s.h-c.y}else if("nw"===e){const e=Math.max(20,s.w-a);c.x=Math.max(0,s.x+s.w-e),c.w=s.x+s.w-c.x;const t=d?c.w/d:Math.max(20,s.h-l);c.y=Math.max(0,s.y+s.h-t),c.h=s.y+s.h-c.y}}V(c)},o=()=>{q.current.mode=null,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o),window.removeEventListener("touchmove",r),window.removeEventListener("touchend",o)};window.addEventListener("mousemove",r,{passive:!1}),window.addEventListener("mouseup",o),window.addEventListener("touchmove",r,{passive:!1}),window.addEventListener("touchend",o)},X=a(()=>new Promise(e=>{const t=M.current,n=R;if(!t||!n)return e(null);const a=document.createElement("canvas"),s=A%180!=0,d=s?B.h:B.w,c=s?B.w:B.h,u=Math.min(1,i/Math.max(d,c));a.width=Math.round(d*u),a.height=Math.round(c*u);const p=a.getContext("2d");if(!p)return e(null);p.filter=`brightness(${T}%) contrast(${j}%)`;const h=document.createElement("canvas");h.width=s?n.h:n.w,h.height=s?n.w:n.h;const f=h.getContext("2d");if(!f)return e(null);f.translate(h.width/2,h.height/2),f.rotate(A*Math.PI/180),f.drawImage(t,-n.w/2,-n.h/2,n.w,n.h),p.drawImage(h,B.x,B.y,B.w,B.h,0,0,a.width,a.height),a.toBlob(t=>{if(!t)return e(null);const n="image/jpeg"===r?"jpg":"image/webp"===r?"webp":"png",o=l.endsWith(`.${n}`)?l:l.replace(/\.\w+$/,"")+`.${n}`;e({blob:t,file:new File([t],o,{type:r,lastModified:Date.now()}),url:URL.createObjectURL(t),width:a.width,height:a.height})},r,o)}),[B,A,T,j,R,r,o,i,l]);c(w,()=>({getResult:X,reset:()=>{if(L(0),W(100),E(100),R){const e=Ms[F];if(e){const t=Math.min(R.w,R.h*e),n=t/e;V({x:(R.w-t)/2,y:(R.h-n)/2,w:t,h:n})}else V({x:0,y:0,w:R.w,h:R.h})}},loadSource:e=>D(e)}),[X,F,R]);const Z={border:`1px solid ${$.border}`,borderRadius:12,background:$.surface,padding:16,...y},G={border:`2px dashed ${H?$.primary:$.border}`,borderRadius:10,padding:48,textAlign:"center",color:$.textMuted,cursor:"pointer",transition:"border-color 0.15s",background:H?`${$.primary}10`:"transparent"},_={padding:"8px 14px",border:`1px solid ${$.border}`,borderRadius:6,background:$.bg,color:$.text,cursor:"pointer",fontSize:13,fontWeight:600,minHeight:36},J=p(()=>{const e=C.current,t=R;if(!e||!t)return null;const n=A%180!=0,r=n?t.h:t.w,o=n?t.w:t.h,i=e.width/r,a=e.height/o;return{left:B.x*i,top:B.y*a,width:B.w*i,height:B.h*a}},[B,R,A]);return N?/* @__PURE__ */b("div",{ref:z,className:g,style:Z,children:[
408
435
  /* @__PURE__ */b("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginBottom:12,alignItems:"center"},children:[
409
436
  /* @__PURE__ */b("span",{style:{fontSize:13,fontWeight:600,marginRight:4},children:[k.aspect,":"]}),n.map(e=>{/* @__PURE__ */return x("button",{type:"button",onClick:()=>I(e),style:(t=F===e,{..._,background:t?$.primary:$.bg,color:t?$.bg:$.text,borderColor:t?$.primary:$.border}),"aria-pressed":F===e,children:"free"===e?k.free:e},e);var t}),
410
437
  /* @__PURE__ */x("div",{style:{width:1,height:24,background:$.border,margin:"0 4px"}}),
@@ -417,53 +444,53 @@ return b("div",{className:y,style:X,onKeyDown:e=>{I&&("ArrowDown"===e.key?(e.pre
417
444
  /* @__PURE__ */x("span",{style:{minWidth:80},children:k.contrast}),
418
445
  /* @__PURE__ */x("input",{type:"range",min:50,max:150,value:j,onChange:e=>E(Number(e.target.value)),"aria-label":k.contrast,style:{width:140}}),
419
446
  /* @__PURE__ */b("span",{style:{minWidth:40,color:$.textMuted,fontVariantNumeric:"tabular-nums"},children:[j,"%"]})]})]}),
420
- /* @__PURE__ */b("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%",userSelect:"none",touchAction:"none"},children:[/* @__PURE__ */x("canvas",{ref:C,style:{display:"block",maxWidth:"100%"}}),J&&/* @__PURE__ */x("div",{role:"region","aria-label":"Crop area",style:{position:"absolute",left:J.left,top:J.top,width:J.width,height:J.height,border:`2px solid ${$.primary}`,boxShadow:`0 0 0 9999px ${$.bg}aa`,cursor:"move",touchAction:"none"},onMouseDown:Y("move"),onTouchStart:Y("move"),tabIndex:0,onKeyDown:e=>{const t=P;if(!t)return;const n=e.shiftKey?20:5;"ArrowLeft"===e.key?V(e=>({...e,x:Math.max(0,e.x-n)})):"ArrowRight"===e.key?V(e=>({...e,x:Math.min(t.w-e.w,e.x+n)})):"ArrowUp"===e.key?V(e=>({...e,y:Math.max(0,e.y-n)})):"ArrowDown"===e.key&&V(e=>({...e,y:Math.min(t.h-e.h,e.y+n)}))},children:["nw","ne","sw","se"].map(e=>/* @__PURE__ */x("div",{onMouseDown:Y(e),onTouchStart:Y(e),style:{position:"absolute",width:14,height:14,background:$.primary,border:`2px solid ${$.bg}`,borderRadius:2,cursor:`${e}-resize`,top:e.startsWith("n")?-7:void 0,bottom:e.startsWith("s")?-7:void 0,left:e.endsWith("w")?-7:void 0,right:e.endsWith("e")?-7:void 0,touchAction:"none"},"aria-hidden":"true"},e))})]}),
447
+ /* @__PURE__ */b("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%",userSelect:"none",touchAction:"none"},children:[/* @__PURE__ */x("canvas",{ref:C,style:{display:"block",maxWidth:"100%"}}),J&&/* @__PURE__ */x("div",{role:"region","aria-label":"Crop area",style:{position:"absolute",left:J.left,top:J.top,width:J.width,height:J.height,border:`2px solid ${$.primary}`,boxShadow:`0 0 0 9999px ${$.bg}aa`,cursor:"move",touchAction:"none"},onMouseDown:Y("move"),onTouchStart:Y("move"),tabIndex:0,onKeyDown:e=>{const t=R;if(!t)return;const n=e.shiftKey?20:5;"ArrowLeft"===e.key?V(e=>({...e,x:Math.max(0,e.x-n)})):"ArrowRight"===e.key?V(e=>({...e,x:Math.min(t.w-e.w,e.x+n)})):"ArrowUp"===e.key?V(e=>({...e,y:Math.max(0,e.y-n)})):"ArrowDown"===e.key&&V(e=>({...e,y:Math.min(t.h-e.h,e.y+n)}))},children:["nw","ne","sw","se"].map(e=>/* @__PURE__ */x("div",{onMouseDown:Y(e),onTouchStart:Y(e),style:{position:"absolute",width:14,height:14,background:$.primary,border:`2px solid ${$.bg}`,borderRadius:2,cursor:`${e}-resize`,top:e.startsWith("n")?-7:void 0,bottom:e.startsWith("s")?-7:void 0,left:e.endsWith("w")?-7:void 0,right:e.endsWith("e")?-7:void 0,touchAction:"none"},"aria-hidden":"true"},e))})]}),
421
448
  /* @__PURE__ */b("div",{style:{display:"flex",gap:8,marginTop:16,justifyContent:"flex-end"},children:[h&&/* @__PURE__ */x("button",{type:"button",onClick:h,style:_,children:k.cancel}),/* @__PURE__ */x("button",{type:"button",onClick:async()=>{const e=await X();e&&u&&u(e)},style:{..._,background:$.primary,color:$.bg,borderColor:$.primary},children:k.apply})]})]}):/* @__PURE__ */x("div",{className:g,style:Z,children:/* @__PURE__ */b("div",{style:G,onClick:()=>S.current?.click(),onDrop:e=>{e.preventDefault(),O(!1);const t=e.dataTransfer.files?.[0];t&&t.type.startsWith("image/")&&K(t)},onDragOver:e=>{e.preventDefault(),O(!0)},onDragLeave:()=>O(!1),role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S.current?.click())},"aria-label":"Upload image to edit",children:[
422
449
  /* @__PURE__ */x("div",{style:{fontSize:14,marginBottom:6},children:k.drop}),
423
450
  /* @__PURE__ */x("button",{type:"button",style:{..._,color:$.primary,borderColor:$.primary},children:k.browse}),
424
- /* @__PURE__ */x("input",{ref:S,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>{const t=e.target.files?.[0];t&&K(t)}})]})})});ys.displayName="TkxImageEditor";var vs={razorpay:"https://checkout.razorpay.com/v1/checkout.js",stripe:"https://js.stripe.com/v3/",square:"https://web.squarecdn.com/v1/square.js"},ws={razorpay:"Razorpay",stripe:"Stripe",square:"Square"},ks=/^[A-Za-z0-9_-]{20,200}$/,$s={},Ss=i(function({config:e,onSuccess:t,onFailure:n,onDismiss:r,children:o,variant:i="primary",size:a="md",disabled:l,className:s,style:d},c){const u=se(),p=yn(),[h,f]=m(!1),g="razorpay"===e.provider||"stripe"===e.provider?e.publicKey:e.applicationId;ks.test(g);const b="sm"===a?13:"lg"===a?16:14,y="sm"===a?32:"lg"===a?48:40,v={padding:`${"sm"===a?6:"lg"===a?12:9}px ${"sm"===a?12:"lg"===a?22:16}px`,borderRadius:8,border:"outline"===i?`1.5px solid ${u.primary}`:"none",background:"outline"===i?"transparent":u.primary,color:"outline"===i?u.primary:u.bg,fontSize:b,fontWeight:600,cursor:l?"not-allowed":h?"progress":"pointer",opacity:l?.5:1,minHeight:y,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,transition:"opacity 0.15s, transform 0.05s",...d};/* @__PURE__ */
425
- return x("button",{ref:c,type:"button",onClick:async()=>{if(!h&&!l){f(!0);try{if(await function(e){if("undefined"==typeof window)return Promise.resolve();if(window[ws[e]])return Promise.resolve();if($s[e])return $s[e];const t=new Promise((t,n)=>{const r=document.querySelector(`script[data-tkx-payment="${e}"]`);if(r)return r.addEventListener("load",()=>t()),void r.addEventListener("error",()=>n(/* @__PURE__ */new Error("script-load-failed")));const o=document.createElement("script");o.src=vs[e],o.async=!0,o.dataset.tkxPayment=e,o.addEventListener("load",()=>t()),o.addEventListener("error",()=>n(/* @__PURE__ */new Error("script-load-failed"))),document.head.appendChild(o)});return $s[e]=t,t}(e.provider),"razorpay"===e.provider){const o=window.Razorpay;if(!o)throw new Error("Razorpay script loaded but global missing");const i=new o({key:e.publicKey,amount:e.amount,currency:e.currency,order_id:e.orderId,name:ke(e.brand?.name??"Payment"),description:ke(e.brand?.description??""),image:e.brand?.image,prefill:e.prefill,notes:e.notes,theme:{color:e.themeColor??u.primary},handler:e=>{t({provider:"razorpay",paymentId:e.razorpay_payment_id,orderId:e.razorpay_order_id,signature:e.razorpay_signature,raw:e})},modal:{ondismiss:()=>{f(!1),r?.()}}});return i.on("payment.failed",e=>{f(!1),n?.({provider:"razorpay",code:e?.error?.code??"unknown",message:e?.error?.description??"Payment failed",raw:e})}),void i.open()}if("stripe"===e.provider){const t=window.Stripe;if(!t)throw new Error("Stripe script loaded but global missing");const r=await t(e.publicKey).redirectToCheckout({sessionId:e.sessionId});return void(r?.error&&(f(!1),n?.({provider:"stripe",code:r.error.code??"unknown",message:r.error.message??"Stripe checkout failed",raw:r})))}if("square"===e.provider){if(!window.Square)throw new Error("Square script loaded but global missing");const r={applicationId:e.applicationId,locationId:e.locationId,orderId:e.orderId,amount:e.amount,currency:e.currency,success:(n,r)=>t({provider:"square",paymentId:n,orderId:e.orderId,raw:r}),failure:(e,t,r)=>n?.({provider:"square",code:e,message:t,raw:r})};return void window.dispatchEvent(new CustomEvent("tkx-payment-square-init",{detail:r}))}}catch(o){f(!1),n?.({provider:e.provider,code:"sdk-load-failed",message:o?.message??"Unable to load payment SDK",raw:o})}}},disabled:l||h,"aria-busy":h,className:s,style:v,"data-tkx-payment-provider":e.provider,children:h?/* @__PURE__ */x("span",{"aria-hidden":"true",children:p.loading}):o??"Pay"})});Ss.displayName="TkxPaymentButton";var Cs=i(function({label:e,width:t,height:n=180,strokeColor:r,strokeWidth:o=2,backgroundColor:i,onChange:l,disabled:d,className:u,style:p},h){const g=se(),y=yn(),v=f(null),w=f(null),k=f([]),$=f(null),S=f(1),[C,z]=m(t??320),M=r??g.text,N=i??g.surface;s(()=>{if(void 0!==t)return;const e=v.current;if(!e||"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(e=>{for(const t of e){const e=Math.floor(t.contentRect.width);e>0&&z(e)}});return n.observe(e),()=>n.disconnect()},[t]);const D=a(()=>{const e=w.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=S.current;t.fillStyle=N,t.fillRect(0,0,e.width,e.height),t.strokeStyle=M,t.lineWidth=o*n,t.lineCap="round",t.lineJoin="round";for(const r of k.current){if(r.length<2){1===r.length&&(t.beginPath(),t.arc(r[0].x*n,r[0].y*n,o*n/2,0,2*Math.PI),t.fillStyle=M,t.fill());continue}t.beginPath(),t.moveTo(r[0].x*n,r[0].y*n);for(let o=1;o<r.length-1;o++){const e=(r[o].x+r[o+1].x)/2,i=(r[o].y+r[o+1].y)/2;t.quadraticCurveTo(r[o].x*n,r[o].y*n,e*n,i*n)}const e=r[r.length-1];t.lineTo(e.x*n,e.y*n),t.stroke()}},[N,M,o]);s(()=>{const e=w.current;if(!e)return;const t=window.devicePixelRatio||1;S.current=t,e.width=C*t,e.height=n*t,e.style.width=`${C}px`,e.style.height=`${n}px`,D()},[C,n,D]);const P=e=>{const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},R=e=>{if($.current){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}$.current=null,l?.(w.current?.toDataURL("image/png")??"")}};c(h,()=>({clear:()=>{k.current=[],$.current=null,D(),l?.(w.current?.toDataURL("image/png")??"")},undo:()=>{k.current.pop(),D(),l?.(w.current?.toDataURL("image/png")??"")},isEmpty:()=>0===k.current.length,toDataURL:(e="image/png",t=.92)=>w.current?.toDataURL(e,t)??"",toBlob:(e="image/png",t=.92)=>new Promise(n=>{w.current?.toBlob(e=>n(e),e,t)})}),[D,l]);const F={display:"inline-flex",flexDirection:"column",gap:6,width:t??"100%",...p},I={fontSize:13,fontWeight:600,color:g.text},A={borderRadius:8,border:`1px solid ${g.border}`,background:N,cursor:d?"not-allowed":"crosshair",touchAction:"none",display:"block",width:"100%"};/* @__PURE__ */
426
- return b("div",{ref:v,className:u,style:F,children:[e&&/* @__PURE__ */x("label",{style:I,children:e}),/* @__PURE__ */x("canvas",{ref:w,role:"img","aria-label":e??y.uploadFiles??"Signature pad",style:A,onPointerDown:e=>{d||(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),$.current=[P(e)],k.current.push($.current))},onPointerMove:e=>{if(!$.current||d)return;e.preventDefault();const t=P(e),n=$.current,r=n[n.length-1];Math.abs(r.x-t.x)<1&&Math.abs(r.y-t.y)<1||(n.push(t),D())},onPointerUp:R,onPointerCancel:R})]})});Cs.displayName="TkxSignaturePad";var zs=async(e,t)=>{const n=await fetch(`https://api.postalpincode.in/pincode/${e}`,{signal:t});if(!n.ok)throw new Error(`HTTP ${n.status}`);const r=await n.json();return Array.isArray(r)&&r[0]&&"Success"===r[0].Status&&r[0].PostOffice?r[0].PostOffice:[]},Ms=/^\d{6}$/,Ns=i(function({value:e,onChange:t,lookup:n=zs,label:r,showAddressLines:o=!0,disabled:i,className:a,style:l},c){const u=se(),p=yn(),h=d(),[f,y]=m([]),[v,w]=m(!1),[k,$]=m(null);s(()=>{if(!e.pin||!Ms.test(e.pin))return y([]),void $(null);const t=new AbortController;return w(!0),$(null),n(e.pin,t.signal).then(e=>{y(e),0===e.length&&$(p.noResults)}).catch(e=>{"AbortError"!==e?.name&&($(e?.message||"Lookup failed"),y([]))}).finally(()=>w(!1)),()=>t.abort()},[e.pin]);const S=n=>{t({...e,pin:n.Pincode,postOffice:n.Name,city:n.District,state:n.State,country:n.Country}),y([])},C=(n,r)=>{t({...e,pin:e.pin??"",[n]:r})},z={display:"flex",flexDirection:"column",gap:8,width:"100%",...l},M={flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},N={width:"100%",padding:"8px 10px",border:`1px solid ${u.border}`,borderRadius:8,background:u.surface,color:u.text,fontSize:14,outline:"none",minHeight:40},D={border:`1px solid ${u.border}`,borderRadius:8,background:u.surface,maxHeight:200,overflow:"auto",padding:4},P={padding:"8px 10px",borderRadius:6,cursor:"pointer",fontSize:13,color:u.text},R={fontSize:12,color:u.textMuted};/* @__PURE__ */
451
+ /* @__PURE__ */x("input",{ref:S,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>{const t=e.target.files?.[0];t&&K(t)}})]})})});Ds.displayName="TkxImageEditor";var Rs={razorpay:"https://checkout.razorpay.com/v1/checkout.js",stripe:"https://js.stripe.com/v3/",square:"https://web.squarecdn.com/v1/square.js"},Ps={razorpay:"Razorpay",stripe:"Stripe",square:"Square"},Fs=/^[A-Za-z0-9_-]{20,200}$/,Is={},As=i(function({config:e,onSuccess:t,onFailure:n,onDismiss:r,children:o,variant:i="primary",size:a="md",disabled:l,className:s,style:d},c){const u=se(),p=yn(),[h,f]=m(!1),g="razorpay"===e.provider||"stripe"===e.provider?e.publicKey:e.applicationId;Fs.test(g);const b="sm"===a?13:"lg"===a?16:14,y="sm"===a?32:"lg"===a?48:40,v={padding:`${"sm"===a?6:"lg"===a?12:9}px ${"sm"===a?12:"lg"===a?22:16}px`,borderRadius:8,border:"outline"===i?`1.5px solid ${u.primary}`:"none",background:"outline"===i?"transparent":u.primary,color:"outline"===i?u.primary:u.bg,fontSize:b,fontWeight:600,cursor:l?"not-allowed":h?"progress":"pointer",opacity:l?.5:1,minHeight:y,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,transition:"opacity 0.15s, transform 0.05s",...d};/* @__PURE__ */
452
+ return x("button",{ref:c,type:"button",onClick:async()=>{if(!h&&!l){f(!0);try{if(await function(e){if("undefined"==typeof window)return Promise.resolve();if(window[Ps[e]])return Promise.resolve();if(Is[e])return Is[e];const t=new Promise((t,n)=>{const r=document.querySelector(`script[data-tkx-payment="${e}"]`);if(r)return r.addEventListener("load",()=>t()),void r.addEventListener("error",()=>n(/* @__PURE__ */new Error("script-load-failed")));const o=document.createElement("script");o.src=Rs[e],o.async=!0,o.dataset.tkxPayment=e,o.addEventListener("load",()=>t()),o.addEventListener("error",()=>n(/* @__PURE__ */new Error("script-load-failed"))),document.head.appendChild(o)});return Is[e]=t,t}(e.provider),"razorpay"===e.provider){const o=window.Razorpay;if(!o)throw new Error("Razorpay script loaded but global missing");const i=new o({key:e.publicKey,amount:e.amount,currency:e.currency,order_id:e.orderId,name:ke(e.brand?.name??"Payment"),description:ke(e.brand?.description??""),image:e.brand?.image,prefill:e.prefill,notes:e.notes,theme:{color:e.themeColor??u.primary},handler:e=>{t({provider:"razorpay",paymentId:e.razorpay_payment_id,orderId:e.razorpay_order_id,signature:e.razorpay_signature,raw:e})},modal:{ondismiss:()=>{f(!1),r?.()}}});return i.on("payment.failed",e=>{f(!1),n?.({provider:"razorpay",code:e?.error?.code??"unknown",message:e?.error?.description??"Payment failed",raw:e})}),void i.open()}if("stripe"===e.provider){const t=window.Stripe;if(!t)throw new Error("Stripe script loaded but global missing");const r=await t(e.publicKey).redirectToCheckout({sessionId:e.sessionId});return void(r?.error&&(f(!1),n?.({provider:"stripe",code:r.error.code??"unknown",message:r.error.message??"Stripe checkout failed",raw:r})))}if("square"===e.provider){if(!window.Square)throw new Error("Square script loaded but global missing");const r={applicationId:e.applicationId,locationId:e.locationId,orderId:e.orderId,amount:e.amount,currency:e.currency,success:(n,r)=>t({provider:"square",paymentId:n,orderId:e.orderId,raw:r}),failure:(e,t,r)=>n?.({provider:"square",code:e,message:t,raw:r})};return void window.dispatchEvent(new CustomEvent("tkx-payment-square-init",{detail:r}))}}catch(o){f(!1),n?.({provider:e.provider,code:"sdk-load-failed",message:o?.message??"Unable to load payment SDK",raw:o})}}},disabled:l||h,"aria-busy":h,className:s,style:v,"data-tkx-payment-provider":e.provider,children:h?/* @__PURE__ */x("span",{"aria-hidden":"true",children:p.loading}):o??"Pay"})});As.displayName="TkxPaymentButton";var Ls=i(function({label:e,width:t,height:n=180,strokeColor:r,strokeWidth:o=2,backgroundColor:i,onChange:l,disabled:d,className:u,style:p},h){const g=se(),y=yn(),v=f(null),w=f(null),k=f([]),$=f(null),S=f(1),[C,z]=m(t??320),M=r??g.text,N=i??g.surface;s(()=>{if(void 0!==t)return;const e=v.current;if(!e||"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(e=>{for(const t of e){const e=Math.floor(t.contentRect.width);e>0&&z(e)}});return n.observe(e),()=>n.disconnect()},[t]);const D=a(()=>{const e=w.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=S.current;t.fillStyle=N,t.fillRect(0,0,e.width,e.height),t.strokeStyle=M,t.lineWidth=o*n,t.lineCap="round",t.lineJoin="round";for(const r of k.current){if(r.length<2){1===r.length&&(t.beginPath(),t.arc(r[0].x*n,r[0].y*n,o*n/2,0,2*Math.PI),t.fillStyle=M,t.fill());continue}t.beginPath(),t.moveTo(r[0].x*n,r[0].y*n);for(let o=1;o<r.length-1;o++){const e=(r[o].x+r[o+1].x)/2,i=(r[o].y+r[o+1].y)/2;t.quadraticCurveTo(r[o].x*n,r[o].y*n,e*n,i*n)}const e=r[r.length-1];t.lineTo(e.x*n,e.y*n),t.stroke()}},[N,M,o]);s(()=>{const e=w.current;if(!e)return;const t=window.devicePixelRatio||1;S.current=t,e.width=C*t,e.height=n*t,e.style.width=`${C}px`,e.style.height=`${n}px`,D()},[C,n,D]);const R=e=>{const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},P=e=>{if($.current){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}$.current=null,l?.(w.current?.toDataURL("image/png")??"")}};c(h,()=>({clear:()=>{k.current=[],$.current=null,D(),l?.(w.current?.toDataURL("image/png")??"")},undo:()=>{k.current.pop(),D(),l?.(w.current?.toDataURL("image/png")??"")},isEmpty:()=>0===k.current.length,toDataURL:(e="image/png",t=.92)=>w.current?.toDataURL(e,t)??"",toBlob:(e="image/png",t=.92)=>new Promise(n=>{w.current?.toBlob(e=>n(e),e,t)})}),[D,l]);const F={display:"inline-flex",flexDirection:"column",gap:6,width:t??"100%",...p},I={fontSize:13,fontWeight:600,color:g.text},A={borderRadius:8,border:`1px solid ${g.border}`,background:N,cursor:d?"not-allowed":"crosshair",touchAction:"none",display:"block",width:"100%"};/* @__PURE__ */
453
+ return b("div",{ref:v,className:u,style:F,children:[e&&/* @__PURE__ */x("label",{style:I,children:e}),/* @__PURE__ */x("canvas",{ref:w,role:"img","aria-label":e??y.uploadFiles??"Signature pad",style:A,onPointerDown:e=>{d||(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),$.current=[R(e)],k.current.push($.current))},onPointerMove:e=>{if(!$.current||d)return;e.preventDefault();const t=R(e),n=$.current,r=n[n.length-1];Math.abs(r.x-t.x)<1&&Math.abs(r.y-t.y)<1||(n.push(t),D())},onPointerUp:P,onPointerCancel:P})]})});Ls.displayName="TkxSignaturePad";var Ts=async(e,t)=>{const n=await fetch(`https://api.postalpincode.in/pincode/${e}`,{signal:t});if(!n.ok)throw new Error(`HTTP ${n.status}`);const r=await n.json();return Array.isArray(r)&&r[0]&&"Success"===r[0].Status&&r[0].PostOffice?r[0].PostOffice:[]},Ws=/^\d{6}$/,js=i(function({value:e,onChange:t,lookup:n=Ts,label:r,showAddressLines:o=!0,disabled:i,className:a,style:l},c){const u=se(),p=yn(),h=d(),[f,y]=m([]),[v,w]=m(!1),[k,$]=m(null);s(()=>{if(!e.pin||!Ws.test(e.pin))return y([]),void $(null);const t=new AbortController;return w(!0),$(null),n(e.pin,t.signal).then(e=>{y(e),0===e.length&&$(p.noResults)}).catch(e=>{"AbortError"!==e?.name&&($(e?.message||"Lookup failed"),y([]))}).finally(()=>w(!1)),()=>t.abort()},[e.pin]);const S=n=>{t({...e,pin:n.Pincode,postOffice:n.Name,city:n.District,state:n.State,country:n.Country}),y([])},C=(n,r)=>{t({...e,pin:e.pin??"",[n]:r})},z={display:"flex",flexDirection:"column",gap:8,width:"100%",...l},M={flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},N={width:"100%",padding:"8px 10px",border:`1px solid ${u.border}`,borderRadius:8,background:u.surface,color:u.text,fontSize:14,outline:"none",minHeight:40},D={border:`1px solid ${u.border}`,borderRadius:8,background:u.surface,maxHeight:200,overflow:"auto",padding:4},R={padding:"8px 10px",borderRadius:6,cursor:"pointer",fontSize:13,color:u.text},P={fontSize:12,color:u.textMuted};/* @__PURE__ */
427
454
  return b("div",{className:a,style:z,children:[r&&/* @__PURE__ */x("label",{htmlFor:`${h}-pin`,style:{fontSize:13,fontWeight:600},children:r}),
428
455
  /* @__PURE__ */b("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[
429
- /* @__PURE__ */b("div",{style:{...M,flex:"0 0 140px"},children:[/* @__PURE__ */x("span",{style:R,children:"PIN code"}),/* @__PURE__ */x("input",{ref:c,id:`${h}-pin`,type:"text",inputMode:"numeric",maxLength:6,autoComplete:"postal-code",value:e.pin??"",onChange:n=>(n=>{const r=n.replace(/\D+/g,"").slice(0,6);t({...e,pin:r})})(n.target.value),disabled:i,"aria-busy":v,"aria-invalid":null!==k,style:N,placeholder:"000000"})]}),
430
- /* @__PURE__ */b("div",{style:M,children:[/* @__PURE__ */x("span",{style:R,children:"City"}),/* @__PURE__ */x("input",{type:"text",autoComplete:"address-level2",value:e.city??"",onChange:n=>t({...e,city:n.target.value,pin:e.pin??""}),disabled:i,style:N})]}),
431
- /* @__PURE__ */b("div",{style:M,children:[/* @__PURE__ */x("span",{style:R,children:"State"}),/* @__PURE__ */x("input",{type:"text",autoComplete:"address-level1",value:e.state??"",onChange:n=>t({...e,state:n.target.value,pin:e.pin??""}),disabled:i,style:N})]})]}),f.length>1&&/* @__PURE__ */x("div",{role:"listbox","aria-label":"Matching post offices",style:D,children:f.map(t=>/* @__PURE__ */b("div",{role:"option","aria-selected":e.postOffice===t.Name,onClick:()=>S(t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S(t))},tabIndex:0,style:{...P,background:e.postOffice===t.Name?u.surfaceAlt:"transparent"},children:[
456
+ /* @__PURE__ */b("div",{style:{...M,flex:"0 0 140px"},children:[/* @__PURE__ */x("span",{style:P,children:"PIN code"}),/* @__PURE__ */x("input",{ref:c,id:`${h}-pin`,type:"text",inputMode:"numeric",maxLength:6,autoComplete:"postal-code",value:e.pin??"",onChange:n=>(n=>{const r=n.replace(/\D+/g,"").slice(0,6);t({...e,pin:r})})(n.target.value),disabled:i,"aria-busy":v,"aria-invalid":null!==k,style:N,placeholder:"000000"})]}),
457
+ /* @__PURE__ */b("div",{style:M,children:[/* @__PURE__ */x("span",{style:P,children:"City"}),/* @__PURE__ */x("input",{type:"text",autoComplete:"address-level2",value:e.city??"",onChange:n=>t({...e,city:n.target.value,pin:e.pin??""}),disabled:i,style:N})]}),
458
+ /* @__PURE__ */b("div",{style:M,children:[/* @__PURE__ */x("span",{style:P,children:"State"}),/* @__PURE__ */x("input",{type:"text",autoComplete:"address-level1",value:e.state??"",onChange:n=>t({...e,state:n.target.value,pin:e.pin??""}),disabled:i,style:N})]})]}),f.length>1&&/* @__PURE__ */x("div",{role:"listbox","aria-label":"Matching post offices",style:D,children:f.map(t=>/* @__PURE__ */b("div",{role:"option","aria-selected":e.postOffice===t.Name,onClick:()=>S(t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S(t))},tabIndex:0,style:{...R,background:e.postOffice===t.Name?u.surfaceAlt:"transparent"},children:[
432
459
  /* @__PURE__ */x("strong",{children:t.Name})," ",
433
- /* @__PURE__ */b("span",{style:{color:u.textMuted},children:["· ",t.District,", ",t.State]})]},`${t.Pincode}-${t.Name}`))}),k&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:u.danger},children:k}),o&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("input",{type:"text",autoComplete:"address-line1",placeholder:"Address line 1",value:e.line1??"",onChange:e=>C("line1",e.target.value),disabled:i,style:N}),/* @__PURE__ */x("input",{type:"text",autoComplete:"address-line2",placeholder:"Address line 2 (optional)",value:e.line2??"",onChange:e=>C("line2",e.target.value),disabled:i,style:N})]})]})});Ns.displayName="TkxAddressInput";var Ds=new Set(["JPY","KRW"]),Ps=i(function({value:e,onChange:t,currency:n="INR",locale:r,label:o,min:i,max:l,precision:s,required:c,disabled:u,showSymbol:h=!0,id:f,name:m,className:g,style:y},v){const w=se(),k=d(),$=f??k,S=r??function(e){return"INR"===e?"en-IN":"PKR"===e?"ur-PK":"BDT"===e?"bn-BD":"JPY"===e?"ja-JP":"KRW"===e?"ko-KR":"CNY"===e?"zh-CN":"undefined"!=typeof navigator&&navigator.language?navigator.language:"en-US"}(n),C=s??(Ds.has(n)?0:2),z=p(()=>new Intl.NumberFormat(S,{minimumFractionDigits:0,maximumFractionDigits:C,useGrouping:!0}),[S,C]),M=p(()=>{try{return new Intl.NumberFormat(S,{style:"currency",currency:n,currencyDisplay:"narrowSymbol",minimumFractionDigits:0,maximumFractionDigits:0}).formatToParts(0).find(e=>"currency"===e.type)?.value??n}catch{return n}},[S,n]),N=null===e||Number.isNaN(e)?"":z.format(e),D=a(e=>{const n=e.replace(/[^\d.,\-]/g,""),r=z.format(1.5),o=r.includes(",")&&!r.includes(".")?",":".",a=n.replace(new RegExp(`[^\\d\\-${o}]`,"g"),"").replace(o,".");if(""===a||"-"===a)return void t(null);const s=Number(a);if(Number.isNaN(s))return;let d=s;void 0!==i&&d<i&&(d=i),void 0!==l&&d>l&&(d=l),t(d)},[z,i,l,t]),P={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:320,...y},R={display:"flex",alignItems:"stretch",border:`1px solid ${w.border}`,borderRadius:8,background:w.surface,overflow:"hidden"},F={display:"inline-flex",alignItems:"center",padding:"0 12px",borderRight:`1px solid ${w.border}`,color:w.textMuted,fontSize:14,fontVariantNumeric:"tabular-nums",background:w.bg},I={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:w.text,background:"transparent",minHeight:40,minWidth:0,textAlign:"right",fontVariantNumeric:"tabular-nums"};/* @__PURE__ */
434
- return b("div",{className:g,style:P,children:[o&&/* @__PURE__ */b("label",{htmlFor:$,style:{fontSize:13,fontWeight:600,color:w.text},children:[o,c&&/* @__PURE__ */x("span",{style:{color:w.danger,marginLeft:4},"aria-hidden":"true",children:"*"})]}),/* @__PURE__ */b("div",{style:R,children:[h&&/* @__PURE__ */x("span",{style:F,"aria-hidden":"true",children:M}),/* @__PURE__ */x("input",{ref:v,id:$,name:m,type:"text",inputMode:C>0?"decimal":"numeric",value:N,onChange:e=>D(e.target.value),disabled:u,required:c,"aria-label":o??`Amount in ${n}`,style:I})]})]})});Ps.displayName="TkxCurrencyInput";var Rs=i(function({items:e,onChange:t,renderItem:n,orientation:r="vertical",disabled:o,className:i,style:l,ariaLabel:s},c){const u=se(),p=d(),[h,y]=m(null),[v,w]=m(null),k=f(null),$=a((n,r)=>{if(n===r||n<0||r<0||r>=e.length)return;const o=[...e],[i]=o.splice(n,1);o.splice(r,0,i),t(o),k.current&&(k.current.textContent=`Moved item ${n+1} to position ${r+1}`)},[e,t]),S=e=>t=>{!o&&h&&(t.preventDefault(),t.dataTransfer.dropEffect="move",w(e))},C=()=>{y(null),w(null)},z=(t,n)=>t=>{if(o)return;const i="vertical"===r,a=i?"ArrowUp"===t.key:"ArrowLeft"===t.key,l=i?"ArrowDown"===t.key:"ArrowRight"===t.key;a&&n>0?(t.preventDefault(),$(n,n-1)):l&&n<e.length-1&&(t.preventDefault(),$(n,n+1))},M={display:"flex",flexDirection:"vertical"===r?"column":"row",gap:8,...l},N=e=>({cursor:o?"not-allowed":"grab",opacity:h===e?.5:1,transition:"opacity 0.15s, transform 0.05s",outline:v===e&&h!==e?`2px dashed ${u.primary}`:"none",outlineOffset:4,borderRadius:8});/* @__PURE__ */
435
- return b(g,{children:[/* @__PURE__ */x("div",{ref:c,id:p,role:"list","aria-label":s??"Sortable list","aria-orientation":r,className:i,style:M,children:e.map((t,r)=>{/* @__PURE__ */return x("div",{role:"listitem",tabIndex:o?-1:0,draggable:!o,"data-tkx-sortable-handle":"true","aria-grabbed":h===t.id,"aria-posinset":r+1,"aria-setsize":e.length,onDragStart:(a=t.id,e=>{o||(y(a),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",a))}),onDragOver:S(t.id),onDragEnd:C,onDrop:(i=t.id,t=>{t.preventDefault(),!o&&h&&($(e.findIndex(e=>e.id===h),e.findIndex(e=>e.id===i)),y(null),w(null))}),onKeyDown:z(t.id,r),style:N(t.id),children:n(t,r)},t.id);var i,a})}),/* @__PURE__ */x("div",{ref:k,role:"status","aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}})]})});Rs.displayName="TkxSortable";var Fs=["#00f5d4","#7b2ff7","#f72585","#ffbe0b","#06d6a0","#3a86ff"],Is=i(function({trigger:e,particleCount:t=80,spread:n=60,origin:r,colors:o=Fs,zIndex:i=9999,className:l,style:d},u){const p=f(null),h=f([]),m=f(null),g=et(),b=a(()=>{const e=p.current;if(!e)return;const t=window.devicePixelRatio||1;e.width=window.innerWidth*t,e.height=window.innerHeight*t,e.style.width="100vw",e.style.height="100vh";const n=e.getContext("2d");n&&n.scale(t,t)},[]);s(()=>(b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)),[b]);const y=a(()=>{const e=p.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=window.devicePixelRatio||1;t.clearRect(0,0,e.width/n,e.height/n);const r=h.current;for(const o of r)t.save(),t.globalAlpha=o.alpha,t.translate(o.x,o.y),t.rotate(o.rot*Math.PI/180),t.fillStyle=o.color,t.fillRect(-o.size/2,-o.size/4,o.size,o.size/2),t.restore()},[]),v=a(()=>{const e=h.current;let t=!1;for(const n of e)n.ttl<=0||(n.x+=n.vx,n.y+=n.vy,n.vy+=.18,n.vx*=.99,n.rot+=n.vRot,n.ttl-=1,n.ttl<30&&(n.alpha=n.ttl/30),t=!0);e.length>1e3&&(h.current=e.filter(e=>e.ttl>0)),y(),m.current=t?requestAnimationFrame(v):null},[y]),w=a(e=>{if(!p.current)return;const i=e?.x??r?.x??window.innerWidth/2,a=e?.y??r?.y??window.innerHeight/3,l=[];for(let r=0;r<t;r++){const e=((Math.random()-.5)*n-90)*(Math.PI/180),t=6+6*Math.random();l.push({x:i,y:a,vx:Math.cos(e)*t,vy:Math.sin(e)*t,rot:360*Math.random(),vRot:14*(Math.random()-.5),size:6+6*Math.random(),color:o[Math.floor(Math.random()*o.length)],alpha:1,ttl:90+Math.floor(30*Math.random())})}if(h.current.push(...l),g)return y(),void window.setTimeout(()=>{h.current=[],y()},1500);null===m.current&&(m.current=requestAnimationFrame(v))},[t,n,r,o,g,v,y]);return c(u,()=>({fire:w}),[w]),s(()=>{e&&w()},[e]),s(()=>()=>{null!==m.current&&cancelAnimationFrame(m.current)},[]),/* @__PURE__ */x("canvas",{ref:p,"aria-hidden":"true",className:l,style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:i,...d}})});Is.displayName="TkxConfetti";var As="data-tkx-seo";function Ls(){"undefined"!=typeof document&&document.querySelectorAll(`[${As}]`).forEach(e=>e.remove())}function Ts(e,t,n="name"){if("undefined"==typeof document||!t)return;const r=document.createElement("meta");r.setAttribute(n,e),r.content=t,r.setAttribute(As,"1"),document.head.appendChild(r)}function Ws({title:e,description:t,canonical:n,keywords:r,image:o,twitterSite:i,twitterCreator:a,ogType:l="website",locale:d,robots:c="index, follow, max-snippet:-1, max-image-preview:large",schema:u}){return s(()=>{if("undefined"!=typeof document)return Ls(),e&&(document.title=e),t&&Ts("description",t),r&&Ts("keywords",r),Ts("robots",c),e&&Ts("og:title",e,"property"),t&&Ts("og:description",t,"property"),Ts("og:type",l,"property"),n&&Ts("og:url",n,"property"),o&&(Ts("og:image",o,"property"),Ts("og:image:width","1200","property"),Ts("og:image:height","630","property")),d&&Ts("og:locale",d,"property"),Ts("twitter:card",o?"summary_large_image":"summary"),e&&Ts("twitter:title",e),t&&Ts("twitter:description",t),o&&Ts("twitter:image",o),i&&Ts("twitter:site",i),a&&Ts("twitter:creator",a),n&&function(e,t){if("undefined"==typeof document||!t)return;const n=document.createElement("link");n.rel="canonical",n.href=t,n.setAttribute(As,"1"),document.head.appendChild(n)}(0,n),u&&function(e){if("undefined"==typeof document)return;const t=Array.isArray(e)?e:[e];for(const n of t){const e=document.createElement("script");e.type="application/ld+json",e.text=JSON.stringify(n),e.setAttribute(As,"1"),document.head.appendChild(e)}}(u),()=>Ls()},[e,t,n,r,o,i,a,l,d,c,u]),null}var js={softwareApplication:e=>({"@context":"https://schema.org","@type":"SoftwareApplication",name:e.name,description:e.description,url:e.url,applicationCategory:"DeveloperApplication",operatingSystem:"Web",...e.version&&{softwareVersion:e.version,version:e.version},...e.license&&{license:e.license},...e.repository&&{codeRepository:e.repository},...e.downloadUrl&&{downloadUrl:e.downloadUrl},...void 0!==e.price&&{offers:{"@type":"Offer",price:e.price,priceCurrency:e.currency??"USD"}}}),article:e=>({"@context":"https://schema.org","@type":"Article",headline:e.headline,description:e.description,mainEntityOfPage:e.url,...e.image&&{image:e.image},author:{"@type":"Person",name:e.author},datePublished:e.datePublished,...e.dateModified&&{dateModified:e.dateModified}}),faqPage:e=>({"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(e=>({"@type":"Question",name:e.question,acceptedAnswer:{"@type":"Answer",text:e.answer}}))}),breadcrumbList:e=>({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((e,t)=>({"@type":"ListItem",position:t+1,name:e.name,item:e.url}))}),product:e=>({"@context":"https://schema.org","@type":"Product",name:e.name,description:e.description,image:e.image,brand:{"@type":"Brand",name:e.brand},...e.sku&&{sku:e.sku},offers:{"@type":"Offer",price:e.price,priceCurrency:e.currency,availability:`https://schema.org/${e.availability??"InStock"}`},...e.rating&&{aggregateRating:{"@type":"AggregateRating",ratingValue:e.rating.value,reviewCount:e.rating.count}}})},Es=["Pratipada","Dwitiya","Tritiya","Chaturthi","Panchami","Shashthi","Saptami","Ashtami","Navami","Dashami","Ekadashi","Dwadashi","Trayodashi","Chaturdashi","Purnima","Pratipada","Dwitiya","Tritiya","Chaturthi","Panchami","Shashthi","Saptami","Ashtami","Navami","Dashami","Ekadashi","Dwadashi","Trayodashi","Chaturdashi","Amavasya"],Bs=["Ashwini","Bharani","Krittika","Rohini","Mrigashira","Ardra","Punarvasu","Pushya","Ashlesha","Magha","Purva Phalguni","Uttara Phalguni","Hasta","Chitra","Swati","Vishakha","Anuradha","Jyeshtha","Mula","Purva Ashadha","Uttara Ashadha","Shravana","Dhanishtha","Shatabhisha","Purva Bhadrapada","Uttara Bhadrapada","Revati"];function Vs(e,t,n){try{return{gregorian:e,display:new Intl.DateTimeFormat(`${t}-u-ca-${n}`,{day:"numeric",month:"long",year:"numeric"}).format(e)}}catch{return{gregorian:e,display:e.toISOString().slice(0,10)}}}function Hs(e,t,n,r){switch(t){case"hindu":return function(e,t,n){const{tithi:r,nakshatra:o}=n?n(e):function(e){const t=function(e){return e.getTime()/864e5-10957.5}(e),n=function(e){return(280.46+.9856474*e)%360}(t),r=function(e){return(218.316+13.176396*e)%360}(t);let o=(r-n+360)%360;const i=Math.floor(o/12)+1,a=Math.floor(r%360/(360/27))+1;return{tithi:Math.max(1,Math.min(30,i)),nakshatra:a}}(e);return{gregorian:e,display:`${new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(e)} · ${r<=15?"Shukla":"Krishna"} ${Es[r-1]} · ${Bs[o-1]}`,tithi:r,nakshatra:o}}(e,n,r);case"hijri":return Vs(e,n,"islamic-civil");case"hebrew":return Vs(e,n,"hebrew");case"buddhist":return Vs(e,n,"buddhist");default:return function(e,t){return{gregorian:e,display:new Intl.DateTimeFormat(t,{dateStyle:"long"}).format(e)}}(e,n)}}var Os=i(function({value:e,onChange:t,calendar:n="gregorian",locale:r,tithiResolver:o,label:i,minDate:a,maxDate:l,disabled:s,className:d,style:c},u){const h=se(),f=yn(),g=r??("undefined"!=typeof navigator?navigator.language:"en-US"),[y,v]=m(!1),w=p(()=>e?Hs(e,n,g,o).display:"",[e,n,g,o]),k={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:360,...c},$={display:"flex",alignItems:"stretch",border:`1px solid ${h.border}`,borderRadius:8,background:h.surface,overflow:"hidden"},S={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:h.text,background:"transparent",minHeight:40,minWidth:0};/* @__PURE__ */
460
+ /* @__PURE__ */b("span",{style:{color:u.textMuted},children:["· ",t.District,", ",t.State]})]},`${t.Pincode}-${t.Name}`))}),k&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:u.danger},children:k}),o&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("input",{type:"text",autoComplete:"address-line1",placeholder:"Address line 1",value:e.line1??"",onChange:e=>C("line1",e.target.value),disabled:i,style:N}),/* @__PURE__ */x("input",{type:"text",autoComplete:"address-line2",placeholder:"Address line 2 (optional)",value:e.line2??"",onChange:e=>C("line2",e.target.value),disabled:i,style:N})]})]})});js.displayName="TkxAddressInput";var Es=new Set(["JPY","KRW"]),Bs=i(function({value:e,onChange:t,currency:n="INR",locale:r,label:o,min:i,max:l,precision:s,required:c,disabled:u,showSymbol:h=!0,id:f,name:m,className:g,style:y},v){const w=se(),k=d(),$=f??k,S=r??function(e){return"INR"===e?"en-IN":"PKR"===e?"ur-PK":"BDT"===e?"bn-BD":"JPY"===e?"ja-JP":"KRW"===e?"ko-KR":"CNY"===e?"zh-CN":"undefined"!=typeof navigator&&navigator.language?navigator.language:"en-US"}(n),C=s??(Es.has(n)?0:2),z=p(()=>new Intl.NumberFormat(S,{minimumFractionDigits:0,maximumFractionDigits:C,useGrouping:!0}),[S,C]),M=p(()=>{try{return new Intl.NumberFormat(S,{style:"currency",currency:n,currencyDisplay:"narrowSymbol",minimumFractionDigits:0,maximumFractionDigits:0}).formatToParts(0).find(e=>"currency"===e.type)?.value??n}catch{return n}},[S,n]),N=null===e||Number.isNaN(e)?"":z.format(e),D=a(e=>{const n=e.replace(/[^\d.,\-]/g,""),r=z.format(1.5),o=r.includes(",")&&!r.includes(".")?",":".",a=n.replace(new RegExp(`[^\\d\\-${o}]`,"g"),"").replace(o,".");if(""===a||"-"===a)return void t(null);const s=Number(a);if(Number.isNaN(s))return;let d=s;void 0!==i&&d<i&&(d=i),void 0!==l&&d>l&&(d=l),t(d)},[z,i,l,t]),R={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:320,...y},P={display:"flex",alignItems:"stretch",border:`1px solid ${w.border}`,borderRadius:8,background:w.surface,overflow:"hidden"},F={display:"inline-flex",alignItems:"center",padding:"0 12px",borderRight:`1px solid ${w.border}`,color:w.textMuted,fontSize:14,fontVariantNumeric:"tabular-nums",background:w.bg},I={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:w.text,background:"transparent",minHeight:40,minWidth:0,textAlign:"right",fontVariantNumeric:"tabular-nums"};/* @__PURE__ */
461
+ return b("div",{className:g,style:R,children:[o&&/* @__PURE__ */b("label",{htmlFor:$,style:{fontSize:13,fontWeight:600,color:w.text},children:[o,c&&/* @__PURE__ */x("span",{style:{color:w.danger,marginLeft:4},"aria-hidden":"true",children:"*"})]}),/* @__PURE__ */b("div",{style:P,children:[h&&/* @__PURE__ */x("span",{style:F,"aria-hidden":"true",children:M}),/* @__PURE__ */x("input",{ref:v,id:$,name:m,type:"text",inputMode:C>0?"decimal":"numeric",value:N,onChange:e=>D(e.target.value),disabled:u,required:c,"aria-label":o??`Amount in ${n}`,style:I})]})]})});Bs.displayName="TkxCurrencyInput";var Vs=i(function({items:e,onChange:t,renderItem:n,orientation:r="vertical",disabled:o,className:i,style:l,ariaLabel:s},c){const u=se(),p=d(),[h,y]=m(null),[v,w]=m(null),k=f(null),$=a((n,r)=>{if(n===r||n<0||r<0||r>=e.length)return;const o=[...e],[i]=o.splice(n,1);o.splice(r,0,i),t(o),k.current&&(k.current.textContent=`Moved item ${n+1} to position ${r+1}`)},[e,t]),S=e=>t=>{!o&&h&&(t.preventDefault(),t.dataTransfer.dropEffect="move",w(e))},C=()=>{y(null),w(null)},z=(t,n)=>t=>{if(o)return;const i="vertical"===r,a=i?"ArrowUp"===t.key:"ArrowLeft"===t.key,l=i?"ArrowDown"===t.key:"ArrowRight"===t.key;a&&n>0?(t.preventDefault(),$(n,n-1)):l&&n<e.length-1&&(t.preventDefault(),$(n,n+1))},M={display:"flex",flexDirection:"vertical"===r?"column":"row",gap:8,...l},N=e=>({cursor:o?"not-allowed":"grab",opacity:h===e?.5:1,transition:"opacity 0.15s, transform 0.05s",outline:v===e&&h!==e?`2px dashed ${u.primary}`:"none",outlineOffset:4,borderRadius:8});/* @__PURE__ */
462
+ return b(g,{children:[/* @__PURE__ */x("div",{ref:c,id:p,role:"list","aria-label":s??"Sortable list","aria-orientation":r,className:i,style:M,children:e.map((t,r)=>{/* @__PURE__ */return x("div",{role:"listitem",tabIndex:o?-1:0,draggable:!o,"data-tkx-sortable-handle":"true","aria-grabbed":h===t.id,"aria-posinset":r+1,"aria-setsize":e.length,onDragStart:(a=t.id,e=>{o||(y(a),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",a))}),onDragOver:S(t.id),onDragEnd:C,onDrop:(i=t.id,t=>{t.preventDefault(),!o&&h&&($(e.findIndex(e=>e.id===h),e.findIndex(e=>e.id===i)),y(null),w(null))}),onKeyDown:z(t.id,r),style:N(t.id),children:n(t,r)},t.id);var i,a})}),/* @__PURE__ */x("div",{ref:k,role:"status","aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}})]})});Vs.displayName="TkxSortable";var Hs=["#00f5d4","#7b2ff7","#f72585","#ffbe0b","#06d6a0","#3a86ff"],Os=i(function({trigger:e,particleCount:t=80,spread:n=60,origin:r,colors:o=Hs,zIndex:i=9999,className:l,style:d},u){const p=f(null),h=f([]),m=f(null),g=et(),b=a(()=>{const e=p.current;if(!e)return;const t=window.devicePixelRatio||1;e.width=window.innerWidth*t,e.height=window.innerHeight*t,e.style.width="100vw",e.style.height="100vh";const n=e.getContext("2d");n&&n.scale(t,t)},[]);s(()=>(b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)),[b]);const y=a(()=>{const e=p.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=window.devicePixelRatio||1;t.clearRect(0,0,e.width/n,e.height/n);const r=h.current;for(const o of r)t.save(),t.globalAlpha=o.alpha,t.translate(o.x,o.y),t.rotate(o.rot*Math.PI/180),t.fillStyle=o.color,t.fillRect(-o.size/2,-o.size/4,o.size,o.size/2),t.restore()},[]),v=a(()=>{const e=h.current;let t=!1;for(const n of e)n.ttl<=0||(n.x+=n.vx,n.y+=n.vy,n.vy+=.18,n.vx*=.99,n.rot+=n.vRot,n.ttl-=1,n.ttl<30&&(n.alpha=n.ttl/30),t=!0);e.length>1e3&&(h.current=e.filter(e=>e.ttl>0)),y(),m.current=t?requestAnimationFrame(v):null},[y]),w=a(e=>{if(!p.current)return;const i=e?.x??r?.x??window.innerWidth/2,a=e?.y??r?.y??window.innerHeight/3,l=[];for(let r=0;r<t;r++){const e=((Math.random()-.5)*n-90)*(Math.PI/180),t=6+6*Math.random();l.push({x:i,y:a,vx:Math.cos(e)*t,vy:Math.sin(e)*t,rot:360*Math.random(),vRot:14*(Math.random()-.5),size:6+6*Math.random(),color:o[Math.floor(Math.random()*o.length)],alpha:1,ttl:90+Math.floor(30*Math.random())})}if(h.current.push(...l),g)return y(),void window.setTimeout(()=>{h.current=[],y()},1500);null===m.current&&(m.current=requestAnimationFrame(v))},[t,n,r,o,g,v,y]);return c(u,()=>({fire:w}),[w]),s(()=>{e&&w()},[e]),s(()=>()=>{null!==m.current&&cancelAnimationFrame(m.current)},[]),/* @__PURE__ */x("canvas",{ref:p,"aria-hidden":"true",className:l,style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:i,...d}})});Os.displayName="TkxConfetti";var qs="data-tkx-seo";function Us(){"undefined"!=typeof document&&document.querySelectorAll(`[${qs}]`).forEach(e=>e.remove())}function Ks(e,t,n="name"){if("undefined"==typeof document||!t)return;const r=document.createElement("meta");r.setAttribute(n,e),r.content=t,r.setAttribute(qs,"1"),document.head.appendChild(r)}function Ys({title:e,description:t,canonical:n,keywords:r,image:o,twitterSite:i,twitterCreator:a,ogType:l="website",locale:d,robots:c="index, follow, max-snippet:-1, max-image-preview:large",schema:u}){return s(()=>{if("undefined"!=typeof document)return Us(),e&&(document.title=e),t&&Ks("description",t),r&&Ks("keywords",r),Ks("robots",c),e&&Ks("og:title",e,"property"),t&&Ks("og:description",t,"property"),Ks("og:type",l,"property"),n&&Ks("og:url",n,"property"),o&&(Ks("og:image",o,"property"),Ks("og:image:width","1200","property"),Ks("og:image:height","630","property")),d&&Ks("og:locale",d,"property"),Ks("twitter:card",o?"summary_large_image":"summary"),e&&Ks("twitter:title",e),t&&Ks("twitter:description",t),o&&Ks("twitter:image",o),i&&Ks("twitter:site",i),a&&Ks("twitter:creator",a),n&&function(e,t){if("undefined"==typeof document||!t)return;const n=document.createElement("link");n.rel="canonical",n.href=t,n.setAttribute(qs,"1"),document.head.appendChild(n)}(0,n),u&&function(e){if("undefined"==typeof document)return;const t=Array.isArray(e)?e:[e];for(const n of t){const e=document.createElement("script");e.type="application/ld+json",e.text=JSON.stringify(n),e.setAttribute(qs,"1"),document.head.appendChild(e)}}(u),()=>Us()},[e,t,n,r,o,i,a,l,d,c,u]),null}var Xs={softwareApplication:e=>({"@context":"https://schema.org","@type":"SoftwareApplication",name:e.name,description:e.description,url:e.url,applicationCategory:"DeveloperApplication",operatingSystem:"Web",...e.version&&{softwareVersion:e.version,version:e.version},...e.license&&{license:e.license},...e.repository&&{codeRepository:e.repository},...e.downloadUrl&&{downloadUrl:e.downloadUrl},...void 0!==e.price&&{offers:{"@type":"Offer",price:e.price,priceCurrency:e.currency??"USD"}}}),article:e=>({"@context":"https://schema.org","@type":"Article",headline:e.headline,description:e.description,mainEntityOfPage:e.url,...e.image&&{image:e.image},author:{"@type":"Person",name:e.author},datePublished:e.datePublished,...e.dateModified&&{dateModified:e.dateModified}}),faqPage:e=>({"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(e=>({"@type":"Question",name:e.question,acceptedAnswer:{"@type":"Answer",text:e.answer}}))}),breadcrumbList:e=>({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((e,t)=>({"@type":"ListItem",position:t+1,name:e.name,item:e.url}))}),product:e=>({"@context":"https://schema.org","@type":"Product",name:e.name,description:e.description,image:e.image,brand:{"@type":"Brand",name:e.brand},...e.sku&&{sku:e.sku},offers:{"@type":"Offer",price:e.price,priceCurrency:e.currency,availability:`https://schema.org/${e.availability??"InStock"}`},...e.rating&&{aggregateRating:{"@type":"AggregateRating",ratingValue:e.rating.value,reviewCount:e.rating.count}}})},Zs=["Pratipada","Dwitiya","Tritiya","Chaturthi","Panchami","Shashthi","Saptami","Ashtami","Navami","Dashami","Ekadashi","Dwadashi","Trayodashi","Chaturdashi","Purnima","Pratipada","Dwitiya","Tritiya","Chaturthi","Panchami","Shashthi","Saptami","Ashtami","Navami","Dashami","Ekadashi","Dwadashi","Trayodashi","Chaturdashi","Amavasya"],Gs=["Ashwini","Bharani","Krittika","Rohini","Mrigashira","Ardra","Punarvasu","Pushya","Ashlesha","Magha","Purva Phalguni","Uttara Phalguni","Hasta","Chitra","Swati","Vishakha","Anuradha","Jyeshtha","Mula","Purva Ashadha","Uttara Ashadha","Shravana","Dhanishtha","Shatabhisha","Purva Bhadrapada","Uttara Bhadrapada","Revati"];function _s(e,t,n){try{return{gregorian:e,display:new Intl.DateTimeFormat(`${t}-u-ca-${n}`,{day:"numeric",month:"long",year:"numeric"}).format(e)}}catch{return{gregorian:e,display:e.toISOString().slice(0,10)}}}function Js(e,t,n,r){switch(t){case"hindu":return function(e,t,n){const{tithi:r,nakshatra:o}=n?n(e):function(e){const t=function(e){return e.getTime()/864e5-10957.5}(e),n=function(e){return(280.46+.9856474*e)%360}(t),r=function(e){return(218.316+13.176396*e)%360}(t);let o=(r-n+360)%360;const i=Math.floor(o/12)+1,a=Math.floor(r%360/(360/27))+1;return{tithi:Math.max(1,Math.min(30,i)),nakshatra:a}}(e);return{gregorian:e,display:`${new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(e)} · ${r<=15?"Shukla":"Krishna"} ${Zs[r-1]} · ${Gs[o-1]}`,tithi:r,nakshatra:o}}(e,n,r);case"hijri":return _s(e,n,"islamic-civil");case"hebrew":return _s(e,n,"hebrew");case"buddhist":return _s(e,n,"buddhist");default:return function(e,t){return{gregorian:e,display:new Intl.DateTimeFormat(t,{dateStyle:"long"}).format(e)}}(e,n)}}var Qs=i(function({value:e,onChange:t,calendar:n="gregorian",locale:r,tithiResolver:o,label:i,minDate:a,maxDate:l,disabled:s,className:d,style:c},u){const h=se(),f=yn(),g=r??("undefined"!=typeof navigator?navigator.language:"en-US"),[y,v]=m(!1),w=p(()=>e?Js(e,n,g,o).display:"",[e,n,g,o]),k={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:360,...c},$={display:"flex",alignItems:"stretch",border:`1px solid ${h.border}`,borderRadius:8,background:h.surface,overflow:"hidden"},S={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:h.text,background:"transparent",minHeight:40,minWidth:0};/* @__PURE__ */
436
463
  return b("div",{className:d,style:k,children:[i&&/* @__PURE__ */x("label",{style:{fontSize:13,fontWeight:600,color:h.text},children:i}),
437
- /* @__PURE__ */b("div",{style:$,children:[/* @__PURE__ */x("input",{ref:u,type:"text",readOnly:!0,value:w,onClick:()=>!s&&v(!0),onFocus:()=>!s&&v(!0),disabled:s,placeholder:f.selectDate,"aria-label":i??f.selectDate,style:S}),/* @__PURE__ */x("input",{type:"date",value:e?e.toISOString().slice(0,10):"",onChange:e=>(e=>{if(!e)return;const r=/* @__PURE__ */new Date(`${e}T00:00:00`);Number.isNaN(r.getTime())||a&&r<a||l&&r>l||(t(Hs(r,n,g,o)),v(!1))})(e.target.value),min:a?a.toISOString().slice(0,10):void 0,max:l?l.toISOString().slice(0,10):void 0,disabled:s,"aria-hidden":"true",tabIndex:-1,style:{width:36,border:"none",borderLeft:`1px solid ${h.border}`,padding:0,background:h.bg,color:h.text,cursor:s?"not-allowed":"pointer"}})]}),y&&e&&"gregorian"!==n&&/* @__PURE__ */b("div",{role:"status",style:{padding:"6px 10px",borderRadius:6,background:h.surfaceAlt,fontSize:12,color:h.textMuted},children:[
438
- /* @__PURE__ */b("strong",{style:{color:h.text},children:[n,":"]})," ",w]})]})});Os.displayName="TkxCalendarLunar";var qs=i(function({items:e,currency:t,locale:n,taxRate:r=0,shipping:o=0,paymentConfigFor:i,onComplete:a,onCancel:l,initialAddress:s={},className:d,style:c},u){const p=se(),h=yn(),[f,y]=m("address"),[v,w]=m(s),[k,$]=m(null),[S,C]=m(null),z=e.reduce((e,t)=>e+t.quantity*t.unitPrice,0),M=z*r,N=z+M+o,D=e=>{try{return new Intl.NumberFormat(n??"en-IN",{style:"currency",currency:t}).format(e)}catch{return`${t} ${e.toFixed(2)}`}},P=Boolean(v.pin&&6===v.pin.length&&v.line1&&v.city),R={display:"grid",gridTemplateColumns:"minmax(0, 1fr) 320px",gap:24,maxWidth:960,width:"100%",...c},F={border:`1px solid ${p.border}`,borderRadius:12,padding:20,background:p.surface},I={...F,position:"sticky",top:16,height:"fit-content"},A={fontSize:11,fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",color:p.textMuted,marginBottom:12};/* @__PURE__ */
439
- return b("div",{ref:u,className:d,style:R,children:[/* @__PURE__ */b("div",{style:F,children:[
464
+ /* @__PURE__ */b("div",{style:$,children:[/* @__PURE__ */x("input",{ref:u,type:"text",readOnly:!0,value:w,onClick:()=>!s&&v(!0),onFocus:()=>!s&&v(!0),disabled:s,placeholder:f.selectDate,"aria-label":i??f.selectDate,style:S}),/* @__PURE__ */x("input",{type:"date",value:e?e.toISOString().slice(0,10):"",onChange:e=>(e=>{if(!e)return;const r=/* @__PURE__ */new Date(`${e}T00:00:00`);Number.isNaN(r.getTime())||a&&r<a||l&&r>l||(t(Js(r,n,g,o)),v(!1))})(e.target.value),min:a?a.toISOString().slice(0,10):void 0,max:l?l.toISOString().slice(0,10):void 0,disabled:s,"aria-hidden":"true",tabIndex:-1,style:{width:36,border:"none",borderLeft:`1px solid ${h.border}`,padding:0,background:h.bg,color:h.text,cursor:s?"not-allowed":"pointer"}})]}),y&&e&&"gregorian"!==n&&/* @__PURE__ */b("div",{role:"status",style:{padding:"6px 10px",borderRadius:6,background:h.surfaceAlt,fontSize:12,color:h.textMuted},children:[
465
+ /* @__PURE__ */b("strong",{style:{color:h.text},children:[n,":"]})," ",w]})]})});Qs.displayName="TkxCalendarLunar";var ed=i(function({items:e,currency:t,locale:n,taxRate:r=0,shipping:o=0,paymentConfigFor:i,onComplete:a,onCancel:l,initialAddress:s={},className:d,style:c},u){const p=se(),h=yn(),[f,y]=m("address"),[v,w]=m(s),[k,$]=m(null),[S,C]=m(null),z=e.reduce((e,t)=>e+t.quantity*t.unitPrice,0),M=z*r,N=z+M+o,D=e=>{try{return new Intl.NumberFormat(n??"en-IN",{style:"currency",currency:t}).format(e)}catch{return`${t} ${e.toFixed(2)}`}},R=Boolean(v.pin&&6===v.pin.length&&v.line1&&v.city),P={display:"grid",gridTemplateColumns:"minmax(0, 1fr) 320px",gap:24,maxWidth:960,width:"100%",...c},F={border:`1px solid ${p.border}`,borderRadius:12,padding:20,background:p.surface},I={...F,position:"sticky",top:16,height:"fit-content"},A={fontSize:11,fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",color:p.textMuted,marginBottom:12};/* @__PURE__ */
466
+ return b("div",{ref:u,className:d,style:P,children:[/* @__PURE__ */b("div",{style:F,children:[
440
467
  /* @__PURE__ */b("div",{style:A,children:["Step ","address"===f?1:"payment"===f?2:3," of 3"]}),"address"===f&&/* @__PURE__ */b(g,{children:[
441
468
  /* @__PURE__ */x("h2",{style:{margin:"0 0 16px",fontSize:20,fontWeight:700},children:"Shipping address"}),
442
- /* @__PURE__ */x(Ns,{value:v,onChange:w}),S&&/* @__PURE__ */x("div",{role:"alert",style:{marginTop:12,fontSize:13,color:p.danger},children:S}),
443
- /* @__PURE__ */b("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end",gap:8},children:[l&&/* @__PURE__ */x("button",{type:"button",onClick:l,style:{padding:"8px 14px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13,fontWeight:600},children:h.cancel}),/* @__PURE__ */x("button",{type:"button",onClick:async()=>{if(P){C(null);try{$(await i(v)),y("payment")}catch(e){C(e?.message??"Could not initialise payment")}}else C(h.fieldRequired??"Address incomplete")},disabled:!P,style:{padding:"8px 14px",borderRadius:6,border:"none",background:P?p.primary:p.border,color:P?p.bg:p.textMuted,cursor:P?"pointer":"not-allowed",fontSize:13,fontWeight:600,minHeight:36},children:"Continue to payment"})]})]}),"payment"===f&&k&&/* @__PURE__ */b(g,{children:[
469
+ /* @__PURE__ */x(js,{value:v,onChange:w}),S&&/* @__PURE__ */x("div",{role:"alert",style:{marginTop:12,fontSize:13,color:p.danger},children:S}),
470
+ /* @__PURE__ */b("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end",gap:8},children:[l&&/* @__PURE__ */x("button",{type:"button",onClick:l,style:{padding:"8px 14px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13,fontWeight:600},children:h.cancel}),/* @__PURE__ */x("button",{type:"button",onClick:async()=>{if(R){C(null);try{$(await i(v)),y("payment")}catch(e){C(e?.message??"Could not initialise payment")}}else C(h.fieldRequired??"Address incomplete")},disabled:!R,style:{padding:"8px 14px",borderRadius:6,border:"none",background:R?p.primary:p.border,color:R?p.bg:p.textMuted,cursor:R?"pointer":"not-allowed",fontSize:13,fontWeight:600,minHeight:36},children:"Continue to payment"})]})]}),"payment"===f&&k&&/* @__PURE__ */b(g,{children:[
444
471
  /* @__PURE__ */x("h2",{style:{margin:"0 0 16px",fontSize:20,fontWeight:700},children:"Payment"}),
445
472
  /* @__PURE__ */b("p",{style:{margin:"0 0 16px",color:p.textMuted,fontSize:14},children:["Total ",/* @__PURE__ */x("strong",{style:{color:p.text,fontSize:18},children:D(N)})]}),
446
- /* @__PURE__ */b(Ss,{config:k,onSuccess:e=>{y("confirm"),a({address:v,payment:e})},onFailure:e=>{C(e.message)},size:"lg",children:["Pay ",D(N)]}),S&&/* @__PURE__ */x("div",{role:"alert",style:{marginTop:12,fontSize:13,color:p.danger},children:S}),
473
+ /* @__PURE__ */b(As,{config:k,onSuccess:e=>{y("confirm"),a({address:v,payment:e})},onFailure:e=>{C(e.message)},size:"lg",children:["Pay ",D(N)]}),S&&/* @__PURE__ */x("div",{role:"alert",style:{marginTop:12,fontSize:13,color:p.danger},children:S}),
447
474
  /* @__PURE__ */x("div",{style:{marginTop:20},children:/* @__PURE__ */x("button",{type:"button",onClick:()=>y("address"),style:{padding:"6px 10px",border:"none",background:"transparent",color:p.textMuted,cursor:"pointer",fontSize:13},children:"← Back to address"})})]}),"confirm"===f&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("h2",{style:{margin:"0 0 16px",fontSize:20,fontWeight:700},children:"Order confirmed"}),/* @__PURE__ */x("p",{style:{color:p.textMuted,fontSize:14,lineHeight:1.6},children:"Thank you. A receipt has been emailed to you. Your order will ship shortly."})]})]}),/* @__PURE__ */b("div",{style:I,children:[
448
475
  /* @__PURE__ */x("div",{style:A,children:"Order summary"}),e.map(e=>/* @__PURE__ */b("div",{style:{display:"flex",justifyContent:"space-between",padding:"6px 0",fontSize:13},children:[/* @__PURE__ */b("span",{style:{color:p.text},children:[e.label," ",
449
476
  /* @__PURE__ */b("span",{style:{color:p.textMuted},children:["×",e.quantity]})]}),/* @__PURE__ */x("span",{style:{color:p.text,fontVariantNumeric:"tabular-nums"},children:D(e.quantity*e.unitPrice)})]},e.id)),
450
477
  /* @__PURE__ */x("hr",{style:{margin:"12px 0",border:0,borderTop:`1px solid ${p.border}`}}),r>0&&/* @__PURE__ */b("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,color:p.textMuted},children:[/* @__PURE__ */b("span",{children:["Tax (",(100*r).toFixed(0),"%)"]}),/* @__PURE__ */x("span",{children:D(M)})]}),o>0&&/* @__PURE__ */b("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,color:p.textMuted},children:[/* @__PURE__ */x("span",{children:"Shipping"}),/* @__PURE__ */x("span",{children:D(o)})]}),
451
- /* @__PURE__ */b("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12,paddingTop:12,borderTop:`2px solid ${p.text}`,fontSize:16,fontWeight:700},children:[/* @__PURE__ */x("span",{children:"Total"}),/* @__PURE__ */x("span",{children:D(N)})]})]})]})});qs.displayName="TkxCheckout";var Us=[[0,1,2,3,4,5,6,7,8,9],[1,2,3,4,0,6,7,8,9,5],[2,3,4,0,1,7,8,9,5,6],[3,4,0,1,2,8,9,5,6,7],[4,0,1,2,3,9,5,6,7,8],[5,9,8,7,6,0,4,3,2,1],[6,5,9,8,7,1,0,4,3,2],[7,6,5,9,8,2,1,0,4,3],[8,7,6,5,9,3,2,1,0,4],[9,8,7,6,5,4,3,2,1,0]],Ks=[[0,1,2,3,4,5,6,7,8,9],[1,5,7,6,2,8,3,0,9,4],[5,8,0,3,7,9,6,1,4,2],[8,9,1,6,0,4,3,5,2,7],[9,4,5,3,1,2,6,8,7,0],[4,2,8,6,5,7,3,9,0,1],[2,7,9,3,8,0,6,4,1,5],[7,0,4,6,9,1,3,2,5,8]];function Ys(e){const t=e.replace(/\D+/g,"");if(12!==t.length)return!1;let n=0;const r=t.split("").reverse();for(let o=0;o<r.length;o++)n=Us[n][Ks[o%8][parseInt(r[o],10)]];return 0===n}function Xs(e){const t=e.replace(/\D+/g,"").slice(0,12);return[t.slice(0,4),t.slice(4,8),t.slice(8,12)].filter(Boolean).join(" ")}function Zs(e){const t=e.replace(/\D+/g,"").slice(0,12);return 0===t.length?"":t.length<=8?"X".repeat(t.length).match(/.{1,4}/g).join(" "):`XXXX XXXX ${t.slice(8,12)}`}var Gs=i(function({value:e,defaultValue:t,onChange:n,label:r,mask:o=!0,disabled:i,required:a,id:l,name:s,className:c,style:u},p){const h=se(),f=yn(),g=d(),y=l??g,v=void 0!==e,[w,k]=m(()=>(t??"").replace(/\D+/g,"").slice(0,12)),$=v?(e??"").replace(/\D+/g,"").slice(0,12):w,S=o?Zs($):Xs($),C=Ys($),z={fontSize:13,fontWeight:600,color:h.text},M={width:"100%",padding:"0 12px",border:`1px solid ${12!==$.length||C?h.border:h.danger}`,borderRadius:8,background:h.surface,color:h.text,fontSize:14,minHeight:40,outline:"none",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",letterSpacing:1.5};/* @__PURE__ */
478
+ /* @__PURE__ */b("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12,paddingTop:12,borderTop:`2px solid ${p.text}`,fontSize:16,fontWeight:700},children:[/* @__PURE__ */x("span",{children:"Total"}),/* @__PURE__ */x("span",{children:D(N)})]})]})]})});ed.displayName="TkxCheckout";var td=[[0,1,2,3,4,5,6,7,8,9],[1,2,3,4,0,6,7,8,9,5],[2,3,4,0,1,7,8,9,5,6],[3,4,0,1,2,8,9,5,6,7],[4,0,1,2,3,9,5,6,7,8],[5,9,8,7,6,0,4,3,2,1],[6,5,9,8,7,1,0,4,3,2],[7,6,5,9,8,2,1,0,4,3],[8,7,6,5,9,3,2,1,0,4],[9,8,7,6,5,4,3,2,1,0]],nd=[[0,1,2,3,4,5,6,7,8,9],[1,5,7,6,2,8,3,0,9,4],[5,8,0,3,7,9,6,1,4,2],[8,9,1,6,0,4,3,5,2,7],[9,4,5,3,1,2,6,8,7,0],[4,2,8,6,5,7,3,9,0,1],[2,7,9,3,8,0,6,4,1,5],[7,0,4,6,9,1,3,2,5,8]];function rd(e){const t=e.replace(/\D+/g,"");if(12!==t.length)return!1;let n=0;const r=t.split("").reverse();for(let o=0;o<r.length;o++)n=td[n][nd[o%8][parseInt(r[o],10)]];return 0===n}function od(e){const t=e.replace(/\D+/g,"").slice(0,12);return[t.slice(0,4),t.slice(4,8),t.slice(8,12)].filter(Boolean).join(" ")}function id(e){const t=e.replace(/\D+/g,"").slice(0,12);return 0===t.length?"":t.length<=8?"X".repeat(t.length).match(/.{1,4}/g).join(" "):`XXXX XXXX ${t.slice(8,12)}`}var ad=i(function({value:e,defaultValue:t,onChange:n,label:r,mask:o=!0,disabled:i,required:a,id:l,name:s,className:c,style:u},p){const h=se(),f=yn(),g=d(),y=l??g,v=void 0!==e,[w,k]=m(()=>(t??"").replace(/\D+/g,"").slice(0,12)),$=v?(e??"").replace(/\D+/g,"").slice(0,12):w,S=o?id($):od($),C=rd($),z={fontSize:13,fontWeight:600,color:h.text},M={width:"100%",padding:"0 12px",border:`1px solid ${12!==$.length||C?h.border:h.danger}`,borderRadius:8,background:h.surface,color:h.text,fontSize:14,minHeight:40,outline:"none",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",letterSpacing:1.5};/* @__PURE__ */
452
479
  return b("div",{className:c,style:{display:"flex",flexDirection:"column",gap:6,...u},children:[r&&/* @__PURE__ */b("label",{htmlFor:y,style:z,children:[r,a&&/* @__PURE__ */x("span",{style:{color:h.danger,marginLeft:4},children:"*"})]}),
453
- /* @__PURE__ */x("input",{ref:p,id:y,name:s,type:"text",inputMode:"numeric",autoComplete:"off",maxLength:14,value:S,onChange:e=>(e=>{const t=e.replace(/\D+/g,"").slice(0,12);v||k(t),n?.({raw:Xs(t),digits:t,display:o?Zs(t):Xs(t),valid:Ys(t)})})(e.target.value),disabled:i,required:a,"aria-invalid":12===$.length&&!C,"aria-describedby":12!==$.length||C?void 0:`${y}-err`,style:M,placeholder:"XXXX XXXX XXXX"}),12===$.length&&!C&&/* @__PURE__ */x("div",{id:`${y}-err`,role:"alert",style:{fontSize:12,color:h.danger},children:f.invalidFormat??"Invalid Aadhaar — checksum mismatch."}),$.length>0&&$.length<12&&/* @__PURE__ */b("div",{style:{fontSize:12,color:h.textMuted},children:[12-$.length," digit",12-$.length==1?"":"s"," remaining"]})]})});Gs.displayName="TkxAadhaarInput";var _s=/^[A-Z]{5}[0-9]{4}[A-Z]$/;function Js(e){const t=e.toUpperCase().trim();return!!_s.test(t)&&"PFCHATBLJG".includes(t[3])}var Qs=i(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:a,name:l,className:s,style:c},u){const p=se(),h=yn(),f=d(),g=a??f,y=void 0!==e,[v,w]=m((t??"").toUpperCase().slice(0,10)),k=(y?e??"":v).toUpperCase().slice(0,10),$=Js(k);/* @__PURE__ */
480
+ /* @__PURE__ */x("input",{ref:p,id:y,name:s,type:"text",inputMode:"numeric",autoComplete:"off",maxLength:14,value:S,onChange:e=>(e=>{const t=e.replace(/\D+/g,"").slice(0,12);v||k(t),n?.({raw:od(t),digits:t,display:o?id(t):od(t),valid:rd(t)})})(e.target.value),disabled:i,required:a,"aria-invalid":12===$.length&&!C,"aria-describedby":12!==$.length||C?void 0:`${y}-err`,style:M,placeholder:"XXXX XXXX XXXX"}),12===$.length&&!C&&/* @__PURE__ */x("div",{id:`${y}-err`,role:"alert",style:{fontSize:12,color:h.danger},children:f.invalidFormat??"Invalid Aadhaar — checksum mismatch."}),$.length>0&&$.length<12&&/* @__PURE__ */b("div",{style:{fontSize:12,color:h.textMuted},children:[12-$.length," digit",12-$.length==1?"":"s"," remaining"]})]})});ad.displayName="TkxAadhaarInput";var ld=/^[A-Z]{5}[0-9]{4}[A-Z]$/;function sd(e){const t=e.toUpperCase().trim();return!!ld.test(t)&&"PFCHATBLJG".includes(t[3])}var dd=i(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:a,name:l,className:s,style:c},u){const p=se(),h=yn(),f=d(),g=a??f,y=void 0!==e,[v,w]=m((t??"").toUpperCase().slice(0,10)),k=(y?e??"":v).toUpperCase().slice(0,10),$=sd(k);/* @__PURE__ */
454
481
  return b("div",{className:s,style:{display:"flex",flexDirection:"column",gap:6,...c},children:[r&&/* @__PURE__ */b("label",{htmlFor:g,style:{fontSize:13,fontWeight:600,color:p.text},children:[r,i&&/* @__PURE__ */x("span",{style:{color:p.danger,marginLeft:4},children:"*"})]}),
455
- /* @__PURE__ */x("input",{ref:u,id:g,name:l,type:"text",inputMode:"text",autoComplete:"off",maxLength:10,value:k,onChange:e=>(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,10);y||w(t),n?.({raw:e,normalised:t,valid:Js(t)})})(e.target.value),disabled:o,required:i,"aria-invalid":10===k.length&&!$,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${10!==k.length||$?p.border:p.danger}`,borderRadius:8,background:p.surface,color:p.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:2,outline:"none",textTransform:"uppercase"},placeholder:"ABCDE1234F"}),10===k.length&&!$&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:p.danger},children:h.invalidFormat??"Invalid PAN format."})]})});Qs.displayName="TkxPanInput";var ed=/^[A-Z]{3}[0-9]{7}$/;function td(e){const t=e.toUpperCase().trim();return ed.test(t)}var nd=i(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:a,name:l,className:s,style:c},u){const p=se(),h=yn(),f=d(),g=a??f,y=void 0!==e,[v,w]=m((t??"").toUpperCase().slice(0,10)),k=(y?e??"":v).toUpperCase().slice(0,10),$=td(k);/* @__PURE__ */
482
+ /* @__PURE__ */x("input",{ref:u,id:g,name:l,type:"text",inputMode:"text",autoComplete:"off",maxLength:10,value:k,onChange:e=>(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,10);y||w(t),n?.({raw:e,normalised:t,valid:sd(t)})})(e.target.value),disabled:o,required:i,"aria-invalid":10===k.length&&!$,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${10!==k.length||$?p.border:p.danger}`,borderRadius:8,background:p.surface,color:p.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:2,outline:"none",textTransform:"uppercase"},placeholder:"ABCDE1234F"}),10===k.length&&!$&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:p.danger},children:h.invalidFormat??"Invalid PAN format."})]})});dd.displayName="TkxPanInput";var cd=/^[A-Z]{3}[0-9]{7}$/;function ud(e){const t=e.toUpperCase().trim();return cd.test(t)}var pd=i(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:a,name:l,className:s,style:c},u){const p=se(),h=yn(),f=d(),g=a??f,y=void 0!==e,[v,w]=m((t??"").toUpperCase().slice(0,10)),k=(y?e??"":v).toUpperCase().slice(0,10),$=ud(k);/* @__PURE__ */
456
483
  return b("div",{className:s,style:{display:"flex",flexDirection:"column",gap:6,...c},children:[r&&/* @__PURE__ */b("label",{htmlFor:g,style:{fontSize:13,fontWeight:600,color:p.text},children:[r,i&&/* @__PURE__ */x("span",{style:{color:p.danger,marginLeft:4},children:"*"})]}),
457
- /* @__PURE__ */x("input",{ref:u,id:g,name:l,type:"text",autoComplete:"off",maxLength:10,value:k,onChange:e=>(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,10);y||w(t),n?.({raw:e,normalised:t,valid:td(t)})})(e.target.value),disabled:o,required:i,"aria-invalid":10===k.length&&!$,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${10!==k.length||$?p.border:p.danger}`,borderRadius:8,background:p.surface,color:p.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:1.5,outline:"none",textTransform:"uppercase"},placeholder:"ABC1234567"}),10===k.length&&!$&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:p.danger},children:h.invalidFormat??"Invalid Voter ID format."})]})});nd.displayName="TkxVoterIdInput";var rd=15;function od(e){const t=e.toUpperCase().replace(/[\s-]/g,"");return t.length===rd&&/^[A-Z]{2}[0-9]{13}$/.test(t)}function id(e){const t=e.toUpperCase().replace(/[\s-]/g,"");return 0===t.length?"":[t.slice(0,2),t.slice(2,4),t.slice(4,8),t.slice(8)].filter(Boolean).join("-")}var ad=i(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:a,name:l,className:s,style:c},u){const p=se(),h=yn(),f=d(),g=a??f,y=void 0!==e,[v,w]=m((t??"").toUpperCase()),k=y?e??"":v,$=k.toUpperCase().replace(/[\s-]/g,"").slice(0,rd),S=od($);/* @__PURE__ */
484
+ /* @__PURE__ */x("input",{ref:u,id:g,name:l,type:"text",autoComplete:"off",maxLength:10,value:k,onChange:e=>(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,10);y||w(t),n?.({raw:e,normalised:t,valid:ud(t)})})(e.target.value),disabled:o,required:i,"aria-invalid":10===k.length&&!$,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${10!==k.length||$?p.border:p.danger}`,borderRadius:8,background:p.surface,color:p.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:1.5,outline:"none",textTransform:"uppercase"},placeholder:"ABC1234567"}),10===k.length&&!$&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:p.danger},children:h.invalidFormat??"Invalid Voter ID format."})]})});pd.displayName="TkxVoterIdInput";var hd=15;function fd(e){const t=e.toUpperCase().replace(/[\s-]/g,"");return t.length===hd&&/^[A-Z]{2}[0-9]{13}$/.test(t)}function md(e){const t=e.toUpperCase().replace(/[\s-]/g,"");return 0===t.length?"":[t.slice(0,2),t.slice(2,4),t.slice(4,8),t.slice(8)].filter(Boolean).join("-")}var gd=i(function({value:e,defaultValue:t,onChange:n,label:r,disabled:o,required:i,id:a,name:l,className:s,style:c},u){const p=se(),h=yn(),f=d(),g=a??f,y=void 0!==e,[v,w]=m((t??"").toUpperCase()),k=y?e??"":v,$=k.toUpperCase().replace(/[\s-]/g,"").slice(0,hd),S=fd($);/* @__PURE__ */
458
485
  return b("div",{className:s,style:{display:"flex",flexDirection:"column",gap:6,...c},children:[r&&/* @__PURE__ */b("label",{htmlFor:g,style:{fontSize:13,fontWeight:600,color:p.text},children:[r,i&&/* @__PURE__ */x("span",{style:{color:p.danger,marginLeft:4},children:"*"})]}),
459
- /* @__PURE__ */x("input",{ref:u,id:g,name:l,type:"text",autoComplete:"off",maxLength:20,value:k,onChange:e=>(e=>{const t=e.toUpperCase();y||w(t);const r=t.replace(/[\s-]/g,"").slice(0,rd);n?.({raw:e,normalised:r,pretty:id(r),valid:od(r)})})(e.target.value),disabled:o,required:i,"aria-invalid":$.length===rd&&!S,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${$.length!==rd||S?p.border:p.danger}`,borderRadius:8,background:p.surface,color:p.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:1.2,outline:"none",textTransform:"uppercase"},placeholder:"MH-12-2010-0012345"}),$.length===rd&&!S&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:p.danger},children:h.invalidFormat??"Invalid Driving Licence format."})]})});function ld(e,t,n){try{return new Intl.NumberFormat(n??"en-US",{style:"currency",currency:t,maximumFractionDigits:e%1==0?0:2}).format(e)}catch{return`${t} ${e.toFixed(2)}`}}ad.displayName="TkxDrivingLicenceInput";var sd=i(function({plans:e,cycle:t,selectedId:n,onSelect:r,className:o,style:i},a){const l=se();/* @__PURE__ */
486
+ /* @__PURE__ */x("input",{ref:u,id:g,name:l,type:"text",autoComplete:"off",maxLength:20,value:k,onChange:e=>(e=>{const t=e.toUpperCase();y||w(t);const r=t.replace(/[\s-]/g,"").slice(0,hd);n?.({raw:e,normalised:r,pretty:md(r),valid:fd(r)})})(e.target.value),disabled:o,required:i,"aria-invalid":$.length===hd&&!S,style:{width:"100%",padding:"0 12px",minHeight:40,border:`1px solid ${$.length!==hd||S?p.border:p.danger}`,borderRadius:8,background:p.surface,color:p.text,fontSize:14,fontFamily:"ui-monospace, monospace",letterSpacing:1.2,outline:"none",textTransform:"uppercase"},placeholder:"MH-12-2010-0012345"}),$.length===hd&&!S&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:p.danger},children:h.invalidFormat??"Invalid Driving Licence format."})]})});function xd(e,t,n){try{return new Intl.NumberFormat(n??"en-US",{style:"currency",currency:t,maximumFractionDigits:e%1==0?0:2}).format(e)}catch{return`${t} ${e.toFixed(2)}`}}gd.displayName="TkxDrivingLicenceInput";var bd=i(function({plans:e,cycle:t,selectedId:n,onSelect:r,className:o,style:i},a){const l=se();/* @__PURE__ */
460
487
  return x("div",{ref:a,className:o,style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:16,...i},role:"radiogroup","aria-label":"Plans",children:e.map(e=>{const o=e.id===n;/* @__PURE__ */
461
488
  return b("button",{type:"button",role:"radio","aria-checked":o,disabled:e.disabled,onClick:()=>!e.disabled&&r?.(e),style:{position:"relative",padding:20,borderRadius:12,border:`${e.highlighted?2:1}px solid ${o||e.highlighted?l.primary:l.border}`,background:l.surface,color:l.text,textAlign:"left",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1,transition:"border-color 0.15s, transform 0.05s",fontFamily:"inherit",fontSize:"inherit",width:"100%"},children:[e.highlighted&&/* @__PURE__ */x("span",{style:{position:"absolute",top:-10,right:16,background:l.primary,color:l.bg,fontSize:11,fontWeight:700,padding:"2px 8px",borderRadius:4,letterSpacing:.4,textTransform:"uppercase"},"aria-hidden":"true",children:"Most popular"}),
462
489
  /* @__PURE__ */x("div",{style:{fontSize:12,fontWeight:700,color:l.textMuted,textTransform:"uppercase",letterSpacing:.5},children:e.name}),e.tagline&&/* @__PURE__ */x("div",{style:{fontSize:12,color:l.textMuted,marginTop:2},children:e.tagline}),
463
- /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"baseline",gap:4,marginTop:12},children:[/* @__PURE__ */x("span",{style:{fontSize:32,fontWeight:800,color:l.text},children:ld(e.prices[t],e.currency,e.locale)}),/* @__PURE__ */b("span",{style:{fontSize:12,color:l.textMuted},children:["/ ","monthly"===t?"mo":"yr"]})]}),
490
+ /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"baseline",gap:4,marginTop:12},children:[/* @__PURE__ */x("span",{style:{fontSize:32,fontWeight:800,color:l.text},children:xd(e.prices[t],e.currency,e.locale)}),/* @__PURE__ */b("span",{style:{fontSize:12,color:l.textMuted},children:["/ ","monthly"===t?"mo":"yr"]})]}),
464
491
  /* @__PURE__ */x("ul",{style:{listStyle:"none",padding:0,margin:"16px 0 0",fontSize:13,lineHeight:1.7},children:e.features.map(e=>/* @__PURE__ */b("li",{style:{display:"flex",gap:6,alignItems:"flex-start",color:l.text},children:[/* @__PURE__ */x("span",{"aria-hidden":"true",style:{color:l.success},children:"✓"}),/* @__PURE__ */x("span",{children:e})]},e))}),
465
- /* @__PURE__ */x("div",{style:{marginTop:16,padding:"8px 12px",borderRadius:6,background:o?l.primary:"transparent",color:o?l.bg:l.primary,border:`1px solid ${l.primary}`,textAlign:"center",fontWeight:600,fontSize:13},children:e.ctaLabel??(o?"Selected":`Choose ${e.name}`)})]},e.id)})})});function dd({value:e,onChange:t,annualSavingsLabel:n,className:r,style:o}){const i=se(),a={display:"inline-flex",alignItems:"center",gap:8,padding:4,border:`1px solid ${i.border}`,borderRadius:999,background:i.surface,...o},l=e=>({padding:"6px 16px",borderRadius:999,fontSize:13,fontWeight:600,background:e?i.primary:"transparent",color:e?i.bg:i.text,border:"none",cursor:"pointer",transition:"background 0.15s, color 0.15s",display:"inline-flex",alignItems:"center",gap:6});/* @__PURE__ */
466
- return b("div",{role:"radiogroup","aria-label":"Billing cycle",className:r,style:a,children:[/* @__PURE__ */x("button",{type:"button",role:"radio","aria-checked":"monthly"===e,onClick:()=>t("monthly"),style:l("monthly"===e),children:"Monthly"}),/* @__PURE__ */b("button",{type:"button",role:"radio","aria-checked":"annual"===e,onClick:()=>t("annual"),style:l("annual"===e),children:["Annual",n&&/* @__PURE__ */x("span",{style:{fontSize:10,padding:"2px 6px",borderRadius:4,background:"annual"===e?i.bg:i.success,color:"annual"===e?i.success:i.bg,fontWeight:700},children:n})]})]})}function cd({newPlan:e,currentPlan:t,cycle:n,daysRemaining:r,cycleDays:o,className:i,style:a,children:l}){const s=se(),d=o>0?r/o:0,c=t.prices[n]*d,u=e.prices[n]*d,p=Math.max(0,u-c),h=Math.max(0,c-u),f={border:`1px solid ${s.border}`,borderRadius:12,padding:20,background:s.surface,...a},m={display:"flex",justifyContent:"space-between",fontSize:13,padding:"6px 0"},g=t=>ld(t,e.currency,e.locale);/* @__PURE__ */
492
+ /* @__PURE__ */x("div",{style:{marginTop:16,padding:"8px 12px",borderRadius:6,background:o?l.primary:"transparent",color:o?l.bg:l.primary,border:`1px solid ${l.primary}`,textAlign:"center",fontWeight:600,fontSize:13},children:e.ctaLabel??(o?"Selected":`Choose ${e.name}`)})]},e.id)})})});function yd({value:e,onChange:t,annualSavingsLabel:n,className:r,style:o}){const i=se(),a={display:"inline-flex",alignItems:"center",gap:8,padding:4,border:`1px solid ${i.border}`,borderRadius:999,background:i.surface,...o},l=e=>({padding:"6px 16px",borderRadius:999,fontSize:13,fontWeight:600,background:e?i.primary:"transparent",color:e?i.bg:i.text,border:"none",cursor:"pointer",transition:"background 0.15s, color 0.15s",display:"inline-flex",alignItems:"center",gap:6});/* @__PURE__ */
493
+ return b("div",{role:"radiogroup","aria-label":"Billing cycle",className:r,style:a,children:[/* @__PURE__ */x("button",{type:"button",role:"radio","aria-checked":"monthly"===e,onClick:()=>t("monthly"),style:l("monthly"===e),children:"Monthly"}),/* @__PURE__ */b("button",{type:"button",role:"radio","aria-checked":"annual"===e,onClick:()=>t("annual"),style:l("annual"===e),children:["Annual",n&&/* @__PURE__ */x("span",{style:{fontSize:10,padding:"2px 6px",borderRadius:4,background:"annual"===e?i.bg:i.success,color:"annual"===e?i.success:i.bg,fontWeight:700},children:n})]})]})}function vd({newPlan:e,currentPlan:t,cycle:n,daysRemaining:r,cycleDays:o,className:i,style:a,children:l}){const s=se(),d=o>0?r/o:0,c=t.prices[n]*d,u=e.prices[n]*d,p=Math.max(0,u-c),h=Math.max(0,c-u),f={border:`1px solid ${s.border}`,borderRadius:12,padding:20,background:s.surface,...a},m={display:"flex",justifyContent:"space-between",fontSize:13,padding:"6px 0"},g=t=>xd(t,e.currency,e.locale);/* @__PURE__ */
467
494
  return b("div",{className:i,style:f,children:[
468
495
  /* @__PURE__ */x("div",{style:{fontSize:12,fontWeight:700,color:s.textMuted,textTransform:"uppercase",letterSpacing:.5,marginBottom:12},children:"Plan change"}),
469
496
  /* @__PURE__ */b("div",{style:{...m,color:s.textMuted},children:[
@@ -475,161 +502,161 @@ return b("div",{className:i,style:f,children:[
475
502
  /* @__PURE__ */b("div",{style:{...m,color:s.textMuted},children:[/* @__PURE__ */b("span",{children:["Credit from ",t.name]}),/* @__PURE__ */b("span",{children:["−",g(c)]})]}),
476
503
  /* @__PURE__ */b("div",{style:{...m,color:s.textMuted},children:[/* @__PURE__ */b("span",{children:["Charge for ",e.name," (prorated)"]}),/* @__PURE__ */x("span",{children:g(u)})]}),
477
504
  /* @__PURE__ */x("hr",{style:{border:0,borderTop:`1px solid ${s.border}`,margin:"8px 0"}}),/* @__PURE__ */b("div",p>0?{style:{...m,fontSize:16,fontWeight:700},children:[/* @__PURE__ */x("span",{style:{color:s.text},children:"Due today"}),/* @__PURE__ */x("span",{style:{color:s.primary},children:g(p)})]}:{style:{...m,fontSize:14,color:s.success},children:[/* @__PURE__ */x("span",{children:"Credit applied at next billing"}),/* @__PURE__ */x("span",{children:g(h)})]}),
478
- /* @__PURE__ */x("div",{style:{...m,color:s.textMuted,fontSize:12,marginTop:6},children:/* @__PURE__ */b("span",{children:["Then ",g(e.prices[n])," / ","monthly"===n?"month":"year"]})}),l&&/* @__PURE__ */x("div",{style:{marginTop:16},children:l})]})}function ud(e,t,n,r,o){if("vertical"===o){const o=e.x+n/2,i=e.y+r,a=t.x+n/2,l=t.y,s=(i+l)/2;return`M${o},${i} C${o},${s} ${a},${s} ${a},${l}`}const i=e.x+n,a=e.y+r/2,l=t.x,s=t.y+r/2,d=(i+l)/2;return`M${i},${a} C${d},${a} ${d},${s} ${l},${s}`}function pd({node:e,w:t,h:n,isActive:r,theme:o}){const i=e.accent??o.primary,a=function(e){if(!e)return;const t=e.trim();return!t||/^javascript:/i.test(t)||/^vbscript:/i.test(t)||/^data:/i.test(t)&&!/^data:image\//i.test(t)?void 0:t}(e.avatar),l=ke(e.label),s=e.subLabel?ke(e.subLabel):"",d=e.badge?ke(e.badge):"";/* @__PURE__ */
505
+ /* @__PURE__ */x("div",{style:{...m,color:s.textMuted,fontSize:12,marginTop:6},children:/* @__PURE__ */b("span",{children:["Then ",g(e.prices[n])," / ","monthly"===n?"month":"year"]})}),l&&/* @__PURE__ */x("div",{style:{marginTop:16},children:l})]})}function wd(e,t,n,r,o){if("vertical"===o){const o=e.x+n/2,i=e.y+r,a=t.x+n/2,l=t.y,s=(i+l)/2;return`M${o},${i} C${o},${s} ${a},${s} ${a},${l}`}const i=e.x+n,a=e.y+r/2,l=t.x,s=t.y+r/2,d=(i+l)/2;return`M${i},${a} C${d},${a} ${d},${s} ${l},${s}`}function kd({node:e,w:t,h:n,isActive:r,theme:o}){const i=e.accent??o.primary,a=function(e){if(!e)return;const t=e.trim();return!t||/^javascript:/i.test(t)||/^vbscript:/i.test(t)||/^data:/i.test(t)&&!/^data:image\//i.test(t)?void 0:t}(e.avatar),l=ke(e.label),s=e.subLabel?ke(e.subLabel):"",d=e.badge?ke(e.badge):"";/* @__PURE__ */
479
506
  return b("div",{style:{width:t,height:n,boxSizing:"border-box",background:o.surface,border:`1.5px solid ${r?i:o.border}`,borderRadius:12,padding:"10px 12px",display:"flex",alignItems:"center",gap:10,boxShadow:r?`0 8px 24px -8px ${i}66`:`0 2px 8px -4px ${o.border}88`,transition:"border-color 0.15s ease, box-shadow 0.15s ease",overflow:"hidden"},children:[
480
507
  /* @__PURE__ */x("div",{style:{width:40,height:40,minWidth:40,borderRadius:"50%",overflow:"hidden",background:`${i}22`,color:i,display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,border:`1.5px solid ${i}44`},"aria-hidden":"true",children:a?/* @__PURE__ */x("img",{src:a,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",style:{width:"100%",height:"100%",objectFit:"cover"}}):l.slice(0,2).toUpperCase()}),
481
- /* @__PURE__ */b("div",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */x("div",{style:{fontSize:13.5,fontWeight:700,color:o.text,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l}),s&&/* @__PURE__ */x("div",{style:{fontSize:11.5,color:o.textMuted,lineHeight:1.3,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:s})]}),d&&/* @__PURE__ */x("span",{style:{fontSize:10,fontWeight:700,padding:"3px 7px",borderRadius:999,color:i,background:`${i}18`,border:`1px solid ${i}33`,letterSpacing:"0.04em",textTransform:"uppercase",flexShrink:0},children:d})]})}function hd({collapsed:e,onClick:t,theme:n,direction:r,w:o,h:i}){const a={position:"absolute",..."vertical"===r?{left:o/2-10,top:i-10}:{left:o-10,top:i/2-10},width:20,height:20,borderRadius:"50%",background:n.surfaceAlt,border:`1.5px solid ${n.border}`,color:n.text,fontSize:12,fontWeight:700,cursor:"pointer",padding:0,lineHeight:1,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center"};/* @__PURE__ */
482
- return x("button",{type:"button","aria-label":e?"Expand subtree":"Collapse subtree","aria-expanded":!e,onClick:e=>{e.stopPropagation(),t(e)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.stopPropagation(),t(e))},style:a,children:e?"+":"−"})}function fd({data:e,direction:t="vertical",interactive:n=!0,initialZoom:r=1,nodeWidth:o=200,nodeHeight:i=84,siblingGap:l=28,levelGap:d=64,onNodeClick:c,renderNode:u,collapsedByDefault:h=!1,height:g=560,ariaLabel:y="Organization chart",className:v,style:w}){const k=se(),$=f(null),S=f(null),[C,z]=m(()=>{if(!h)/* @__PURE__ */return new Set;const t=/* @__PURE__ */new Set;return function n(r){r.id!==e.id&&t.add(r.id),(r.children??[]).forEach(n)}(e),t}),[M,N]=m(md(r)),[D,P]=m({x:0,y:0}),[R,F]=m(e.id),I=p(()=>function(e,t,n){const{nodeWidth:r,nodeHeight:o,siblingGap:i,levelGap:a,direction:l}=n,s=[],d=function e(n,r,o){const i=t.has(n.id),a={id:n.id,node:n,x:0,y:0,depth:r,parent:o,children:[],collapsed:i};if(!i)for(const t of n.children??[])a.children.push(e(t,r+1,a));return s.push(a),a}(e,0,null);let c=0;!function e(t){if(0===t.children.length)return t.x=c,void(c+=r+i);t.children.forEach(e),t.x=(t.children[0].x+t.children[t.children.length-1].x)/2}(d);for(const m of s)m.y=m.depth*(o+a);if("horizontal"===l)for(const m of s){const e=m.x;m.x=m.y,m.y=e}let u=1/0,p=1/0,h=-1/0,f=-1/0;for(const m of s)m.x<u&&(u=m.x),m.y<p&&(p=m.y),m.x>h&&(h=m.x),m.y>f&&(f=m.y);Number.isFinite(u)||(u=0,p=0,h=0,f=0);for(const m of s)m.x-=u,m.y-=p;return{nodes:s,width:h-u+r,height:f-p+o}}(e,C,{nodeWidth:o,nodeHeight:i,siblingGap:l,levelGap:d,direction:t}),[e,C,o,i,l,d,t]),A=a(e=>{z(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);s(()=>{if(!n)return;const e=$.current;if(!e)return;const t=e=>{if(!e.ctrlKey&&!e.metaKey){if(Math.abs(e.deltaY)<4&&Math.abs(e.deltaX)<4)return;return P(t=>({x:t.x-e.deltaX,y:t.y-e.deltaY})),void e.preventDefault()}e.preventDefault();const t=e.deltaY<0?.1:-.1;N(e=>md(e+t))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[n]),s(()=>{if(!n)return;const e=$.current;if(!e)return;let t=!1,r=0,o=0,i=0,a=0;const l=n=>{n.target.closest('button, [role="treeitem"], a, input')||(t=!0,r=n.clientX,o=n.clientY,i=D.x,a=D.y,e.setPointerCapture(n.pointerId))},s=e=>{t&&P({x:i+(e.clientX-r),y:a+(e.clientY-o)})},d=n=>{t=!1;try{e.releasePointerCapture(n.pointerId)}catch{}};return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",s),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",s),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d)}},[n,D]);const L=a(e=>{const t=I.nodes.find(e=>e.id===R);if(t)if("ArrowRight"===e.key||"ArrowDown"===e.key){const n=t.children[0];n&&(F(n.id),e.preventDefault())}else"ArrowLeft"===e.key||"ArrowUp"===e.key?t.parent&&(F(t.parent.id),e.preventDefault()):"Enter"===e.key||" "===e.key?(c?.(t.node),e.preventDefault()):"+"===e.key||"="===e.key?N(e=>md(e+.1)):"-"===e.key?N(e=>md(e-.1)):"0"===e.key&&(N(1),P({x:0,y:0}))},[R,I,c]),T=p(()=>{const e=[];for(const n of I.nodes)for(const r of n.children)e.push({id:`${n.id}→${r.id}`,d:ud(n,r,o,i,t)});return e},[I,o,i,t]),W={position:"relative",width:"100%",height:g,overflow:"hidden",borderRadius:12,background:k.bg,border:`1px solid ${k.border}`,touchAction:"none",cursor:n?"grab":"default",boxSizing:"border-box",...w},j={position:"absolute",left:"50%",top:24,width:I.width,height:I.height,transform:`translate(calc(-50% + ${D.x}px), ${D.y}px) scale(${M})`,transformOrigin:"top center",transition:"transform 0.08s ease-out"};/* @__PURE__ */
508
+ /* @__PURE__ */b("div",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */x("div",{style:{fontSize:13.5,fontWeight:700,color:o.text,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l}),s&&/* @__PURE__ */x("div",{style:{fontSize:11.5,color:o.textMuted,lineHeight:1.3,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:s})]}),d&&/* @__PURE__ */x("span",{style:{fontSize:10,fontWeight:700,padding:"3px 7px",borderRadius:999,color:i,background:`${i}18`,border:`1px solid ${i}33`,letterSpacing:"0.04em",textTransform:"uppercase",flexShrink:0},children:d})]})}function $d({collapsed:e,onClick:t,theme:n,direction:r,w:o,h:i}){const a={position:"absolute",..."vertical"===r?{left:o/2-10,top:i-10}:{left:o-10,top:i/2-10},width:20,height:20,borderRadius:"50%",background:n.surfaceAlt,border:`1.5px solid ${n.border}`,color:n.text,fontSize:12,fontWeight:700,cursor:"pointer",padding:0,lineHeight:1,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center"};/* @__PURE__ */
509
+ return x("button",{type:"button","aria-label":e?"Expand subtree":"Collapse subtree","aria-expanded":!e,onClick:e=>{e.stopPropagation(),t(e)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.stopPropagation(),t(e))},style:a,children:e?"+":"−"})}function Sd({data:e,direction:t="vertical",interactive:n=!0,initialZoom:r=1,nodeWidth:o=200,nodeHeight:i=84,siblingGap:l=28,levelGap:d=64,onNodeClick:c,renderNode:u,collapsedByDefault:h=!1,height:g=560,ariaLabel:y="Organization chart",className:v,style:w}){const k=se(),$=f(null),S=f(null),[C,z]=m(()=>{if(!h)/* @__PURE__ */return new Set;const t=/* @__PURE__ */new Set;return function n(r){r.id!==e.id&&t.add(r.id),(r.children??[]).forEach(n)}(e),t}),[M,N]=m(Cd(r)),[D,R]=m({x:0,y:0}),[P,F]=m(e.id),I=p(()=>function(e,t,n){const{nodeWidth:r,nodeHeight:o,siblingGap:i,levelGap:a,direction:l}=n,s=[],d=function e(n,r,o){const i=t.has(n.id),a={id:n.id,node:n,x:0,y:0,depth:r,parent:o,children:[],collapsed:i};if(!i)for(const t of n.children??[])a.children.push(e(t,r+1,a));return s.push(a),a}(e,0,null);let c=0;!function e(t){if(0===t.children.length)return t.x=c,void(c+=r+i);t.children.forEach(e),t.x=(t.children[0].x+t.children[t.children.length-1].x)/2}(d);for(const m of s)m.y=m.depth*(o+a);if("horizontal"===l)for(const m of s){const e=m.x;m.x=m.y,m.y=e}let u=1/0,p=1/0,h=-1/0,f=-1/0;for(const m of s)m.x<u&&(u=m.x),m.y<p&&(p=m.y),m.x>h&&(h=m.x),m.y>f&&(f=m.y);Number.isFinite(u)||(u=0,p=0,h=0,f=0);for(const m of s)m.x-=u,m.y-=p;return{nodes:s,width:h-u+r,height:f-p+o}}(e,C,{nodeWidth:o,nodeHeight:i,siblingGap:l,levelGap:d,direction:t}),[e,C,o,i,l,d,t]),A=a(e=>{z(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);s(()=>{if(!n)return;const e=$.current;if(!e)return;const t=e=>{if(!e.ctrlKey&&!e.metaKey){if(Math.abs(e.deltaY)<4&&Math.abs(e.deltaX)<4)return;return R(t=>({x:t.x-e.deltaX,y:t.y-e.deltaY})),void e.preventDefault()}e.preventDefault();const t=e.deltaY<0?.1:-.1;N(e=>Cd(e+t))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[n]),s(()=>{if(!n)return;const e=$.current;if(!e)return;let t=!1,r=0,o=0,i=0,a=0;const l=n=>{n.target.closest('button, [role="treeitem"], a, input')||(t=!0,r=n.clientX,o=n.clientY,i=D.x,a=D.y,e.setPointerCapture(n.pointerId))},s=e=>{t&&R({x:i+(e.clientX-r),y:a+(e.clientY-o)})},d=n=>{t=!1;try{e.releasePointerCapture(n.pointerId)}catch{}};return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",s),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",s),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d)}},[n,D]);const L=a(e=>{const t=I.nodes.find(e=>e.id===P);if(t)if("ArrowRight"===e.key||"ArrowDown"===e.key){const n=t.children[0];n&&(F(n.id),e.preventDefault())}else"ArrowLeft"===e.key||"ArrowUp"===e.key?t.parent&&(F(t.parent.id),e.preventDefault()):"Enter"===e.key||" "===e.key?(c?.(t.node),e.preventDefault()):"+"===e.key||"="===e.key?N(e=>Cd(e+.1)):"-"===e.key?N(e=>Cd(e-.1)):"0"===e.key&&(N(1),R({x:0,y:0}))},[P,I,c]),T=p(()=>{const e=[];for(const n of I.nodes)for(const r of n.children)e.push({id:`${n.id}→${r.id}`,d:wd(n,r,o,i,t)});return e},[I,o,i,t]),W={position:"relative",width:"100%",height:g,overflow:"hidden",borderRadius:12,background:k.bg,border:`1px solid ${k.border}`,touchAction:"none",cursor:n?"grab":"default",boxSizing:"border-box",...w},j={position:"absolute",left:"50%",top:24,width:I.width,height:I.height,transform:`translate(calc(-50% + ${D.x}px), ${D.y}px) scale(${M})`,transformOrigin:"top center",transition:"transform 0.08s ease-out"};/* @__PURE__ */
483
510
  return b("div",{ref:$,className:v,style:W,role:"tree","aria-label":ke(y),tabIndex:0,onKeyDown:L,children:[n&&/* @__PURE__ */b("div",{style:{position:"absolute",top:12,right:12,zIndex:3,display:"flex",gap:6,background:k.surface,border:`1px solid ${k.border}`,borderRadius:8,padding:4,boxShadow:`0 4px 12px -6px ${k.border}88`},children:[
484
- /* @__PURE__ */x(gd,{theme:k,label:"Zoom out",onClick:()=>N(e=>md(e-.1)),children:"−"}),
485
- /* @__PURE__ */x(gd,{theme:k,label:"Reset zoom",onClick:()=>{N(1),P({x:0,y:0})},children:"⟳"}),
486
- /* @__PURE__ */x(gd,{theme:k,label:"Zoom in",onClick:()=>N(e=>md(e+.1)),children:"+"})]}),/* @__PURE__ */b("div",{ref:S,style:j,children:[/* @__PURE__ */x("svg",{width:I.width,height:I.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none"},"aria-hidden":"true",children:T.map(e=>/* @__PURE__ */x("path",{d:e.d,fill:"none",stroke:k.border,strokeWidth:1.5},e.id))}),I.nodes.map(e=>{const n=(e.node.children?.length??0)>0,r=e.id===R;/* @__PURE__ */
487
- return b("div",{role:"treeitem","aria-label":ke(e.node.label),"aria-selected":r,"aria-level":e.depth+1,"aria-expanded":n?!e.collapsed:void 0,tabIndex:-1,onClick:t=>{t.stopPropagation(),F(e.id),c?.(e.node)},style:{position:"absolute",left:e.x,top:e.y,width:o,height:i,cursor:c?"pointer":"default"},children:[u?u(e.node,r):/* @__PURE__ */x(pd,{node:e.node,w:o,h:i,isActive:r,theme:k}),n&&/* @__PURE__ */x(hd,{collapsed:e.collapsed,onClick:()=>A(e.id),theme:k,direction:t,w:o,h:i})]},e.id)})]})]})}function md(e){return e<.25?.25:e>4?4:e}function gd({children:e,onClick:t,label:n,theme:r}){/* @__PURE__ */
488
- return x("button",{type:"button","aria-label":n,onClick:t,style:{width:28,height:28,borderRadius:6,background:"transparent",border:"none",color:r.text,fontSize:14,fontWeight:700,cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>{e.currentTarget.style.background=r.surfaceAlt},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:e})}function xd({locale:e="en-US",direction:t,strings:n,children:r}){const o=p(()=>{const r=fn[e]??hn,o=n?{...r,...n}:r;return{locale:e,direction:t??(gn(e)?"rtl":"ltr"),strings:o}},[e,t,n]);/* @__PURE__ */
489
- return x(xn.Provider,{value:o,children:/* @__PURE__ */x("div",{dir:o.direction,style:{direction:o.direction,display:"contents"},children:r})})}function bd({contentId:e="tkx-main-content",label:t="Skip to main content"}){/* @__PURE__ */
490
- return x("a",{href:`#${e}`,className:"tkx-skip-nav",children:t})}function yd({politeness:e="polite",children:t,atomic:n=!0}){/* @__PURE__ */
491
- return x("div",{role:"status","aria-live":e,"aria-atomic":n,className:"tkx-sr-only",children:t})}function vd({active:e,children:t,as:n="div"}){/* @__PURE__ */
492
- return x(n,{ref:nt(e),children:t})}function wd({as:e,children:t,...n}){/* @__PURE__ */
493
- return x(e??"span",{className:"tkx-sr-only",...n,children:t})}function kd(e,t,n,r){const o=e.getBoundingClientRect(),i=t?t.offsetHeight:320,a=t?t.offsetWidth:200,l=window.innerWidth,s=window.innerHeight,d=window.scrollX,c=window.scrollY;let u=0,p=0;switch(n){case"bottom-start":default:u=o.bottom+c+r,p=o.left+d;break;case"bottom-end":u=o.bottom+c+r,p=o.right+d-a;break;case"top-start":u=o.top+c-r-i,p=o.left+d;break;case"top-end":u=o.top+c-r-i,p=o.right+d-a;break;case"right":u=o.top+c,p=o.right+d+r;break;case"left":u=o.top+c,p=o.left+d-r-a}return n.startsWith("bottom")&&o.bottom+i>s&&(u=o.top+c-r-i),n.startsWith("top")&&o.top-i<0&&(u=o.bottom+c+r),p+a>l+d&&(p=l+d-a-8),p<d&&(p=d+8),{top:u,left:p,minWidth:o.width}}function $d(e,t){if(!t)return e;const n=e.toLowerCase().indexOf(t.toLowerCase());return-1===n?e:/* @__PURE__ */b(g,{children:[e.slice(0,n),
494
- /* @__PURE__ */x("mark",{style:{background:"rgba(0,245,212,0.3)",color:"inherit",borderRadius:2},children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function Sd({groups:e,position:t,maxHeight:n,minWidth:r,selectedKeys:o,multiSelect:i,searchable:l,searchPlaceholder:d,onSelect:c,onClose:u,renderItem:p,menuRef:h,isPortal:g,menuId:y}){const v=se(),w=yn(),k=d??`${w.search}…`,[$,S]=m(""),[C,z]=m(0),[M,N]=m(null),[D,P]=m(0),R=f(null),F=f([]),I=f([]),A=$?e.map(e=>({...e,items:e.items.filter(e=>e.label.toLowerCase().includes($.toLowerCase())||e.description?.toLowerCase().includes($.toLowerCase())||e.children?.some(e=>e.label.toLowerCase().includes($.toLowerCase())))})).filter(e=>e.items.length>0):e,L=function(e,t){const n=[];for(const r of e)for(const e of r.items)e.disabled||t&&!e.label.toLowerCase().includes(t.toLowerCase())||n.push(e);return n}(A,$);s(()=>{l&&R.current?R.current.focus():F.current[0]?.focus(),z(0)},[l]),s(()=>{l&&""===$||F.current[C]?.focus()},[C,l,$]);const T=a(e=>{switch(e.key){case"ArrowDown":if(e.preventDefault(),M){const e=(L.find(e=>e.key===M)?.children??[]).filter(e=>!e.disabled);P(t=>Math.min(t+1,e.length-1))}else z(e=>Math.min(e+1,L.length-1));break;case"ArrowUp":e.preventDefault(),M?P(e=>Math.max(e-1,0)):z(e=>Math.max(e-1,0));break;case"ArrowRight":{e.preventDefault();const t=L[C];t?.children?.length&&(N(t.key),P(0));break}case"ArrowLeft":e.preventDefault(),N(null);break;case"Enter":case" ":if(e.preventDefault(),M){const e=(L.find(e=>e.key===M)?.children??[]).filter(e=>!e.disabled)[D];e&&c(e.key,e)}else{const e=L[C];e&&c(e.key,e)}break;case"Escape":e.preventDefault(),M?N(null):u();break;case"Tab":u()}},[L,C,u,c,M,D]);s(()=>{M&&I.current[D]?.focus()},[D,M]);const W={position:g?"fixed":"absolute",top:g?t.top:void 0,left:g?t.left:void 0,minWidth:Math.max(r,t.minWidth),maxHeight:n,overflowY:"auto",background:v.surface,border:`1px solid ${v.border}`,borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:9999,outline:"none",transformOrigin:"top left",animation:"tkx-dropdown-in 150ms ease forwards"};let j=0;/* @__PURE__ */
511
+ /* @__PURE__ */x(zd,{theme:k,label:"Zoom out",onClick:()=>N(e=>Cd(e-.1)),children:"−"}),
512
+ /* @__PURE__ */x(zd,{theme:k,label:"Reset zoom",onClick:()=>{N(1),R({x:0,y:0})},children:"⟳"}),
513
+ /* @__PURE__ */x(zd,{theme:k,label:"Zoom in",onClick:()=>N(e=>Cd(e+.1)),children:"+"})]}),/* @__PURE__ */b("div",{ref:S,style:j,children:[/* @__PURE__ */x("svg",{width:I.width,height:I.height,style:{position:"absolute",left:0,top:0,pointerEvents:"none"},"aria-hidden":"true",children:T.map(e=>/* @__PURE__ */x("path",{d:e.d,fill:"none",stroke:k.border,strokeWidth:1.5},e.id))}),I.nodes.map(e=>{const n=(e.node.children?.length??0)>0,r=e.id===P;/* @__PURE__ */
514
+ return b("div",{role:"treeitem","aria-label":ke(e.node.label),"aria-selected":r,"aria-level":e.depth+1,"aria-expanded":n?!e.collapsed:void 0,tabIndex:-1,onClick:t=>{t.stopPropagation(),F(e.id),c?.(e.node)},style:{position:"absolute",left:e.x,top:e.y,width:o,height:i,cursor:c?"pointer":"default"},children:[u?u(e.node,r):/* @__PURE__ */x(kd,{node:e.node,w:o,h:i,isActive:r,theme:k}),n&&/* @__PURE__ */x($d,{collapsed:e.collapsed,onClick:()=>A(e.id),theme:k,direction:t,w:o,h:i})]},e.id)})]})]})}function Cd(e){return e<.25?.25:e>4?4:e}function zd({children:e,onClick:t,label:n,theme:r}){/* @__PURE__ */
515
+ return x("button",{type:"button","aria-label":n,onClick:t,style:{width:28,height:28,borderRadius:6,background:"transparent",border:"none",color:r.text,fontSize:14,fontWeight:700,cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>{e.currentTarget.style.background=r.surfaceAlt},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:e})}function Md({locale:e="en-US",direction:t,strings:n,children:r}){const o=p(()=>{const r=fn[e]??hn,o=n?{...r,...n}:r;return{locale:e,direction:t??(gn(e)?"rtl":"ltr"),strings:o}},[e,t,n]);/* @__PURE__ */
516
+ return x(xn.Provider,{value:o,children:/* @__PURE__ */x("div",{dir:o.direction,style:{direction:o.direction,display:"contents"},children:r})})}function Nd({contentId:e="tkx-main-content",label:t="Skip to main content"}){/* @__PURE__ */
517
+ return x("a",{href:`#${e}`,className:"tkx-skip-nav",children:t})}function Dd({politeness:e="polite",children:t,atomic:n=!0}){/* @__PURE__ */
518
+ return x("div",{role:"status","aria-live":e,"aria-atomic":n,className:"tkx-sr-only",children:t})}function Rd({active:e,children:t,as:n="div"}){/* @__PURE__ */
519
+ return x(n,{ref:nt(e),children:t})}function Pd({as:e,children:t,...n}){/* @__PURE__ */
520
+ return x(e??"span",{className:"tkx-sr-only",...n,children:t})}function Fd(e,t,n,r){const o=e.getBoundingClientRect(),i=t?t.offsetHeight:320,a=t?t.offsetWidth:200,l=window.innerWidth,s=window.innerHeight,d=window.scrollX,c=window.scrollY;let u=0,p=0;switch(n){case"bottom-start":default:u=o.bottom+c+r,p=o.left+d;break;case"bottom-end":u=o.bottom+c+r,p=o.right+d-a;break;case"top-start":u=o.top+c-r-i,p=o.left+d;break;case"top-end":u=o.top+c-r-i,p=o.right+d-a;break;case"right":u=o.top+c,p=o.right+d+r;break;case"left":u=o.top+c,p=o.left+d-r-a}return n.startsWith("bottom")&&o.bottom+i>s&&(u=o.top+c-r-i),n.startsWith("top")&&o.top-i<0&&(u=o.bottom+c+r),p+a>l+d&&(p=l+d-a-8),p<d&&(p=d+8),{top:u,left:p,minWidth:o.width}}function Id(e,t){if(!t)return e;const n=e.toLowerCase().indexOf(t.toLowerCase());return-1===n?e:/* @__PURE__ */b(g,{children:[e.slice(0,n),
521
+ /* @__PURE__ */x("mark",{style:{background:"rgba(0,245,212,0.3)",color:"inherit",borderRadius:2},children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function Ad({groups:e,position:t,maxHeight:n,minWidth:r,selectedKeys:o,multiSelect:i,searchable:l,searchPlaceholder:d,onSelect:c,onClose:u,renderItem:p,menuRef:h,isPortal:g,menuId:y}){const v=se(),w=yn(),k=d??`${w.search}…`,[$,S]=m(""),[C,z]=m(0),[M,N]=m(null),[D,R]=m(0),P=f(null),F=f([]),I=f([]),A=$?e.map(e=>({...e,items:e.items.filter(e=>e.label.toLowerCase().includes($.toLowerCase())||e.description?.toLowerCase().includes($.toLowerCase())||e.children?.some(e=>e.label.toLowerCase().includes($.toLowerCase())))})).filter(e=>e.items.length>0):e,L=function(e,t){const n=[];for(const r of e)for(const e of r.items)e.disabled||t&&!e.label.toLowerCase().includes(t.toLowerCase())||n.push(e);return n}(A,$);s(()=>{l&&P.current?P.current.focus():F.current[0]?.focus(),z(0)},[l]),s(()=>{l&&""===$||F.current[C]?.focus()},[C,l,$]);const T=a(e=>{switch(e.key){case"ArrowDown":if(e.preventDefault(),M){const e=(L.find(e=>e.key===M)?.children??[]).filter(e=>!e.disabled);R(t=>Math.min(t+1,e.length-1))}else z(e=>Math.min(e+1,L.length-1));break;case"ArrowUp":e.preventDefault(),M?R(e=>Math.max(e-1,0)):z(e=>Math.max(e-1,0));break;case"ArrowRight":{e.preventDefault();const t=L[C];t?.children?.length&&(N(t.key),R(0));break}case"ArrowLeft":e.preventDefault(),N(null);break;case"Enter":case" ":if(e.preventDefault(),M){const e=(L.find(e=>e.key===M)?.children??[]).filter(e=>!e.disabled)[D];e&&c(e.key,e)}else{const e=L[C];e&&c(e.key,e)}break;case"Escape":e.preventDefault(),M?N(null):u();break;case"Tab":u()}},[L,C,u,c,M,D]);s(()=>{M&&I.current[D]?.focus()},[D,M]);const W={position:g?"fixed":"absolute",top:g?t.top:void 0,left:g?t.left:void 0,minWidth:Math.max(r,t.minWidth),maxHeight:n,overflowY:"auto",background:v.surface,border:`1px solid ${v.border}`,borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:9999,outline:"none",transformOrigin:"top left",animation:"tkx-dropdown-in 150ms ease forwards"};let j=0;/* @__PURE__ */
495
522
  return b("div",{ref:h,id:y,role:"menu","aria-label":"Dropdown menu",tabIndex:-1,style:W,onKeyDown:T,children:[
496
- /* @__PURE__ */x("style",{children:"\n @keyframes tkx-dropdown-in {\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n }\n "}),l&&/* @__PURE__ */x("div",{style:{padding:"8px 8px 4px"},children:/* @__PURE__ */x("input",{ref:R,type:"text",value:$,onChange:e=>{S(e.target.value),z(0)},placeholder:k,"aria-label":`${w.search} items`,style:{width:"100%",boxSizing:"border-box",padding:"6px 10px",background:v.surfaceAlt,border:`1px solid ${v.border}`,borderRadius:6,color:v.text,fontSize:13,outline:"none"}})}),0===A.length&&/* @__PURE__ */x("div",{style:{padding:"12px 16px",color:v.textMuted,fontSize:13,textAlign:"center"},children:"No results found"}),A.map((e,t)=>/* @__PURE__ */b("div",{role:"group","aria-label":e.label,children:[e.label&&/* @__PURE__ */x("div",{style:{padding:"8px 12px 4px",fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:v.textMuted},children:ke(e.label)}),e.items.map(e=>{const t=j;e.disabled||j++;const n=o.includes(e.key),r=t===C&&!e.disabled,a=!!e.children?.length,l=M===e.key,s=p?p(e,n):/* @__PURE__ */x(Cd,{item:e,isSelected:n,isFocused:r,multiSelect:i,query:$,theme:v,hasSubmenu:a});/* @__PURE__ */
497
- return b("div",{children:[e.divider&&/* @__PURE__ */x("div",{role:"separator",style:{height:1,background:v.border,margin:"4px 0"}}),/* @__PURE__ */b("div",{ref:e=>{F.current[t]=e},role:"menuitem","aria-disabled":e.disabled,"aria-checked":i?n:void 0,"aria-selected":i?void 0:n,"aria-haspopup":a?"menu":void 0,"aria-expanded":a?l:void 0,tabIndex:e.disabled?-1:0,style:{position:"relative",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1},onClick:()=>{e.disabled||(a?(N(l?null:e.key),P(0)):c(e.key,e))},onMouseEnter:()=>{e.disabled||(z(t),a?(N(e.key),P(0)):N(null))},onFocus:()=>{e.disabled||z(t)},children:[s,a&&l&&/* @__PURE__ */x("div",{role:"menu",style:{position:"absolute",top:0,left:"100%",minWidth:180,background:v.surface,border:`1px solid ${v.border}`,borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:1e4,animation:"tkx-dropdown-in 120ms ease forwards"},children:e.children.map((e,t)=>{const n=o.includes(e.key),r=t===D;/* @__PURE__ */
498
- return x("div",{ref:e=>{I.current[t]=e},role:"menuitem","aria-disabled":e.disabled,"aria-selected":n,tabIndex:e.disabled?-1:0,style:{cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1},onClick:t=>{t.stopPropagation(),e.disabled||c(e.key,e)},onMouseEnter:()=>P(t),children:/* @__PURE__ */x(Cd,{item:e,isSelected:n,isFocused:r,multiSelect:i,query:$,theme:v,hasSubmenu:!1})},e.key)})})]})]},e.key)})]},t))]})}function Cd({item:e,isSelected:t,isFocused:n,multiSelect:r,query:o,theme:i,hasSubmenu:a}){/* @__PURE__ */
523
+ /* @__PURE__ */x("style",{children:"\n @keyframes tkx-dropdown-in {\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n }\n "}),l&&/* @__PURE__ */x("div",{style:{padding:"8px 8px 4px"},children:/* @__PURE__ */x("input",{ref:P,type:"text",value:$,onChange:e=>{S(e.target.value),z(0)},placeholder:k,"aria-label":`${w.search} items`,style:{width:"100%",boxSizing:"border-box",padding:"6px 10px",background:v.surfaceAlt,border:`1px solid ${v.border}`,borderRadius:6,color:v.text,fontSize:13,outline:"none"}})}),0===A.length&&/* @__PURE__ */x("div",{style:{padding:"12px 16px",color:v.textMuted,fontSize:13,textAlign:"center"},children:"No results found"}),A.map((e,t)=>/* @__PURE__ */b("div",{role:"group","aria-label":e.label,children:[e.label&&/* @__PURE__ */x("div",{style:{padding:"8px 12px 4px",fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:v.textMuted},children:ke(e.label)}),e.items.map(e=>{const t=j;e.disabled||j++;const n=o.includes(e.key),r=t===C&&!e.disabled,a=!!e.children?.length,l=M===e.key,s=p?p(e,n):/* @__PURE__ */x(Ld,{item:e,isSelected:n,isFocused:r,multiSelect:i,query:$,theme:v,hasSubmenu:a});/* @__PURE__ */
524
+ return b("div",{children:[e.divider&&/* @__PURE__ */x("div",{role:"separator",style:{height:1,background:v.border,margin:"4px 0"}}),/* @__PURE__ */b("div",{ref:e=>{F.current[t]=e},role:"menuitem","aria-disabled":e.disabled,"aria-checked":i?n:void 0,"aria-selected":i?void 0:n,"aria-haspopup":a?"menu":void 0,"aria-expanded":a?l:void 0,tabIndex:e.disabled?-1:0,style:{position:"relative",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1},onClick:()=>{e.disabled||(a?(N(l?null:e.key),R(0)):c(e.key,e))},onMouseEnter:()=>{e.disabled||(z(t),a?(N(e.key),R(0)):N(null))},onFocus:()=>{e.disabled||z(t)},children:[s,a&&l&&/* @__PURE__ */x("div",{role:"menu",style:{position:"absolute",top:0,left:"100%",minWidth:180,background:v.surface,border:`1px solid ${v.border}`,borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:1e4,animation:"tkx-dropdown-in 120ms ease forwards"},children:e.children.map((e,t)=>{const n=o.includes(e.key),r=t===D;/* @__PURE__ */
525
+ return x("div",{ref:e=>{I.current[t]=e},role:"menuitem","aria-disabled":e.disabled,"aria-selected":n,tabIndex:e.disabled?-1:0,style:{cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?.5:1},onClick:t=>{t.stopPropagation(),e.disabled||c(e.key,e)},onMouseEnter:()=>R(t),children:/* @__PURE__ */x(Ld,{item:e,isSelected:n,isFocused:r,multiSelect:i,query:$,theme:v,hasSubmenu:!1})},e.key)})})]})]},e.key)})]},t))]})}function Ld({item:e,isSelected:t,isFocused:n,multiSelect:r,query:o,theme:i,hasSubmenu:a}){/* @__PURE__ */
499
526
  return b("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:n?e.danger?`${i.danger}20`:`${i.primary}18`:"transparent",transition:"background 80ms",color:e.danger?i.danger:i.text,fontSize:14,userSelect:"none"},children:[r&&/* @__PURE__ */x("div",{style:{width:16,height:16,border:`2px solid ${t?i.primary:i.border}`,borderRadius:4,background:t?i.primary:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 120ms"},children:t&&/* @__PURE__ */x("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:/* @__PURE__ */x("path",{d:"M1 4l3 3L9 1",stroke:i.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.icon&&/* @__PURE__ */x("span",{style:{display:"flex",alignItems:"center",flexShrink:0,color:e.danger?i.danger:i.textMuted},children:e.icon}),
500
- /* @__PURE__ */b("div",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */x("div",{style:{fontWeight:t&&!r?600:400},children:$d(e.label,o)}),e.description&&/* @__PURE__ */x("div",{style:{fontSize:12,color:i.textMuted,marginTop:1},children:$d(e.description,o)})]}),void 0!==e.badge&&/* @__PURE__ */x("span",{style:{background:i.primary,color:i.bg,fontSize:11,fontWeight:700,borderRadius:10,padding:"1px 7px",flexShrink:0},children:e.badge}),e.shortcut&&!a&&/* @__PURE__ */x("span",{style:{fontSize:12,color:i.textMuted,flexShrink:0},children:e.shortcut}),a&&/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0},children:/* @__PURE__ */x("path",{d:"M4 2l4 4-4 4",stroke:i.textMuted,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),!r&&t&&/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",style:{flexShrink:0},children:/* @__PURE__ */x("path",{d:"M2 7l4 4L12 3",stroke:i.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function zd({trigger:e,items:t,groups:n,placement:r="bottom-start",onSelect:o,selectedKeys:i,multiSelect:l=!1,searchable:c=!1,searchPlaceholder:u,closeOnSelect:p,disabled:h=!1,maxHeight:g=320,minWidth:v=200,open:w,onOpenChange:k,portal:$=!0,offset:S=6,renderItem:C}){const[z,M]=m(!1),[N,D]=m([]),[P,R]=m({top:0,left:0,minWidth:v}),F=f(null),I=f(null),A=d(),L=void 0!==w?w:z,T=void 0!==i?i:N,W=void 0!==p?p:!l,j=n??(t?[{items:t}]:[{items:[]}]),E=a(e=>{void 0===w&&M(e),k?.(e)},[w,k]),B=a((e,t)=>{l&&void 0===i&&D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),o?.(e,t),W&&E(!1)},[l,i,o,W,E]),V=a(()=>E(!1),[E]);s(()=>{L&&F.current&&R(kd(F.current,I.current,r,S))},[L,r,S]),s(()=>{L&&F.current&&I.current&&R(kd(F.current,I.current,r,S))},[L,r,S]),s(()=>{if(!L)return;const e=e=>{const t=e.target;F.current&&!F.current.contains(t)&&I.current&&!I.current.contains(t)&&E(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[L,E]);const H=L?/* @__PURE__ */x(Sd,{groups:j,position:P,maxHeight:g,minWidth:v,selectedKeys:T,multiSelect:l,searchable:c,searchPlaceholder:u,onSelect:B,onClose:V,renderItem:C,menuRef:I,isPortal:$,menuId:A}):null;/* @__PURE__ */
501
- return b("div",{style:{display:"inline-block",position:"relative"},children:[/* @__PURE__ */x("div",{ref:F,onClick:()=>{h||E(!L)},"aria-haspopup":"menu","aria-expanded":L,"aria-controls":L?A:void 0,"aria-disabled":h,style:{cursor:h?"not-allowed":"pointer",opacity:h?.5:1,display:"inline-block"},children:e}),$&&"undefined"!=typeof document?y(H,document.body):H]})}fd.displayName="TkxOrgChart";var Md=!1,Nd="tkx-holographic-styles";function Dd(){Pd()}function Pd(){if(Md||"undefined"==typeof document)return;if(document.getElementById(Nd))return void(Md=!0);Md=!0;const e=document.createElement("style");e.id=Nd,e.textContent="\n@keyframes tkx-holo-shimmer {\n 0% { background-position: 0% 50%; }\n 50% { background-position: 100% 50%; }\n 100% { background-position: 0% 50%; }\n}\n@keyframes tkx-holo-snapback {\n to { --tkx-holo-rx: 0deg; --tkx-holo-ry: 0deg; --tkx-holo-mx: 50%; --tkx-holo-my: 50%; }\n}\n.tkx-holo-root {\n --tkx-holo-rx: 0deg;\n --tkx-holo-ry: 0deg;\n --tkx-holo-mx: 50%;\n --tkx-holo-my: 50%;\n position: relative;\n transform-style: preserve-3d;\n transform: perspective(1000px) rotateX(var(--tkx-holo-rx)) rotateY(var(--tkx-holo-ry));\n transition: transform 280ms cubic-bezier(.2,.8,.2,1);\n will-change: transform;\n isolation: isolate;\n}\n.tkx-holo-root.tkx-holo-tracking {\n transition: none;\n}\n.tkx-holo-foil {\n position: absolute;\n inset: 0;\n border-radius: inherit;\n pointer-events: none;\n background:\n radial-gradient(circle at var(--tkx-holo-mx) var(--tkx-holo-my),\n rgba(255,255,255,0.32) 0%,\n rgba(255,255,255,0.08) 22%,\n transparent 55%),\n conic-gradient(from calc(var(--tkx-holo-mx) * 3.6deg) at 50% 50%,\n #ff006e, #ffbe0b, #06d6a0, #00f5d4, #3a86ff, #7b2ff7, #ff006e);\n background-size: 100% 100%, 280% 280%;\n background-position: 0 0, var(--tkx-holo-mx) var(--tkx-holo-my);\n mix-blend-mode: color-dodge;\n opacity: 0.55;\n filter: saturate(1.4) contrast(1.1);\n}\n.tkx-holo-foil.tkx-holo-foil-soft {\n mix-blend-mode: overlay;\n opacity: 0.35;\n}\n.tkx-holo-scan {\n position: absolute;\n inset: 0;\n border-radius: inherit;\n pointer-events: none;\n background: repeating-linear-gradient(\n 180deg,\n rgba(255,255,255,0.06) 0px,\n rgba(255,255,255,0.06) 1px,\n transparent 1px,\n transparent 3px\n );\n mix-blend-mode: overlay;\n opacity: 0.5;\n}\n.tkx-holo-content {\n position: relative;\n z-index: 1;\n transform: translateZ(20px);\n}\n.tkx-holo-root:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 4px;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-holo-root, .tkx-holo-root.tkx-holo-tracking {\n transform: none !important;\n transition: none;\n }\n .tkx-holo-content { transform: none !important; }\n .tkx-holo-foil { animation: tkx-holo-shimmer 8s ease infinite; }\n}",document.head.appendChild(e)}function Rd(e={}){const{maxTilt:t=14,disabled:n=!1}=e,r=f(null),o=et(),i=f(null),a=f({rx:0,ry:0,mx:50,my:50});return s(()=>{Pd()},[]),s(()=>{const e=r.current;if(e&&!n&&!o)return e.addEventListener("pointermove",d),e.addEventListener("pointerleave",c),()=>{e.removeEventListener("pointermove",d),e.removeEventListener("pointerleave",c),null!=i.current&&cancelAnimationFrame(i.current)};function l(){if(!e)return;const{rx:t,ry:n,mx:r,my:o}=a.current;e.style.setProperty("--tkx-holo-rx",`${t}deg`),e.style.setProperty("--tkx-holo-ry",`${n}deg`),e.style.setProperty("--tkx-holo-mx",`${r}%`),e.style.setProperty("--tkx-holo-my",`${o}%`),i.current=null}function s(){null==i.current&&(i.current=requestAnimationFrame(l))}function d(n){const r=e.getBoundingClientRect(),o=(n.clientX-r.left)/r.width,i=(n.clientY-r.top)/r.height,l=Math.max(0,Math.min(1,o)),d=Math.max(0,Math.min(1,i));a.current={rx:(.5-d)*t*2,ry:(l-.5)*t*2,mx:100*l,my:100*d},e.classList.add("tkx-holo-tracking"),s()}function c(){a.current={rx:0,ry:0,mx:50,my:50},e.classList.remove("tkx-holo-tracking"),s()}},[t,n,o]),r}var Fd=i(function({children:e,maxTilt:t=14,scanLines:n=!0,foilIntensity:r="strong",radius:o=16,disabled:i=!1,className:a,style:l,...d},c){const u=se(),p=Rd({maxTilt:t,disabled:i});s(()=>{if(!c)return;const e=p.current;"function"==typeof c?c(e):c.current=e},[c,p]);const h={borderRadius:"number"==typeof o?`${o}px`:o,background:`linear-gradient(135deg, ${u.surface}cc, ${u.surfaceAlt}cc)`,border:`1px solid ${u.border}`,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:u.text,...l};/* @__PURE__ */
527
+ /* @__PURE__ */b("div",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */x("div",{style:{fontWeight:t&&!r?600:400},children:Id(e.label,o)}),e.description&&/* @__PURE__ */x("div",{style:{fontSize:12,color:i.textMuted,marginTop:1},children:Id(e.description,o)})]}),void 0!==e.badge&&/* @__PURE__ */x("span",{style:{background:i.primary,color:i.bg,fontSize:11,fontWeight:700,borderRadius:10,padding:"1px 7px",flexShrink:0},children:e.badge}),e.shortcut&&!a&&/* @__PURE__ */x("span",{style:{fontSize:12,color:i.textMuted,flexShrink:0},children:e.shortcut}),a&&/* @__PURE__ */x("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0},children:/* @__PURE__ */x("path",{d:"M4 2l4 4-4 4",stroke:i.textMuted,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),!r&&t&&/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",style:{flexShrink:0},children:/* @__PURE__ */x("path",{d:"M2 7l4 4L12 3",stroke:i.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function Td({trigger:e,items:t,groups:n,placement:r="bottom-start",onSelect:o,selectedKeys:i,multiSelect:l=!1,searchable:c=!1,searchPlaceholder:u,closeOnSelect:p,disabled:h=!1,maxHeight:g=320,minWidth:v=200,open:w,onOpenChange:k,portal:$=!0,offset:S=6,renderItem:C}){const[z,M]=m(!1),[N,D]=m([]),[R,P]=m({top:0,left:0,minWidth:v}),F=f(null),I=f(null),A=d(),L=void 0!==w?w:z,T=void 0!==i?i:N,W=void 0!==p?p:!l,j=n??(t?[{items:t}]:[{items:[]}]),E=a(e=>{void 0===w&&M(e),k?.(e)},[w,k]),B=a((e,t)=>{l&&void 0===i&&D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),o?.(e,t),W&&E(!1)},[l,i,o,W,E]),V=a(()=>E(!1),[E]);s(()=>{L&&F.current&&P(Fd(F.current,I.current,r,S))},[L,r,S]),s(()=>{L&&F.current&&I.current&&P(Fd(F.current,I.current,r,S))},[L,r,S]),s(()=>{if(!L)return;const e=e=>{const t=e.target;F.current&&!F.current.contains(t)&&I.current&&!I.current.contains(t)&&E(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[L,E]);const H=L?/* @__PURE__ */x(Ad,{groups:j,position:R,maxHeight:g,minWidth:v,selectedKeys:T,multiSelect:l,searchable:c,searchPlaceholder:u,onSelect:B,onClose:V,renderItem:C,menuRef:I,isPortal:$,menuId:A}):null;/* @__PURE__ */
528
+ return b("div",{style:{display:"inline-block",position:"relative"},children:[/* @__PURE__ */x("div",{ref:F,onClick:()=>{h||E(!L)},"aria-haspopup":"menu","aria-expanded":L,"aria-controls":L?A:void 0,"aria-disabled":h,style:{cursor:h?"not-allowed":"pointer",opacity:h?.5:1,display:"inline-block"},children:e}),$&&"undefined"!=typeof document?y(H,document.body):H]})}Sd.displayName="TkxOrgChart";var Wd=!1,jd="tkx-holographic-styles";function Ed(){Bd()}function Bd(){if(Wd||"undefined"==typeof document)return;if(document.getElementById(jd))return void(Wd=!0);Wd=!0;const e=document.createElement("style");e.id=jd,e.textContent="\n@keyframes tkx-holo-shimmer {\n 0% { background-position: 0% 50%; }\n 50% { background-position: 100% 50%; }\n 100% { background-position: 0% 50%; }\n}\n@keyframes tkx-holo-snapback {\n to { --tkx-holo-rx: 0deg; --tkx-holo-ry: 0deg; --tkx-holo-mx: 50%; --tkx-holo-my: 50%; }\n}\n.tkx-holo-root {\n --tkx-holo-rx: 0deg;\n --tkx-holo-ry: 0deg;\n --tkx-holo-mx: 50%;\n --tkx-holo-my: 50%;\n position: relative;\n transform-style: preserve-3d;\n transform: perspective(1000px) rotateX(var(--tkx-holo-rx)) rotateY(var(--tkx-holo-ry));\n transition: transform 280ms cubic-bezier(.2,.8,.2,1);\n will-change: transform;\n isolation: isolate;\n}\n.tkx-holo-root.tkx-holo-tracking {\n transition: none;\n}\n.tkx-holo-foil {\n position: absolute;\n inset: 0;\n border-radius: inherit;\n pointer-events: none;\n background:\n radial-gradient(circle at var(--tkx-holo-mx) var(--tkx-holo-my),\n rgba(255,255,255,0.32) 0%,\n rgba(255,255,255,0.08) 22%,\n transparent 55%),\n conic-gradient(from calc(var(--tkx-holo-mx) * 3.6deg) at 50% 50%,\n #ff006e, #ffbe0b, #06d6a0, #00f5d4, #3a86ff, #7b2ff7, #ff006e);\n background-size: 100% 100%, 280% 280%;\n background-position: 0 0, var(--tkx-holo-mx) var(--tkx-holo-my);\n mix-blend-mode: color-dodge;\n opacity: 0.55;\n filter: saturate(1.4) contrast(1.1);\n}\n.tkx-holo-foil.tkx-holo-foil-soft {\n mix-blend-mode: overlay;\n opacity: 0.35;\n}\n.tkx-holo-scan {\n position: absolute;\n inset: 0;\n border-radius: inherit;\n pointer-events: none;\n background: repeating-linear-gradient(\n 180deg,\n rgba(255,255,255,0.06) 0px,\n rgba(255,255,255,0.06) 1px,\n transparent 1px,\n transparent 3px\n );\n mix-blend-mode: overlay;\n opacity: 0.5;\n}\n.tkx-holo-content {\n position: relative;\n z-index: 1;\n transform: translateZ(20px);\n}\n.tkx-holo-root:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 4px;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-holo-root, .tkx-holo-root.tkx-holo-tracking {\n transform: none !important;\n transition: none;\n }\n .tkx-holo-content { transform: none !important; }\n .tkx-holo-foil { animation: tkx-holo-shimmer 8s ease infinite; }\n}",document.head.appendChild(e)}function Vd(e={}){const{maxTilt:t=14,disabled:n=!1}=e,r=f(null),o=et(),i=f(null),a=f({rx:0,ry:0,mx:50,my:50});return s(()=>{Bd()},[]),s(()=>{const e=r.current;if(e&&!n&&!o)return e.addEventListener("pointermove",d),e.addEventListener("pointerleave",c),()=>{e.removeEventListener("pointermove",d),e.removeEventListener("pointerleave",c),null!=i.current&&cancelAnimationFrame(i.current)};function l(){if(!e)return;const{rx:t,ry:n,mx:r,my:o}=a.current;e.style.setProperty("--tkx-holo-rx",`${t}deg`),e.style.setProperty("--tkx-holo-ry",`${n}deg`),e.style.setProperty("--tkx-holo-mx",`${r}%`),e.style.setProperty("--tkx-holo-my",`${o}%`),i.current=null}function s(){null==i.current&&(i.current=requestAnimationFrame(l))}function d(n){const r=e.getBoundingClientRect(),o=(n.clientX-r.left)/r.width,i=(n.clientY-r.top)/r.height,l=Math.max(0,Math.min(1,o)),d=Math.max(0,Math.min(1,i));a.current={rx:(.5-d)*t*2,ry:(l-.5)*t*2,mx:100*l,my:100*d},e.classList.add("tkx-holo-tracking"),s()}function c(){a.current={rx:0,ry:0,mx:50,my:50},e.classList.remove("tkx-holo-tracking"),s()}},[t,n,o]),r}var Hd=i(function({children:e,maxTilt:t=14,scanLines:n=!0,foilIntensity:r="strong",radius:o=16,disabled:i=!1,className:a,style:l,...d},c){const u=se(),p=Vd({maxTilt:t,disabled:i});s(()=>{if(!c)return;const e=p.current;"function"==typeof c?c(e):c.current=e},[c,p]);const h={borderRadius:"number"==typeof o?`${o}px`:o,background:`linear-gradient(135deg, ${u.surface}cc, ${u.surfaceAlt}cc)`,border:`1px solid ${u.border}`,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:u.text,...l};/* @__PURE__ */
502
529
  return b("div",{ref:p,className:["tkx-holo-root",a].filter(Boolean).join(" "),style:h,...d,children:["none"!==r&&/* @__PURE__ */x("div",{className:"tkx-holo-foil "+("soft"===r?"tkx-holo-foil-soft":""),"aria-hidden":"true"}),n&&/* @__PURE__ */x("div",{className:"tkx-holo-scan","aria-hidden":"true"}),
503
- /* @__PURE__ */x("div",{className:"tkx-holo-content",children:e})]})}),Id=i(function({title:e,subtitle:t,badge:n,children:r,padding:o=24,...i},a){const l=se(),s=d(),c="number"==typeof o?`${o}px`:o;/* @__PURE__ */
504
- return x(Fd,{ref:a,role:"article","aria-labelledby":e?s:void 0,...i,style:{minHeight:200,...i.style},children:/* @__PURE__ */b("div",{style:{padding:c},children:[(e||n)&&/* @__PURE__ */b("header",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:12,marginBottom:t?4:12},children:[e&&/* @__PURE__ */x("h3",{id:s,style:{margin:0,fontSize:20,fontWeight:700,letterSpacing:"-0.01em",color:l.text},children:e}),n]}),t&&/* @__PURE__ */x("p",{style:{margin:"0 0 16px",color:l.textMuted,fontSize:14},children:t}),r]})})}),Ad=i(function({src:e,alt:t,size:n=96,initials:r,scanLines:o=!1,...i},a){const l=se();/* @__PURE__ */
505
- return x(Fd,{ref:a,radius:"50%",scanLines:o,...i,style:{width:n,height:n,...i.style},children:e?/* @__PURE__ */x("img",{src:e,alt:t,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",display:"block"}}):/* @__PURE__ */x("div",{role:"img","aria-label":t,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:.36*n,fontWeight:700,color:l.text},children:r??t.charAt(0).toUpperCase()})})}),Ld={sm:"4px 10px",md:"6px 14px",lg:"8px 18px"},Td={sm:11,md:13,lg:15},Wd={neutral:{fg:"#c4a8ff",bg:"rgba(196,168,255,0.10)",bd:"rgba(196,168,255,0.30)"},success:{fg:"#00f5d4",bg:"rgba(0,245,212,0.10)",bd:"rgba(0,245,212,0.40)"},info:{fg:"#7b8eff",bg:"rgba(123,142,255,0.10)",bd:"rgba(123,142,255,0.40)"},warning:{fg:"#ffbe0b",bg:"rgba(255,190,11,0.10)",bd:"rgba(255,190,11,0.40)"},danger:{fg:"#ff7eaf",bg:"rgba(255,0,110,0.10)",bd:"rgba(255,0,110,0.40)"}},jd=i(function({children:e,size:t="md",tone:n="neutral",scanLines:r=!1,...o},i){const a=Wd[n];/* @__PURE__ */
506
- return x(Fd,{ref:i,radius:999,scanLines:r,maxTilt:6,...o,style:{display:"inline-flex",padding:Ld[t],fontSize:Td[t],fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:a.fg,background:a.bg,border:`1px solid ${a.bd}`,...o.style},children:e})}),Ed=i(function({children:e,onClick:t,isDisabled:n=!1,type:r="button",maxTilt:o=8,...i},a){const l=se(),d=et(),c=f(null),u=Rd({maxTilt:o,disabled:n});return s(()=>{const e=c.current;e&&(u.current=e,"function"==typeof a?a(e):a&&(a.current=e))},[a,u]),/* @__PURE__ */b("button",{ref:c,type:r,onClick:n?void 0:t,disabled:n,className:"tkx-holo-root",style:{position:"relative",padding:"14px 28px",fontSize:15,fontWeight:700,letterSpacing:"0.02em",color:l.text,background:`linear-gradient(135deg, ${l.surface}, ${l.surfaceAlt})`,border:`1px solid ${l.primary}55`,borderRadius:12,cursor:n?"not-allowed":"pointer",opacity:n?.5:1,minHeight:44,transformStyle:"preserve-3d",...i.style},...i,children:[
530
+ /* @__PURE__ */x("div",{className:"tkx-holo-content",children:e})]})}),Od=i(function({title:e,subtitle:t,badge:n,children:r,padding:o=24,...i},a){const l=se(),s=d(),c="number"==typeof o?`${o}px`:o;/* @__PURE__ */
531
+ return x(Hd,{ref:a,role:"article","aria-labelledby":e?s:void 0,...i,style:{minHeight:200,...i.style},children:/* @__PURE__ */b("div",{style:{padding:c},children:[(e||n)&&/* @__PURE__ */b("header",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:12,marginBottom:t?4:12},children:[e&&/* @__PURE__ */x("h3",{id:s,style:{margin:0,fontSize:20,fontWeight:700,letterSpacing:"-0.01em",color:l.text},children:e}),n]}),t&&/* @__PURE__ */x("p",{style:{margin:"0 0 16px",color:l.textMuted,fontSize:14},children:t}),r]})})}),qd=i(function({src:e,alt:t,size:n=96,initials:r,scanLines:o=!1,...i},a){const l=se();/* @__PURE__ */
532
+ return x(Hd,{ref:a,radius:"50%",scanLines:o,...i,style:{width:n,height:n,...i.style},children:e?/* @__PURE__ */x("img",{src:e,alt:t,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",display:"block"}}):/* @__PURE__ */x("div",{role:"img","aria-label":t,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:.36*n,fontWeight:700,color:l.text},children:r??t.charAt(0).toUpperCase()})})}),Ud={sm:"4px 10px",md:"6px 14px",lg:"8px 18px"},Kd={sm:11,md:13,lg:15},Yd={neutral:{fg:"#c4a8ff",bg:"rgba(196,168,255,0.10)",bd:"rgba(196,168,255,0.30)"},success:{fg:"#00f5d4",bg:"rgba(0,245,212,0.10)",bd:"rgba(0,245,212,0.40)"},info:{fg:"#7b8eff",bg:"rgba(123,142,255,0.10)",bd:"rgba(123,142,255,0.40)"},warning:{fg:"#ffbe0b",bg:"rgba(255,190,11,0.10)",bd:"rgba(255,190,11,0.40)"},danger:{fg:"#ff7eaf",bg:"rgba(255,0,110,0.10)",bd:"rgba(255,0,110,0.40)"}},Xd=i(function({children:e,size:t="md",tone:n="neutral",scanLines:r=!1,...o},i){const a=Yd[n];/* @__PURE__ */
533
+ return x(Hd,{ref:i,radius:999,scanLines:r,maxTilt:6,...o,style:{display:"inline-flex",padding:Ud[t],fontSize:Kd[t],fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:a.fg,background:a.bg,border:`1px solid ${a.bd}`,...o.style},children:e})}),Zd=i(function({children:e,onClick:t,isDisabled:n=!1,type:r="button",maxTilt:o=8,...i},a){const l=se(),d=et(),c=f(null),u=Vd({maxTilt:o,disabled:n});return s(()=>{const e=c.current;e&&(u.current=e,"function"==typeof a?a(e):a&&(a.current=e))},[a,u]),/* @__PURE__ */b("button",{ref:c,type:r,onClick:n?void 0:t,disabled:n,className:"tkx-holo-root",style:{position:"relative",padding:"14px 28px",fontSize:15,fontWeight:700,letterSpacing:"0.02em",color:l.text,background:`linear-gradient(135deg, ${l.surface}, ${l.surfaceAlt})`,border:`1px solid ${l.primary}55`,borderRadius:12,cursor:n?"not-allowed":"pointer",opacity:n?.5:1,minHeight:44,transformStyle:"preserve-3d",...i.style},...i,children:[
507
534
  /* @__PURE__ */x("span",{className:"tkx-holo-foil","aria-hidden":"true"}),
508
- /* @__PURE__ */x("span",{className:"tkx-holo-content",style:{display:"inline-block"},children:e}),!d&&!n&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{position:"absolute",inset:-1,borderRadius:12,border:`1px solid ${l.primary}88`,boxShadow:`0 0 24px ${l.primary}44`,pointerEvents:"none",opacity:.6}})]})});function Bd(){s(()=>{Dd()},[])}var Vd=i(function({header:e,footer:t,tabs:n,activeTabId:r,onTabChange:o,accent:i="#00f5d4",children:a,style:l,...s},d){return Bd(),/* @__PURE__ */b("div",{ref:d,className:"tkx-holo-root",style:{position:"relative",display:"flex",flexDirection:"column",padding:0,borderRadius:14,background:"linear-gradient(180deg, rgba(13,13,20,0.85), rgba(8,8,14,0.85))",border:`1px solid ${i}33`,boxShadow:`0 0 0 1px ${i}11, 0 12px 40px rgba(0,0,0,0.5)`,overflow:"hidden",color:"#e8e8f4",...l},...s,children:[
535
+ /* @__PURE__ */x("span",{className:"tkx-holo-content",style:{display:"inline-block"},children:e}),!d&&!n&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{position:"absolute",inset:-1,borderRadius:12,border:`1px solid ${l.primary}88`,boxShadow:`0 0 24px ${l.primary}44`,pointerEvents:"none",opacity:.6}})]})});function Gd(){s(()=>{Ed()},[])}var _d=i(function({header:e,footer:t,tabs:n,activeTabId:r,onTabChange:o,accent:i="#00f5d4",children:a,style:l,...s},d){return Gd(),/* @__PURE__ */b("div",{ref:d,className:"tkx-holo-root",style:{position:"relative",display:"flex",flexDirection:"column",padding:0,borderRadius:14,background:"linear-gradient(180deg, rgba(13,13,20,0.85), rgba(8,8,14,0.85))",border:`1px solid ${i}33`,boxShadow:`0 0 0 1px ${i}11, 0 12px 40px rgba(0,0,0,0.5)`,overflow:"hidden",color:"#e8e8f4",...l},...s,children:[
509
536
  /* @__PURE__ */x("span",{className:"tkx-holo-foil","aria-hidden":"true"}),e&&/* @__PURE__ */x("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${i}22`,display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,position:"relative",zIndex:1},children:e}),n&&n.length>0&&/* @__PURE__ */x("div",{role:"tablist",style:{display:"flex",gap:0,borderBottom:`1px solid ${i}22`,position:"relative",zIndex:1},children:n.map(e=>{const t=e.id===r;/* @__PURE__ */
510
537
  return x("button",{type:"button",role:"tab","aria-selected":t,onClick:()=>o?.(e.id),style:{padding:"10px 14px",minHeight:38,border:"none",background:"transparent",color:t?i:"#aaa",fontWeight:600,fontSize:12,cursor:"pointer",borderBottom:`2px solid ${t?i:"transparent"}`},children:e.label},e.id)})}),
511
- /* @__PURE__ */x("div",{style:{padding:16,flex:1,position:"relative",zIndex:1,minHeight:0},children:a}),t&&/* @__PURE__ */x("div",{style:{padding:"12px 16px",borderTop:`1px solid ${i}22`,position:"relative",zIndex:1},children:t})]})});function Hd({value:e,size:t=140,thickness:n=.12,accent:r="#00f5d4",label:o,caption:i,ariaValueText:a,className:l,style:s}){Bd();const d=Math.max(0,Math.min(100,e)),c=t*n,u=(t-c)/2,p=t/2,h=t/2,m=2*Math.PI*u,g=d/100*m,y=f(`holo-gauge-${Math.random().toString(36).slice(2,8)}`).current;/* @__PURE__ */
538
+ /* @__PURE__ */x("div",{style:{padding:16,flex:1,position:"relative",zIndex:1,minHeight:0},children:a}),t&&/* @__PURE__ */x("div",{style:{padding:"12px 16px",borderTop:`1px solid ${i}22`,position:"relative",zIndex:1},children:t})]})});function Jd({value:e,size:t=140,thickness:n=.12,accent:r="#00f5d4",label:o,caption:i,ariaValueText:a,className:l,style:s}){Gd();const d=Math.max(0,Math.min(100,e)),c=t*n,u=(t-c)/2,p=t/2,h=t/2,m=2*Math.PI*u,g=d/100*m,y=f(`holo-gauge-${Math.random().toString(36).slice(2,8)}`).current;/* @__PURE__ */
512
539
  return b("div",{role:"meter","aria-valuenow":d,"aria-valuemin":0,"aria-valuemax":100,"aria-valuetext":a??`${d.toFixed(0)} percent`,className:l,style:{position:"relative",width:t,height:t,display:"inline-flex",alignItems:"center",justifyContent:"center",...s},children:[/* @__PURE__ */b("svg",{width:t,height:t,"aria-hidden":"true",style:{position:"absolute",inset:0},children:[
513
540
  /* @__PURE__ */x("defs",{children:/* @__PURE__ */b("linearGradient",{id:y,x1:"0",y1:"0",x2:"1",y2:"1",children:[
514
541
  /* @__PURE__ */x("stop",{offset:"0%",stopColor:r,stopOpacity:.95}),
515
542
  /* @__PURE__ */x("stop",{offset:"50%",stopColor:"#7b2ff7",stopOpacity:.95}),
516
543
  /* @__PURE__ */x("stop",{offset:"100%",stopColor:r,stopOpacity:.95})]})}),
517
544
  /* @__PURE__ */x("circle",{cx:p,cy:h,r:u,fill:"none",stroke:`${r}1a`,strokeWidth:c}),
518
- /* @__PURE__ */x("circle",{cx:p,cy:h,r:u,fill:"none",stroke:`url(#${y})`,strokeWidth:c,strokeLinecap:"round",strokeDasharray:`${g} ${m}`,transform:`rotate(-90 ${p} ${h})`,style:{filter:`drop-shadow(0 0 6px ${r}aa)`,transition:"stroke-dasharray 600ms cubic-bezier(.2,.8,.2,1)"}})]}),/* @__PURE__ */b("div",{style:{position:"relative",textAlign:"center",zIndex:1,color:"#e8e8f4"},children:[/* @__PURE__ */x("div",{style:{fontSize:.22*t,fontWeight:800,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontVariantNumeric:"tabular-nums",color:r,lineHeight:1,textShadow:`0 0 16px ${r}88`},children:o??`${d.toFixed(0)}%`}),i&&/* @__PURE__ */x("div",{style:{fontSize:10,color:"#888",marginTop:4,textTransform:"uppercase",letterSpacing:"0.08em"},children:i})]})]})}function Od({value:e,label:t,valueLabel:n,height:r=8,accent:o="#00f5d4",shimmer:i=!0,className:a,style:l}){Bd();const s=Math.max(0,Math.min(1,e));/* @__PURE__ */
519
- return b("div",{className:a,style:l,children:[(t||n)&&/* @__PURE__ */b("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:6,fontSize:12},children:[/* @__PURE__ */x("span",{style:{color:"#aaa",fontWeight:600},children:t}),/* @__PURE__ */x("span",{style:{color:o,fontFamily:"ui-monospace, monospace",fontVariantNumeric:"tabular-nums"},children:n??`${(100*s).toFixed(0)}%`})]}),/* @__PURE__ */x("div",{role:"progressbar","aria-valuenow":Math.round(100*s),"aria-valuemin":0,"aria-valuemax":100,style:{position:"relative",height:r,width:"100%",borderRadius:r,background:`${o}14`,overflow:"hidden"},children:/* @__PURE__ */x("div",{style:{position:"absolute",inset:0,width:100*s+"%",background:`linear-gradient(90deg, ${o}, #7b2ff7, ${o})`,backgroundSize:"200% 100%",animation:i?"tkx-holo-shimmer 3s linear infinite":void 0,boxShadow:`0 0 12px ${o}88`,transition:"width 600ms cubic-bezier(.2,.8,.2,1)",borderRadius:r}})})]})}function qd({lines:e,typeSpeed:t=12,prompt:n="$ ",maxLines:r=10,height:o=220,accent:i="#00f5d4",className:a,style:l}){Bd();const d=f(null),[c,u]=m(()=>0===t?e:[]),p=f(0);s(()=>{if(0===t)return void u(e);if(e.length<=p.current)return u(e),void(p.current=e.length);let n=!1;const r=p.current,o=e[r]??"";let i=0;u(e=>[...e.slice(0,r),""]);const a=()=>{n||(i+=1,u(e=>{const t=e.slice();return t[r]=o.slice(0,i),t}),i<o.length?setTimeout(a,t):(p.current=r+1,e.length>p.current&&u(e=>[...e,""])))};return a(),()=>{n=!0}},[e,t]),s(()=>{const e=d.current;e&&(e.scrollTop=e.scrollHeight)},[c]);const h=c.slice(-r);/* @__PURE__ */
545
+ /* @__PURE__ */x("circle",{cx:p,cy:h,r:u,fill:"none",stroke:`url(#${y})`,strokeWidth:c,strokeLinecap:"round",strokeDasharray:`${g} ${m}`,transform:`rotate(-90 ${p} ${h})`,style:{filter:`drop-shadow(0 0 6px ${r}aa)`,transition:"stroke-dasharray 600ms cubic-bezier(.2,.8,.2,1)"}})]}),/* @__PURE__ */b("div",{style:{position:"relative",textAlign:"center",zIndex:1,color:"#e8e8f4"},children:[/* @__PURE__ */x("div",{style:{fontSize:.22*t,fontWeight:800,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontVariantNumeric:"tabular-nums",color:r,lineHeight:1,textShadow:`0 0 16px ${r}88`},children:o??`${d.toFixed(0)}%`}),i&&/* @__PURE__ */x("div",{style:{fontSize:10,color:"#888",marginTop:4,textTransform:"uppercase",letterSpacing:"0.08em"},children:i})]})]})}function Qd({value:e,label:t,valueLabel:n,height:r=8,accent:o="#00f5d4",shimmer:i=!0,className:a,style:l}){Gd();const s=Math.max(0,Math.min(1,e));/* @__PURE__ */
546
+ return b("div",{className:a,style:l,children:[(t||n)&&/* @__PURE__ */b("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:6,fontSize:12},children:[/* @__PURE__ */x("span",{style:{color:"#aaa",fontWeight:600},children:t}),/* @__PURE__ */x("span",{style:{color:o,fontFamily:"ui-monospace, monospace",fontVariantNumeric:"tabular-nums"},children:n??`${(100*s).toFixed(0)}%`})]}),/* @__PURE__ */x("div",{role:"progressbar","aria-valuenow":Math.round(100*s),"aria-valuemin":0,"aria-valuemax":100,style:{position:"relative",height:r,width:"100%",borderRadius:r,background:`${o}14`,overflow:"hidden"},children:/* @__PURE__ */x("div",{style:{position:"absolute",inset:0,width:100*s+"%",background:`linear-gradient(90deg, ${o}, #7b2ff7, ${o})`,backgroundSize:"200% 100%",animation:i?"tkx-holo-shimmer 3s linear infinite":void 0,boxShadow:`0 0 12px ${o}88`,transition:"width 600ms cubic-bezier(.2,.8,.2,1)",borderRadius:r}})})]})}function ec({lines:e,typeSpeed:t=12,prompt:n="$ ",maxLines:r=10,height:o=220,accent:i="#00f5d4",className:a,style:l}){Gd();const d=f(null),[c,u]=m(()=>0===t?e:[]),p=f(0);s(()=>{if(0===t)return void u(e);if(e.length<=p.current)return u(e),void(p.current=e.length);let n=!1;const r=p.current,o=e[r]??"";let i=0;u(e=>[...e.slice(0,r),""]);const a=()=>{n||(i+=1,u(e=>{const t=e.slice();return t[r]=o.slice(0,i),t}),i<o.length?setTimeout(a,t):(p.current=r+1,e.length>p.current&&u(e=>[...e,""])))};return a(),()=>{n=!0}},[e,t]),s(()=>{const e=d.current;e&&(e.scrollTop=e.scrollHeight)},[c]);const h=c.slice(-r);/* @__PURE__ */
520
547
  return b("div",{ref:d,role:"log","aria-live":"polite",className:a,style:{position:"relative",height:o,padding:12,borderRadius:10,background:"linear-gradient(180deg, rgba(0,10,20,0.7), rgba(0,5,10,0.9))",border:`1px solid ${i}33`,color:i,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12,lineHeight:1.5,overflowY:"auto",boxShadow:`inset 0 0 24px ${i}14`,...l},children:[
521
548
  /* @__PURE__ */x("span",{className:"tkx-holo-foil","aria-hidden":"true",style:{borderRadius:10}}),
522
549
  /* @__PURE__ */x("pre",{style:{margin:0,position:"relative",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:h.map((e,t)=>/* @__PURE__ */b("div",{children:[
523
550
  /* @__PURE__ */x("span",{style:{color:"#666"},children:n}),
524
551
  /* @__PURE__ */x("span",{style:{color:i},children:e}),t===h.length-1&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.6ch",height:"1em",marginLeft:2,background:i,verticalAlign:"text-bottom",animation:"tkx-holo-cursor 1.1s steps(2) infinite"}})]},t))}),
525
- /* @__PURE__ */x("style",{children:"\n @keyframes tkx-holo-cursor {\n 0%, 49% { opacity: 1; }\n 50%, 100% { opacity: 0; }\n }\n "})]})}var Ud=i(function({columns:e,onReorder:t,renderCard:n,onCardClick:r,maxHeight:o=720,minColumnWidth:i=280,isDragDisabled:l=!1,className:c,style:u},h){const y=se(),v=et();d();const[w,k]=m(null),[$,S]=m(""),C=f(/* @__PURE__ */new Map),z=a((e,t,n,r)=>{l||t.isDragDisabled||0!==e.button&&"mouse"===e.pointerType||(e.currentTarget.setPointerCapture(e.pointerId),k({cardId:t.id,fromColumnId:n.id,fromIndex:r,mode:"pointer",ghostX:0,ghostY:0,toColumnId:n.id,toIndex:r}),S(`Picked up "${t.title}" from ${n.title}, position ${r+1}`))},[l]),M=a((e,t,n)=>{if(!w||"pointer"!==w.mode)return;e.currentTarget;const r=C.current.get(w.cardId);if(!r)return;const o=r.getBoundingClientRect();k(r=>r?{...r,ghostX:e.clientX-(o.left+o.width/2),ghostY:e.clientY-(o.top+o.height/2),toColumnId:t.id,toIndex:n}:r)},[w]),N=a(()=>{w&&"pointer"===w.mode&&P(w)},[w]),D=a(()=>{w&&(S("Drag cancelled"),k(null))},[w]);function P(n){if(n.fromColumnId!==n.toColumnId||n.fromIndex!==n.toIndex){const r=e.find(e=>e.id===n.toColumnId),o=e.find(e=>e.id===n.fromColumnId)?.cards[n.fromIndex];t({cardId:n.cardId,fromColumnId:n.fromColumnId,fromIndex:n.fromIndex,toColumnId:n.toColumnId,toIndex:n.toIndex}),S(o&&r?`Moved "${o.title}" to ${r.title}, position ${n.toIndex+1}`:"Card moved")}else S("Returned to original position");k(null)}const R=a((t,n,r,o)=>{if(l||n.isDragDisabled)return;if(" "===t.key||"Enter"===t.key)return t.preventDefault(),void(w?P(w):(k({cardId:n.id,fromColumnId:r.id,fromIndex:o,mode:"keyboard",toColumnId:r.id,toIndex:o}),S(`Grabbed "${n.title}". Use arrow keys to move. Enter to drop, Esc to cancel.`)));if("Escape"===t.key&&w)return t.preventDefault(),void D();if(!w||"keyboard"!==w.mode||w.cardId!==n.id)return;const i=e.findIndex(e=>e.id===w.toColumnId),a=e[i];if(a)switch(t.key){case"ArrowUp":t.preventDefault(),w.toIndex>0&&(k({...w,toIndex:w.toIndex-1}),S(`Position ${w.toIndex} of ${a.cards.length}`));break;case"ArrowDown":t.preventDefault(),w.toIndex<a.cards.length&&(k({...w,toIndex:w.toIndex+1}),S(`Position ${w.toIndex+2} of ${a.cards.length+1}`));break;case"ArrowLeft":if(t.preventDefault(),i>0){const t=e[i-1];k({...w,toColumnId:t.id,toIndex:Math.min(w.toIndex,t.cards.length)}),S(`Moved to ${t.title}`)}break;case"ArrowRight":if(t.preventDefault(),i<e.length-1){const t=e[i+1];k({...w,toColumnId:t.id,toIndex:Math.min(w.toIndex,t.cards.length)}),S(`Moved to ${t.title}`)}}},[e,w,D,l]);s(()=>{if(!w)return;const e=e=>{"Escape"===e.key&&D()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[w,D]);const F=a(e=>/* @__PURE__ */b(g,{children:[e.badges&&e.badges.length>0&&/* @__PURE__ */x("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap"},children:e.badges.map((e,t)=>/* @__PURE__ */x("span",{style:{padding:"2px 8px",fontSize:10,fontWeight:700,borderRadius:999,background:e.color?`${e.color}22`:`${y.primary}22`,color:e.color??y.primary,letterSpacing:"0.05em",textTransform:"uppercase"},children:e.label},t))}),
552
+ /* @__PURE__ */x("style",{children:"\n @keyframes tkx-holo-cursor {\n 0%, 49% { opacity: 1; }\n 50%, 100% { opacity: 0; }\n }\n "})]})}var tc=i(function({columns:e,onReorder:t,renderCard:n,onCardClick:r,maxHeight:o=720,minColumnWidth:i=280,isDragDisabled:l=!1,className:c,style:u},h){const y=se(),v=et();d();const[w,k]=m(null),[$,S]=m(""),C=f(/* @__PURE__ */new Map),z=a((e,t,n,r)=>{l||t.isDragDisabled||0!==e.button&&"mouse"===e.pointerType||(e.currentTarget.setPointerCapture(e.pointerId),k({cardId:t.id,fromColumnId:n.id,fromIndex:r,mode:"pointer",ghostX:0,ghostY:0,toColumnId:n.id,toIndex:r}),S(`Picked up "${t.title}" from ${n.title}, position ${r+1}`))},[l]),M=a((e,t,n)=>{if(!w||"pointer"!==w.mode)return;e.currentTarget;const r=C.current.get(w.cardId);if(!r)return;const o=r.getBoundingClientRect();k(r=>r?{...r,ghostX:e.clientX-(o.left+o.width/2),ghostY:e.clientY-(o.top+o.height/2),toColumnId:t.id,toIndex:n}:r)},[w]),N=a(()=>{w&&"pointer"===w.mode&&R(w)},[w]),D=a(()=>{w&&(S("Drag cancelled"),k(null))},[w]);function R(n){if(n.fromColumnId!==n.toColumnId||n.fromIndex!==n.toIndex){const r=e.find(e=>e.id===n.toColumnId),o=e.find(e=>e.id===n.fromColumnId)?.cards[n.fromIndex];t({cardId:n.cardId,fromColumnId:n.fromColumnId,fromIndex:n.fromIndex,toColumnId:n.toColumnId,toIndex:n.toIndex}),S(o&&r?`Moved "${o.title}" to ${r.title}, position ${n.toIndex+1}`:"Card moved")}else S("Returned to original position");k(null)}const P=a((t,n,r,o)=>{if(l||n.isDragDisabled)return;if(" "===t.key||"Enter"===t.key)return t.preventDefault(),void(w?R(w):(k({cardId:n.id,fromColumnId:r.id,fromIndex:o,mode:"keyboard",toColumnId:r.id,toIndex:o}),S(`Grabbed "${n.title}". Use arrow keys to move. Enter to drop, Esc to cancel.`)));if("Escape"===t.key&&w)return t.preventDefault(),void D();if(!w||"keyboard"!==w.mode||w.cardId!==n.id)return;const i=e.findIndex(e=>e.id===w.toColumnId),a=e[i];if(a)switch(t.key){case"ArrowUp":t.preventDefault(),w.toIndex>0&&(k({...w,toIndex:w.toIndex-1}),S(`Position ${w.toIndex} of ${a.cards.length}`));break;case"ArrowDown":t.preventDefault(),w.toIndex<a.cards.length&&(k({...w,toIndex:w.toIndex+1}),S(`Position ${w.toIndex+2} of ${a.cards.length+1}`));break;case"ArrowLeft":if(t.preventDefault(),i>0){const t=e[i-1];k({...w,toColumnId:t.id,toIndex:Math.min(w.toIndex,t.cards.length)}),S(`Moved to ${t.title}`)}break;case"ArrowRight":if(t.preventDefault(),i<e.length-1){const t=e[i+1];k({...w,toColumnId:t.id,toIndex:Math.min(w.toIndex,t.cards.length)}),S(`Moved to ${t.title}`)}}},[e,w,D,l]);s(()=>{if(!w)return;const e=e=>{"Escape"===e.key&&D()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[w,D]);const F=a(e=>/* @__PURE__ */b(g,{children:[e.badges&&e.badges.length>0&&/* @__PURE__ */x("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap"},children:e.badges.map((e,t)=>/* @__PURE__ */x("span",{style:{padding:"2px 8px",fontSize:10,fontWeight:700,borderRadius:999,background:e.color?`${e.color}22`:`${y.primary}22`,color:e.color??y.primary,letterSpacing:"0.05em",textTransform:"uppercase"},children:e.label},t))}),
526
553
  /* @__PURE__ */x("div",{style:{fontSize:14,fontWeight:600,color:y.text,lineHeight:1.4},children:e.title}),e.description&&/* @__PURE__ */x("div",{style:{fontSize:12,color:y.textMuted,marginTop:6,lineHeight:1.5},children:e.description}),e.assignee&&/* @__PURE__ */b("div",{style:{marginTop:10,display:"flex",alignItems:"center",gap:6,fontSize:11,color:y.textMuted},children:[e.assignee.avatarUrl?/* @__PURE__ */x("img",{src:e.assignee.avatarUrl,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):/* @__PURE__ */x("div",{"aria-hidden":"true",style:{width:20,height:20,borderRadius:"50%",background:y.primary,color:y.bg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700},children:e.assignee.name.charAt(0).toUpperCase()}),/* @__PURE__ */x("span",{children:e.assignee.name})]})]}),[y]),I=p(()=>({display:"grid",gridAutoFlow:"column",gridAutoColumns:`minmax(${i}px, 1fr)`,gap:12,overflowX:"auto",maxHeight:"number"==typeof o?`${o}px`:o,padding:4,...u}),[o,i,u]);/* @__PURE__ */
527
554
  return b("div",{ref:h,className:c,role:"grid","aria-label":"Kanban board","aria-rowcount":Math.max(...e.map(e=>e.cards.length),0)+1,"aria-colcount":e.length,style:I,children:[/* @__PURE__ */x("div",{"aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0},children:$}),e.map((e,t)=>{const o=w?.toColumnId===e.id,i=void 0!==e.wipLimit&&e.cards.length>=e.wipLimit;/* @__PURE__ */
528
555
  return b("section",{role:"row","aria-rowindex":t+1,"aria-label":`Column: ${e.title}`,style:{background:y.surface,border:`1px solid ${o?e.color??y.primary:y.border}`,borderRadius:12,display:"flex",flexDirection:"column",minHeight:0,transition:"border-color 120ms"},children:[/* @__PURE__ */b("header",{style:{padding:"12px 14px",borderBottom:`1px solid ${y.border}`,display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[
529
556
  /* @__PURE__ */x("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",background:e.color??y.primary}}),
530
557
  /* @__PURE__ */x("h3",{style:{margin:0,fontSize:13,fontWeight:700,color:y.text,letterSpacing:"0.02em",flex:1},children:e.title}),
531
558
  /* @__PURE__ */b("span",{style:{fontSize:12,color:i?y.danger:y.textMuted,fontFamily:"monospace",fontWeight:600},"aria-label":e.wipLimit?`${e.cards.length} of ${e.wipLimit} cards`:`${e.cards.length} cards`,children:[e.cards.length,e.wipLimit&&` / ${e.wipLimit}`]})]}),/* @__PURE__ */b("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8,overflowY:"auto",flex:1,minHeight:60},children:[e.cards.map((o,i)=>{const a=w?.cardId===o.id;/* @__PURE__ */
532
- return b("div",{children:[w&&w.toColumnId===e.id&&w.toIndex===i&&!a&&/* @__PURE__ */x(Kd,{color:e.color??y.primary}),/* @__PURE__ */x("div",{ref:e=>{e?C.current.set(o.id,e):C.current.delete(o.id)},role:"gridcell","aria-rowindex":i+1,"aria-colindex":t+1,"aria-grabbed":a,"aria-label":o.title,tabIndex:0,"data-card-id":o.id,onPointerDown:t=>z(t,o,e,i),onPointerMove:t=>"pointer"===w?.mode?M(t,e,i):void 0,onPointerUp:N,onPointerCancel:D,onKeyDown:t=>R(t,o,e,i),onClick:()=>{w||r?.(o,e)},style:{padding:12,borderRadius:8,background:y.surfaceAlt,border:`1px solid ${a?e.color??y.primary:y.border}`,cursor:l||o.isDragDisabled?"default":"grab",touchAction:l||o.isDragDisabled?"auto":"none",opacity:a?.4:1,transform:a&&"pointer"===w.mode&&!v?`translate(${w.ghostX??0}px, ${w.ghostY??0}px) scale(1.02)`:void 0,transition:a||v?"none":"transform 120ms, border-color 120ms",userSelect:"none",outlineOffset:2},children:(n??F)(o,e)})]},`slot-${i}`)}),w&&w.toColumnId===e.id&&w.toIndex>=e.cards.length&&/* @__PURE__ */x(Kd,{color:e.color??y.primary}),0===e.cards.length&&!w&&/* @__PURE__ */x("div",{style:{padding:24,textAlign:"center",color:y.textMuted,fontSize:12,border:`1px dashed ${y.border}`,borderRadius:8},children:"No cards"})]})]},e.id)})]})});function Kd({color:e}){/* @__PURE__ */
533
- return x("div",{"aria-hidden":"true",style:{height:3,background:e,borderRadius:999,margin:"2px 0",boxShadow:`0 0 8px ${e}66`}})}var Yd=new Set(["P","BR","DIV","SPAN","B","STRONG","I","EM","U","S","STRIKE","DEL","H1","H2","H3","H4","H5","H6","UL","OL","LI","BLOCKQUOTE","PRE","CODE","A","IMG","HR"]),Xd=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","NOSCRIPT","TEMPLATE","META","LINK","BASE","FORM","INPUT","BUTTON","TEXTAREA","SELECT"]),Zd=new Set(["href","src","alt","title"]);function Gd(e){if(!e)return null;const t=e.trim().toLowerCase();return t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:")?null:e.trim()}function _d(e){if(!e)return null;const t=e.trim().toLowerCase();return t.startsWith("https://")||t.startsWith("http://")||t.startsWith("data:image/")?e.trim():null}function Jd(e){if("undefined"==typeof document)return e;const t=document.createElement("div");return t.innerHTML=e,Qd(t),t.innerHTML}function Qd(e){const t=Array.from(e.childNodes);for(const n of t){if(n.nodeType===Node.TEXT_NODE){const e=n.textContent||"",t=He(e);t!==e&&(n.textContent=t);continue}if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(Xd.has(t.tagName)){e.removeChild(t);continue}if(!Yd.has(t.tagName)){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t);continue}const r=Array.from(t.attributes);for(const e of r)if(e.name.startsWith("on"))t.removeAttribute(e.name);else if(Zd.has(e.name)){if("href"===e.name&&"A"===t.tagName){const n=Gd(e.value);n?(t.setAttribute("href",n),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank")):t.removeAttribute("href")}"src"===e.name&&"IMG"===t.tagName&&(_d(e.value)||t.removeAttribute("src"))}else t.removeAttribute(e.name);Qd(t)}else n.nodeType===Node.COMMENT_NODE&&e.removeChild(n)}}var ec=[{id:"bold",label:"Bold",icon:"B",cmd:"bold",shortcut:"⌘B"},{id:"italic",label:"Italic",icon:"I",cmd:"italic",shortcut:"⌘I"},{id:"underline",label:"Underline",icon:"U",cmd:"underline",shortcut:"⌘U"},{id:"strike",label:"Strikethrough",icon:"S",cmd:"strikeThrough"},{id:"h1",label:"Heading 1",icon:"H1"},{id:"h2",label:"Heading 2",icon:"H2"},{id:"h3",label:"Heading 3",icon:"H3"},{id:"ul",label:"Bullet list",icon:"•",cmd:"insertUnorderedList"},{id:"ol",label:"Numbered list",icon:"1.",cmd:"insertOrderedList"},{id:"quote",label:"Quote",icon:'"'},{id:"code",label:"Inline code",icon:"<>"},{id:"codeblock",label:"Code block",icon:"{ }"},{id:"link",label:"Link",icon:"🔗",shortcut:"⌘K"},{id:"image",label:"Image",icon:"🖼"},{id:"hr",label:"Divider",icon:"—"}],tc=i(function({initialValue:e="",onChange:t,placeholder:n="Start writing…",tools:r,maxHeight:o,minHeight:i=200,label:l="Rich text editor",isDisabled:u=!1,className:p,style:h,topSlot:g,bottomSlot:y},v){const w=se(),k=f(null),$=d(),[S,C]=m(/* @__PURE__ */new Set),[z,M]=m(!0),N=r??ec.map(e=>e.id),D=a(()=>{if(!k.current)return;const e=Jd(k.current.innerHTML);t?.(e),M(""===k.current.textContent?.trim())},[t]);c(v,()=>({getHTML:()=>Jd(k.current?.innerHTML??""),getMarkdown:()=>function(e){if("undefined"==typeof document)return e;const t=document.createElement("div");return t.innerHTML=Jd(e),function e(t,n=0){if(t.nodeType===Node.TEXT_NODE)return t.textContent||"";if(t.nodeType!==Node.ELEMENT_NODE)return"";const r=t,o=Array.from(r.childNodes).map(t=>e(t,n)).join("");switch(r.tagName){case"B":case"STRONG":return`**${o}**`;case"I":case"EM":return`*${o}*`;case"U":return`<u>${o}</u>`;case"S":case"STRIKE":case"DEL":return`~~${o}~~`;case"H1":return`# ${o}\n\n`;case"H2":return`## ${o}\n\n`;case"H3":return`### ${o}\n\n`;case"H4":return`#### ${o}\n\n`;case"H5":return`##### ${o}\n\n`;case"H6":return`###### ${o}\n\n`;case"P":return`${o}\n\n`;case"BR":return"\n";case"HR":return"\n---\n\n";case"BLOCKQUOTE":return`> ${o.replace(/\n/g,"\n> ")}\n\n`;case"CODE":return"PRE"===r.parentElement?.tagName?o:`\`${o}\``;case"PRE":return`\`\`\`\n${o}\n\`\`\`\n\n`;case"UL":case"OL":return"\n"+Array.from(r.children).map((t,o)=>e(t,n+1).replace(/^/,"OL"===r.tagName?`${o+1}. `:"- ")).join("")+"\n";case"LI":return`${" ".repeat(Math.max(0,n-1))}${o}\n`;case"A":return`[${o}](${r.getAttribute("href")||""})`;case"IMG":{const e=r.getAttribute("src")||"";return`![${r.getAttribute("alt")||""}](${e})`}default:return o}}(t).trim()}(k.current?.innerHTML??""),getText:()=>k.current?.textContent??"",setHTML:e=>{k.current&&(k.current.innerHTML=Jd(e),D())},focus:()=>k.current?.focus()})),s(()=>{k.current&&e&&(k.current.innerHTML=Jd(e),M(""===k.current.textContent?.trim()))},[]);const P=a(()=>{if("undefined"==typeof document)return;const e=/* @__PURE__ */new Set;try{document.queryCommandState("bold")&&e.add("bold"),document.queryCommandState("italic")&&e.add("italic"),document.queryCommandState("underline")&&e.add("underline"),document.queryCommandState("strikeThrough")&&e.add("strike"),document.queryCommandState("insertUnorderedList")&&e.add("ul"),document.queryCommandState("insertOrderedList")&&e.add("ol")}catch{}C(e)},[]);s(()=>(document.addEventListener("selectionchange",P),()=>document.removeEventListener("selectionchange",P)),[P]);const R=a(e=>{if(u)return;k.current?.focus();const t=ec.find(t=>t.id===e);switch(e){case"h1":case"h2":case"h3":document.execCommand("formatBlock",!1,e);break;case"quote":document.execCommand("formatBlock",!1,"blockquote");break;case"code":!function(){if("undefined"==typeof window)return;const e=window.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0),n=t.toString();if(!n)return;const r=document.createElement("code");r.textContent=n,t.deleteContents(),t.insertNode(r)}();break;case"codeblock":document.execCommand("formatBlock",!1,"pre");break;case"link":{const e=window.getSelection()?.toString()||"",t=window.prompt("Link URL","https://");if(!t)break;const r=Gd(t);if(!r){window.alert("That URL is not allowed.");break}const o=e||r;document.execCommand("insertHTML",!1,`<a href="${nc(r)}" target="_blank" rel="noopener noreferrer">${n=o,n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</a>`);break}case"image":{const e=window.prompt("Image URL (https:// or data:image/…)");if(!e)break;const t=_d(e);if(!t){window.alert("That image URL is not allowed.");break}const n=window.prompt("Alt text (required for accessibility)")||"";document.execCommand("insertHTML",!1,`<img src="${nc(t)}" alt="${nc(n)}" />`);break}case"hr":document.execCommand("insertHTML",!1,"<hr />");break;default:t?.cmd&&document.execCommand(t.cmd,!1)}var n;D(),P()},[u,D,P]),F=a(e=>{if(!e.metaKey&&!e.ctrlKey)return;const t=e.key.toLowerCase();"b"===t?(e.preventDefault(),R("bold")):"i"===t?(e.preventDefault(),R("italic")):"u"===t?(e.preventDefault(),R("underline")):"k"===t&&(e.preventDefault(),R("link"))},[R]),I=a(e=>{e.preventDefault();const t=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain");t?document.execCommand("insertHTML",!1,Jd(t)):n&&document.execCommand("insertText",!1,n),D()},[D]),A=a(e=>{const t=Array.from(e.currentTarget.querySelectorAll("button[data-tool]")),n=t.indexOf(document.activeElement);n<0||("ArrowRight"===e.key?(e.preventDefault(),t[(n+1)%t.length].focus()):"ArrowLeft"===e.key?(e.preventDefault(),t[(n-1+t.length)%t.length].focus()):"Home"===e.key?(e.preventDefault(),t[0].focus()):"End"===e.key&&(e.preventDefault(),t[t.length-1].focus()))},[]),L={border:`1px solid ${w.border}`,borderRadius:12,background:w.surface,...h},T={display:"flex",flexWrap:"wrap",gap:4,padding:8,borderBottom:`1px solid ${w.border}`,background:w.surfaceAlt,borderTopLeftRadius:12,borderTopRightRadius:12},W={padding:16,outline:"none",minHeight:"number"==typeof i?`${i}px`:i,maxHeight:"number"==typeof o?`${o}px`:o,overflowY:o?"auto":"visible",color:w.text,fontSize:15,lineHeight:1.6,borderBottomLeftRadius:12,borderBottomRightRadius:12,cursor:u?"not-allowed":"text",opacity:u?.6:1};/* @__PURE__ */
559
+ return b("div",{children:[w&&w.toColumnId===e.id&&w.toIndex===i&&!a&&/* @__PURE__ */x(nc,{color:e.color??y.primary}),/* @__PURE__ */x("div",{ref:e=>{e?C.current.set(o.id,e):C.current.delete(o.id)},role:"gridcell","aria-rowindex":i+1,"aria-colindex":t+1,"aria-grabbed":a,"aria-label":o.title,tabIndex:0,"data-card-id":o.id,onPointerDown:t=>z(t,o,e,i),onPointerMove:t=>"pointer"===w?.mode?M(t,e,i):void 0,onPointerUp:N,onPointerCancel:D,onKeyDown:t=>P(t,o,e,i),onClick:()=>{w||r?.(o,e)},style:{padding:12,borderRadius:8,background:y.surfaceAlt,border:`1px solid ${a?e.color??y.primary:y.border}`,cursor:l||o.isDragDisabled?"default":"grab",touchAction:l||o.isDragDisabled?"auto":"none",opacity:a?.4:1,transform:a&&"pointer"===w.mode&&!v?`translate(${w.ghostX??0}px, ${w.ghostY??0}px) scale(1.02)`:void 0,transition:a||v?"none":"transform 120ms, border-color 120ms",userSelect:"none",outlineOffset:2},children:(n??F)(o,e)})]},`slot-${i}`)}),w&&w.toColumnId===e.id&&w.toIndex>=e.cards.length&&/* @__PURE__ */x(nc,{color:e.color??y.primary}),0===e.cards.length&&!w&&/* @__PURE__ */x("div",{style:{padding:24,textAlign:"center",color:y.textMuted,fontSize:12,border:`1px dashed ${y.border}`,borderRadius:8},children:"No cards"})]})]},e.id)})]})});function nc({color:e}){/* @__PURE__ */
560
+ return x("div",{"aria-hidden":"true",style:{height:3,background:e,borderRadius:999,margin:"2px 0",boxShadow:`0 0 8px ${e}66`}})}var rc=new Set(["P","BR","DIV","SPAN","B","STRONG","I","EM","U","S","STRIKE","DEL","H1","H2","H3","H4","H5","H6","UL","OL","LI","BLOCKQUOTE","PRE","CODE","A","IMG","HR"]),oc=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","NOSCRIPT","TEMPLATE","META","LINK","BASE","FORM","INPUT","BUTTON","TEXTAREA","SELECT"]),ic=new Set(["href","src","alt","title"]);function ac(e){if(!e)return null;const t=e.trim().toLowerCase();return t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:")?null:e.trim()}function lc(e){if(!e)return null;const t=e.trim().toLowerCase();return t.startsWith("https://")||t.startsWith("http://")||t.startsWith("data:image/")?e.trim():null}function sc(e){if("undefined"==typeof document)return e;const t=document.createElement("div");return t.innerHTML=e,dc(t),t.innerHTML}function dc(e){const t=Array.from(e.childNodes);for(const n of t){if(n.nodeType===Node.TEXT_NODE){const e=n.textContent||"",t=He(e);t!==e&&(n.textContent=t);continue}if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(oc.has(t.tagName)){e.removeChild(t);continue}if(!rc.has(t.tagName)){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t);continue}const r=Array.from(t.attributes);for(const e of r)if(e.name.startsWith("on"))t.removeAttribute(e.name);else if(ic.has(e.name)){if("href"===e.name&&"A"===t.tagName){const n=ac(e.value);n?(t.setAttribute("href",n),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank")):t.removeAttribute("href")}"src"===e.name&&"IMG"===t.tagName&&(lc(e.value)||t.removeAttribute("src"))}else t.removeAttribute(e.name);dc(t)}else n.nodeType===Node.COMMENT_NODE&&e.removeChild(n)}}var cc=[{id:"bold",label:"Bold",icon:"B",cmd:"bold",shortcut:"⌘B"},{id:"italic",label:"Italic",icon:"I",cmd:"italic",shortcut:"⌘I"},{id:"underline",label:"Underline",icon:"U",cmd:"underline",shortcut:"⌘U"},{id:"strike",label:"Strikethrough",icon:"S",cmd:"strikeThrough"},{id:"h1",label:"Heading 1",icon:"H1"},{id:"h2",label:"Heading 2",icon:"H2"},{id:"h3",label:"Heading 3",icon:"H3"},{id:"ul",label:"Bullet list",icon:"•",cmd:"insertUnorderedList"},{id:"ol",label:"Numbered list",icon:"1.",cmd:"insertOrderedList"},{id:"quote",label:"Quote",icon:'"'},{id:"code",label:"Inline code",icon:"<>"},{id:"codeblock",label:"Code block",icon:"{ }"},{id:"link",label:"Link",icon:"🔗",shortcut:"⌘K"},{id:"image",label:"Image",icon:"🖼"},{id:"hr",label:"Divider",icon:"—"}],uc=i(function({initialValue:e="",onChange:t,placeholder:n="Start writing…",tools:r,maxHeight:o,minHeight:i=200,label:l="Rich text editor",isDisabled:u=!1,className:p,style:h,topSlot:g,bottomSlot:y},v){const w=se(),k=f(null),$=d(),[S,C]=m(/* @__PURE__ */new Set),[z,M]=m(!0),N=r??cc.map(e=>e.id),D=a(()=>{if(!k.current)return;const e=sc(k.current.innerHTML);t?.(e),M(""===k.current.textContent?.trim())},[t]);c(v,()=>({getHTML:()=>sc(k.current?.innerHTML??""),getMarkdown:()=>function(e){if("undefined"==typeof document)return e;const t=document.createElement("div");return t.innerHTML=sc(e),function e(t,n=0){if(t.nodeType===Node.TEXT_NODE)return t.textContent||"";if(t.nodeType!==Node.ELEMENT_NODE)return"";const r=t,o=Array.from(r.childNodes).map(t=>e(t,n)).join("");switch(r.tagName){case"B":case"STRONG":return`**${o}**`;case"I":case"EM":return`*${o}*`;case"U":return`<u>${o}</u>`;case"S":case"STRIKE":case"DEL":return`~~${o}~~`;case"H1":return`# ${o}\n\n`;case"H2":return`## ${o}\n\n`;case"H3":return`### ${o}\n\n`;case"H4":return`#### ${o}\n\n`;case"H5":return`##### ${o}\n\n`;case"H6":return`###### ${o}\n\n`;case"P":return`${o}\n\n`;case"BR":return"\n";case"HR":return"\n---\n\n";case"BLOCKQUOTE":return`> ${o.replace(/\n/g,"\n> ")}\n\n`;case"CODE":return"PRE"===r.parentElement?.tagName?o:`\`${o}\``;case"PRE":return`\`\`\`\n${o}\n\`\`\`\n\n`;case"UL":case"OL":return"\n"+Array.from(r.children).map((t,o)=>e(t,n+1).replace(/^/,"OL"===r.tagName?`${o+1}. `:"- ")).join("")+"\n";case"LI":return`${" ".repeat(Math.max(0,n-1))}${o}\n`;case"A":return`[${o}](${r.getAttribute("href")||""})`;case"IMG":{const e=r.getAttribute("src")||"";return`![${r.getAttribute("alt")||""}](${e})`}default:return o}}(t).trim()}(k.current?.innerHTML??""),getText:()=>k.current?.textContent??"",setHTML:e=>{k.current&&(k.current.innerHTML=sc(e),D())},focus:()=>k.current?.focus()})),s(()=>{k.current&&e&&(k.current.innerHTML=sc(e),M(""===k.current.textContent?.trim()))},[]);const R=a(()=>{if("undefined"==typeof document)return;const e=/* @__PURE__ */new Set;try{document.queryCommandState("bold")&&e.add("bold"),document.queryCommandState("italic")&&e.add("italic"),document.queryCommandState("underline")&&e.add("underline"),document.queryCommandState("strikeThrough")&&e.add("strike"),document.queryCommandState("insertUnorderedList")&&e.add("ul"),document.queryCommandState("insertOrderedList")&&e.add("ol")}catch{}C(e)},[]);s(()=>(document.addEventListener("selectionchange",R),()=>document.removeEventListener("selectionchange",R)),[R]);const P=a(e=>{if(u)return;k.current?.focus();const t=cc.find(t=>t.id===e);switch(e){case"h1":case"h2":case"h3":document.execCommand("formatBlock",!1,e);break;case"quote":document.execCommand("formatBlock",!1,"blockquote");break;case"code":!function(){if("undefined"==typeof window)return;const e=window.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0),n=t.toString();if(!n)return;const r=document.createElement("code");r.textContent=n,t.deleteContents(),t.insertNode(r)}();break;case"codeblock":document.execCommand("formatBlock",!1,"pre");break;case"link":{const e=window.getSelection()?.toString()||"",t=window.prompt("Link URL","https://");if(!t)break;const r=ac(t);if(!r){window.alert("That URL is not allowed.");break}const o=e||r;document.execCommand("insertHTML",!1,`<a href="${pc(r)}" target="_blank" rel="noopener noreferrer">${n=o,n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</a>`);break}case"image":{const e=window.prompt("Image URL (https:// or data:image/…)");if(!e)break;const t=lc(e);if(!t){window.alert("That image URL is not allowed.");break}const n=window.prompt("Alt text (required for accessibility)")||"";document.execCommand("insertHTML",!1,`<img src="${pc(t)}" alt="${pc(n)}" />`);break}case"hr":document.execCommand("insertHTML",!1,"<hr />");break;default:t?.cmd&&document.execCommand(t.cmd,!1)}var n;D(),R()},[u,D,R]),F=a(e=>{if(!e.metaKey&&!e.ctrlKey)return;const t=e.key.toLowerCase();"b"===t?(e.preventDefault(),P("bold")):"i"===t?(e.preventDefault(),P("italic")):"u"===t?(e.preventDefault(),P("underline")):"k"===t&&(e.preventDefault(),P("link"))},[P]),I=a(e=>{e.preventDefault();const t=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain");t?document.execCommand("insertHTML",!1,sc(t)):n&&document.execCommand("insertText",!1,n),D()},[D]),A=a(e=>{const t=Array.from(e.currentTarget.querySelectorAll("button[data-tool]")),n=t.indexOf(document.activeElement);n<0||("ArrowRight"===e.key?(e.preventDefault(),t[(n+1)%t.length].focus()):"ArrowLeft"===e.key?(e.preventDefault(),t[(n-1+t.length)%t.length].focus()):"Home"===e.key?(e.preventDefault(),t[0].focus()):"End"===e.key&&(e.preventDefault(),t[t.length-1].focus()))},[]),L={border:`1px solid ${w.border}`,borderRadius:12,background:w.surface,...h},T={display:"flex",flexWrap:"wrap",gap:4,padding:8,borderBottom:`1px solid ${w.border}`,background:w.surfaceAlt,borderTopLeftRadius:12,borderTopRightRadius:12},W={padding:16,outline:"none",minHeight:"number"==typeof i?`${i}px`:i,maxHeight:"number"==typeof o?`${o}px`:o,overflowY:o?"auto":"visible",color:w.text,fontSize:15,lineHeight:1.6,borderBottomLeftRadius:12,borderBottomRightRadius:12,cursor:u?"not-allowed":"text",opacity:u?.6:1};/* @__PURE__ */
534
561
  return b("div",{className:p,style:L,children:[g,
535
- /* @__PURE__ */x("div",{role:"toolbar","aria-label":"Formatting","aria-controls":$,onKeyDown:A,style:T,children:N.map((e,t)=>{const n=ec.find(t=>t.id===e);if(!n)return null;const r=S.has(e);/* @__PURE__ */
536
- return x("button",{type:"button","data-tool":n.id,tabIndex:0===t?0:-1,"aria-label":n.label+(n.shortcut?` (${n.shortcut})`:""),"aria-pressed":r,disabled:u,onMouseDown:e=>e.preventDefault(),onClick:()=>R(n.id),style:{background:r?w.primary:"transparent",color:r?w.bg:w.text,border:`1px solid ${r?w.primary:"transparent"}`,padding:"6px 10px",borderRadius:6,cursor:u?"not-allowed":"pointer",fontWeight:700,fontSize:13,minWidth:32,minHeight:32,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"background 120ms"},children:n.icon},n.id)})}),
537
- /* @__PURE__ */b("div",{style:{position:"relative"},children:[/* @__PURE__ */x("div",{ref:k,id:$,role:"textbox","aria-label":l,"aria-multiline":"true","aria-readonly":u,contentEditable:!u,suppressContentEditableWarning:!0,onInput:D,onKeyDown:F,onPaste:I,spellCheck:!0,style:W}),z&&!u&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",top:16,left:16,color:w.textMuted,pointerEvents:"none",fontSize:15},children:n})]}),y]})});function nc(e){return e.replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var rc=[{key:"bg",label:"Page background",group:"surface"},{key:"surface",label:"Card surface",group:"surface"},{key:"surfaceAlt",label:"Alt surface",group:"surface"},{key:"border",label:"Border",group:"surface"},{key:"text",label:"Body text",group:"text",contrastAgainst:"bg",threshold:7},{key:"textMuted",label:"Muted text",group:"text",contrastAgainst:"bg",threshold:4.5},{key:"primary",label:"Primary",group:"brand",contrastAgainst:"bg",threshold:4.5},{key:"secondary",label:"Secondary",group:"brand",contrastAgainst:"bg",threshold:4.5},{key:"success",label:"Success",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"warning",label:"Warning",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"danger",label:"Danger",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"info",label:"Info",group:"status",contrastAgainst:"bg",threshold:4.5}],oc={surface:"Surfaces",text:"Text",brand:"Brand",status:"Status colors"};function ic(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ac(e){const t=e.replace(/^#/,"").match(/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(!t)return 0;const[n,r,o]=[t[1],t[2],t[3]].map(e=>parseInt(e,16));return.2126*ic(n)+.7152*ic(r)+.0722*ic(o)}function lc({initialTheme:e,onChange:t,onExport:n,preview:r,exportName:o="myTheme",className:i,style:l}){const s=se(),d=e??s,[c,u]=m(d),[h,f]=m("ts"),[g,y]=m(!1),v=a((e,n)=>{u(r=>{const o={...r,[e]:n};return t?.(o),o})},[t]),w=p(()=>"json"===h?function(e){return JSON.stringify(e,null,2)}(c):"ts"===h?function(e,t="myTheme"){const n=["import type { ThemeTokens } from 'tekivex-ui';",""];n.push(`export const ${t}: ThemeTokens = {`);for(const[r,o]of Object.entries(e))n.push(` ${r}: ${JSON.stringify(o)},`);return n.push("};"),n.join("\n")}(c,o):function(e){const t=[":root {"];for(const[n,r]of Object.entries(e))t.push(` --tkx-${n}: ${r};`);return t.push("}"),t.join("\n")}(c),[c,h,o]),k=a(()=>{u(d),t?.(d)},[d,t]),$=p(()=>{const e={surface:[],text:[],brand:[],status:[]};for(const t of rc)e[t.group].push(t);return e},[]);/* @__PURE__ */
562
+ /* @__PURE__ */x("div",{role:"toolbar","aria-label":"Formatting","aria-controls":$,onKeyDown:A,style:T,children:N.map((e,t)=>{const n=cc.find(t=>t.id===e);if(!n)return null;const r=S.has(e);/* @__PURE__ */
563
+ return x("button",{type:"button","data-tool":n.id,tabIndex:0===t?0:-1,"aria-label":n.label+(n.shortcut?` (${n.shortcut})`:""),"aria-pressed":r,disabled:u,onMouseDown:e=>e.preventDefault(),onClick:()=>P(n.id),style:{background:r?w.primary:"transparent",color:r?w.bg:w.text,border:`1px solid ${r?w.primary:"transparent"}`,padding:"6px 10px",borderRadius:6,cursor:u?"not-allowed":"pointer",fontWeight:700,fontSize:13,minWidth:32,minHeight:32,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"background 120ms"},children:n.icon},n.id)})}),
564
+ /* @__PURE__ */b("div",{style:{position:"relative"},children:[/* @__PURE__ */x("div",{ref:k,id:$,role:"textbox","aria-label":l,"aria-multiline":"true","aria-readonly":u,contentEditable:!u,suppressContentEditableWarning:!0,onInput:D,onKeyDown:F,onPaste:I,spellCheck:!0,style:W}),z&&!u&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",top:16,left:16,color:w.textMuted,pointerEvents:"none",fontSize:15},children:n})]}),y]})});function pc(e){return e.replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var hc=[{key:"bg",label:"Page background",group:"surface"},{key:"surface",label:"Card surface",group:"surface"},{key:"surfaceAlt",label:"Alt surface",group:"surface"},{key:"border",label:"Border",group:"surface"},{key:"text",label:"Body text",group:"text",contrastAgainst:"bg",threshold:7},{key:"textMuted",label:"Muted text",group:"text",contrastAgainst:"bg",threshold:4.5},{key:"primary",label:"Primary",group:"brand",contrastAgainst:"bg",threshold:4.5},{key:"secondary",label:"Secondary",group:"brand",contrastAgainst:"bg",threshold:4.5},{key:"success",label:"Success",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"warning",label:"Warning",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"danger",label:"Danger",group:"status",contrastAgainst:"bg",threshold:4.5},{key:"info",label:"Info",group:"status",contrastAgainst:"bg",threshold:4.5}],fc={surface:"Surfaces",text:"Text",brand:"Brand",status:"Status colors"};function mc(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function gc(e){const t=e.replace(/^#/,"").match(/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(!t)return 0;const[n,r,o]=[t[1],t[2],t[3]].map(e=>parseInt(e,16));return.2126*mc(n)+.7152*mc(r)+.0722*mc(o)}function xc({initialTheme:e,onChange:t,onExport:n,preview:r,exportName:o="myTheme",className:i,style:l}){const s=se(),d=e??s,[c,u]=m(d),[h,f]=m("ts"),[g,y]=m(!1),v=a((e,n)=>{u(r=>{const o={...r,[e]:n};return t?.(o),o})},[t]),w=p(()=>"json"===h?function(e){return JSON.stringify(e,null,2)}(c):"ts"===h?function(e,t="myTheme"){const n=["import type { ThemeTokens } from 'tekivex-ui';",""];n.push(`export const ${t}: ThemeTokens = {`);for(const[r,o]of Object.entries(e))n.push(` ${r}: ${JSON.stringify(o)},`);return n.push("};"),n.join("\n")}(c,o):function(e){const t=[":root {"];for(const[n,r]of Object.entries(e))t.push(` --tkx-${n}: ${r};`);return t.push("}"),t.join("\n")}(c),[c,h,o]),k=a(()=>{u(d),t?.(d)},[d,t]),$=p(()=>{const e={surface:[],text:[],brand:[],status:[]};for(const t of hc)e[t.group].push(t);return e},[]);/* @__PURE__ */
538
565
  return b("div",{className:i,style:{display:"grid",gridTemplateColumns:"minmax(300px, 380px) 1fr",gap:16,color:s.text,...l},role:"region","aria-label":"Theme editor",children:[
539
566
  /* @__PURE__ */x("style",{children:"\n @media (max-width: 760px) {\n .tk-studio-grid { grid-template-columns: 1fr !important; }\n }\n "}),
540
567
  /* @__PURE__ */b("aside",{style:{background:s.surface,border:`1px solid ${s.border}`,borderRadius:12,padding:16,display:"flex",flexDirection:"column",gap:16,maxHeight:"80vh",overflowY:"auto"},children:[
541
- /* @__PURE__ */b("header",{style:{display:"flex",alignItems:"center",gap:8},children:[/* @__PURE__ */x("h2",{style:{margin:0,fontSize:16,fontWeight:800,letterSpacing:"-0.01em",flex:1},children:"Theme Studio"}),/* @__PURE__ */x("button",{type:"button",onClick:k,style:cc(s),"aria-label":"Reset to original theme",children:"↺ Reset"})]}),Object.keys($).map(e=>/* @__PURE__ */b("section",{children:[/* @__PURE__ */x("h3",{style:{margin:"0 0 10px",fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:s.textMuted},children:oc[e]}),/* @__PURE__ */x("div",{style:{display:"flex",flexDirection:"column",gap:10},children:$[e].map(e=>/* @__PURE__ */x(sc,{slot:e,value:c[e.key],pairedValue:e.contrastAgainst?c[e.contrastAgainst]:void 0,onChange:t=>v(e.key,t)},e.key))})]},e)),
568
+ /* @__PURE__ */b("header",{style:{display:"flex",alignItems:"center",gap:8},children:[/* @__PURE__ */x("h2",{style:{margin:0,fontSize:16,fontWeight:800,letterSpacing:"-0.01em",flex:1},children:"Theme Studio"}),/* @__PURE__ */x("button",{type:"button",onClick:k,style:vc(s),"aria-label":"Reset to original theme",children:"↺ Reset"})]}),Object.keys($).map(e=>/* @__PURE__ */b("section",{children:[/* @__PURE__ */x("h3",{style:{margin:"0 0 10px",fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:s.textMuted},children:fc[e]}),/* @__PURE__ */x("div",{style:{display:"flex",flexDirection:"column",gap:10},children:$[e].map(e=>/* @__PURE__ */x(bc,{slot:e,value:c[e.key],pairedValue:e.contrastAgainst?c[e.contrastAgainst]:void 0,onChange:t=>v(e.key,t)},e.key))})]},e)),
542
569
  /* @__PURE__ */b("section",{style:{marginTop:8},children:[
543
570
  /* @__PURE__ */x("h3",{style:{margin:"0 0 10px",fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:s.textMuted},children:"Export"}),
544
- /* @__PURE__ */x("div",{role:"tablist",style:{display:"flex",gap:4,marginBottom:8},children:["ts","json","css"].map(e=>/* @__PURE__ */x("button",{role:"tab",type:"button","aria-selected":h===e,onClick:()=>f(e),style:uc(s,h===e),children:e.toUpperCase()},e))}),
571
+ /* @__PURE__ */x("div",{role:"tablist",style:{display:"flex",gap:4,marginBottom:8},children:["ts","json","css"].map(e=>/* @__PURE__ */x("button",{role:"tab",type:"button","aria-selected":h===e,onClick:()=>f(e),style:wc(s,h===e),children:e.toUpperCase()},e))}),
545
572
  /* @__PURE__ */x("pre",{style:{margin:0,padding:12,background:s.bg,border:`1px solid ${s.border}`,borderRadius:8,fontSize:11,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",color:s.text,maxHeight:200,overflow:"auto",lineHeight:1.5,whiteSpace:"pre"},children:/* @__PURE__ */x("code",{children:w})}),
546
- /* @__PURE__ */b("div",{style:{display:"flex",gap:8,marginTop:8},children:[/* @__PURE__ */x("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(w),y(!0),setTimeout(()=>y(!1),1500)},style:pc(s),children:g?"✓ Copied":"📋 Copy"}),/* @__PURE__ */x("button",{type:"button",onClick:()=>n?.(h,w),disabled:!n,style:hc(s,!n),children:"Save…"})]})]})]}),
547
- /* @__PURE__ */x("section",{"aria-label":"Theme preview",style:{background:c.bg,border:`1px solid ${c.border}`,borderRadius:12,padding:24,minHeight:480,color:c.text},children:/* @__PURE__ */x(le,{theme:c,children:r??/* @__PURE__ */x(dc,{})})})]})}function sc({slot:e,value:t,pairedValue:n,onChange:r}){const o=se(),i=n?function(e,t){const n=ac(e),r=ac(t),[o,i]=n>r?[n,r]:[r,n];return(o+.05)/(i+.05)}(t,n):null,a=i?function(e){return e>=7?{label:"AAA",color:"#06d6a0"}:e>=4.5?{label:"AA",color:"#ffbe0b"}:e>=3?{label:"AA Large",color:"#ff8500"}:{label:"fail",color:"#f72585"}}(i):null,l=e.threshold&&null!==i?i>=e.threshold:null;/* @__PURE__ */
573
+ /* @__PURE__ */b("div",{style:{display:"flex",gap:8,marginTop:8},children:[/* @__PURE__ */x("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(w),y(!0),setTimeout(()=>y(!1),1500)},style:kc(s),children:g?"✓ Copied":"📋 Copy"}),/* @__PURE__ */x("button",{type:"button",onClick:()=>n?.(h,w),disabled:!n,style:$c(s,!n),children:"Save…"})]})]})]}),
574
+ /* @__PURE__ */x("section",{"aria-label":"Theme preview",style:{background:c.bg,border:`1px solid ${c.border}`,borderRadius:12,padding:24,minHeight:480,color:c.text},children:/* @__PURE__ */x(le,{theme:c,children:r??/* @__PURE__ */x(yc,{})})})]})}function bc({slot:e,value:t,pairedValue:n,onChange:r}){const o=se(),i=n?function(e,t){const n=gc(e),r=gc(t),[o,i]=n>r?[n,r]:[r,n];return(o+.05)/(i+.05)}(t,n):null,a=i?function(e){return e>=7?{label:"AAA",color:"#06d6a0"}:e>=4.5?{label:"AA",color:"#ffbe0b"}:e>=3?{label:"AA Large",color:"#ff8500"}:{label:"fail",color:"#f72585"}}(i):null,l=e.threshold&&null!==i?i>=e.threshold:null;/* @__PURE__ */
548
575
  return b("div",{style:{display:"grid",gridTemplateColumns:"32px 1fr auto",gap:10,alignItems:"center"},children:[
549
576
  /* @__PURE__ */x("input",{type:"color",value:t,onChange:e=>r(e.target.value),"aria-label":`${e.label} color`,style:{width:32,height:32,padding:0,border:`1px solid ${o.border}`,borderRadius:6,background:"transparent",cursor:"pointer"}}),
550
- /* @__PURE__ */b("div",{style:{minWidth:0},children:[/* @__PURE__ */x("div",{style:{fontSize:13,fontWeight:600,color:o.text},children:e.label}),/* @__PURE__ */x("input",{type:"text",value:t,onChange:e=>{const t=e.target.value;/^#[0-9a-f]{0,6}$/i.test(t)&&r(t)},"aria-label":`${e.label} hex`,style:{background:"transparent",border:"none",color:o.textMuted,fontFamily:"monospace",fontSize:12,padding:0,outline:"none",width:"100%"}})]}),a&&/* @__PURE__ */b("span",{title:`Contrast vs ${e.contrastAgainst}: ${i?.toFixed(2)}:1 — needs ${e.threshold}:1`,style:{padding:"3px 8px",borderRadius:999,fontSize:10,fontWeight:700,background:!1===l?"#f7258522":`${a.color}22`,color:!1===l?"#f72585":a.color,letterSpacing:"0.04em",whiteSpace:"nowrap"},children:[i?.toFixed(1)," · ",a.label]})]})}function dc(){const e=se();/* @__PURE__ */
577
+ /* @__PURE__ */b("div",{style:{minWidth:0},children:[/* @__PURE__ */x("div",{style:{fontSize:13,fontWeight:600,color:o.text},children:e.label}),/* @__PURE__ */x("input",{type:"text",value:t,onChange:e=>{const t=e.target.value;/^#[0-9a-f]{0,6}$/i.test(t)&&r(t)},"aria-label":`${e.label} hex`,style:{background:"transparent",border:"none",color:o.textMuted,fontFamily:"monospace",fontSize:12,padding:0,outline:"none",width:"100%"}})]}),a&&/* @__PURE__ */b("span",{title:`Contrast vs ${e.contrastAgainst}: ${i?.toFixed(2)}:1 — needs ${e.threshold}:1`,style:{padding:"3px 8px",borderRadius:999,fontSize:10,fontWeight:700,background:!1===l?"#f7258522":`${a.color}22`,color:!1===l?"#f72585":a.color,letterSpacing:"0.04em",whiteSpace:"nowrap"},children:[i?.toFixed(1)," · ",a.label]})]})}function yc(){const e=se();/* @__PURE__ */
551
578
  return b("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[
552
579
  /* @__PURE__ */x("h2",{style:{margin:0,fontSize:24,fontWeight:800,color:e.text},children:"Live preview"}),
553
580
  /* @__PURE__ */x("p",{style:{margin:0,color:e.textMuted},children:"Edit the tokens on the left. Sample components render here with the current theme. Contrast badges flag any token that fails WCAG."}),
554
581
  /* @__PURE__ */b("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[
555
- /* @__PURE__ */x("button",{style:fc(e.primary,e.bg),children:"Primary"}),
556
- /* @__PURE__ */x("button",{style:fc(e.secondary,e.bg),children:"Secondary"}),
557
- /* @__PURE__ */x("button",{style:fc(e.success,e.bg),children:"Success"}),
558
- /* @__PURE__ */x("button",{style:fc(e.warning,e.bg),children:"Warning"}),
559
- /* @__PURE__ */x("button",{style:fc(e.danger,e.bg),children:"Danger"}),
560
- /* @__PURE__ */x("button",{style:fc(e.info,e.bg),children:"Info"})]}),
582
+ /* @__PURE__ */x("button",{style:Sc(e.primary,e.bg),children:"Primary"}),
583
+ /* @__PURE__ */x("button",{style:Sc(e.secondary,e.bg),children:"Secondary"}),
584
+ /* @__PURE__ */x("button",{style:Sc(e.success,e.bg),children:"Success"}),
585
+ /* @__PURE__ */x("button",{style:Sc(e.warning,e.bg),children:"Warning"}),
586
+ /* @__PURE__ */x("button",{style:Sc(e.danger,e.bg),children:"Danger"}),
587
+ /* @__PURE__ */x("button",{style:Sc(e.info,e.bg),children:"Info"})]}),
561
588
  /* @__PURE__ */b("div",{style:{padding:16,background:e.surface,border:`1px solid ${e.border}`,borderRadius:12},children:[/* @__PURE__ */x("h3",{style:{margin:"0 0 6px",fontSize:16,fontWeight:700,color:e.text},children:"Card surface"}),/* @__PURE__ */b("p",{style:{margin:0,color:e.textMuted,fontSize:13},children:["Cards use the ",
562
589
  /* @__PURE__ */x("code",{children:"surface"})," token with ",
563
590
  /* @__PURE__ */x("code",{children:"border"})," as outline."]})]}),
564
591
  /* @__PURE__ */b("div",{style:{padding:16,background:e.surfaceAlt,border:`1px solid ${e.border}`,borderRadius:12},children:[/* @__PURE__ */x("h3",{style:{margin:"0 0 6px",fontSize:16,fontWeight:700,color:e.text},children:"Alt surface"}),/* @__PURE__ */x("p",{style:{margin:0,color:e.textMuted,fontSize:13},children:"Used for nested panels (e.g. modal headers, kanban cards)."})]}),
565
- /* @__PURE__ */x("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["primary","secondary","success","warning","danger","info"].map(t=>/* @__PURE__ */x("span",{style:mc(e[t]),children:t},t))}),
592
+ /* @__PURE__ */x("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["primary","secondary","success","warning","danger","info"].map(t=>/* @__PURE__ */x("span",{style:Cc(e[t]),children:t},t))}),
566
593
  /* @__PURE__ */x("input",{type:"text",placeholder:"Sample input",style:{background:e.surface,border:`1px solid ${e.border}`,color:e.text,padding:"10px 14px",borderRadius:8,fontSize:14,outline:"none",minHeight:44}}),
567
594
  /* @__PURE__ */x("p",{style:{color:e.text,fontSize:14,margin:0},children:"Body text on page background — must be 7:1 for AAA."}),
568
- /* @__PURE__ */x("p",{style:{color:e.textMuted,fontSize:13,margin:0},children:"Muted text — must be at least 4.5:1."})]})}var cc=e=>({background:"transparent",border:`1px solid ${e.border}`,color:e.textMuted,padding:"6px 12px",borderRadius:6,fontSize:12,cursor:"pointer",fontWeight:600}),uc=(e,t)=>({flex:1,background:t?e.primary:"transparent",color:t?e.bg:e.text,border:`1px solid ${t?e.primary:e.border}`,padding:"6px 10px",borderRadius:6,fontSize:11,fontWeight:700,cursor:"pointer",letterSpacing:"0.05em"}),pc=e=>({flex:1,background:e.primary,color:e.bg,border:"none",padding:"8px 14px",borderRadius:6,fontSize:12,fontWeight:700,cursor:"pointer",minHeight:36}),hc=(e,t)=>({flex:1,background:"transparent",color:e.textMuted,border:`1px solid ${e.border}`,padding:"8px 14px",borderRadius:6,fontSize:12,fontWeight:600,cursor:t?"not-allowed":"pointer",opacity:t?.5:1,minHeight:36}),fc=(e,t)=>({background:e,color:t,padding:"8px 14px",border:"none",borderRadius:6,fontWeight:700,fontSize:12,cursor:"pointer",minHeight:36}),mc=e=>({padding:"4px 10px",background:`${e}22`,color:e,fontSize:11,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",borderRadius:999,border:`1px solid ${e}55`}),gc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],xc=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function bc(e){return e.toISOString().slice(0,10)}function yc(e){return Date,new Date(e)}function vc(e,t){const n=new Date(e);return n.setUTCHours(0,0,0,0),n.setUTCDate(n.getUTCDate()+t),n}function wc({data:e,endDate:t,startDate:n,colors:r,cellSize:o=11,gap:i=3,showMonthLabels:l=!0,showWeekdayLabels:s=!0,onCellClick:d,formatTooltip:c,ariaLabel:u,className:h,style:f}){const g=se(),[y,v]=m(null),{end:w,start:k,weeks:$,valuesByDate:S,max:C,total:z}=p(()=>{const r=t?yc(t):/* @__PURE__ */new Date,o=new Date(r);o.setUTCHours(0,0,0,0);const i=n?yc(n):vc(o,-365),a=/* @__PURE__ */new Map;let l=0,s=0;for(const t of e){const e=bc(yc(t.date)),n=(a.get(e)??0)+t.value;a.set(e,n),l+=t.value,n>s&&(s=n)}const d=[];let c=function(e){const t=new Date(e);return t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-t.getUTCDay()),t}(i);for(;c<=o;){const e=[];for(let t=0;t<7;t++)e.push(vc(c,t));d.push(e),c=vc(c,7)}return{end:o,start:i,weeks:d,valuesByDate:a,max:s,total:l}},[e,n,t]),M=p(()=>{if(r)return r;const e=g.primary;return[g.surface,`${e}33`,`${e}66`,`${e}AA`,e]},[r,g.primary,g.surface]),N=a(c??(e=>{const t=yc(e.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric"});return e.value>0?`${e.value} on ${t}`:`No activity on ${t}`}),[c]),D=p(()=>{const e=[];let t=-1;return $.forEach((n,r)=>{const o=n[0].getUTCMonth();o!==t&&(e.push({week:r,label:gc[o]}),t=o)}),e},[$]),P=u??`Activity heatmap from ${bc(k)} to ${bc(w)}. ${z} total events.`;/* @__PURE__ */
569
- return b("div",{className:h,style:{display:"inline-block",position:"relative",color:g.text,...f},role:"img","aria-label":P,children:[l&&/* @__PURE__ */b("div",{"aria-hidden":"true",style:{display:"grid",gridTemplateColumns:`${s?"24px ":""}repeat(${$.length}, ${o+i}px)`,marginBottom:4,fontSize:10,color:g.textMuted,position:"relative",height:14},children:[s&&/* @__PURE__ */x("div",{}),$.map((e,t)=>{const n=D.find(e=>e.week===t);/* @__PURE__ */
595
+ /* @__PURE__ */x("p",{style:{color:e.textMuted,fontSize:13,margin:0},children:"Muted text — must be at least 4.5:1."})]})}var vc=e=>({background:"transparent",border:`1px solid ${e.border}`,color:e.textMuted,padding:"6px 12px",borderRadius:6,fontSize:12,cursor:"pointer",fontWeight:600}),wc=(e,t)=>({flex:1,background:t?e.primary:"transparent",color:t?e.bg:e.text,border:`1px solid ${t?e.primary:e.border}`,padding:"6px 10px",borderRadius:6,fontSize:11,fontWeight:700,cursor:"pointer",letterSpacing:"0.05em"}),kc=e=>({flex:1,background:e.primary,color:e.bg,border:"none",padding:"8px 14px",borderRadius:6,fontSize:12,fontWeight:700,cursor:"pointer",minHeight:36}),$c=(e,t)=>({flex:1,background:"transparent",color:e.textMuted,border:`1px solid ${e.border}`,padding:"8px 14px",borderRadius:6,fontSize:12,fontWeight:600,cursor:t?"not-allowed":"pointer",opacity:t?.5:1,minHeight:36}),Sc=(e,t)=>({background:e,color:t,padding:"8px 14px",border:"none",borderRadius:6,fontWeight:700,fontSize:12,cursor:"pointer",minHeight:36}),Cc=e=>({padding:"4px 10px",background:`${e}22`,color:e,fontSize:11,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",borderRadius:999,border:`1px solid ${e}55`}),zc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Mc=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Nc(e){return e.toISOString().slice(0,10)}function Dc(e){return Date,new Date(e)}function Rc(e,t){const n=new Date(e);return n.setUTCHours(0,0,0,0),n.setUTCDate(n.getUTCDate()+t),n}function Pc({data:e,endDate:t,startDate:n,colors:r,cellSize:o=11,gap:i=3,showMonthLabels:l=!0,showWeekdayLabels:s=!0,onCellClick:d,formatTooltip:c,ariaLabel:u,className:h,style:f}){const g=se(),[y,v]=m(null),{end:w,start:k,weeks:$,valuesByDate:S,max:C,total:z}=p(()=>{const r=t?Dc(t):/* @__PURE__ */new Date,o=new Date(r);o.setUTCHours(0,0,0,0);const i=n?Dc(n):Rc(o,-365),a=/* @__PURE__ */new Map;let l=0,s=0;for(const t of e){const e=Nc(Dc(t.date)),n=(a.get(e)??0)+t.value;a.set(e,n),l+=t.value,n>s&&(s=n)}const d=[];let c=function(e){const t=new Date(e);return t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-t.getUTCDay()),t}(i);for(;c<=o;){const e=[];for(let t=0;t<7;t++)e.push(Rc(c,t));d.push(e),c=Rc(c,7)}return{end:o,start:i,weeks:d,valuesByDate:a,max:s,total:l}},[e,n,t]),M=p(()=>{if(r)return r;const e=g.primary;return[g.surface,`${e}33`,`${e}66`,`${e}AA`,e]},[r,g.primary,g.surface]),N=a(c??(e=>{const t=Dc(e.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric"});return e.value>0?`${e.value} on ${t}`:`No activity on ${t}`}),[c]),D=p(()=>{const e=[];let t=-1;return $.forEach((n,r)=>{const o=n[0].getUTCMonth();o!==t&&(e.push({week:r,label:zc[o]}),t=o)}),e},[$]),R=u??`Activity heatmap from ${Nc(k)} to ${Nc(w)}. ${z} total events.`;/* @__PURE__ */
596
+ return b("div",{className:h,style:{display:"inline-block",position:"relative",color:g.text,...f},role:"img","aria-label":R,children:[l&&/* @__PURE__ */b("div",{"aria-hidden":"true",style:{display:"grid",gridTemplateColumns:`${s?"24px ":""}repeat(${$.length}, ${o+i}px)`,marginBottom:4,fontSize:10,color:g.textMuted,position:"relative",height:14},children:[s&&/* @__PURE__ */x("div",{}),$.map((e,t)=>{const n=D.find(e=>e.week===t);/* @__PURE__ */
570
597
  return x("div",{style:{position:"relative",overflow:"visible"},children:n&&/* @__PURE__ */x("span",{style:{position:"absolute",top:0,left:0,whiteSpace:"nowrap",fontWeight:600},children:n.label})},t)})]}),
571
- /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"flex-start"},children:[s&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{display:"grid",gridTemplateRows:`repeat(7, ${o}px)`,rowGap:i,marginRight:4,fontSize:9,color:g.textMuted},children:xc.map((e,t)=>/* @__PURE__ */x("div",{style:{height:o,lineHeight:`${o}px`,visibility:t%2==1?"visible":"hidden"},children:e},e))}),/* @__PURE__ */x("div",{role:"grid",style:{display:"grid",gridTemplateColumns:`repeat(${$.length}, ${o}px)`,columnGap:i},children:$.map((e,t)=>/* @__PURE__ */x("div",{role:"row",style:{display:"grid",gridTemplateRows:`repeat(7, ${o}px)`,rowGap:i},children:e.map((e,n)=>{if(e<k||e>w)/* @__PURE__ */return x("div",{"aria-hidden":"true"},n);const r=bc(e),i=S.get(r)??0,a=function(e,t,n){if(e<=0)return n[0];if(t<=0)return n[0];const r=e/t;return r>.75?n[4]:r>.5?n[3]:r>.25?n[2]:n[1]}(i,C,M),l=N({date:r,value:i});/* @__PURE__ */
598
+ /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"flex-start"},children:[s&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{display:"grid",gridTemplateRows:`repeat(7, ${o}px)`,rowGap:i,marginRight:4,fontSize:9,color:g.textMuted},children:Mc.map((e,t)=>/* @__PURE__ */x("div",{style:{height:o,lineHeight:`${o}px`,visibility:t%2==1?"visible":"hidden"},children:e},e))}),/* @__PURE__ */x("div",{role:"grid",style:{display:"grid",gridTemplateColumns:`repeat(${$.length}, ${o}px)`,columnGap:i},children:$.map((e,t)=>/* @__PURE__ */x("div",{role:"row",style:{display:"grid",gridTemplateRows:`repeat(7, ${o}px)`,rowGap:i},children:e.map((e,n)=>{if(e<k||e>w)/* @__PURE__ */return x("div",{"aria-hidden":"true"},n);const r=Nc(e),i=S.get(r)??0,a=function(e,t,n){if(e<=0)return n[0];if(t<=0)return n[0];const r=e/t;return r>.75?n[4]:r>.5?n[3]:r>.25?n[2]:n[1]}(i,C,M),l=N({date:r,value:i});/* @__PURE__ */
572
599
  return x("div",{role:"gridcell",tabIndex:0===n&&0===t?0:-1,"data-cell":`${t}-${n}`,"aria-label":l,onClick:()=>d?.({date:r,value:i}),onKeyDown:e=>{"Enter"===e.key||" "===e.key?(e.preventDefault(),d?.({date:r,value:i})):((e,t,n)=>{let r=null;const o=e.currentTarget.parentElement?.parentElement;function i(e,t){return o.querySelector(`[data-cell="${e}-${t}"]`)}o&&("ArrowRight"===e.key?r=i(t+1,n):"ArrowLeft"===e.key?r=i(t-1,n):"ArrowDown"===e.key?r=i(t,n+1):"ArrowUp"===e.key&&(r=i(t,n-1)),r&&(e.preventDefault(),r.focus()))})(e,t,n)},onMouseEnter:e=>{const t=e.target.getBoundingClientRect(),n=e.currentTarget.closest('[role="img"]')?.getBoundingClientRect();v({date:r,value:i,x:t.left-(n?.left??0)+t.width/2,y:t.top-(n?.top??0)})},onMouseLeave:()=>v(null),onFocus:e=>{const t=e.target.getBoundingClientRect(),n=e.currentTarget.closest('[role="img"]')?.getBoundingClientRect();v({date:r,value:i,x:t.left-(n?.left??0)+t.width/2,y:t.top-(n?.top??0)})},onBlur:()=>v(null),style:{width:o,height:o,background:a,borderRadius:2,cursor:d?"pointer":"default",border:`1px solid ${g.border}33`,outline:"none"}},n)})},t))})]}),
573
600
  /* @__PURE__ */b("div",{"aria-hidden":"true",style:{marginTop:8,display:"flex",alignItems:"center",justifyContent:"flex-end",gap:6,fontSize:10,color:g.textMuted},children:[
574
601
  /* @__PURE__ */x("span",{children:"Less"}),M.map((e,t)=>/* @__PURE__ */x("span",{style:{width:o,height:o,background:e,borderRadius:2,border:`1px solid ${g.border}33`}},t)),
575
- /* @__PURE__ */x("span",{children:"More"})]}),y&&/* @__PURE__ */x("div",{role:"tooltip",style:{position:"absolute",left:y.x,top:y.y-8,transform:"translate(-50%, -100%)",padding:"4px 10px",background:g.surface,border:`1px solid ${g.border}`,borderRadius:6,fontSize:11,color:g.text,pointerEvents:"none",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:N({date:y.date,value:y.value})})]})}var kc={critical:"#f72585",serious:"#ff8500",moderate:"#ffbe0b",minor:"#3a86ff"};function $c({show:e,intervalMs:t=4e3,position:n="bottom-right",scope:r,axeOptions:o,onScan:i}){const a=se(),[l,d]=m([]),[c,u]=m(!1),[p,h]=m(null),[f,y]=m(!1),[v,w]=m(null),k="production"===(globalThis.process?.env)?.NODE_ENV,$=e??!k;if(s(()=>{if(!$)return;let e=!1,n=null,a=null;async function l(t){if(!e){y(!0);try{const n=r??document,a=await t.run(n,o);if(e)return;d(a.violations);const l={};a.violations.forEach(e=>{const t=e.impact??"unknown";l[t]=(l[t]??0)+1}),i?.({violations:a.violations.length,impacts:l}),w(null)}catch(n){w(n instanceof Error?n.message:"scan failed")}finally{e||y(!1)}}}return async function(){try{const e=await new Function("s","return import(s)")("axe-core");return e.default??e}catch{return null}}().then(r=>{e||(r?(h(!0),n=r,l(r),t>0&&(a=setInterval(()=>{n&&l(n)},t))):h(!1))}),()=>{e=!0,a&&clearInterval(a)}},[$,t,r]),!$||!1===p)return null;const S={};l.forEach(e=>{const t=e.impact??"unknown";S[t]=(S[t]??0)+1});const C=l.length,z=0===C?{color:a.success??"#06d6a0",label:"✓ AAA"}:S.critical||S.serious?{color:"#f72585",label:"Issues"}:{color:"#ffbe0b",label:"Warnings"};/* @__PURE__ */
576
- return b(g,{children:[/* @__PURE__ */b("button",{type:"button","aria-label":`Accessibility status: ${C} violation${1===C?"":"s"}`,"aria-expanded":c,onClick:()=>u(e=>!e),style:Sc(a,z.color,n),children:[/* @__PURE__ */x("span",{style:{fontSize:14,fontWeight:700},children:f?"…":0===C?"✓":C}),/* @__PURE__ */x("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em"},children:"A11Y"})]}),c&&/* @__PURE__ */b("div",{role:"dialog","aria-label":"Accessibility violations","aria-modal":"false",style:Cc(a,n),children:[
602
+ /* @__PURE__ */x("span",{children:"More"})]}),y&&/* @__PURE__ */x("div",{role:"tooltip",style:{position:"absolute",left:y.x,top:y.y-8,transform:"translate(-50%, -100%)",padding:"4px 10px",background:g.surface,border:`1px solid ${g.border}`,borderRadius:6,fontSize:11,color:g.text,pointerEvents:"none",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:N({date:y.date,value:y.value})})]})}var Fc={critical:"#f72585",serious:"#ff8500",moderate:"#ffbe0b",minor:"#3a86ff"};function Ic({show:e,intervalMs:t=4e3,position:n="bottom-right",scope:r,axeOptions:o,onScan:i}){const a=se(),[l,d]=m([]),[c,u]=m(!1),[p,h]=m(null),[f,y]=m(!1),[v,w]=m(null),k="production"===(globalThis.process?.env)?.NODE_ENV,$=e??!k;if(s(()=>{if(!$)return;let e=!1,n=null,a=null;async function l(t){if(!e){y(!0);try{const n=r??document,a=await t.run(n,o);if(e)return;d(a.violations);const l={};a.violations.forEach(e=>{const t=e.impact??"unknown";l[t]=(l[t]??0)+1}),i?.({violations:a.violations.length,impacts:l}),w(null)}catch(n){w(n instanceof Error?n.message:"scan failed")}finally{e||y(!1)}}}return async function(){try{const e=await new Function("s","return import(s)")("axe-core");return e.default??e}catch{return null}}().then(r=>{e||(r?(h(!0),n=r,l(r),t>0&&(a=setInterval(()=>{n&&l(n)},t))):h(!1))}),()=>{e=!0,a&&clearInterval(a)}},[$,t,r]),!$||!1===p)return null;const S={};l.forEach(e=>{const t=e.impact??"unknown";S[t]=(S[t]??0)+1});const C=l.length,z=0===C?{color:a.success??"#06d6a0",label:"✓ AAA"}:S.critical||S.serious?{color:"#f72585",label:"Issues"}:{color:"#ffbe0b",label:"Warnings"};/* @__PURE__ */
603
+ return b(g,{children:[/* @__PURE__ */b("button",{type:"button","aria-label":`Accessibility status: ${C} violation${1===C?"":"s"}`,"aria-expanded":c,onClick:()=>u(e=>!e),style:Ac(a,z.color,n),children:[/* @__PURE__ */x("span",{style:{fontSize:14,fontWeight:700},children:f?"…":0===C?"✓":C}),/* @__PURE__ */x("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em"},children:"A11Y"})]}),c&&/* @__PURE__ */b("div",{role:"dialog","aria-label":"Accessibility violations","aria-modal":"false",style:Lc(a,n),children:[
577
604
  /* @__PURE__ */b("header",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 16px",borderBottom:`1px solid ${a.border}`,background:a.surfaceAlt},children:[
578
605
  /* @__PURE__ */x("span",{style:{width:10,height:10,borderRadius:"50%",background:z.color,boxShadow:`0 0 12px ${z.color}`},"aria-hidden":"true"}),
579
606
  /* @__PURE__ */b("h3",{style:{margin:0,fontSize:14,fontWeight:700,color:a.text,flex:1},children:["Accessibility — ",z.label]}),
580
607
  /* @__PURE__ */x("button",{type:"button",onClick:()=>u(!1),"aria-label":"Close panel",style:{background:"transparent",border:"none",color:a.textMuted,cursor:"pointer",fontSize:18,padding:4},children:"×"})]}),
581
608
  /* @__PURE__ */b("div",{style:{padding:16,maxHeight:400,overflowY:"auto"},children:[v&&/* @__PURE__ */b("div",{style:{color:"#f72585",fontSize:12,marginBottom:8},children:["Scan error: ",v]}),0===C?/* @__PURE__ */x("div",{style:{color:a.textMuted,fontSize:13},children:"No axe-core violations on this page. ✓"}):/* @__PURE__ */b(g,{children:[
582
- /* @__PURE__ */x("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:Object.entries(S).map(([e,t])=>/* @__PURE__ */b("span",{style:{padding:"3px 8px",background:`${kc[e]??a.textMuted}22`,color:kc[e]??a.textMuted,borderRadius:999,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase"},children:[e,": ",t]},e))}),
609
+ /* @__PURE__ */x("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:Object.entries(S).map(([e,t])=>/* @__PURE__ */b("span",{style:{padding:"3px 8px",background:`${Fc[e]??a.textMuted}22`,color:Fc[e]??a.textMuted,borderRadius:999,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase"},children:[e,": ",t]},e))}),
583
610
  /* @__PURE__ */x("ol",{style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:10},children:l.slice(0,10).map(e=>/* @__PURE__ */b("li",{style:{padding:10,background:a.surfaceAlt,border:`1px solid ${a.border}`,borderRadius:8,fontSize:12},children:[
584
611
  /* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[
585
- /* @__PURE__ */x("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:kc[e.impact??"minor"]??a.textMuted}}),
612
+ /* @__PURE__ */x("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:Fc[e.impact??"minor"]??a.textMuted}}),
586
613
  /* @__PURE__ */x("strong",{style:{color:a.text,flex:1},children:e.help}),
587
614
  /* @__PURE__ */b("span",{style:{fontSize:10,color:a.textMuted,fontFamily:"monospace"},children:[e.nodes.length,"×"]})]}),
588
615
  /* @__PURE__ */x("div",{style:{color:a.textMuted,marginBottom:6},children:e.description}),
589
616
  /* @__PURE__ */x("a",{href:e.helpUrl,target:"_blank",rel:"noopener noreferrer",style:{color:a.primary,fontSize:11},children:"Learn more →"})]},e.id))}),l.length>10&&/* @__PURE__ */b("div",{style:{marginTop:10,color:a.textMuted,fontSize:11,textAlign:"center"},children:["+ ",l.length-10," more violations not shown"]})]})]}),
590
- /* @__PURE__ */b("footer",{style:{padding:"8px 16px",borderTop:`1px solid ${a.border}`,fontSize:10,color:a.textMuted,fontFamily:"monospace",textAlign:"center"},children:["Powered by axe-core · scans every ",t/1e3,"s"]})]})]})}function Sc(e,t,n){const r=16,o={};return"bottom-right"===n&&Object.assign(o,{bottom:r,right:r}),"bottom-left"===n&&Object.assign(o,{bottom:r,left:r}),"top-right"===n&&Object.assign(o,{top:r,right:r}),"top-left"===n&&Object.assign(o,{top:r,left:r}),{position:"fixed",zIndex:99999,width:56,height:56,borderRadius:"50%",background:e.surface,border:`2px solid ${t}`,boxShadow:`0 0 24px ${t}55, 0 4px 12px rgba(0,0,0,0.3)`,color:t,cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:0,fontFamily:"inherit",transition:"transform 120ms",...o}}function Cc(e,t){const n={};return"bottom-right"===t&&Object.assign(n,{bottom:84,right:16}),"bottom-left"===t&&Object.assign(n,{bottom:84,left:16}),"top-right"===t&&Object.assign(n,{top:84,right:16}),"top-left"===t&&Object.assign(n,{top:84,left:16}),{position:"fixed",zIndex:99998,width:360,maxWidth:"calc(100vw - 32px)",background:e.surface,border:`1px solid ${e.border}`,borderRadius:12,boxShadow:"0 16px 40px rgba(0,0,0,0.4)",overflow:"hidden",color:e.text,...n}}function zc(e,t,n,r){const o=!!e.children&&e.children.length>0,i=n.has(e.id);if(!o||i)return{node:e,depth:t,y:r+.5,span:1,children:[],hasChildren:o,collapsed:i};let a=r;const l=[];for(const u of e.children){const e=zc(u,t+1,n,a);l.push(e),a+=e.span}const s=a-r,d=l[0],c=l[l.length-1];return{node:e,depth:t,y:(d.y+c.y)/2,span:s,children:l,hasChildren:o,collapsed:i}}function Mc(e,t,n,r=[],o=null){r.push({laid:e,x:e.depth*t,y:e.y*n,parentId:o});for(const i of e.children)Mc(i,t,n,r,e.node.id);return r}function Nc({root:e,selectedId:t,collapsedIds:n,onSelect:r,onToggle:o,leafHeight:i=44,levelWidth:l=200,nodeWidth:s=160,style:d,className:c}){const[u,h]=m(e.id),[g,y]=m(()=>{const t=/* @__PURE__ */new Set;return function e(n){n.collapsed&&t.add(n.id),n.children?.forEach(e)}(e),t}),v=void 0!==t?t:u,w=n??g,k=f(null),$=p(()=>zc(e,0,w,0),[e,w]),S=p(()=>Mc($,l,i),[$,l,i]),C=p(()=>function(e){const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;return function e(o,i){if(t.set(o.node.id,i),r.set(o.node.id,o.children[0]?.node.id??null),n.has(o.node.id)||n.set(o.node.id,[o.node.id]),o.children.length){const t=o.children.map(e=>e.node.id);for(const r of o.children)n.set(r.node.id,t),e(r,o.node.id)}}(e,null),{parents:t,siblings:n,firstChild:r}}($),[$]),z=Math.max(...S.map(e=>e.x),0)+s,M=Math.max(...S.map(e=>e.y),0)+i,N=Math.min(...S.map(e=>e.y),0),D=M-N+i,P=a(e=>{void 0===t&&h(e);const n=S.find(t=>t.laid.node.id===e)?.laid.node;n&&r?.(e,n)},[t,r,S]),R=a(e=>{const t=w.has(e);void 0===n&&y(n=>{const r=new Set(n);return t?r.delete(e):r.add(e),r}),o?.(e,!t)},[w,n,o]);/* @__PURE__ */
591
- return x("div",{ref:k,className:c,role:"tree","aria-label":"Mind map",tabIndex:0,onKeyDown:e=>{if(!v)return;const{parents:t,siblings:n,firstChild:r}=C;let o;switch(e.key){case"ArrowRight":w.has(v)?R(v):o=r.get(v)??void 0;break;case"ArrowLeft":{const e=t.get(v);e?o=e:!w.has(v)&&r.get(v)&&R(v);break}case"ArrowUp":case"ArrowDown":{const t=n.get(v);if(!t||t.length<2)break;const r=t.indexOf(v),i="ArrowUp"===e.key?r-1:r+1;i>=0&&i<t.length&&(o=t[i]);break}case"Enter":case" ":R(v),e.preventDefault();break;default:return}o&&(e.preventDefault(),P(o))},"data-testid":"tkx-mindmap",style:{position:"relative",width:"100%",overflow:"auto",outline:"none",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",...d},children:/* @__PURE__ */b("div",{style:{position:"relative",width:z+24,height:D+24,padding:12},children:[/* @__PURE__ */x("svg",{"aria-hidden":"true",width:z+24,height:D+24,style:{position:"absolute",top:0,left:0,pointerEvents:"none",transform:`translate(0, ${12-N}px)`},children:S.map(e=>{if(!e.parentId)return null;const t=S.find(t=>t.laid.node.id===e.parentId);if(!t)return null;const n=t.x+s,r=t.y+i/2,o=e.x,a=e.y+i/2,l=(n+o)/2,d=e.laid.node.color||"var(--tkx-accent, #00f5d4)";/* @__PURE__ */
617
+ /* @__PURE__ */b("footer",{style:{padding:"8px 16px",borderTop:`1px solid ${a.border}`,fontSize:10,color:a.textMuted,fontFamily:"monospace",textAlign:"center"},children:["Powered by axe-core · scans every ",t/1e3,"s"]})]})]})}function Ac(e,t,n){const r=16,o={};return"bottom-right"===n&&Object.assign(o,{bottom:r,right:r}),"bottom-left"===n&&Object.assign(o,{bottom:r,left:r}),"top-right"===n&&Object.assign(o,{top:r,right:r}),"top-left"===n&&Object.assign(o,{top:r,left:r}),{position:"fixed",zIndex:99999,width:56,height:56,borderRadius:"50%",background:e.surface,border:`2px solid ${t}`,boxShadow:`0 0 24px ${t}55, 0 4px 12px rgba(0,0,0,0.3)`,color:t,cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:0,fontFamily:"inherit",transition:"transform 120ms",...o}}function Lc(e,t){const n={};return"bottom-right"===t&&Object.assign(n,{bottom:84,right:16}),"bottom-left"===t&&Object.assign(n,{bottom:84,left:16}),"top-right"===t&&Object.assign(n,{top:84,right:16}),"top-left"===t&&Object.assign(n,{top:84,left:16}),{position:"fixed",zIndex:99998,width:360,maxWidth:"calc(100vw - 32px)",background:e.surface,border:`1px solid ${e.border}`,borderRadius:12,boxShadow:"0 16px 40px rgba(0,0,0,0.4)",overflow:"hidden",color:e.text,...n}}function Tc(e,t,n,r){const o=!!e.children&&e.children.length>0,i=n.has(e.id);if(!o||i)return{node:e,depth:t,y:r+.5,span:1,children:[],hasChildren:o,collapsed:i};let a=r;const l=[];for(const u of e.children){const e=Tc(u,t+1,n,a);l.push(e),a+=e.span}const s=a-r,d=l[0],c=l[l.length-1];return{node:e,depth:t,y:(d.y+c.y)/2,span:s,children:l,hasChildren:o,collapsed:i}}function Wc(e,t,n,r=[],o=null){r.push({laid:e,x:e.depth*t,y:e.y*n,parentId:o});for(const i of e.children)Wc(i,t,n,r,e.node.id);return r}function jc({root:e,selectedId:t,collapsedIds:n,onSelect:r,onToggle:o,leafHeight:i=44,levelWidth:l=200,nodeWidth:s=160,style:d,className:c}){const[u,h]=m(e.id),[g,y]=m(()=>{const t=/* @__PURE__ */new Set;return function e(n){n.collapsed&&t.add(n.id),n.children?.forEach(e)}(e),t}),v=void 0!==t?t:u,w=n??g,k=f(null),$=p(()=>Tc(e,0,w,0),[e,w]),S=p(()=>Wc($,l,i),[$,l,i]),C=p(()=>function(e){const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;return function e(o,i){if(t.set(o.node.id,i),r.set(o.node.id,o.children[0]?.node.id??null),n.has(o.node.id)||n.set(o.node.id,[o.node.id]),o.children.length){const t=o.children.map(e=>e.node.id);for(const r of o.children)n.set(r.node.id,t),e(r,o.node.id)}}(e,null),{parents:t,siblings:n,firstChild:r}}($),[$]),z=Math.max(...S.map(e=>e.x),0)+s,M=Math.max(...S.map(e=>e.y),0)+i,N=Math.min(...S.map(e=>e.y),0),D=M-N+i,R=a(e=>{void 0===t&&h(e);const n=S.find(t=>t.laid.node.id===e)?.laid.node;n&&r?.(e,n)},[t,r,S]),P=a(e=>{const t=w.has(e);void 0===n&&y(n=>{const r=new Set(n);return t?r.delete(e):r.add(e),r}),o?.(e,!t)},[w,n,o]);/* @__PURE__ */
618
+ return x("div",{ref:k,className:c,role:"tree","aria-label":"Mind map",tabIndex:0,onKeyDown:e=>{if(!v)return;const{parents:t,siblings:n,firstChild:r}=C;let o;switch(e.key){case"ArrowRight":w.has(v)?P(v):o=r.get(v)??void 0;break;case"ArrowLeft":{const e=t.get(v);e?o=e:!w.has(v)&&r.get(v)&&P(v);break}case"ArrowUp":case"ArrowDown":{const t=n.get(v);if(!t||t.length<2)break;const r=t.indexOf(v),i="ArrowUp"===e.key?r-1:r+1;i>=0&&i<t.length&&(o=t[i]);break}case"Enter":case" ":P(v),e.preventDefault();break;default:return}o&&(e.preventDefault(),R(o))},"data-testid":"tkx-mindmap",style:{position:"relative",width:"100%",overflow:"auto",outline:"none",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",...d},children:/* @__PURE__ */b("div",{style:{position:"relative",width:z+24,height:D+24,padding:12},children:[/* @__PURE__ */x("svg",{"aria-hidden":"true",width:z+24,height:D+24,style:{position:"absolute",top:0,left:0,pointerEvents:"none",transform:`translate(0, ${12-N}px)`},children:S.map(e=>{if(!e.parentId)return null;const t=S.find(t=>t.laid.node.id===e.parentId);if(!t)return null;const n=t.x+s,r=t.y+i/2,o=e.x,a=e.y+i/2,l=(n+o)/2,d=e.laid.node.color||"var(--tkx-accent, #00f5d4)";/* @__PURE__ */
592
619
  return x("path",{d:`M ${n} ${r} C ${l} ${r}, ${l} ${a}, ${o} ${a}`,stroke:d,strokeOpacity:.5,strokeWidth:1.5,fill:"none"},`${e.parentId}->${e.laid.node.id}`)})}),S.map(e=>{const t=e.laid.node.id===v,n=e.laid.node.color||"var(--tkx-accent, #00f5d4)";/* @__PURE__ */
593
- return b("div",{role:"treeitem","aria-selected":t,"aria-expanded":e.laid.hasChildren?!e.laid.collapsed:void 0,"data-testid":`mindmap-node-${e.laid.node.id}`,onClick:()=>P(e.laid.node.id),onDoubleClick:()=>e.laid.hasChildren&&R(e.laid.node.id),style:{position:"absolute",left:e.x+12,top:e.y-N+12,width:s,height:i-8,display:"flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:8,border:`1px solid ${t?n:"var(--tkx-border, #2a2a3e)"}`,background:t?`${n}1a`:"var(--tkx-bg-subtle, #12121a)",cursor:"pointer",fontSize:13,lineHeight:1.3,boxShadow:t?`0 0 0 2px ${n}33`:"none",transition:"border-color 0.12s, box-shadow 0.12s",boxSizing:"border-box"},children:[e.laid.hasChildren&&/* @__PURE__ */x("button",{type:"button","aria-label":e.laid.collapsed?"Expand":"Collapse","data-testid":`mindmap-toggle-${e.laid.node.id}`,onClick:t=>{t.stopPropagation(),R(e.laid.node.id)},style:{width:20,height:20,flex:"0 0 20px",borderRadius:4,border:"none",background:n,color:"#0a0a0f",cursor:"pointer",fontSize:12,fontWeight:700,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1},children:e.laid.collapsed?"+":"−"}),/* @__PURE__ */x("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.laid.node.label,children:e.laid.node.label})]},e.laid.node.id)})]})})}function Dc(e){const t=e.width??160,n=e.height??60;return{out:[e.x+t,e.y+n/2],in:[e.x,e.y+n/2]}}function Pc(e,t){const n=Dc(e).out,r=Dc(t).in,o=Math.max(40,Math.abs(r[0]-n[0])/2),i=[n[0]+o,n[1]],a=[r[0]-o,r[1]];return`M ${n[0]} ${n[1]} C ${i[0]} ${i[1]}, ${a[0]} ${a[1]}, ${r[0]} ${r[1]}`}var Rc={x:0,y:0,scale:1},Fc=i(function({data:e,onChange:t,selectedId:n,onSelect:r,initialViewport:o,draggable:i=!0,pannable:l=!0,zoomable:s=!0,minZoom:c=.25,maxZoom:u=3,height:h=480,showGrid:g=!0,showControls:y=!0,renderNode:v,className:w,style:k},$){const[S,C]=m(o??Rc),[z,M]=m(null),N=void 0!==n?n:z,[D,P]=m(null),[R,F]=m(null),[I,A]=m(null),[L,T]=m(!1),W=f(null),j=d(),E=a(e=>{void 0===n&&M(e),r?.(e)},[n,r]),B=f(null),V=f(/* @__PURE__ */new Map),H=f(null),O=f(/* @__PURE__ */new Set),[q,U]=m(null),K=n=>{const r=B.current;if(!r||"node"!==r.kind||r.pointerId!==n.pointerId)return;const o=(n.clientX-r.startX)/S.scale,i=(n.clientY-r.startY)/S.scale,a=r.nodeStartX+o,l=r.nodeStartY+i;t({...e,nodes:e.nodes.map(e=>e.id===r.id?{...e,x:a,y:l}:e)})},Y=e=>{const t=B.current;t&&"node"===t.kind&&t.pointerId===e.pointerId&&(O.current.delete(t.id),B.current=null)},X=a((e,t)=>{const n=W.current?.getBoundingClientRect();return n?[(e-n.left-S.x)/S.scale,(t-n.top-S.y)/S.scale]:[0,0]},[S.x,S.y,S.scale]),Z=e=>{const t=B.current;if(!t||"edge"!==t.kind||t.pointerId!==e.pointerId)return;const[n,r]=X(e.clientX,e.clientY);U({fromNodeId:t.fromNodeId,gx:n,gy:r})},G=n=>{const r=B.current;if(!r||"edge"!==r.kind||r.pointerId!==n.pointerId)return;let o;n.stopPropagation();try{o=((document.elementFromPoint?.(n.clientX,n.clientY))?.closest("[data-tkx-node-id]"))?.dataset.tkxNodeId}catch{}if(o&&o!==r.fromNodeId&&!e.edges.some(e=>e.from===r.fromNodeId&&e.to===o)){const n={id:`e-${r.fromNodeId}-${o}-${Date.now().toString(36)}`,from:r.fromNodeId,to:o};t({...e,edges:[...e.edges,n]})}B.current=null,U(null)},_=e=>{V.current.delete(e.pointerId),V.current.size<2&&(H.current=null);const t=B.current;t&&"pan"===t.kind&&t.pointerId===e.pointerId&&(B.current=null)};function J(e,t,n){return Math.max(t,Math.min(n,e))}const Q=a((e,t,n)=>{C(r=>{const o=J(e,c,u),i=(t-r.x)/r.scale,a=(n-r.y)/r.scale;return{x:t-i*o,y:n-a*o,scale:o}})},[c,u]),ee=a(()=>{const t=W.current?.getBoundingClientRect();if(!t||0===e.nodes.length)return void C(Rc);let n=1/0,r=1/0,o=-1/0,i=-1/0;for(const c of e.nodes){const e=c.width??160,t=c.height??60;c.x<n&&(n=c.x),c.y<r&&(r=c.y),c.x+e>o&&(o=c.x+e),c.y+t>i&&(i=c.y+t)}const a=o-n+80,l=i-r+80,s=t.width/a,d=t.height/l,p=J(Math.min(s,d),c,u);C({x:-n*p+(t.width-(o-n)*p)/2,y:-r*p+(t.height-(i-r)*p)/2,scale:p})},[e.nodes,c,u]),te=`translate3d(${S.x}px, ${S.y}px, 0) scale(${S.scale})`,ne=p(()=>new Map(e.nodes.map(e=>[e.id,e])),[e.nodes]);/* @__PURE__ */
594
- return b("div",{ref:e=>{W.current=e,"function"==typeof $?$(e):$&&($.current=e)},className:w,role:"application","aria-label":"Flow chart editor",tabIndex:0,onKeyDown:n=>{if(R&&("Delete"===n.key||"Backspace"===n.key))return n.preventDefault(),t({...e,edges:e.edges.filter(e=>e.id!==R)}),void F(null);if(!N)return void("Tab"===n.key&&e.nodes.length>0&&(n.preventDefault(),E(e.nodes[0].id)));const r=e.nodes.findIndex(e=>e.id===N);switch(n.key){case"Tab":{n.preventDefault();const t=(r+(n.shiftKey?-1:1)+e.nodes.length)%e.nodes.length;E(e.nodes[t].id);break}case"Delete":case"Backspace":n.preventDefault(),t({nodes:e.nodes.filter(e=>e.id!==N),edges:e.edges.filter(e=>e.from!==N&&e.to!==N)}),E(null);break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{n.preventDefault();const r=n.shiftKey?10:1,o="ArrowRight"===n.key?r:"ArrowLeft"===n.key?-r:0,i="ArrowDown"===n.key?r:"ArrowUp"===n.key?-r:0;t({...e,nodes:e.nodes.map(e=>e.id===N?{...e,x:e.x+o,y:e.y+i}:e)});break}}},onPointerDown:e=>{if(V.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),s&&2===V.current.size){const[e,t]=Array.from(V.current.values());return void(H.current={startDist:Math.hypot(t.x-e.x,t.y-e.y),startScale:S.scale,centerX:(e.x+t.x)/2,centerY:(e.y+t.y)/2})}if(e.target===e.currentTarget&&l){E(null);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}B.current={kind:"pan",pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,vpStartX:S.x,vpStartY:S.y}}},onPointerMove:e=>{V.current.has(e.pointerId)&&V.current.set(e.pointerId,{x:e.clientX,y:e.clientY});const t=H.current;if(t&&2===V.current.size){const[e,n]=Array.from(V.current.values()),r=Math.hypot(n.x-e.x,n.y-e.y)/t.startDist,o=J(t.startScale*r,c,u),i=W.current?.getBoundingClientRect();return void(i&&Q(o,t.centerX-i.left,t.centerY-i.top))}const n=B.current;n&&"pan"===n.kind&&n.pointerId===e.pointerId&&C({x:n.vpStartX+(e.clientX-n.startX),y:n.vpStartY+(e.clientY-n.startY),scale:S.scale})},onPointerUp:_,onPointerCancel:_,onWheel:e=>{if(!s)return;e.preventDefault();const t=W.current?.getBoundingClientRect();if(!t)return;const n=Math.exp(.0015*-e.deltaY);Q(S.scale*n,e.clientX-t.left,e.clientY-t.top)},"data-testid":"tkx-flowchart",style:{position:"relative",width:"100%",height:h,overflow:"hidden",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:12,touchAction:s||l?"none":"auto",outline:"none",...k},children:[g&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px)",backgroundSize:`${24*S.scale}px ${24*S.scale}px`,backgroundPosition:`${S.x}px ${S.y}px`,pointerEvents:"none"}}),
620
+ return b("div",{role:"treeitem","aria-selected":t,"aria-expanded":e.laid.hasChildren?!e.laid.collapsed:void 0,"data-testid":`mindmap-node-${e.laid.node.id}`,onClick:()=>R(e.laid.node.id),onDoubleClick:()=>e.laid.hasChildren&&P(e.laid.node.id),style:{position:"absolute",left:e.x+12,top:e.y-N+12,width:s,height:i-8,display:"flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:8,border:`1px solid ${t?n:"var(--tkx-border, #2a2a3e)"}`,background:t?`${n}1a`:"var(--tkx-bg-subtle, #12121a)",cursor:"pointer",fontSize:13,lineHeight:1.3,boxShadow:t?`0 0 0 2px ${n}33`:"none",transition:"border-color 0.12s, box-shadow 0.12s",boxSizing:"border-box"},children:[e.laid.hasChildren&&/* @__PURE__ */x("button",{type:"button","aria-label":e.laid.collapsed?"Expand":"Collapse","data-testid":`mindmap-toggle-${e.laid.node.id}`,onClick:t=>{t.stopPropagation(),P(e.laid.node.id)},style:{width:20,height:20,flex:"0 0 20px",borderRadius:4,border:"none",background:n,color:"#0a0a0f",cursor:"pointer",fontSize:12,fontWeight:700,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1},children:e.laid.collapsed?"+":"−"}),/* @__PURE__ */x("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.laid.node.label,children:e.laid.node.label})]},e.laid.node.id)})]})})}function Ec(e){const t=e.width??160,n=e.height??60;return{out:[e.x+t,e.y+n/2],in:[e.x,e.y+n/2]}}function Bc(e,t){const n=Ec(e).out,r=Ec(t).in,o=Math.max(40,Math.abs(r[0]-n[0])/2),i=[n[0]+o,n[1]],a=[r[0]-o,r[1]];return`M ${n[0]} ${n[1]} C ${i[0]} ${i[1]}, ${a[0]} ${a[1]}, ${r[0]} ${r[1]}`}var Vc={x:0,y:0,scale:1},Hc=i(function({data:e,onChange:t,selectedId:n,onSelect:r,initialViewport:o,draggable:i=!0,pannable:l=!0,zoomable:s=!0,minZoom:c=.25,maxZoom:u=3,height:h=480,showGrid:g=!0,showControls:y=!0,renderNode:v,className:w,style:k},$){const[S,C]=m(o??Vc),[z,M]=m(null),N=void 0!==n?n:z,[D,R]=m(null),[P,F]=m(null),[I,A]=m(null),[L,T]=m(!1),W=f(null),j=d(),E=a(e=>{void 0===n&&M(e),r?.(e)},[n,r]),B=f(null),V=f(/* @__PURE__ */new Map),H=f(null),O=f(/* @__PURE__ */new Set),[q,U]=m(null),K=n=>{const r=B.current;if(!r||"node"!==r.kind||r.pointerId!==n.pointerId)return;const o=(n.clientX-r.startX)/S.scale,i=(n.clientY-r.startY)/S.scale,a=r.nodeStartX+o,l=r.nodeStartY+i;t({...e,nodes:e.nodes.map(e=>e.id===r.id?{...e,x:a,y:l}:e)})},Y=e=>{const t=B.current;t&&"node"===t.kind&&t.pointerId===e.pointerId&&(O.current.delete(t.id),B.current=null)},X=a((e,t)=>{const n=W.current?.getBoundingClientRect();return n?[(e-n.left-S.x)/S.scale,(t-n.top-S.y)/S.scale]:[0,0]},[S.x,S.y,S.scale]),Z=e=>{const t=B.current;if(!t||"edge"!==t.kind||t.pointerId!==e.pointerId)return;const[n,r]=X(e.clientX,e.clientY);U({fromNodeId:t.fromNodeId,gx:n,gy:r})},G=n=>{const r=B.current;if(!r||"edge"!==r.kind||r.pointerId!==n.pointerId)return;let o;n.stopPropagation();try{o=((document.elementFromPoint?.(n.clientX,n.clientY))?.closest("[data-tkx-node-id]"))?.dataset.tkxNodeId}catch{}if(o&&o!==r.fromNodeId&&!e.edges.some(e=>e.from===r.fromNodeId&&e.to===o)){const n={id:`e-${r.fromNodeId}-${o}-${Date.now().toString(36)}`,from:r.fromNodeId,to:o};t({...e,edges:[...e.edges,n]})}B.current=null,U(null)},_=e=>{V.current.delete(e.pointerId),V.current.size<2&&(H.current=null);const t=B.current;t&&"pan"===t.kind&&t.pointerId===e.pointerId&&(B.current=null)};function J(e,t,n){return Math.max(t,Math.min(n,e))}const Q=a((e,t,n)=>{C(r=>{const o=J(e,c,u),i=(t-r.x)/r.scale,a=(n-r.y)/r.scale;return{x:t-i*o,y:n-a*o,scale:o}})},[c,u]),ee=a(()=>{const t=W.current?.getBoundingClientRect();if(!t||0===e.nodes.length)return void C(Vc);let n=1/0,r=1/0,o=-1/0,i=-1/0;for(const c of e.nodes){const e=c.width??160,t=c.height??60;c.x<n&&(n=c.x),c.y<r&&(r=c.y),c.x+e>o&&(o=c.x+e),c.y+t>i&&(i=c.y+t)}const a=o-n+80,l=i-r+80,s=t.width/a,d=t.height/l,p=J(Math.min(s,d),c,u);C({x:-n*p+(t.width-(o-n)*p)/2,y:-r*p+(t.height-(i-r)*p)/2,scale:p})},[e.nodes,c,u]),te=`translate3d(${S.x}px, ${S.y}px, 0) scale(${S.scale})`,ne=p(()=>new Map(e.nodes.map(e=>[e.id,e])),[e.nodes]);/* @__PURE__ */
621
+ return b("div",{ref:e=>{W.current=e,"function"==typeof $?$(e):$&&($.current=e)},className:w,role:"application","aria-label":"Flow chart editor",tabIndex:0,onKeyDown:n=>{if(P&&("Delete"===n.key||"Backspace"===n.key))return n.preventDefault(),t({...e,edges:e.edges.filter(e=>e.id!==P)}),void F(null);if(!N)return void("Tab"===n.key&&e.nodes.length>0&&(n.preventDefault(),E(e.nodes[0].id)));const r=e.nodes.findIndex(e=>e.id===N);switch(n.key){case"Tab":{n.preventDefault();const t=(r+(n.shiftKey?-1:1)+e.nodes.length)%e.nodes.length;E(e.nodes[t].id);break}case"Delete":case"Backspace":n.preventDefault(),t({nodes:e.nodes.filter(e=>e.id!==N),edges:e.edges.filter(e=>e.from!==N&&e.to!==N)}),E(null);break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{n.preventDefault();const r=n.shiftKey?10:1,o="ArrowRight"===n.key?r:"ArrowLeft"===n.key?-r:0,i="ArrowDown"===n.key?r:"ArrowUp"===n.key?-r:0;t({...e,nodes:e.nodes.map(e=>e.id===N?{...e,x:e.x+o,y:e.y+i}:e)});break}}},onPointerDown:e=>{if(V.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),s&&2===V.current.size){const[e,t]=Array.from(V.current.values());return void(H.current={startDist:Math.hypot(t.x-e.x,t.y-e.y),startScale:S.scale,centerX:(e.x+t.x)/2,centerY:(e.y+t.y)/2})}if(e.target===e.currentTarget&&l){E(null);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}B.current={kind:"pan",pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,vpStartX:S.x,vpStartY:S.y}}},onPointerMove:e=>{V.current.has(e.pointerId)&&V.current.set(e.pointerId,{x:e.clientX,y:e.clientY});const t=H.current;if(t&&2===V.current.size){const[e,n]=Array.from(V.current.values()),r=Math.hypot(n.x-e.x,n.y-e.y)/t.startDist,o=J(t.startScale*r,c,u),i=W.current?.getBoundingClientRect();return void(i&&Q(o,t.centerX-i.left,t.centerY-i.top))}const n=B.current;n&&"pan"===n.kind&&n.pointerId===e.pointerId&&C({x:n.vpStartX+(e.clientX-n.startX),y:n.vpStartY+(e.clientY-n.startY),scale:S.scale})},onPointerUp:_,onPointerCancel:_,onWheel:e=>{if(!s)return;e.preventDefault();const t=W.current?.getBoundingClientRect();if(!t)return;const n=Math.exp(.0015*-e.deltaY);Q(S.scale*n,e.clientX-t.left,e.clientY-t.top)},"data-testid":"tkx-flowchart",style:{position:"relative",width:"100%",height:h,overflow:"hidden",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:12,touchAction:s||l?"none":"auto",outline:"none",...k},children:[g&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px)",backgroundSize:`${24*S.scale}px ${24*S.scale}px`,backgroundPosition:`${S.x}px ${S.y}px`,pointerEvents:"none"}}),
595
622
  /* @__PURE__ */x("svg",{"aria-hidden":"true",width:"100%",height:"100%",style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"visible"},children:/* @__PURE__ */b("g",{style:{transform:te,transformOrigin:"0 0"},children:[
596
- /* @__PURE__ */x("defs",{children:/* @__PURE__ */x("marker",{id:`tkx-flow-arrow-${j}`,markerWidth:"6",markerHeight:"6",refX:"5",refY:"3",orient:"auto",children:/* @__PURE__ */x("path",{d:"M0,0 L6,3 L0,6 z",fill:"currentColor"})})}),q&&(()=>{const e=ne.get(q.fromNodeId);if(!e)return null;const t=Dc(e).out,n=[q.gx,q.gy],r=Math.max(40,Math.abs(n[0]-t[0])/2);/* @__PURE__ */
597
- return x("path",{"data-testid":"flow-edge-draft",d:`M ${t[0]} ${t[1]} C ${t[0]+r} ${t[1]}, ${n[0]-r} ${n[1]}, ${n[0]} ${n[1]}`,stroke:"var(--tkx-accent, #00f5d4)",strokeWidth:1.6/S.scale,strokeDasharray:`${4/S.scale} ${4/S.scale}`,fill:"none",strokeOpacity:.85})})(),e.edges.map(e=>{const t=ne.get(e.from),n=ne.get(e.to);if(!t||!n)return null;const r=e.color??t.color??"var(--tkx-accent, #00f5d4)",o=e.id===R;/* @__PURE__ */
623
+ /* @__PURE__ */x("defs",{children:/* @__PURE__ */x("marker",{id:`tkx-flow-arrow-${j}`,markerWidth:"6",markerHeight:"6",refX:"5",refY:"3",orient:"auto",children:/* @__PURE__ */x("path",{d:"M0,0 L6,3 L0,6 z",fill:"currentColor"})})}),q&&(()=>{const e=ne.get(q.fromNodeId);if(!e)return null;const t=Ec(e).out,n=[q.gx,q.gy],r=Math.max(40,Math.abs(n[0]-t[0])/2);/* @__PURE__ */
624
+ return x("path",{"data-testid":"flow-edge-draft",d:`M ${t[0]} ${t[1]} C ${t[0]+r} ${t[1]}, ${n[0]-r} ${n[1]}, ${n[0]} ${n[1]}`,stroke:"var(--tkx-accent, #00f5d4)",strokeWidth:1.6/S.scale,strokeDasharray:`${4/S.scale} ${4/S.scale}`,fill:"none",strokeOpacity:.85})})(),e.edges.map(e=>{const t=ne.get(e.from),n=ne.get(e.to);if(!t||!n)return null;const r=e.color??t.color??"var(--tkx-accent, #00f5d4)",o=e.id===P;/* @__PURE__ */
598
625
  return b("g",{"data-testid":`flow-edge-${e.id}`,style:{color:r,pointerEvents:"auto",cursor:"pointer"},children:[
599
- /* @__PURE__ */x("path",{d:Pc(t,n),stroke:"transparent",strokeWidth:12/S.scale,fill:"none",onClick:t=>{t.stopPropagation(),F(e.id),E(null)}}),
600
- /* @__PURE__ */x("path",{d:Pc(t,n),stroke:r,strokeWidth:(o?2.5:1.5)/S.scale,fill:"none",markerEnd:`url(#tkx-flow-arrow-${j})`,strokeOpacity:o?1:.8,style:{filter:o?`drop-shadow(0 0 4px ${r})`:"none",pointerEvents:"none"}}),e.label&&/* @__PURE__ */x("text",{x:(Dc(t).out[0]+Dc(n).in[0])/2,y:(Dc(t).out[1]+Dc(n).in[1])/2-6,textAnchor:"middle",fill:r,fontSize:11/S.scale,fontFamily:"ui-monospace, monospace",children:e.label})]},e.id)})]})}),
626
+ /* @__PURE__ */x("path",{d:Bc(t,n),stroke:"transparent",strokeWidth:12/S.scale,fill:"none",onClick:t=>{t.stopPropagation(),F(e.id),E(null)}}),
627
+ /* @__PURE__ */x("path",{d:Bc(t,n),stroke:r,strokeWidth:(o?2.5:1.5)/S.scale,fill:"none",markerEnd:`url(#tkx-flow-arrow-${j})`,strokeOpacity:o?1:.8,style:{filter:o?`drop-shadow(0 0 4px ${r})`:"none",pointerEvents:"none"}}),e.label&&/* @__PURE__ */x("text",{x:(Ec(t).out[0]+Ec(n).in[0])/2,y:(Ec(t).out[1]+Ec(n).in[1])/2-6,textAnchor:"middle",fill:r,fontSize:11/S.scale,fontFamily:"ui-monospace, monospace",children:e.label})]},e.id)})]})}),
601
628
  /* @__PURE__ */x("div",{style:{position:"absolute",inset:0,transform:te,transformOrigin:"0 0",pointerEvents:"none"},children:e.nodes.map(n=>{const r=n.id===N,o=n.width??160,a=n.height??60,l=n.color??"var(--tkx-accent, #00f5d4)";/* @__PURE__ */
602
- return b("div",{role:"button","aria-pressed":r,tabIndex:-1,"data-testid":`flow-node-${n.id}`,"data-tkx-node-id":n.id,onPointerDown:e=>((e,t)=>{if(i){e.stopPropagation(),E(t.id),O.current.add(t.id);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}B.current={kind:"node",id:t.id,pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,nodeStartX:t.x,nodeStartY:t.y}}})(e,n),onPointerMove:K,onPointerUp:Y,onPointerCancel:Y,onDoubleClick:e=>{e.stopPropagation(),v||(E(n.id),P(n.id))},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),E(n.id),A({x:e.clientX,y:e.clientY,nodeId:n.id})},style:{position:"absolute",left:n.x,top:n.y,width:o,height:a,pointerEvents:"auto",borderRadius:8,background:r?`${l}1f`:"rgba(18, 20, 38, 0.9)",border:`2px solid ${r?l:"rgba(255,255,255,0.12)"}`,boxShadow:r?`0 0 0 3px ${l}33`:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 10px",fontSize:13,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)",textAlign:"center",cursor:"grab",userSelect:"none",touchAction:"none"},children:[D===n.id?/* @__PURE__ */x("input",{autoFocus:!0,"data-testid":`flow-node-rename-${n.id}`,defaultValue:n.label,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),onBlur:r=>{const o=r.currentTarget.value.trim();o&&o!==n.label&&t({...e,nodes:e.nodes.map(e=>e.id===n.id?{...e,label:o}:e)}),P(null)},onKeyDown:e=>{"Enter"===e.key?e.currentTarget.blur():"Escape"===e.key&&(e.currentTarget.value=n.label,P(null)),e.stopPropagation()},style:{width:"100%",padding:"4px 6px",borderRadius:4,border:`1px solid ${l}`,background:"rgba(8,10,25,0.95)",color:"#fff",textAlign:"center",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit",outline:"none"}}):v?v(n,r):n.label,
629
+ return b("div",{role:"button","aria-pressed":r,tabIndex:-1,"data-testid":`flow-node-${n.id}`,"data-tkx-node-id":n.id,onPointerDown:e=>((e,t)=>{if(i){e.stopPropagation(),E(t.id),O.current.add(t.id);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}B.current={kind:"node",id:t.id,pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,nodeStartX:t.x,nodeStartY:t.y}}})(e,n),onPointerMove:K,onPointerUp:Y,onPointerCancel:Y,onDoubleClick:e=>{e.stopPropagation(),v||(E(n.id),R(n.id))},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),E(n.id),A({x:e.clientX,y:e.clientY,nodeId:n.id})},style:{position:"absolute",left:n.x,top:n.y,width:o,height:a,pointerEvents:"auto",borderRadius:8,background:r?`${l}1f`:"rgba(18, 20, 38, 0.9)",border:`2px solid ${r?l:"rgba(255,255,255,0.12)"}`,boxShadow:r?`0 0 0 3px ${l}33`:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 10px",fontSize:13,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)",textAlign:"center",cursor:"grab",userSelect:"none",touchAction:"none"},children:[D===n.id?/* @__PURE__ */x("input",{autoFocus:!0,"data-testid":`flow-node-rename-${n.id}`,defaultValue:n.label,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),onBlur:r=>{const o=r.currentTarget.value.trim();o&&o!==n.label&&t({...e,nodes:e.nodes.map(e=>e.id===n.id?{...e,label:o}:e)}),R(null)},onKeyDown:e=>{"Enter"===e.key?e.currentTarget.blur():"Escape"===e.key&&(e.currentTarget.value=n.label,R(null)),e.stopPropagation()},style:{width:"100%",padding:"4px 6px",borderRadius:4,border:`1px solid ${l}`,background:"rgba(8,10,25,0.95)",color:"#fff",textAlign:"center",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit",outline:"none"}}):v?v(n,r):n.label,
603
630
  /* @__PURE__ */x("span",{"aria-hidden":"true",style:{position:"absolute",left:-6,top:"50%",width:10,height:10,transform:"translateY(-50%)",borderRadius:"50%",background:l,boxShadow:`0 0 8px ${l}88`,pointerEvents:"none"}}),
604
631
  /* @__PURE__ */x("button",{type:"button","aria-label":`Connect from ${n.label} — drag to another node`,title:"Drag to connect to another node","data-testid":`flow-port-${n.id}`,onPointerDown:r=>((n,r)=>{n.stopPropagation(),n.preventDefault();const o=n.pointerId,[i,a]=X(n.clientX,n.clientY);B.current={kind:"edge",pointerId:o,fromNodeId:r},U({fromNodeId:r,gx:i,gy:a});const l=e=>{const t=B.current;if(!t||"edge"!==t.kind||t.pointerId!==e.pointerId)return;const[n,r]=X(e.clientX,e.clientY);U({fromNodeId:t.fromNodeId,gx:n,gy:r})},s=n=>{const r=B.current;if(!r||"edge"!==r.kind||r.pointerId!==n.pointerId)return;let o;try{o=((document.elementFromPoint?.(n.clientX,n.clientY))?.closest("[data-tkx-node-id]"))?.dataset.tkxNodeId}catch{}if(o&&o!==r.fromNodeId&&!e.edges.some(e=>e.from===r.fromNodeId&&e.to===o)){const n={id:`e-${r.fromNodeId}-${o}-${Date.now().toString(36)}`,from:r.fromNodeId,to:o};t({...e,edges:[...e.edges,n]})}B.current=null,U(null),window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)};window.addEventListener("pointermove",l),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s)})(r,n.id),onPointerMove:Z,onPointerUp:G,onPointerCancel:G,onMouseEnter:e=>{e.currentTarget.style.transform="translateY(-50%) scale(1.25)",e.currentTarget.style.boxShadow=`0 0 18px ${l}, 0 0 6px ${l}`},onMouseLeave:e=>{e.currentTarget.style.transform="translateY(-50%) scale(1)",e.currentTarget.style.boxShadow=`0 0 12px ${l}aa`},style:{position:"absolute",right:-11,top:"50%",width:22,height:22,transform:"translateY(-50%)",borderRadius:"50%",background:l,boxShadow:`0 0 12px ${l}aa`,border:"2px solid rgba(8,10,25,0.95)",cursor:"crosshair",padding:0,touchAction:"none",color:"#0a0a0f",fontSize:12,fontWeight:900,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,transition:"transform 0.15s, box-shadow 0.15s",zIndex:2},children:/* @__PURE__ */x("span",{"aria-hidden":"true",children:"+"})})]},n.id)})}),y&&/* @__PURE__ */b("div",{role:"toolbar","aria-label":"Flow chart controls",style:{position:"absolute",right:12,bottom:12,display:"flex",gap:4,padding:4,borderRadius:999,background:"rgba(8, 10, 25, 0.7)",border:"1px solid rgba(255,255,255,0.12)",backdropFilter:"blur(6px)"},children:[
605
- /* @__PURE__ */x(Wc,{label:"Zoom out",onClick:()=>{const e=W.current?.getBoundingClientRect();e&&Q(.8*S.scale,e.width/2,e.height/2)},testId:"flow-zoom-out",children:"−"}),
606
- /* @__PURE__ */x(Wc,{label:"Reset zoom",onClick:ee,testId:"flow-fit",children:"⤢"}),
607
- /* @__PURE__ */x(Wc,{label:"Zoom in",onClick:()=>{const e=W.current?.getBoundingClientRect();e&&Q(1.25*S.scale,e.width/2,e.height/2)},testId:"flow-zoom-in",children:"+"}),
632
+ /* @__PURE__ */x(Yc,{label:"Zoom out",onClick:()=>{const e=W.current?.getBoundingClientRect();e&&Q(.8*S.scale,e.width/2,e.height/2)},testId:"flow-zoom-out",children:"−"}),
633
+ /* @__PURE__ */x(Yc,{label:"Reset zoom",onClick:ee,testId:"flow-fit",children:"⤢"}),
634
+ /* @__PURE__ */x(Yc,{label:"Zoom in",onClick:()=>{const e=W.current?.getBoundingClientRect();e&&Q(1.25*S.scale,e.width/2,e.height/2)},testId:"flow-zoom-in",children:"+"}),
608
635
  /* @__PURE__ */b("span",{"data-testid":"flow-zoom-readout",style:{display:"inline-flex",alignItems:"center",padding:"0 10px",color:"#aaa",fontSize:11,fontFamily:"ui-monospace, monospace",fontVariantNumeric:"tabular-nums"},children:[Math.round(100*S.scale),"%"]}),
609
- /* @__PURE__ */x(Wc,{label:"Toggle inspector",onClick:()=>T(e=>!e),testId:"flow-toggle-inspector",children:"☰"})]}),I&&/* @__PURE__ */x(Tc,{x:I.x,y:I.y,containerEl:W.current,onClose:()=>A(null),actions:[{id:"rename",label:"Rename",icon:"✏️",run:()=>{P(I.nodeId)}},{id:"duplicate",label:"Duplicate",icon:"⎘",run:()=>{const n=e.nodes.find(e=>e.id===I.nodeId);if(!n)return;const r=`${n.id}-copy-${Date.now().toString(36)}`;t({...e,nodes:[...e.nodes,{...n,id:r,x:n.x+20,y:n.y+20}]}),E(r)}},{id:"bring-to-front",label:"Bring to front",icon:"⬆",run:()=>{const n=e.nodes.findIndex(e=>e.id===I.nodeId);if(n<0)return;const r=[...e.nodes.slice(0,n),...e.nodes.slice(n+1),e.nodes[n]];t({...e,nodes:r})}},{id:"delete",label:"Delete",icon:"🗑",danger:!0,run:()=>{t({nodes:e.nodes.filter(e=>e.id!==I.nodeId),edges:e.edges.filter(e=>e.from!==I.nodeId&&e.to!==I.nodeId)}),N===I.nodeId&&E(null)}}]}),L&&N&&(()=>{const n=e.nodes.find(e=>e.id===N);if(!n)return null;const r=n.color??"#00f5d4",o=n.width??160,i=n.height??60,a=n=>{t({...e,nodes:e.nodes.map(e=>e.id===N?{...e,...n}:e)})};/* @__PURE__ */
636
+ /* @__PURE__ */x(Yc,{label:"Toggle inspector",onClick:()=>T(e=>!e),testId:"flow-toggle-inspector",children:"☰"})]}),I&&/* @__PURE__ */x(Kc,{x:I.x,y:I.y,containerEl:W.current,onClose:()=>A(null),actions:[{id:"rename",label:"Rename",icon:"✏️",run:()=>{R(I.nodeId)}},{id:"duplicate",label:"Duplicate",icon:"⎘",run:()=>{const n=e.nodes.find(e=>e.id===I.nodeId);if(!n)return;const r=`${n.id}-copy-${Date.now().toString(36)}`;t({...e,nodes:[...e.nodes,{...n,id:r,x:n.x+20,y:n.y+20}]}),E(r)}},{id:"bring-to-front",label:"Bring to front",icon:"⬆",run:()=>{const n=e.nodes.findIndex(e=>e.id===I.nodeId);if(n<0)return;const r=[...e.nodes.slice(0,n),...e.nodes.slice(n+1),e.nodes[n]];t({...e,nodes:r})}},{id:"delete",label:"Delete",icon:"🗑",danger:!0,run:()=>{t({nodes:e.nodes.filter(e=>e.id!==I.nodeId),edges:e.edges.filter(e=>e.from!==I.nodeId&&e.to!==I.nodeId)}),N===I.nodeId&&E(null)}}]}),L&&N&&(()=>{const n=e.nodes.find(e=>e.id===N);if(!n)return null;const r=n.color??"#00f5d4",o=n.width??160,i=n.height??60,a=n=>{t({...e,nodes:e.nodes.map(e=>e.id===N?{...e,...n}:e)})};/* @__PURE__ */
610
637
  return b("div",{role:"region","aria-label":"Node properties","data-testid":"flow-inspector",style:{position:"absolute",top:12,right:12,width:220,padding:12,borderRadius:10,background:"rgba(8, 10, 25, 0.92)",border:"1px solid rgba(196,168,255,0.3)",color:"#dcdce8",fontSize:12,backdropFilter:"blur(8px)",boxShadow:"0 12px 32px rgba(0,0,0,0.45)",zIndex:5},children:[
611
638
  /* @__PURE__ */x("div",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"#888",marginBottom:8},children:"Properties"}),
612
- /* @__PURE__ */x(Ic,{label:"Label",children:/* @__PURE__ */x("input",{"data-testid":"inspector-label",value:n.label,onChange:e=>a({label:e.target.value}),style:Ac})}),
613
- /* @__PURE__ */x(Ic,{label:"Color",children:/* @__PURE__ */x("input",{type:"color","data-testid":"inspector-color",value:Lc(r),onChange:e=>a({color:e.target.value}),style:{...Ac,padding:0,height:32}})}),
614
- /* @__PURE__ */x(Ic,{label:`Width (${o}px)`,children:/* @__PURE__ */x("input",{type:"range",min:80,max:320,value:o,onChange:e=>a({width:+e.target.value}),style:{width:"100%"}})}),
615
- /* @__PURE__ */x(Ic,{label:`Height (${i}px)`,children:/* @__PURE__ */x("input",{type:"range",min:40,max:200,value:i,onChange:e=>a({height:+e.target.value}),style:{width:"100%"}})})]})})()]})});function Ic({label:e,children:t}){/* @__PURE__ */
616
- return b("label",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8,fontSize:11,color:"#aaa"},children:[e,t]})}var Ac={padding:"6px 8px",minHeight:30,borderRadius:5,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(13, 13, 20, 0.6)",color:"#e8e8f4",fontSize:12,fontFamily:"inherit",width:"100%"};function Lc(e){if(e.startsWith("#"))return 7===e.length?e:"#00f5d4";if(e.startsWith("rgb")){const t=e.match(/\d+/g);return!t||t.length<3?"#00f5d4":"#"+t.slice(0,3).map(e=>Number(e).toString(16).padStart(2,"0")).join("")}return"#00f5d4"}function Tc({x:t,y:n,containerEl:r,actions:o,onClose:i}){e.useEffect(()=>{const e=e=>{e.target.closest?.("[data-tkx-context-menu]")||i()},t=e=>{"Escape"===e.key&&i()};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[i]);const a=r?.getBoundingClientRect(),l=a?t-a.left:t,s=a?n-a.top:n;/* @__PURE__ */
617
- return x("div",{role:"menu","aria-label":"Node actions","data-testid":"flow-context-menu","data-tkx-context-menu":"",style:{position:"absolute",left:Math.max(4,Math.min(l,(a?.width??600)-180)),top:Math.max(4,Math.min(s,(a?.height??400)-200)),minWidth:180,padding:4,borderRadius:8,background:"rgba(8, 10, 25, 0.96)",border:"1px solid rgba(196,168,255,0.3)",color:"#dcdce8",backdropFilter:"blur(8px)",boxShadow:"0 12px 32px rgba(0,0,0,0.55)",zIndex:10},children:o.map(e=>/* @__PURE__ */b("button",{type:"button",role:"menuitem","data-testid":`flow-menu-${e.id}`,onClick:()=>{e.run(),i()},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 12px",minHeight:36,border:"none",background:"transparent",color:e.danger?"#ff7eaf":"#dcdce8",cursor:"pointer",fontSize:13,fontWeight:500,fontFamily:"inherit",textAlign:"left",borderRadius:5},onMouseEnter:e=>e.currentTarget.style.background="rgba(196,168,255,0.12)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[/* @__PURE__ */x("span",{"aria-hidden":"true",children:e.icon}),/* @__PURE__ */x("span",{children:e.label})]},e.id))})}function Wc({children:e,label:t,onClick:n,testId:r}){/* @__PURE__ */
618
- return x("button",{type:"button","aria-label":t,onClick:n,"data-testid":r,style:{width:44,height:44,minWidth:44,minHeight:44,borderRadius:999,border:"none",background:"transparent",color:"#dcdce8",cursor:"pointer",fontSize:18,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e})}var jc="undefined"!=typeof navigator&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform||"");function Ec(e,t){if(!e)return 0;const n=e.toLowerCase(),r=t.toLowerCase();let o=0,i=0,a=-2,l=0;for(let s=0;s<r.length&&o<n.length;s++){if(r[s]!==n[o]){l=0;continue}let e=1;0===s?e+=8:/[\s_\-./]/.test(r[s-1])&&(e+=6),s===a+1?(l+=1,e+=2*l):l=1,i+=e,a=s,o+=1}return o<n.length?null:i-.05*r.length}var Bc={ctrl:!0,key:"k"};function Vc({commands:e,hotkey:t=Bc,open:n,onOpenChange:r,placeholder:o="Type a command…",onSelect:i,recents:l=!0,maxRecents:c=5,emptyState:u,className:h}){const[g,v]=m(!1),w=n??g,k=a(e=>{void 0===n&&v(e),r?.(e)},[n,r]),[$,S]=m(""),[C,z]=m([]),[M,N]=m(0),D=f(null),P=f(null),R=d();s(()=>{if(!t)return;const e=e=>{e.key.toLowerCase()===t.key.toLowerCase()&&function(e,t){return!t||(jc?e.metaKey:e.ctrlKey)}(e,t.ctrl??!0)&&(t.shift??!1)===e.shiftKey&&(t.alt??!1)===e.altKey&&(e.preventDefault(),k(!w))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,w,k]),s(()=>{w&&(S(""),N(0),requestAnimationFrame(()=>D.current?.focus()))},[w]);const F=p(()=>{const t=e.filter(e=>!e.hidden);if(""===$.trim()){const e=[],n=new Set(l?C:[]),r=new Map(t.map(e=>[e.id,e]));if(l)for(const t of C){const n=r.get(t);n&&e.push({cmd:n,section:"Recents",score:0,recent:!0})}for(const o of t)n.has(o.id)||e.push({cmd:o,section:o.section??"Commands",score:0});return e}const n=[];for(const e of t){const t=Ec($,e.title),r=e.subtitle?Ec($,e.subtitle):null;let o=null;null!==t&&(o=t),null!==r&&(o=null===o?r-4:Math.max(o,r-4)),null!==o&&n.push({cmd:e,section:e.section??"Commands",score:o})}return n.sort((e,t)=>t.score-e.score),n},[e,$,C,l]),I=p(()=>{const e=/* @__PURE__ */new Map,t=[];for(const n of F)e.has(n.section)||(e.set(n.section,[]),t.push(n.section)),e.get(n.section).push(n);return t.map(t=>({section:t,items:e.get(t)}))},[F]),A=p(()=>I.flatMap(e=>e.items),[I]);s(()=>{M>=A.length&&N(Math.max(0,A.length-1))},[A.length,M]);const L=a(e=>{i?.(e),e.onSelect?.(e),z(t=>[e.id,...t.filter(t=>t!==e.id)].slice(0,c)),k(!1)},[i,k,c]);if(s(()=>{P.current&&P.current.querySelector(`[data-idx="${M}"]`)?.scrollIntoView({block:"nearest"})},[M]),!w)return null;if("undefined"==typeof document)return null;const T=`${R}-opt-${M}`;return y(/* @__PURE__ */x("div",{role:"dialog","aria-modal":"true","aria-label":"Command palette",className:h,onClick:()=>k(!1),"data-testid":"tkx-command-palette",style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"min(15vh, 120px) 16px 16px",background:"rgba(8, 10, 25, 0.6)",backdropFilter:"blur(8px)"},children:/* @__PURE__ */b("div",{onClick:e=>e.stopPropagation(),onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),N(e=>Math.min(A.length-1,e+1));break;case"ArrowUp":e.preventDefault(),N(e=>Math.max(0,e-1));break;case"Enter":{e.preventDefault();const t=A[M];t&&L(t.cmd);break}case"Escape":e.preventDefault(),k(!1);break;case"Home":e.preventDefault(),N(0);break;case"End":e.preventDefault(),N(A.length-1)}},style:{width:"100%",maxWidth:560,maxHeight:"70vh",display:"flex",flexDirection:"column",background:"rgba(18, 20, 38, 0.92)",backdropFilter:"blur(20px) saturate(140%)",border:"1px solid rgba(196,168,255,0.25)",borderRadius:14,boxShadow:"0 24px 64px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,245,212,0.08)",overflow:"hidden",color:"#e8e8f4"},children:[/* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"14px 18px",borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[
639
+ /* @__PURE__ */x(Oc,{label:"Label",children:/* @__PURE__ */x("input",{"data-testid":"inspector-label",value:n.label,onChange:e=>a({label:e.target.value}),style:qc})}),
640
+ /* @__PURE__ */x(Oc,{label:"Color",children:/* @__PURE__ */x("input",{type:"color","data-testid":"inspector-color",value:Uc(r),onChange:e=>a({color:e.target.value}),style:{...qc,padding:0,height:32}})}),
641
+ /* @__PURE__ */x(Oc,{label:`Width (${o}px)`,children:/* @__PURE__ */x("input",{type:"range",min:80,max:320,value:o,onChange:e=>a({width:+e.target.value}),style:{width:"100%"}})}),
642
+ /* @__PURE__ */x(Oc,{label:`Height (${i}px)`,children:/* @__PURE__ */x("input",{type:"range",min:40,max:200,value:i,onChange:e=>a({height:+e.target.value}),style:{width:"100%"}})})]})})()]})});function Oc({label:e,children:t}){/* @__PURE__ */
643
+ return b("label",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8,fontSize:11,color:"#aaa"},children:[e,t]})}var qc={padding:"6px 8px",minHeight:30,borderRadius:5,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(13, 13, 20, 0.6)",color:"#e8e8f4",fontSize:12,fontFamily:"inherit",width:"100%"};function Uc(e){if(e.startsWith("#"))return 7===e.length?e:"#00f5d4";if(e.startsWith("rgb")){const t=e.match(/\d+/g);return!t||t.length<3?"#00f5d4":"#"+t.slice(0,3).map(e=>Number(e).toString(16).padStart(2,"0")).join("")}return"#00f5d4"}function Kc({x:t,y:n,containerEl:r,actions:o,onClose:i}){e.useEffect(()=>{const e=e=>{e.target.closest?.("[data-tkx-context-menu]")||i()},t=e=>{"Escape"===e.key&&i()};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[i]);const a=r?.getBoundingClientRect(),l=a?t-a.left:t,s=a?n-a.top:n;/* @__PURE__ */
644
+ return x("div",{role:"menu","aria-label":"Node actions","data-testid":"flow-context-menu","data-tkx-context-menu":"",style:{position:"absolute",left:Math.max(4,Math.min(l,(a?.width??600)-180)),top:Math.max(4,Math.min(s,(a?.height??400)-200)),minWidth:180,padding:4,borderRadius:8,background:"rgba(8, 10, 25, 0.96)",border:"1px solid rgba(196,168,255,0.3)",color:"#dcdce8",backdropFilter:"blur(8px)",boxShadow:"0 12px 32px rgba(0,0,0,0.55)",zIndex:10},children:o.map(e=>/* @__PURE__ */b("button",{type:"button",role:"menuitem","data-testid":`flow-menu-${e.id}`,onClick:()=>{e.run(),i()},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 12px",minHeight:36,border:"none",background:"transparent",color:e.danger?"#ff7eaf":"#dcdce8",cursor:"pointer",fontSize:13,fontWeight:500,fontFamily:"inherit",textAlign:"left",borderRadius:5},onMouseEnter:e=>e.currentTarget.style.background="rgba(196,168,255,0.12)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[/* @__PURE__ */x("span",{"aria-hidden":"true",children:e.icon}),/* @__PURE__ */x("span",{children:e.label})]},e.id))})}function Yc({children:e,label:t,onClick:n,testId:r}){/* @__PURE__ */
645
+ return x("button",{type:"button","aria-label":t,onClick:n,"data-testid":r,style:{width:44,height:44,minWidth:44,minHeight:44,borderRadius:999,border:"none",background:"transparent",color:"#dcdce8",cursor:"pointer",fontSize:18,fontFamily:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e})}var Xc="undefined"!=typeof navigator&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform||"");function Zc(e,t){if(!e)return 0;const n=e.toLowerCase(),r=t.toLowerCase();let o=0,i=0,a=-2,l=0;for(let s=0;s<r.length&&o<n.length;s++){if(r[s]!==n[o]){l=0;continue}let e=1;0===s?e+=8:/[\s_\-./]/.test(r[s-1])&&(e+=6),s===a+1?(l+=1,e+=2*l):l=1,i+=e,a=s,o+=1}return o<n.length?null:i-.05*r.length}var Gc={ctrl:!0,key:"k"};function _c({commands:e,hotkey:t=Gc,open:n,onOpenChange:r,placeholder:o="Type a command…",onSelect:i,recents:l=!0,maxRecents:c=5,emptyState:u,className:h}){const[g,v]=m(!1),w=n??g,k=a(e=>{void 0===n&&v(e),r?.(e)},[n,r]),[$,S]=m(""),[C,z]=m([]),[M,N]=m(0),D=f(null),R=f(null),P=d();s(()=>{if(!t)return;const e=e=>{e.key.toLowerCase()===t.key.toLowerCase()&&function(e,t){return!t||(Xc?e.metaKey:e.ctrlKey)}(e,t.ctrl??!0)&&(t.shift??!1)===e.shiftKey&&(t.alt??!1)===e.altKey&&(e.preventDefault(),k(!w))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,w,k]),s(()=>{w&&(S(""),N(0),requestAnimationFrame(()=>D.current?.focus()))},[w]);const F=p(()=>{const t=e.filter(e=>!e.hidden);if(""===$.trim()){const e=[],n=new Set(l?C:[]),r=new Map(t.map(e=>[e.id,e]));if(l)for(const t of C){const n=r.get(t);n&&e.push({cmd:n,section:"Recents",score:0,recent:!0})}for(const o of t)n.has(o.id)||e.push({cmd:o,section:o.section??"Commands",score:0});return e}const n=[];for(const e of t){const t=Zc($,e.title),r=e.subtitle?Zc($,e.subtitle):null;let o=null;null!==t&&(o=t),null!==r&&(o=null===o?r-4:Math.max(o,r-4)),null!==o&&n.push({cmd:e,section:e.section??"Commands",score:o})}return n.sort((e,t)=>t.score-e.score),n},[e,$,C,l]),I=p(()=>{const e=/* @__PURE__ */new Map,t=[];for(const n of F)e.has(n.section)||(e.set(n.section,[]),t.push(n.section)),e.get(n.section).push(n);return t.map(t=>({section:t,items:e.get(t)}))},[F]),A=p(()=>I.flatMap(e=>e.items),[I]);s(()=>{M>=A.length&&N(Math.max(0,A.length-1))},[A.length,M]);const L=a(e=>{i?.(e),e.onSelect?.(e),z(t=>[e.id,...t.filter(t=>t!==e.id)].slice(0,c)),k(!1)},[i,k,c]);if(s(()=>{R.current&&R.current.querySelector(`[data-idx="${M}"]`)?.scrollIntoView({block:"nearest"})},[M]),!w)return null;if("undefined"==typeof document)return null;const T=`${P}-opt-${M}`;return y(/* @__PURE__ */x("div",{role:"dialog","aria-modal":"true","aria-label":"Command palette",className:h,onClick:()=>k(!1),"data-testid":"tkx-command-palette",style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"min(15vh, 120px) 16px 16px",background:"rgba(8, 10, 25, 0.6)",backdropFilter:"blur(8px)"},children:/* @__PURE__ */b("div",{onClick:e=>e.stopPropagation(),onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),N(e=>Math.min(A.length-1,e+1));break;case"ArrowUp":e.preventDefault(),N(e=>Math.max(0,e-1));break;case"Enter":{e.preventDefault();const t=A[M];t&&L(t.cmd);break}case"Escape":e.preventDefault(),k(!1);break;case"Home":e.preventDefault(),N(0);break;case"End":e.preventDefault(),N(A.length-1)}},style:{width:"100%",maxWidth:560,maxHeight:"70vh",display:"flex",flexDirection:"column",background:"rgba(18, 20, 38, 0.92)",backdropFilter:"blur(20px) saturate(140%)",border:"1px solid rgba(196,168,255,0.25)",borderRadius:14,boxShadow:"0 24px 64px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,245,212,0.08)",overflow:"hidden",color:"#e8e8f4"},children:[/* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"14px 18px",borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[
619
646
  /* @__PURE__ */x("span",{"aria-hidden":"true",style:{fontSize:18,opacity:.7},children:"🔍"}),
620
- /* @__PURE__ */x("input",{ref:D,role:"combobox","aria-expanded":!0,"aria-controls":`${R}-list`,"aria-activedescendant":A.length?T:void 0,value:$,onChange:e=>{S(e.target.value),N(0)},placeholder:o,"data-testid":"cmdk-input",style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:15,color:"inherit",fontFamily:"inherit",minWidth:0}}),
621
- /* @__PURE__ */x("kbd",{"aria-hidden":"true",style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,border:"1px solid rgba(255,255,255,0.12)",color:"#aaa",background:"rgba(255,255,255,0.04)",fontFamily:"ui-monospace, monospace"},children:"ESC"})]}),/* @__PURE__ */b("ul",{ref:P,id:`${R}-list`,role:"listbox","data-testid":"cmdk-list",style:{listStyle:"none",margin:0,padding:6,overflow:"auto",flex:1,minHeight:0},children:[0===A.length&&/* @__PURE__ */x("li",{"data-testid":"cmdk-empty",style:{padding:"24px 16px",textAlign:"center",color:"#888",fontSize:13},children:u??`No matches for "${$}"`}),I.map(e=>{const t=A.indexOf(e.items[0]);/* @__PURE__ */
647
+ /* @__PURE__ */x("input",{ref:D,role:"combobox","aria-expanded":!0,"aria-controls":`${P}-list`,"aria-activedescendant":A.length?T:void 0,value:$,onChange:e=>{S(e.target.value),N(0)},placeholder:o,"data-testid":"cmdk-input",style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:15,color:"inherit",fontFamily:"inherit",minWidth:0}}),
648
+ /* @__PURE__ */x("kbd",{"aria-hidden":"true",style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,border:"1px solid rgba(255,255,255,0.12)",color:"#aaa",background:"rgba(255,255,255,0.04)",fontFamily:"ui-monospace, monospace"},children:"ESC"})]}),/* @__PURE__ */b("ul",{ref:R,id:`${P}-list`,role:"listbox","data-testid":"cmdk-list",style:{listStyle:"none",margin:0,padding:6,overflow:"auto",flex:1,minHeight:0},children:[0===A.length&&/* @__PURE__ */x("li",{"data-testid":"cmdk-empty",style:{padding:"24px 16px",textAlign:"center",color:"#888",fontSize:13},children:u??`No matches for "${$}"`}),I.map(e=>{const t=A.indexOf(e.items[0]);/* @__PURE__ */
622
649
  return b("li",{role:"presentation",children:[/* @__PURE__ */x("div",{style:{padding:"8px 12px 4px",fontSize:10,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"#888"},children:e.section}),/* @__PURE__ */x("ul",{role:"presentation",style:{listStyle:"none",margin:0,padding:0},children:e.items.map((e,n)=>{const r=t+n,o=r===M;/* @__PURE__ */
623
- return b("li",{id:r===M?T:void 0,role:"option","aria-selected":o,"data-testid":`cmdk-item-${e.cmd.id}`,"data-idx":r,onMouseMove:()=>N(r),onClick:()=>L(e.cmd),style:Hc(o),children:[e.cmd.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{fontSize:16,opacity:.9},children:e.cmd.icon}),
624
- /* @__PURE__ */b("span",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */x("span",{style:{fontWeight:600,fontSize:13.5,color:"#e8e8f4",display:"block"},children:e.cmd.title}),e.cmd.subtitle&&/* @__PURE__ */x("span",{style:{fontSize:12,color:"#aaa",display:"block"},children:e.cmd.subtitle})]}),e.cmd.shortcut&&/* @__PURE__ */x("span",{style:{display:"inline-flex",gap:4},children:e.cmd.shortcut.map((e,t)=>/* @__PURE__ */x("kbd",{style:Oc(o),children:e},t))})]},e.cmd.id)})})]},e.section)})]})]})}),document.body)}function Hc(e){return{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minHeight:44,borderRadius:8,cursor:"pointer",background:e?"rgba(123,142,255,0.16)":"transparent",outline:e?"1px solid rgba(123,142,255,0.4)":"none",color:"#e8e8f4",transition:"background 80ms"}}function Oc(e){return{fontSize:10,fontWeight:700,padding:"2px 6px",minWidth:18,borderRadius:4,textAlign:"center",border:"1px solid "+(e?"rgba(123,142,255,0.45)":"rgba(255,255,255,0.12)"),background:e?"rgba(123,142,255,0.14)":"rgba(255,255,255,0.04)",color:e?"#c4a8ff":"#aaa",fontFamily:"ui-monospace, monospace"}}function qc(e){return 0===e.length?"":e.map((e,t)=>`${0===t?"M":"L"}${e.x.toFixed(2)},${e.y.toFixed(2)}`).join(" ")}var Uc=i(({data:e,variant:t="line",width:n=120,height:r=32,color:o,showPoints:i=!1,showLastPoint:a=!0,showValue:l=!1,smooth:s=!1,ariaLabel:d,className:c,style:u,...p},h)=>{const f=se(),m=o??f.primary,g=!Array.isArray(e)||0===e.length,y=d??(g?"Sparkline showing no data":`Sparkline showing ${e.length} value${1===e.length?"":"s"}, trending ${function(e){if(e.length<2)return"flat";const t=e[0],n=e[e.length-1];return n>t?"up":n<t?"down":"flat"}(e)}`);if(g)/* @__PURE__ */return x("span",{ref:h,role:"img","aria-label":y,className:jt(At("inline-flex items-center"),c),style:u,...p,children:/* @__PURE__ */x("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true","data-tkx-sparkline-empty":""})});const v=function(e,t,n){if(0===e.length)return[];const r=Math.min(...e),o=Math.max(...e)-r||1,i=Math.max(0,t-4),a=Math.max(0,n-4);return 1===e.length?[{x:2+i/2,y:2+a/2}]:e.map((t,n)=>({x:2+n/(e.length-1)*i,y:2+a-(t-r)/o*a}))}(e,n,r),w=v[v.length-1],k=e[e.length-1];let $=null;if("bar"===t){const t=Math.max(0,n-4)/e.length,o=Math.max(1,.7*t),i=Math.min(...e),a=Math.max(...e)-i||1,l=Math.max(0,r-4);$=/* @__PURE__ */x("g",{"data-tkx-sparkline-variant":"bar",children:e.map((e,n)=>{const r=(e-i)/a*l,s=2+l-r;/* @__PURE__ */
625
- return x("rect",{x:(2+t*n+(t-o)/2).toFixed(2),y:s.toFixed(2),width:o.toFixed(2),height:Math.max(1,r).toFixed(2),fill:m,rx:1},n)})})}else{const e=s?function(e){if(e.length<2)return qc(e);const t=[`M${e[0].x.toFixed(2)},${e[0].y.toFixed(2)}`];for(let n=0;n<e.length-1;n++){const r=e[n-1]??e[n],o=e[n],i=e[n+1],a=e[n+2]??i,l=o.x+(i.x-r.x)/6,s=o.y+(i.y-r.y)/6,d=i.x-(a.x-o.x)/6,c=i.y-(a.y-o.y)/6;t.push(`C${l.toFixed(2)},${s.toFixed(2)} ${d.toFixed(2)},${c.toFixed(2)} ${i.x.toFixed(2)},${i.y.toFixed(2)}`)}return t.join(" ")}(v):qc(v),n=(()=>{if("area"!==t||0===v.length)return"";const n=(r-2).toFixed(2);return`${e} L${v[v.length-1].x.toFixed(2)},${n} L${v[0].x.toFixed(2)},${n} Z`})();$=/* @__PURE__ */b("g",{"data-tkx-sparkline-variant":t,children:["area"===t&&/* @__PURE__ */x("path",{d:n,fill:m,fillOpacity:.18,stroke:"none"}),
650
+ return b("li",{id:r===M?T:void 0,role:"option","aria-selected":o,"data-testid":`cmdk-item-${e.cmd.id}`,"data-idx":r,onMouseMove:()=>N(r),onClick:()=>L(e.cmd),style:Jc(o),children:[e.cmd.icon&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{fontSize:16,opacity:.9},children:e.cmd.icon}),
651
+ /* @__PURE__ */b("span",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */x("span",{style:{fontWeight:600,fontSize:13.5,color:"#e8e8f4",display:"block"},children:e.cmd.title}),e.cmd.subtitle&&/* @__PURE__ */x("span",{style:{fontSize:12,color:"#aaa",display:"block"},children:e.cmd.subtitle})]}),e.cmd.shortcut&&/* @__PURE__ */x("span",{style:{display:"inline-flex",gap:4},children:e.cmd.shortcut.map((e,t)=>/* @__PURE__ */x("kbd",{style:Qc(o),children:e},t))})]},e.cmd.id)})})]},e.section)})]})]})}),document.body)}function Jc(e){return{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minHeight:44,borderRadius:8,cursor:"pointer",background:e?"rgba(123,142,255,0.16)":"transparent",outline:e?"1px solid rgba(123,142,255,0.4)":"none",color:"#e8e8f4",transition:"background 80ms"}}function Qc(e){return{fontSize:10,fontWeight:700,padding:"2px 6px",minWidth:18,borderRadius:4,textAlign:"center",border:"1px solid "+(e?"rgba(123,142,255,0.45)":"rgba(255,255,255,0.12)"),background:e?"rgba(123,142,255,0.14)":"rgba(255,255,255,0.04)",color:e?"#c4a8ff":"#aaa",fontFamily:"ui-monospace, monospace"}}function eu(e){return 0===e.length?"":e.map((e,t)=>`${0===t?"M":"L"}${e.x.toFixed(2)},${e.y.toFixed(2)}`).join(" ")}var tu=i(({data:e,variant:t="line",width:n=120,height:r=32,color:o,showPoints:i=!1,showLastPoint:a=!0,showValue:l=!1,smooth:s=!1,ariaLabel:d,className:c,style:u,...p},h)=>{const f=se(),m=o??f.primary,g=!Array.isArray(e)||0===e.length,y=d??(g?"Sparkline showing no data":`Sparkline showing ${e.length} value${1===e.length?"":"s"}, trending ${function(e){if(e.length<2)return"flat";const t=e[0],n=e[e.length-1];return n>t?"up":n<t?"down":"flat"}(e)}`);if(g)/* @__PURE__ */return x("span",{ref:h,role:"img","aria-label":y,className:jt(At("inline-flex items-center"),c),style:u,...p,children:/* @__PURE__ */x("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true","data-tkx-sparkline-empty":""})});const v=function(e,t,n){if(0===e.length)return[];const r=Math.min(...e),o=Math.max(...e)-r||1,i=Math.max(0,t-4),a=Math.max(0,n-4);return 1===e.length?[{x:2+i/2,y:2+a/2}]:e.map((t,n)=>({x:2+n/(e.length-1)*i,y:2+a-(t-r)/o*a}))}(e,n,r),w=v[v.length-1],k=e[e.length-1];let $=null;if("bar"===t){const t=Math.max(0,n-4)/e.length,o=Math.max(1,.7*t),i=Math.min(...e),a=Math.max(...e)-i||1,l=Math.max(0,r-4);$=/* @__PURE__ */x("g",{"data-tkx-sparkline-variant":"bar",children:e.map((e,n)=>{const r=(e-i)/a*l,s=2+l-r;/* @__PURE__ */
652
+ return x("rect",{x:(2+t*n+(t-o)/2).toFixed(2),y:s.toFixed(2),width:o.toFixed(2),height:Math.max(1,r).toFixed(2),fill:m,rx:1},n)})})}else{const e=s?function(e){if(e.length<2)return eu(e);const t=[`M${e[0].x.toFixed(2)},${e[0].y.toFixed(2)}`];for(let n=0;n<e.length-1;n++){const r=e[n-1]??e[n],o=e[n],i=e[n+1],a=e[n+2]??i,l=o.x+(i.x-r.x)/6,s=o.y+(i.y-r.y)/6,d=i.x-(a.x-o.x)/6,c=i.y-(a.y-o.y)/6;t.push(`C${l.toFixed(2)},${s.toFixed(2)} ${d.toFixed(2)},${c.toFixed(2)} ${i.x.toFixed(2)},${i.y.toFixed(2)}`)}return t.join(" ")}(v):eu(v),n=(()=>{if("area"!==t||0===v.length)return"";const n=(r-2).toFixed(2);return`${e} L${v[v.length-1].x.toFixed(2)},${n} L${v[0].x.toFixed(2)},${n} Z`})();$=/* @__PURE__ */b("g",{"data-tkx-sparkline-variant":t,children:["area"===t&&/* @__PURE__ */x("path",{d:n,fill:m,fillOpacity:.18,stroke:"none"}),
626
653
  /* @__PURE__ */x("path",{d:e,fill:"none",stroke:m,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),i&&v.map((e,t)=>/* @__PURE__ */x("circle",{cx:e.x.toFixed(2),cy:e.y.toFixed(2),r:1.75,fill:m,"data-tkx-sparkline-point":""},t)),a&&!i&&w&&/* @__PURE__ */x("circle",{cx:w.x.toFixed(2),cy:w.y.toFixed(2),r:2.25,fill:m,"data-tkx-sparkline-last":""})]})}/* @__PURE__ */
627
- return b("span",{ref:h,role:"img","aria-label":y,className:jt(At("inline-flex items-center gap-2"),c),style:u,...p,children:[/* @__PURE__ */x("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:$}),l&&/* @__PURE__ */x("span",{className:At("text-xs"),style:{color:f.textMuted,fontVariantNumeric:"tabular-nums"},"data-tkx-sparkline-value":"",children:String(k)})]})});Uc.displayName="TkxSparkline";var Kc={arc:{start:-135,end:135,sweep:270},speedometer:{start:-90,end:90,sweep:180}};function Yc(e,t,n,r){const o=(r-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}}function Xc(e,t,n,r,o){if(Math.abs(o-r)<1e-4)return"";const i=Yc(e,t,n,r),a=Yc(e,t,n,o),l=o-r,s=Math.abs(l)>180?1:0,d=l>=0?1:0;return`M${i.x.toFixed(2)},${i.y.toFixed(2)} A${n.toFixed(2)},${n.toFixed(2)} 0 ${s} ${d} ${a.x.toFixed(2)},${a.y.toFixed(2)}`}function Zc(e,t,n){if(!t||0===t.length)return n;const r=[...t].sort((e,t)=>e.at-t.at);let o=r[0].color;for(const i of r)e>=i.at&&(o=i.color);return o}var Gc=i(({value:e,min:t=0,max:n=100,size:r=200,thickness:o=16,variant:i="arc",thresholds:a,label:l,showValue:d=!0,showTicks:c=!1,formatValue:u,ariaLabel:p,className:h,style:g,...y},v)=>{const w=se(),k=et(),$=Math.min(t,n),S=Math.max(t,n),C=(N=S,(z=e)<(M=$)?M:z>N?N:z);var z,M,N;const D=S-$||1,P=(C-$)/D,{start:R,end:F,sweep:I}=Kc[i],A=R+I*P,L=r/2,T=r/2,W=(r-o)/2,[j,E]=m(P),B=f(null),V=f(P),H=f(P),O=f(0);s(()=>{if(k)return void E(P);V.current=j,H.current=P,O.current="undefined"!=typeof performance?performance.now():Date.now();const e=t=>{const n=Math.min(1,(t-O.current)/400),r=1-Math.pow(1-n,3);E(V.current+(H.current-V.current)*r),n<1&&(B.current=requestAnimationFrame(e))};return"undefined"!=typeof requestAnimationFrame?B.current=requestAnimationFrame(e):E(P),()=>{null!=B.current&&"undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame(B.current)}},[P,k]);const q=R+I*j,U=Xc(L,T,W,R,F),K=[];if(a&&a.length>0){const e=[...a].sort((e,t)=>e.at-t.at),t=[$];for(const n of e)n.at>$&&n.at<S&&t.push(n.at);t.push(S);for(let n=0;n<t.length-1;n++){const e=t[n],r=R+I*((e-$)/D),o=R+I*((t[n+1]-$)/D),i=Math.min(o,q);if(i<=r)continue;const l=Zc(e+1e-4,a,w.primary);K.push({d:Xc(L,T,W,r,i),color:l})}}else K.push({d:Xc(L,T,W,R,q),color:w.primary});const Y=Zc(C,a,w.primary),X=[];if(c){const e=5,t=W+o/2+1,n=W+o/2-4,r=W+o/2-2,i=10*e;for(let o=0;o<=i;o++){const a=o%e===0,l=R+I*o/i,s=Yc(L,T,t,l),d=Yc(L,T,a?n:r,l);X.push(/* @__PURE__ */x("line",{x1:s.x.toFixed(2),y1:s.y.toFixed(2),x2:d.x.toFixed(2),y2:d.y.toFixed(2),stroke:w.textMuted,strokeWidth:a?1.5:.75,strokeLinecap:"round","data-tkx-gauge-tick":a?"major":"minor"},o))}}const Z=u?u(C):String(C);/* @__PURE__ */
654
+ return b("span",{ref:h,role:"img","aria-label":y,className:jt(At("inline-flex items-center gap-2"),c),style:u,...p,children:[/* @__PURE__ */x("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:$}),l&&/* @__PURE__ */x("span",{className:At("text-xs"),style:{color:f.textMuted,fontVariantNumeric:"tabular-nums"},"data-tkx-sparkline-value":"",children:String(k)})]})});tu.displayName="TkxSparkline";var nu={arc:{start:-135,end:135,sweep:270},speedometer:{start:-90,end:90,sweep:180}};function ru(e,t,n,r){const o=(r-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}}function ou(e,t,n,r,o){if(Math.abs(o-r)<1e-4)return"";const i=ru(e,t,n,r),a=ru(e,t,n,o),l=o-r,s=Math.abs(l)>180?1:0,d=l>=0?1:0;return`M${i.x.toFixed(2)},${i.y.toFixed(2)} A${n.toFixed(2)},${n.toFixed(2)} 0 ${s} ${d} ${a.x.toFixed(2)},${a.y.toFixed(2)}`}function iu(e,t,n){if(!t||0===t.length)return n;const r=[...t].sort((e,t)=>e.at-t.at);let o=r[0].color;for(const i of r)e>=i.at&&(o=i.color);return o}var au=i(({value:e,min:t=0,max:n=100,size:r=200,thickness:o=16,variant:i="arc",thresholds:a,label:l,showValue:d=!0,showTicks:c=!1,formatValue:u,ariaLabel:p,className:h,style:g,...y},v)=>{const w=se(),k=et(),$=Math.min(t,n),S=Math.max(t,n),C=(N=S,(z=e)<(M=$)?M:z>N?N:z);var z,M,N;const D=S-$||1,R=(C-$)/D,{start:P,end:F,sweep:I}=nu[i],A=P+I*R,L=r/2,T=r/2,W=(r-o)/2,[j,E]=m(R),B=f(null),V=f(R),H=f(R),O=f(0);s(()=>{if(k)return void E(R);V.current=j,H.current=R,O.current="undefined"!=typeof performance?performance.now():Date.now();const e=t=>{const n=Math.min(1,(t-O.current)/400),r=1-Math.pow(1-n,3);E(V.current+(H.current-V.current)*r),n<1&&(B.current=requestAnimationFrame(e))};return"undefined"!=typeof requestAnimationFrame?B.current=requestAnimationFrame(e):E(R),()=>{null!=B.current&&"undefined"!=typeof cancelAnimationFrame&&cancelAnimationFrame(B.current)}},[R,k]);const q=P+I*j,U=ou(L,T,W,P,F),K=[];if(a&&a.length>0){const e=[...a].sort((e,t)=>e.at-t.at),t=[$];for(const n of e)n.at>$&&n.at<S&&t.push(n.at);t.push(S);for(let n=0;n<t.length-1;n++){const e=t[n],r=P+I*((e-$)/D),o=P+I*((t[n+1]-$)/D),i=Math.min(o,q);if(i<=r)continue;const l=iu(e+1e-4,a,w.primary);K.push({d:ou(L,T,W,r,i),color:l})}}else K.push({d:ou(L,T,W,P,q),color:w.primary});const Y=iu(C,a,w.primary),X=[];if(c){const e=5,t=W+o/2+1,n=W+o/2-4,r=W+o/2-2,i=10*e;for(let o=0;o<=i;o++){const a=o%e===0,l=P+I*o/i,s=ru(L,T,t,l),d=ru(L,T,a?n:r,l);X.push(/* @__PURE__ */x("line",{x1:s.x.toFixed(2),y1:s.y.toFixed(2),x2:d.x.toFixed(2),y2:d.y.toFixed(2),stroke:w.textMuted,strokeWidth:a?1.5:.75,strokeLinecap:"round","data-tkx-gauge-tick":a?"major":"minor"},o))}}const Z=u?u(C):String(C);/* @__PURE__ */
628
655
  return b("div",{ref:v,role:"meter","aria-valuenow":C,"aria-valuemin":$,"aria-valuemax":S,"aria-valuetext":Z,"aria-label":p??l??"Gauge",className:jt(At("inline-flex flex-col items-center"),h),style:g,"data-tkx-gauge-variant":i,"data-tkx-reduced-motion":k?"true":"false",...y,children:[
629
656
  /* @__PURE__ */b("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:[
630
657
  /* @__PURE__ */x("path",{d:U,fill:"none",stroke:w.border,strokeWidth:o,strokeLinecap:"round","data-tkx-gauge-track":""}),K.map((e,t)=>/* @__PURE__ */x("path",{d:e.d,fill:"none",stroke:e.color,strokeWidth:o,strokeLinecap:"round","data-tkx-gauge-segment":""},t)),c&&/* @__PURE__ */x("g",{"data-tkx-gauge-ticks":"",children:X}),d&&/* @__PURE__ */x("text",{x:L,y:T+("speedometer"===i?4:6),textAnchor:"middle",dominantBaseline:"middle",fill:Y,style:{fontSize:.18*r+"px",fontWeight:700,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-gauge-value":"",children:Z})]}),l&&/* @__PURE__ */x("span",{className:At("text-sm"),style:{color:w.textMuted,marginTop:"-8px"},"data-tkx-gauge-label":"",children:l}),
631
- /* @__PURE__ */x("span",{hidden:!0,"data-tkx-gauge-target-angle":A.toFixed(2)})]})});function _c(e){const t=/* @__PURE__ */new Set,n=[];for(const r of e){const e=String(r);t.has(e)||(t.add(e),n.push(r))}return n.every(e=>"number"==typeof e||/^-?\d+(\.\d+)?$/.test(String(e)))?n.sort((e,t)=>Number(e)-Number(t)):n.sort((e,t)=>String(e).localeCompare(String(t)))}function Jc(e){const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t,r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return[isNaN(r)?0:r,isNaN(o)?0:o,isNaN(i)?0:i]}function Qc(e,t,n){return e+(t-e)*n}function eu(e,t){if(0===e.length)return"#000000";if(1===e.length)return e[0];if(t<=0)return e[0];if(t>=1)return e[e.length-1];const n=t*(e.length-1),r=Math.floor(n),o=n-r;return function(e,t,n){const[r,o,i]=Jc(e),[a,l,s]=Jc(t);return function(e,t,n){const r=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}(Qc(r,a,n),Qc(o,l,n),Qc(i,s,n))}(e[r],e[r+1],o)}function tu(e,t,n,r){const[o,i]=t,a=i-o,l=0===a?.5:Math.max(0,Math.min(1,(e-o)/a));return Array.isArray(n)?eu(n.length>0?n:[r],l):eu("diverging"===n?["#d7191c","#ffffff","#2c7bb6"]:["#f7fbff",r],l)}function nu(e){return O(e)>.179?"#000000":"#ffffff"}Gc.displayName="TkxGauge";var ru=i(({data:e,xLabels:t,yLabels:n,cellSize:r=32,gap:o=2,colorScale:i="sequential",domain:a,showValues:l=!1,showLegend:s=!0,legendPosition:d="right",formatValue:c,emptyCellColor:u,ariaLabel:p,onCellClick:h,className:f,style:m,...g},y)=>{const v=se(),w=Array.isArray(e)?e:[],k=c??(e=>String(e)),$=u??v.surfaceAlt;if(!(0!==w.length||t&&0!==t.length||n&&0!==n.length))/* @__PURE__ */return b("div",{ref:y,role:"img","aria-label":p??"Heatmap with no data",className:jt(At("inline-flex items-center justify-center"),f),style:{color:v.textMuted,fontSize:12,padding:16,...m},"data-tkx-heatmap-empty":"",...g,children:[/* @__PURE__ */x("svg",{width:4*r,height:2*r,"aria-hidden":"true"}),/* @__PURE__ */x("span",{style:{marginLeft:8},children:"No data"})]});const S=t??_c(w.map(e=>e.x)),C=n??_c(w.map(e=>e.y)),z=w.map(e=>e.value),M=z.length>0?Math.min(...z):0,N=z.length>0?Math.max(...z):1,[D,P]=a??[M,N],R=[D,P],F=/* @__PURE__ */new Map;for(const x of w)F.set(`${String(x.x)}\0${String(x.y)}`,x);const I=C.reduce((e,t)=>Math.max(e,String(t).length),0),A=Math.max(24,7*I+8),L=S.reduce((e,t)=>Math.max(e,String(t).length),0),T=7*L>r+o,W=T?Math.min(80,5*L+12):18,j=S.length*r+Math.max(0,S.length-1)*o,E=C.length*r+Math.max(0,C.length-1)*o,B=10,V=s&&"right"===d,H=s&&"bottom"===d,O=A+j+(V?58:0)+4,q=E+W+(H?36:0)+4,U=A,K=k(R[0]),Y=k(R[1]),X=p??`Heatmap with ${S.length}×${C.length} cells, values from ${K} to ${Y}`,Z=[];for(let ee=0;ee<C.length;ee++){const e=String(C[ee]);for(let t=0;t<S.length;t++){const n=String(S[t]),a=F.get(`${n}\0${e}`),s=U+t*(r+o),d=2+ee*(r+o),c=a?tu(a.value,R,i,v.primary):$,u=!!h&&!!a,p=a?`${n} × ${e}: ${a.label??k(a.value)}`:`${n} × ${e}: no data`,f=u?()=>h(a):void 0;Z.push(/* @__PURE__ */b("g",{"data-tkx-heatmap-cell":"","data-x":n,"data-y":e,"data-empty":a?void 0:"",onClick:f,style:{cursor:u?"pointer":"default"},children:[/* @__PURE__ */x("rect",{x:s,y:d,width:r,height:r,fill:c,rx:2,ry:2,children:/* @__PURE__ */x("title",{children:p})}),l&&a&&/* @__PURE__ */x("text",{x:s+r/2,y:d+r/2,textAnchor:"middle",dominantBaseline:"central",fill:nu(c),style:{fontSize:Math.max(9,Math.min(13,.35*r)),fontFamily:"inherit",fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-heatmap-value":"",children:a.label??k(a.value)})]},`${t}-${ee}`))}}const G=C.map((e,t)=>/* @__PURE__ */x("text",{x:A-6,y:2+t*(r+o)+r/2,textAnchor:"end",dominantBaseline:"central",fill:v.textMuted,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-ylabel":"",children:String(e)},`y-${t}`)),_=2+E+12,J=S.map((e,t)=>{const n=U+t*(r+o)+r/2;/* @__PURE__ */
632
- return x("text",T?{x:n,y:_,textAnchor:"end",dominantBaseline:"hanging",fill:v.textMuted,transform:`rotate(-45 ${n} ${_})`,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-xlabel":"",children:String(e)}:{x:n,y:_,textAnchor:"middle",dominantBaseline:"hanging",fill:v.textMuted,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-xlabel":"",children:String(e)},`x-${t}`)});let Q=null;if(s){const e=Array.from({length:32},(e,t)=>tu(R[0]+t/31*(R[1]-R[0]),R,i,v.primary));if(V){const t=U+j+12,n=2,r=E,o=r/32;Q=/* @__PURE__ */b("g",{"data-tkx-heatmap-legend":"right",children:[e.map((e,r)=>/* @__PURE__ */x("rect",{x:t,y:n+(31-r)*o,width:B,height:o+.5,fill:e},r)),
658
+ /* @__PURE__ */x("span",{hidden:!0,"data-tkx-gauge-target-angle":A.toFixed(2)})]})});function lu(e){const t=/* @__PURE__ */new Set,n=[];for(const r of e){const e=String(r);t.has(e)||(t.add(e),n.push(r))}return n.every(e=>"number"==typeof e||/^-?\d+(\.\d+)?$/.test(String(e)))?n.sort((e,t)=>Number(e)-Number(t)):n.sort((e,t)=>String(e).localeCompare(String(t)))}function su(e){const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t,r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return[isNaN(r)?0:r,isNaN(o)?0:o,isNaN(i)?0:i]}function du(e,t,n){return e+(t-e)*n}function cu(e,t){if(0===e.length)return"#000000";if(1===e.length)return e[0];if(t<=0)return e[0];if(t>=1)return e[e.length-1];const n=t*(e.length-1),r=Math.floor(n),o=n-r;return function(e,t,n){const[r,o,i]=su(e),[a,l,s]=su(t);return function(e,t,n){const r=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}(du(r,a,n),du(o,l,n),du(i,s,n))}(e[r],e[r+1],o)}function uu(e,t,n,r){const[o,i]=t,a=i-o,l=0===a?.5:Math.max(0,Math.min(1,(e-o)/a));return Array.isArray(n)?cu(n.length>0?n:[r],l):cu("diverging"===n?["#d7191c","#ffffff","#2c7bb6"]:["#f7fbff",r],l)}function pu(e){return O(e)>.179?"#000000":"#ffffff"}au.displayName="TkxGauge";var hu=i(({data:e,xLabels:t,yLabels:n,cellSize:r=32,gap:o=2,colorScale:i="sequential",domain:a,showValues:l=!1,showLegend:s=!0,legendPosition:d="right",formatValue:c,emptyCellColor:u,ariaLabel:p,onCellClick:h,className:f,style:m,...g},y)=>{const v=se(),w=Array.isArray(e)?e:[],k=c??(e=>String(e)),$=u??v.surfaceAlt;if(!(0!==w.length||t&&0!==t.length||n&&0!==n.length))/* @__PURE__ */return b("div",{ref:y,role:"img","aria-label":p??"Heatmap with no data",className:jt(At("inline-flex items-center justify-center"),f),style:{color:v.textMuted,fontSize:12,padding:16,...m},"data-tkx-heatmap-empty":"",...g,children:[/* @__PURE__ */x("svg",{width:4*r,height:2*r,"aria-hidden":"true"}),/* @__PURE__ */x("span",{style:{marginLeft:8},children:"No data"})]});const S=t??lu(w.map(e=>e.x)),C=n??lu(w.map(e=>e.y)),z=w.map(e=>e.value),M=z.length>0?Math.min(...z):0,N=z.length>0?Math.max(...z):1,[D,R]=a??[M,N],P=[D,R],F=/* @__PURE__ */new Map;for(const x of w)F.set(`${String(x.x)}\0${String(x.y)}`,x);const I=C.reduce((e,t)=>Math.max(e,String(t).length),0),A=Math.max(24,7*I+8),L=S.reduce((e,t)=>Math.max(e,String(t).length),0),T=7*L>r+o,W=T?Math.min(80,5*L+12):18,j=S.length*r+Math.max(0,S.length-1)*o,E=C.length*r+Math.max(0,C.length-1)*o,B=10,V=s&&"right"===d,H=s&&"bottom"===d,O=A+j+(V?58:0)+4,q=E+W+(H?36:0)+4,U=A,K=k(P[0]),Y=k(P[1]),X=p??`Heatmap with ${S.length}×${C.length} cells, values from ${K} to ${Y}`,Z=[];for(let ee=0;ee<C.length;ee++){const e=String(C[ee]);for(let t=0;t<S.length;t++){const n=String(S[t]),a=F.get(`${n}\0${e}`),s=U+t*(r+o),d=2+ee*(r+o),c=a?uu(a.value,P,i,v.primary):$,u=!!h&&!!a,p=a?`${n} × ${e}: ${a.label??k(a.value)}`:`${n} × ${e}: no data`,f=u?()=>h(a):void 0;Z.push(/* @__PURE__ */b("g",{"data-tkx-heatmap-cell":"","data-x":n,"data-y":e,"data-empty":a?void 0:"",onClick:f,style:{cursor:u?"pointer":"default"},children:[/* @__PURE__ */x("rect",{x:s,y:d,width:r,height:r,fill:c,rx:2,ry:2,children:/* @__PURE__ */x("title",{children:p})}),l&&a&&/* @__PURE__ */x("text",{x:s+r/2,y:d+r/2,textAnchor:"middle",dominantBaseline:"central",fill:pu(c),style:{fontSize:Math.max(9,Math.min(13,.35*r)),fontFamily:"inherit",fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-heatmap-value":"",children:a.label??k(a.value)})]},`${t}-${ee}`))}}const G=C.map((e,t)=>/* @__PURE__ */x("text",{x:A-6,y:2+t*(r+o)+r/2,textAnchor:"end",dominantBaseline:"central",fill:v.textMuted,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-ylabel":"",children:String(e)},`y-${t}`)),_=2+E+12,J=S.map((e,t)=>{const n=U+t*(r+o)+r/2;/* @__PURE__ */
659
+ return x("text",T?{x:n,y:_,textAnchor:"end",dominantBaseline:"hanging",fill:v.textMuted,transform:`rotate(-45 ${n} ${_})`,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-xlabel":"",children:String(e)}:{x:n,y:_,textAnchor:"middle",dominantBaseline:"hanging",fill:v.textMuted,style:{fontSize:11,fontFamily:"inherit"},"data-tkx-heatmap-xlabel":"",children:String(e)},`x-${t}`)});let Q=null;if(s){const e=Array.from({length:32},(e,t)=>uu(P[0]+t/31*(P[1]-P[0]),P,i,v.primary));if(V){const t=U+j+12,n=2,r=E,o=r/32;Q=/* @__PURE__ */b("g",{"data-tkx-heatmap-legend":"right",children:[e.map((e,r)=>/* @__PURE__ */x("rect",{x:t,y:n+(31-r)*o,width:B,height:o+.5,fill:e},r)),
633
660
  /* @__PURE__ */x("text",{x:t+B+4,y:n,dominantBaseline:"hanging",fill:v.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-max":"",children:Y}),
634
661
  /* @__PURE__ */x("text",{x:t+B+4,y:n+r,dominantBaseline:"auto",fill:v.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-min":"",children:K})]})}else if(H){const t=U,n=2+E+W+12,r=j,o=r/32;Q=/* @__PURE__ */b("g",{"data-tkx-heatmap-legend":"bottom",children:[e.map((e,r)=>/* @__PURE__ */x("rect",{x:t+r*o,y:n,width:o+.5,height:B,fill:e},r)),
635
662
  /* @__PURE__ */x("text",{x:t,y:n+B+11,textAnchor:"start",fill:v.textMuted,style:{fontSize:10,fontFamily:"inherit"},"data-tkx-heatmap-legend-min":"",children:K}),
@@ -637,58 +664,58 @@ return x("text",T?{x:n,y:_,textAnchor:"end",dominantBaseline:"hanging",fill:v.te
637
664
  return x("div",{ref:y,className:jt(At("inline-block"),f),style:m,"data-tkx-heatmap":"",...g,children:/* @__PURE__ */b("svg",{role:"img","aria-label":X,width:O,height:q,viewBox:`0 0 ${O} ${q}`,style:{display:"block",overflow:"visible"},children:[
638
665
  /* @__PURE__ */x("g",{"data-tkx-heatmap-ylabels":"",children:G}),
639
666
  /* @__PURE__ */x("g",{"data-tkx-heatmap-cells":"",children:Z}),
640
- /* @__PURE__ */x("g",{"data-tkx-heatmap-xlabels":"",children:J}),Q]})})});ru.displayName="TkxHeatmap";var ou=["#00f5d4","#3a86ff","#7b2ff7","#f72585","#ffbe0b","#06d6a0"];function iu(e){return O(e)>.179?"#000000":"#ffffff"}var au=i(({data:e,width:t=400,height:n=300,orientation:r="vertical",colors:o,showValues:i=!0,showPercentages:a=!0,formatValue:l,gap:s=4,ariaLabel:d,onStageClick:c,className:u,style:p,...h},f)=>{const m=se(),g=Array.isArray(e)?e:[],y=o&&o.length>0?o:ou,v=l??(e=>String(e));if(0===g.length)/* @__PURE__ */return x("div",{ref:f,role:"img","aria-label":d??"Funnel chart with no stages",className:jt(At("inline-block"),u),style:p,"data-tkx-funnel-empty":"",...h,children:/* @__PURE__ */x("svg",{width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":"true"})});const w=Math.max(g[0].value,1e-4),k=g[g.length-1].value,$=w>0?Math.round((w-k)/w*100):0,S=g.map(e=>Math.max(.04,Math.min(1,e.value/w))),C="vertical"===r,z=d??(1===g.length?`Funnel chart with 1 stage, value ${v(g[0].value)}`:`Funnel chart with ${g.length} stages, top value ${v(g[0].value)}, bottom value ${v(k)}, total drop-off ${$}%`),M=a&&g.length>1?28:0,N=[],D=[],P=[];if(C){const e=t-110,r=(n-s*Math.max(0,g.length-1))/g.length,o=e/2;g.forEach((t,n)=>{const l=0===n?1:S[n-1],d=S[n],u=l*e/2,p=d*e/2,h=n*(r+s),f=h+r,w=t.color??y[n%y.length],k=1===g.length,$=k?o+p:o+u,C=o-p,z=o+p,M=`M${(k?o-p:o-u).toFixed(2)},${h.toFixed(2)} L${$.toFixed(2)},${h.toFixed(2)} L${z.toFixed(2)},${f.toFixed(2)} L${C.toFixed(2)},${f.toFixed(2)} Z`,R=!!c,F=R?()=>c(t,n):void 0,I=iu(w);if(N.push(/* @__PURE__ */b("g",{"data-tkx-funnel-stage":"","data-index":n,onClick:F,style:{cursor:R?"pointer":"default"},children:[/* @__PURE__ */x("path",{d:M,fill:w,"data-tkx-funnel-shape":"",children:/* @__PURE__ */x("title",{children:`${t.label}: ${v(t.value)}`})}),i&&/* @__PURE__ */x("text",{x:o,y:(h+f)/2,textAnchor:"middle",dominantBaseline:"central",fill:I,style:{fontSize:12,fontFamily:"inherit",fontWeight:600,fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-funnel-value":"",children:v(t.value)})]},`stage-${n}`)),D.push(/* @__PURE__ */x("text",{x:e+8,y:(h+f)/2,textAnchor:"start",dominantBaseline:"central",fill:m.text,style:{fontSize:12,fontFamily:"inherit"},"data-tkx-funnel-label":"",children:t.label},`label-${n}`)),a&&n<g.length-1){const r=g[n+1],o=t.value>0?Math.round((t.value-r.value)/t.value*100):0;P.push(/* @__PURE__ */x("text",{x:e+8,y:f+s/2,textAnchor:"start",dominantBaseline:"central",fill:m.textMuted,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-funnel-pct":"",children:o>=0?`−${o}%`:`+${Math.abs(o)}%`},`pct-${n}`))}})}else{const e=n-110,r=(t-s*Math.max(0,g.length-1))/g.length,o=e/2;g.forEach((t,n)=>{const l=0===n?1:S[n-1],d=S[n],u=l*e/2,p=d*e/2,h=n*(r+s),f=h+r,w=t.color??y[n%y.length],k=1===g.length,$=k?o-p:o-u,C=k?o+p:o+u,z=o-p,M=o+p,R=`M${h.toFixed(2)},${$.toFixed(2)} L${h.toFixed(2)},${C.toFixed(2)} L${f.toFixed(2)},${M.toFixed(2)} L${f.toFixed(2)},${z.toFixed(2)} Z`,F=!!c,I=F?()=>c(t,n):void 0,A=iu(w);if(N.push(/* @__PURE__ */b("g",{"data-tkx-funnel-stage":"","data-index":n,onClick:I,style:{cursor:F?"pointer":"default"},children:[/* @__PURE__ */x("path",{d:R,fill:w,"data-tkx-funnel-shape":"",children:/* @__PURE__ */x("title",{children:`${t.label}: ${v(t.value)}`})}),i&&/* @__PURE__ */x("text",{x:(h+f)/2,y:o,textAnchor:"middle",dominantBaseline:"central",fill:A,style:{fontSize:12,fontFamily:"inherit",fontWeight:600,fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-funnel-value":"",children:v(t.value)})]},`stage-${n}`)),D.push(/* @__PURE__ */x("text",{x:(h+f)/2,y:e+16,textAnchor:"middle",dominantBaseline:"hanging",fill:m.text,style:{fontSize:12,fontFamily:"inherit"},"data-tkx-funnel-label":"",children:t.label},`label-${n}`)),a&&n<g.length-1){const r=g[n+1],o=t.value>0?Math.round((t.value-r.value)/t.value*100):0;P.push(/* @__PURE__ */x("text",{x:f+s/2,y:e+36,textAnchor:"middle",dominantBaseline:"hanging",fill:m.textMuted,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-funnel-pct":"",children:o>=0?`−${o}%`:`+${Math.abs(o)}%`},`pct-${n}`))}})}/* @__PURE__ */
667
+ /* @__PURE__ */x("g",{"data-tkx-heatmap-xlabels":"",children:J}),Q]})})});hu.displayName="TkxHeatmap";var fu=["#00f5d4","#3a86ff","#7b2ff7","#f72585","#ffbe0b","#06d6a0"];function mu(e){return O(e)>.179?"#000000":"#ffffff"}var gu=i(({data:e,width:t=400,height:n=300,orientation:r="vertical",colors:o,showValues:i=!0,showPercentages:a=!0,formatValue:l,gap:s=4,ariaLabel:d,onStageClick:c,className:u,style:p,...h},f)=>{const m=se(),g=Array.isArray(e)?e:[],y=o&&o.length>0?o:fu,v=l??(e=>String(e));if(0===g.length)/* @__PURE__ */return x("div",{ref:f,role:"img","aria-label":d??"Funnel chart with no stages",className:jt(At("inline-block"),u),style:p,"data-tkx-funnel-empty":"",...h,children:/* @__PURE__ */x("svg",{width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":"true"})});const w=Math.max(g[0].value,1e-4),k=g[g.length-1].value,$=w>0?Math.round((w-k)/w*100):0,S=g.map(e=>Math.max(.04,Math.min(1,e.value/w))),C="vertical"===r,z=d??(1===g.length?`Funnel chart with 1 stage, value ${v(g[0].value)}`:`Funnel chart with ${g.length} stages, top value ${v(g[0].value)}, bottom value ${v(k)}, total drop-off ${$}%`),M=a&&g.length>1?28:0,N=[],D=[],R=[];if(C){const e=t-110,r=(n-s*Math.max(0,g.length-1))/g.length,o=e/2;g.forEach((t,n)=>{const l=0===n?1:S[n-1],d=S[n],u=l*e/2,p=d*e/2,h=n*(r+s),f=h+r,w=t.color??y[n%y.length],k=1===g.length,$=k?o+p:o+u,C=o-p,z=o+p,M=`M${(k?o-p:o-u).toFixed(2)},${h.toFixed(2)} L${$.toFixed(2)},${h.toFixed(2)} L${z.toFixed(2)},${f.toFixed(2)} L${C.toFixed(2)},${f.toFixed(2)} Z`,P=!!c,F=P?()=>c(t,n):void 0,I=mu(w);if(N.push(/* @__PURE__ */b("g",{"data-tkx-funnel-stage":"","data-index":n,onClick:F,style:{cursor:P?"pointer":"default"},children:[/* @__PURE__ */x("path",{d:M,fill:w,"data-tkx-funnel-shape":"",children:/* @__PURE__ */x("title",{children:`${t.label}: ${v(t.value)}`})}),i&&/* @__PURE__ */x("text",{x:o,y:(h+f)/2,textAnchor:"middle",dominantBaseline:"central",fill:I,style:{fontSize:12,fontFamily:"inherit",fontWeight:600,fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-funnel-value":"",children:v(t.value)})]},`stage-${n}`)),D.push(/* @__PURE__ */x("text",{x:e+8,y:(h+f)/2,textAnchor:"start",dominantBaseline:"central",fill:m.text,style:{fontSize:12,fontFamily:"inherit"},"data-tkx-funnel-label":"",children:t.label},`label-${n}`)),a&&n<g.length-1){const r=g[n+1],o=t.value>0?Math.round((t.value-r.value)/t.value*100):0;R.push(/* @__PURE__ */x("text",{x:e+8,y:f+s/2,textAnchor:"start",dominantBaseline:"central",fill:m.textMuted,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-funnel-pct":"",children:o>=0?`−${o}%`:`+${Math.abs(o)}%`},`pct-${n}`))}})}else{const e=n-110,r=(t-s*Math.max(0,g.length-1))/g.length,o=e/2;g.forEach((t,n)=>{const l=0===n?1:S[n-1],d=S[n],u=l*e/2,p=d*e/2,h=n*(r+s),f=h+r,w=t.color??y[n%y.length],k=1===g.length,$=k?o-p:o-u,C=k?o+p:o+u,z=o-p,M=o+p,P=`M${h.toFixed(2)},${$.toFixed(2)} L${h.toFixed(2)},${C.toFixed(2)} L${f.toFixed(2)},${M.toFixed(2)} L${f.toFixed(2)},${z.toFixed(2)} Z`,F=!!c,I=F?()=>c(t,n):void 0,A=mu(w);if(N.push(/* @__PURE__ */b("g",{"data-tkx-funnel-stage":"","data-index":n,onClick:I,style:{cursor:F?"pointer":"default"},children:[/* @__PURE__ */x("path",{d:P,fill:w,"data-tkx-funnel-shape":"",children:/* @__PURE__ */x("title",{children:`${t.label}: ${v(t.value)}`})}),i&&/* @__PURE__ */x("text",{x:(h+f)/2,y:o,textAnchor:"middle",dominantBaseline:"central",fill:A,style:{fontSize:12,fontFamily:"inherit",fontWeight:600,fontVariantNumeric:"tabular-nums",pointerEvents:"none"},"data-tkx-funnel-value":"",children:v(t.value)})]},`stage-${n}`)),D.push(/* @__PURE__ */x("text",{x:(h+f)/2,y:e+16,textAnchor:"middle",dominantBaseline:"hanging",fill:m.text,style:{fontSize:12,fontFamily:"inherit"},"data-tkx-funnel-label":"",children:t.label},`label-${n}`)),a&&n<g.length-1){const r=g[n+1],o=t.value>0?Math.round((t.value-r.value)/t.value*100):0;R.push(/* @__PURE__ */x("text",{x:f+s/2,y:e+36,textAnchor:"middle",dominantBaseline:"hanging",fill:m.textMuted,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums"},"data-tkx-funnel-pct":"",children:o>=0?`−${o}%`:`+${Math.abs(o)}%`},`pct-${n}`))}})}/* @__PURE__ */
641
668
  return b("div",{ref:f,className:jt(At("inline-block"),u),style:p,"data-tkx-funnel":"","data-orientation":r,...h,children:[/* @__PURE__ */b("svg",{role:"img","aria-label":z,width:t,height:n,viewBox:`0 0 ${t} ${n}`,style:{display:"block",overflow:"visible"},children:[
642
669
  /* @__PURE__ */x("g",{"data-tkx-funnel-stages":"",children:N}),
643
- /* @__PURE__ */x("g",{"data-tkx-funnel-labels":"",children:D}),a&&g.length>1&&/* @__PURE__ */x("g",{"data-tkx-funnel-pcts":"",children:P})]}),/* @__PURE__ */x("span",{hidden:!0,"data-tkx-funnel-pct-area":M})]})});au.displayName="TkxFunnelChart";var lu=["#00f5d4","#3a86ff","#7b2ff7","#f72585","#ffbe0b","#06d6a0","#ef476f","#118ab2"];function su(e){return O(e)>.179?"#000000":"#ffffff"}function du(e,t){if(0===e.length)return 1/0;const n=e.reduce((e,t)=>e+t,0),r=n*n,o=t*t;let i=-1/0,a=1/0,l=-1/0;for(const c of e)c>l&&(l=c),c<a&&(a=c);if(0===r)return 1/0;const s=o*l/r,d=r/(o*a);return i=Math.max(s,d),i}function cu(e,t,n){const r=[],o=t.w>=t.h,i=Math.min(t.w,t.h),a=e.reduce((e,t)=>e+t.value,0),l=0===i?0:a/i;if(o){let o=t.y;for(const i of e){const s=0===a?t.h/e.length:i.value/a*t.h;r.push({x:t.x,y:o,w:l,h:s,node:i.node,origIndex:i.origIndex,path:[...n,i.origIndex]}),o+=s}return{placed:r,remaining:{x:t.x+l,y:t.y,w:t.w-l,h:t.h}}}let s=t.x;for(const d of e){const o=0===a?t.w/e.length:d.value/a*t.w;r.push({x:s,y:t.y,w:o,h:l,node:d.node,origIndex:d.origIndex,path:[...n,d.origIndex]}),s+=o}return{placed:r,remaining:{x:t.x,y:t.y+l,w:t.w,h:t.h-l}}}var uu=i(({data:e,width:t=600,height:n=400,colors:r,showLabels:o=!0,showValues:i=!1,minLabelSize:a=80,formatValue:l,ariaLabel:s,onNodeClick:d,className:c,style:u,...p},h)=>{const f=se(),m=Array.isArray(e)?e:[],g=r&&r.length>0?r:lu,y=l??(e=>String(e));if(0===m.length)/* @__PURE__ */return x("div",{ref:h,role:"img","aria-label":s??"Treemap with no data",className:jt(At("inline-block"),c),style:u,"data-tkx-treemap-empty":"",...p,children:/* @__PURE__ */x("svg",{width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":"true"})});const v=m.reduce((e,t)=>e+Math.max(0,t.value),0),w=s??`Treemap with ${m.length} node${1===m.length?"":"s"}, total value ${y(v)}`,k=(e,t,n,r)=>{const l=function(e,t,n){const r=e.map((e,t)=>({node:e,value:Math.max(0,e.value),origIndex:t})).filter(e=>e.value>0);if(0===r.length)return[];if(1===r.length)return[{x:t.x,y:t.y,w:t.w,h:t.h,node:r[0].node,origIndex:r[0].origIndex,path:[...n,r[0].origIndex]}];const o=[...r].sort((e,t)=>t.value-e.value),i=o.reduce((e,t)=>e+t.value,0),a=t.w*t.h,l=0===i?0:a/i;return function(e,t,n){const r=[];let o={...t},i=[...e];for(;i.length>0;){const e=Math.min(o.w,o.h);if(e<=0)break;const t=[],a=[];let l=0;for(;l<i.length;){const n=i[l],r=[...a,n.value],o=0===t.length?1/0:du(a,e),s=du(r,e);if(!(0===t.length||s<=o))break;t.push(n),a.push(n.value),l+=1}if(0===t.length)break;const{placed:s,remaining:d}=cu(t,o,n);r.push(...s),i=i.slice(t.length),o=d}return r}(o.map(e=>({...e,value:e.value*l})),t,n)}(e,t,n),s=[];for(const c of l){const e=c.node.color??g[c.origIndex%g.length],t=c.w*c.h,n=o&&t>=a,l=c.node.label,u=su(e),p=!!d,h=p?e=>{e.stopPropagation(),d(c.node,c.path)}:void 0,m=Array.isArray(c.node.children)&&c.node.children.length>0,v=m?{x:c.x+1,y:c.y+(n?16:1),w:Math.max(0,c.w-2),h:Math.max(0,c.h-(n?17:2))}:c;s.push(/* @__PURE__ */b("g",{"data-tkx-treemap-node":"","data-depth":r,"data-label":l,onClick:h,style:{cursor:p?"pointer":"default"},children:[
670
+ /* @__PURE__ */x("g",{"data-tkx-funnel-labels":"",children:D}),a&&g.length>1&&/* @__PURE__ */x("g",{"data-tkx-funnel-pcts":"",children:R})]}),/* @__PURE__ */x("span",{hidden:!0,"data-tkx-funnel-pct-area":M})]})});gu.displayName="TkxFunnelChart";var xu=["#00f5d4","#3a86ff","#7b2ff7","#f72585","#ffbe0b","#06d6a0","#ef476f","#118ab2"];function bu(e){return O(e)>.179?"#000000":"#ffffff"}function yu(e,t){if(0===e.length)return 1/0;const n=e.reduce((e,t)=>e+t,0),r=n*n,o=t*t;let i=-1/0,a=1/0,l=-1/0;for(const c of e)c>l&&(l=c),c<a&&(a=c);if(0===r)return 1/0;const s=o*l/r,d=r/(o*a);return i=Math.max(s,d),i}function vu(e,t,n){const r=[],o=t.w>=t.h,i=Math.min(t.w,t.h),a=e.reduce((e,t)=>e+t.value,0),l=0===i?0:a/i;if(o){let o=t.y;for(const i of e){const s=0===a?t.h/e.length:i.value/a*t.h;r.push({x:t.x,y:o,w:l,h:s,node:i.node,origIndex:i.origIndex,path:[...n,i.origIndex]}),o+=s}return{placed:r,remaining:{x:t.x+l,y:t.y,w:t.w-l,h:t.h}}}let s=t.x;for(const d of e){const o=0===a?t.w/e.length:d.value/a*t.w;r.push({x:s,y:t.y,w:o,h:l,node:d.node,origIndex:d.origIndex,path:[...n,d.origIndex]}),s+=o}return{placed:r,remaining:{x:t.x,y:t.y+l,w:t.w,h:t.h-l}}}var wu=i(({data:e,width:t=600,height:n=400,colors:r,showLabels:o=!0,showValues:i=!1,minLabelSize:a=80,formatValue:l,ariaLabel:s,onNodeClick:d,className:c,style:u,...p},h)=>{const f=se(),m=Array.isArray(e)?e:[],g=r&&r.length>0?r:xu,y=l??(e=>String(e));if(0===m.length)/* @__PURE__ */return x("div",{ref:h,role:"img","aria-label":s??"Treemap with no data",className:jt(At("inline-block"),c),style:u,"data-tkx-treemap-empty":"",...p,children:/* @__PURE__ */x("svg",{width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":"true"})});const v=m.reduce((e,t)=>e+Math.max(0,t.value),0),w=s??`Treemap with ${m.length} node${1===m.length?"":"s"}, total value ${y(v)}`,k=(e,t,n,r)=>{const l=function(e,t,n){const r=e.map((e,t)=>({node:e,value:Math.max(0,e.value),origIndex:t})).filter(e=>e.value>0);if(0===r.length)return[];if(1===r.length)return[{x:t.x,y:t.y,w:t.w,h:t.h,node:r[0].node,origIndex:r[0].origIndex,path:[...n,r[0].origIndex]}];const o=[...r].sort((e,t)=>t.value-e.value),i=o.reduce((e,t)=>e+t.value,0),a=t.w*t.h,l=0===i?0:a/i;return function(e,t,n){const r=[];let o={...t},i=[...e];for(;i.length>0;){const e=Math.min(o.w,o.h);if(e<=0)break;const t=[],a=[];let l=0;for(;l<i.length;){const n=i[l],r=[...a,n.value],o=0===t.length?1/0:yu(a,e),s=yu(r,e);if(!(0===t.length||s<=o))break;t.push(n),a.push(n.value),l+=1}if(0===t.length)break;const{placed:s,remaining:d}=vu(t,o,n);r.push(...s),i=i.slice(t.length),o=d}return r}(o.map(e=>({...e,value:e.value*l})),t,n)}(e,t,n),s=[];for(const c of l){const e=c.node.color??g[c.origIndex%g.length],t=c.w*c.h,n=o&&t>=a,l=c.node.label,u=bu(e),p=!!d,h=p?e=>{e.stopPropagation(),d(c.node,c.path)}:void 0,m=Array.isArray(c.node.children)&&c.node.children.length>0,v=m?{x:c.x+1,y:c.y+(n?16:1),w:Math.max(0,c.w-2),h:Math.max(0,c.h-(n?17:2))}:c;s.push(/* @__PURE__ */b("g",{"data-tkx-treemap-node":"","data-depth":r,"data-label":l,onClick:h,style:{cursor:p?"pointer":"default"},children:[
644
671
  /* @__PURE__ */x("rect",{x:c.x,y:c.y,width:c.w,height:c.h,fill:e,stroke:f.bg,strokeWidth:1,"data-tkx-treemap-rect":"",children:/* @__PURE__ */x("title",{children:`${l}: ${y(c.node.value)}`})}),n&&/* @__PURE__ */x("text",{x:c.x+4,y:c.y+(m?12:14),fill:u,style:{fontSize:11,fontFamily:"inherit",fontWeight:600,pointerEvents:"none"},"data-tkx-treemap-label":"",children:l}),n&&i&&!m&&t>=1.5*a&&/* @__PURE__ */x("text",{x:c.x+4,y:c.y+26,fill:u,style:{fontSize:10,fontFamily:"inherit",fontVariantNumeric:"tabular-nums",opacity:.85,pointerEvents:"none"},"data-tkx-treemap-value":"",children:y(c.node.value)}),m&&v.w>4&&v.h>4&&/* @__PURE__ */x("g",{"data-tkx-treemap-children":"",children:k(c.node.children,v,c.path,r+1)})]},`d${r}-${c.path.join("-")}`))}return s},$=k(m,{x:0,y:0,w:t,h:n},[],0);/* @__PURE__ */
645
- return x("div",{ref:h,className:jt(At("inline-block"),c),style:u,"data-tkx-treemap":"",...p,children:/* @__PURE__ */x("svg",{role:"img","aria-label":w,width:t,height:n,viewBox:`0 0 ${t} ${n}`,style:{display:"block",overflow:"visible"},children:$})})});function pu(e){if(e instanceof Date)return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(!t)throw new Error(`TkxGantt: invalid date "${e}" (expected YYYY-MM-DD)`);return new Date(Date.UTC(+t[1],+t[2]-1,+t[3]))}function hu(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}-${String(e.getUTCDate()).padStart(2,"0")}`}uu.displayName="TkxTreemap";var fu=864e5;function mu(e,t){return Math.round((t.getTime()-e.getTime())/fu)}function gu(e,t){return new Date(e.getTime()+t*fu)}function xu(e){return e.toLocaleString("en",{month:"short",timeZone:"UTC"})}function bu({tasks:e,dayWidth:t=28,rowHeight:n=40,labelColumnWidth:r=220,selectedId:o,onSelect:i,onTaskChange:l,style:s,className:d}){const[c,u]=m(e[0]?.id??null),h=void 0!==o?o:c,{rangeStart:f,rangeEnd:g,totalDays:y,parsed:v}=p(()=>{if(0===e.length){const e=pu(/* @__PURE__ */new Date);return{rangeStart:e,rangeEnd:gu(e,7),totalDays:7,parsed:[]}}const t=e.map(e=>({task:e,start:pu(e.start),end:pu(e.end)}));let n=t[0].start,r=t[0].end;for(const e of t)e.start.getTime()<n.getTime()&&(n=e.start),e.end.getTime()>r.getTime()&&(r=e.end);const o=gu(n,-1),i=gu(r,1);return{rangeStart:o,rangeEnd:i,totalDays:mu(o,i)+1,parsed:t}},[e]),w=a(e=>mu(f,e)*t,[f,t]),k=p(()=>{const e=/* @__PURE__ */new Map;return v.forEach((t,n)=>e.set(t.task.id,{...t,index:n})),e},[v]),$=a(t=>{void 0===o&&u(t);const n=e.find(e=>e.id===t);n&&i?.(t,n)},[o,i,e]),S=a(e=>{if(!h)return;const t=k.get(h);if(!t)return;const n=gu(t.start,e),r=gu(t.end,e);l?.(h,{start:hu(n),end:hu(r)},t.task)},[h,k,l]),C=y*t,z=e.length*n;/* @__PURE__ */
672
+ return x("div",{ref:h,className:jt(At("inline-block"),c),style:u,"data-tkx-treemap":"",...p,children:/* @__PURE__ */x("svg",{role:"img","aria-label":w,width:t,height:n,viewBox:`0 0 ${t} ${n}`,style:{display:"block",overflow:"visible"},children:$})})});function ku(e){if(e instanceof Date)return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);if(!t)throw new Error(`TkxGantt: invalid date "${e}" (expected YYYY-MM-DD)`);return new Date(Date.UTC(+t[1],+t[2]-1,+t[3]))}function $u(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}-${String(e.getUTCDate()).padStart(2,"0")}`}wu.displayName="TkxTreemap";var Su=864e5;function Cu(e,t){return Math.round((t.getTime()-e.getTime())/Su)}function zu(e,t){return new Date(e.getTime()+t*Su)}function Mu(e){return e.toLocaleString("en",{month:"short",timeZone:"UTC"})}function Nu({tasks:e,dayWidth:t=28,rowHeight:n=40,labelColumnWidth:r=220,selectedId:o,onSelect:i,onTaskChange:l,style:s,className:d}){const[c,u]=m(e[0]?.id??null),h=void 0!==o?o:c,{rangeStart:f,rangeEnd:g,totalDays:y,parsed:v}=p(()=>{if(0===e.length){const e=ku(/* @__PURE__ */new Date);return{rangeStart:e,rangeEnd:zu(e,7),totalDays:7,parsed:[]}}const t=e.map(e=>({task:e,start:ku(e.start),end:ku(e.end)}));let n=t[0].start,r=t[0].end;for(const e of t)e.start.getTime()<n.getTime()&&(n=e.start),e.end.getTime()>r.getTime()&&(r=e.end);const o=zu(n,-1),i=zu(r,1);return{rangeStart:o,rangeEnd:i,totalDays:Cu(o,i)+1,parsed:t}},[e]),w=a(e=>Cu(f,e)*t,[f,t]),k=p(()=>{const e=/* @__PURE__ */new Map;return v.forEach((t,n)=>e.set(t.task.id,{...t,index:n})),e},[v]),$=a(t=>{void 0===o&&u(t);const n=e.find(e=>e.id===t);n&&i?.(t,n)},[o,i,e]),S=a(e=>{if(!h)return;const t=k.get(h);if(!t)return;const n=zu(t.start,e),r=zu(t.end,e);l?.(h,{start:$u(n),end:$u(r)},t.task)},[h,k,l]),C=y*t,z=e.length*n;/* @__PURE__ */
646
673
  return b("div",{className:d,role:"application","aria-label":"Gantt chart",tabIndex:0,onKeyDown:t=>{if(!h)return;const n=e.findIndex(e=>e.id===h);switch(t.key){case"ArrowUp":n>0&&(t.preventDefault(),$(e[n-1].id));break;case"ArrowDown":n<e.length-1&&(t.preventDefault(),$(e[n+1].id));break;case"ArrowLeft":t.preventDefault(),S(-1);break;case"ArrowRight":t.preventDefault(),S(1)}},"data-testid":"tkx-gantt",style:{display:"flex",outline:"none",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:12,overflow:"hidden",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",...s},children:[/* @__PURE__ */b("div",{role:"list","aria-label":"Tasks",style:{width:r,flex:`0 0 ${r}px`,borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)",overflow:"hidden"},children:[/* @__PURE__ */x("div",{style:{height:48,borderBottom:"1px solid var(--tkx-border, #2a2a3e)",display:"flex",alignItems:"center",padding:"0 12px",fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"#888"},children:"Task"}),e.map(e=>{const t=e.id===h;/* @__PURE__ */
647
- return x("div",{role:"listitem","data-testid":`gantt-label-${e.id}`,onClick:()=>$(e.id),style:{height:n,display:"flex",alignItems:"center",padding:"0 12px",cursor:"pointer",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",background:t?"rgba(0,245,212,0.08)":"transparent",fontSize:13,fontWeight:t?600:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:e.label,children:e.label},e.id)})]}),/* @__PURE__ */x("div",{style:{flex:1,overflow:"auto"},children:/* @__PURE__ */b("div",{style:{position:"relative",width:C,minWidth:"100%"},children:[/* @__PURE__ */x("div",{style:{height:48,borderBottom:"1px solid var(--tkx-border, #2a2a3e)",position:"sticky",top:0,background:"var(--tkx-bg-subtle, #0d0d14)",zIndex:2},children:Array.from({length:y}).map((e,n)=>{const r=gu(f,n),o=1===r.getUTCDate()||0===n,i=r.getUTCDay();/* @__PURE__ */
648
- return b("div",{style:{position:"absolute",left:n*t,top:0,width:t,height:48,fontSize:10,color:0===i||6===i?"#666":"#aaa",textAlign:"center",borderRight:"1px solid var(--tkx-border-soft, #1a1a25)",paddingTop:4},children:[o&&/* @__PURE__ */x("div",{style:{fontSize:11,fontWeight:700,color:"var(--tkx-accent, #00f5d4)"},children:xu(r)}),/* @__PURE__ */x("div",{style:{marginTop:o?2:14},children:r.getUTCDate()})]},n)})}),/* @__PURE__ */b("div",{style:{position:"relative",height:z},children:[Array.from({length:y}).map((e,n)=>{const r=gu(f,n).getUTCDay();return 0!==r&&6!==r?null:/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",left:n*t,top:0,width:t,height:z,background:"rgba(255,255,255,0.02)",pointerEvents:"none"}},`w${n}`)}),e.map((e,t)=>/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:(t+1)*n-1,height:1,background:"var(--tkx-border-soft, #1a1a25)",pointerEvents:"none"}},`r${t}`)),v.map((e,r)=>{const o=e.task.id===h,i=w(e.start),a=(mu(e.start,e.end)+1)*t,l=e.task.color||"var(--tkx-accent, #00f5d4)",s=Math.max(0,Math.min(1,e.task.progress??0));/* @__PURE__ */
649
- return b("div",{role:"button","aria-pressed":o,"aria-label":`${e.task.label}: ${hu(e.start)} to ${hu(e.end)}`,"data-testid":`gantt-bar-${e.task.id}`,onClick:()=>$(e.task.id),style:{position:"absolute",left:i,top:r*n+6,width:a,height:n-12,borderRadius:6,border:`1px solid ${l}`,background:o?`${l}33`:`${l}1f`,cursor:"pointer",overflow:"hidden",boxShadow:o?`0 0 0 2px ${l}40`:"none",display:"flex",alignItems:"center",paddingLeft:8,fontSize:12,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)",boxSizing:"border-box"},children:[s>0&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,width:100*s+"%",background:`${l}55`,pointerEvents:"none"}}),/* @__PURE__ */x("span",{style:{position:"relative",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",paddingRight:8},children:e.task.label})]},e.task.id)}),
674
+ return x("div",{role:"listitem","data-testid":`gantt-label-${e.id}`,onClick:()=>$(e.id),style:{height:n,display:"flex",alignItems:"center",padding:"0 12px",cursor:"pointer",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",background:t?"rgba(0,245,212,0.08)":"transparent",fontSize:13,fontWeight:t?600:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:e.label,children:e.label},e.id)})]}),/* @__PURE__ */x("div",{style:{flex:1,overflow:"auto"},children:/* @__PURE__ */b("div",{style:{position:"relative",width:C,minWidth:"100%"},children:[/* @__PURE__ */x("div",{style:{height:48,borderBottom:"1px solid var(--tkx-border, #2a2a3e)",position:"sticky",top:0,background:"var(--tkx-bg-subtle, #0d0d14)",zIndex:2},children:Array.from({length:y}).map((e,n)=>{const r=zu(f,n),o=1===r.getUTCDate()||0===n,i=r.getUTCDay();/* @__PURE__ */
675
+ return b("div",{style:{position:"absolute",left:n*t,top:0,width:t,height:48,fontSize:10,color:0===i||6===i?"#666":"#aaa",textAlign:"center",borderRight:"1px solid var(--tkx-border-soft, #1a1a25)",paddingTop:4},children:[o&&/* @__PURE__ */x("div",{style:{fontSize:11,fontWeight:700,color:"var(--tkx-accent, #00f5d4)"},children:Mu(r)}),/* @__PURE__ */x("div",{style:{marginTop:o?2:14},children:r.getUTCDate()})]},n)})}),/* @__PURE__ */b("div",{style:{position:"relative",height:z},children:[Array.from({length:y}).map((e,n)=>{const r=zu(f,n).getUTCDay();return 0!==r&&6!==r?null:/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",left:n*t,top:0,width:t,height:z,background:"rgba(255,255,255,0.02)",pointerEvents:"none"}},`w${n}`)}),e.map((e,t)=>/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",left:0,right:0,top:(t+1)*n-1,height:1,background:"var(--tkx-border-soft, #1a1a25)",pointerEvents:"none"}},`r${t}`)),v.map((e,r)=>{const o=e.task.id===h,i=w(e.start),a=(Cu(e.start,e.end)+1)*t,l=e.task.color||"var(--tkx-accent, #00f5d4)",s=Math.max(0,Math.min(1,e.task.progress??0));/* @__PURE__ */
676
+ return b("div",{role:"button","aria-pressed":o,"aria-label":`${e.task.label}: ${$u(e.start)} to ${$u(e.end)}`,"data-testid":`gantt-bar-${e.task.id}`,onClick:()=>$(e.task.id),style:{position:"absolute",left:i,top:r*n+6,width:a,height:n-12,borderRadius:6,border:`1px solid ${l}`,background:o?`${l}33`:`${l}1f`,cursor:"pointer",overflow:"hidden",boxShadow:o?`0 0 0 2px ${l}40`:"none",display:"flex",alignItems:"center",paddingLeft:8,fontSize:12,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)",boxSizing:"border-box"},children:[s>0&&/* @__PURE__ */x("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,width:100*s+"%",background:`${l}55`,pointerEvents:"none"}}),/* @__PURE__ */x("span",{style:{position:"relative",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",paddingRight:8},children:e.task.label})]},e.task.id)}),
650
677
  /* @__PURE__ */b("svg",{"aria-hidden":"true",width:C,height:z,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[/* @__PURE__ */x("defs",{children:/* @__PURE__ */x("marker",{id:"tkx-gantt-arrowhead",markerWidth:"6",markerHeight:"6",refX:"5",refY:"3",orient:"auto",children:/* @__PURE__ */x("path",{d:"M0,0 L6,3 L0,6 z",fill:"var(--tkx-fg-muted, #aaa)"})})}),v.flatMap((e,r)=>e.task.dependencies?.length?e.task.dependencies.map(o=>{const i=k.get(o);if(!i)return null;const a=w(i.end)+t,l=i.index*n+n/2,s=w(e.start),d=r*n+n/2,c=Math.max(a+8,s-8),u=`M ${a} ${l} L ${c} ${l} L ${c} ${d} L ${s} ${d}`;/* @__PURE__ */
651
- return x("path",{"data-testid":`gantt-arrow-${o}-to-${e.task.id}`,d:u,stroke:"var(--tkx-fg-muted, #aaa)",strokeOpacity:.6,strokeWidth:1.5,fill:"none",markerEnd:"url(#tkx-gantt-arrowhead)"},`${o}->${e.task.id}`)}):[])]})]})]})})]})}function yu(e,t){e.sum+=t,e.count+=1,t<e.min&&(e.min=t),t>e.max&&(e.max=t)}function vu(e,t){if(0===e.count)return null;switch(t){case"sum":return e.sum;case"avg":return e.sum/e.count;case"min":return e.min;case"max":return e.max;case"count":return e.count}}function wu(e,t){return t.map(t=>String(e[t]??""))}function ku(e){return e.label??("count"===e.agg?"count":`${e.agg}(${e.field??""})`)}var $u=e=>Number.isFinite(e)?Number.isInteger(e)?String(e):String(Math.round(1e4*e)/1e4):"";function Su(){return{keys:[],children:/* @__PURE__ */new Map}}function Cu(e,t){let n=e.children.get(t);return n||(n=Su(),e.children.set(t,n),e.keys.push(t)),n}function zu(e,t,n){e.keys.sort((e,r)=>n(e,r,t));for(const r of e.keys)zu(e.children.get(r),t+1,n)}function Mu(e,t,n=[]){if(0===t)return[n];const r=[];for(const o of e.keys)r.push(...Mu(e.children.get(o),t-1,[...n,o]));return r}var Nu=(e,t)=>e<t?-1:e>t?1:0;function Du({data:e,rows:t,cols:n=[],values:r,sortRows:o=Nu,sortCols:i=Nu,showTotals:a=!0,formatNumber:l=$u,style:s,className:d}){if(0===r.length)throw new Error("TkxPivotTable: values must contain at least one entry");const{rowPaths:c,colPaths:u,lookup:h,rowTotals:f,colTotals:m,grandTotal:g}=p(()=>{const a=Su(),l=Su(),s=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,u=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0}));for(const o of e){const e=wu(o,t),i=wu(o,n),p=e.join(""),h=i.join("");let f=a;for(const t of e)f=Cu(f,t);let m=l;for(const t of i)m=Cu(m,t);let g=s.get(p);g||(g=/* @__PURE__ */new Map,s.set(p,g));let x=g.get(h);x||(x=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),g.set(h,x));let b=d.get(p);b||(b=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),d.set(p,b));let y=c.get(h);y||(y=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),c.set(h,y)),r.forEach((e,t)=>{let n;if("count"===e.agg)n=1;else{const t=o[e.field??""];if("number"!=typeof t)return;n=t}yu(x[t],n),yu(b[t],n),yu(y[t],n),yu(u[t],n)})}return zu(a,0,o),zu(l,0,i),{rowPaths:t.length>0?Mu(a,t.length):[[]],colPaths:n.length>0?Mu(l,n.length):[[]],lookup:(e,t,n)=>{const o=s.get(e.join(""));if(!o)return null;const i=o.get(t.join(""));return i?vu(i[n],r[n].agg):null},rowTotals:(e,t)=>{const n=d.get(e.join(""));return n?vu(n[t],r[t].agg):null},colTotals:(e,t)=>{const n=c.get(e.join(""));return n?vu(n[t],r[t].agg):null},grandTotal:e=>vu(u[e],r[e].agg)}},[e,t,n,r,o,i]);u.length,r.length,a&&r.length;const y=n.length,v="6px 10px",w="var(--tkx-bg-subtle, #0d0d14)",k="var(--tkx-border, #2a2a3e)",$="var(--tkx-border-soft, #1a1a25)";/* @__PURE__ */
652
- return x("div",{className:d,style:{overflow:"auto",border:`1px solid ${k}`,borderRadius:8,background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",...s},"data-testid":"tkx-pivot",children:/* @__PURE__ */b("table",{role:"table",style:{borderCollapse:"collapse",width:"100%",fontSize:13,fontFamily:"inherit"},children:[/* @__PURE__ */b("thead",{children:[Array.from({length:y}).map((e,n)=>/* @__PURE__ */b("tr",{children:[0===n&&/* @__PURE__ */x("th",{rowSpan:y+1,colSpan:t.length,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:"#888",textAlign:"left"},children:t.join(" / ")||""}),(()=>{const e=[];for(const t of u){const o=t[n]??"",i=e[e.length-1];i&&i.key===o?i.span+=r.length:e.push({key:o,span:r.length})}return e.map((e,t)=>/* @__PURE__ */x("th",{colSpan:e.span,"data-testid":`pivot-colhead-${n}-${e.key}`,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,textAlign:"center"},children:e.key},t))})(),a&&0===n&&/* @__PURE__ */x("th",{rowSpan:y,colSpan:r.length,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:"var(--tkx-accent, #00f5d4)",textAlign:"center"},children:"Total"})]},`ch${n}`)),/* @__PURE__ */b("tr",{children:[0===y&&/* @__PURE__ */x("th",{colSpan:t.length,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:"#888",textAlign:"left"},children:t.join(" / ")||""}),u.map((e,t)=>r.map((e,n)=>/* @__PURE__ */x("th",{"data-testid":`pivot-vhead-${t}-${n}`,style:{background:w,border:`1px solid ${$}`,padding:v,fontSize:11,fontWeight:600,color:"#aaa",textAlign:"right"},children:ku(e)},`${t}-${n}`))),a&&r.map((e,t)=>/* @__PURE__ */x("th",{style:{background:w,border:`1px solid ${$}`,padding:v,fontSize:11,fontWeight:600,color:"var(--tkx-accent, #00f5d4)",textAlign:"right"},children:ku(e)},`tv-${t}`))]})]}),/* @__PURE__ */b("tbody",{children:[c.map((e,t)=>/* @__PURE__ */b("tr",{"data-testid":`pivot-row-${t}`,children:[e.map((e,t)=>/* @__PURE__ */x("th",{scope:"row",style:{background:"var(--tkx-bg-subtle, #12121a)",border:`1px solid ${$}`,padding:v,fontWeight:600,textAlign:"left"},children:e},t)),u.map((n,o)=>r.map((r,i)=>{const a=h(e,n,i);/* @__PURE__ */
678
+ return x("path",{"data-testid":`gantt-arrow-${o}-to-${e.task.id}`,d:u,stroke:"var(--tkx-fg-muted, #aaa)",strokeOpacity:.6,strokeWidth:1.5,fill:"none",markerEnd:"url(#tkx-gantt-arrowhead)"},`${o}->${e.task.id}`)}):[])]})]})]})})]})}function Du(e,t){e.sum+=t,e.count+=1,t<e.min&&(e.min=t),t>e.max&&(e.max=t)}function Ru(e,t){if(0===e.count)return null;switch(t){case"sum":return e.sum;case"avg":return e.sum/e.count;case"min":return e.min;case"max":return e.max;case"count":return e.count}}function Pu(e,t){return t.map(t=>String(e[t]??""))}function Fu(e){return e.label??("count"===e.agg?"count":`${e.agg}(${e.field??""})`)}var Iu=e=>Number.isFinite(e)?Number.isInteger(e)?String(e):String(Math.round(1e4*e)/1e4):"";function Au(){return{keys:[],children:/* @__PURE__ */new Map}}function Lu(e,t){let n=e.children.get(t);return n||(n=Au(),e.children.set(t,n),e.keys.push(t)),n}function Tu(e,t,n){e.keys.sort((e,r)=>n(e,r,t));for(const r of e.keys)Tu(e.children.get(r),t+1,n)}function Wu(e,t,n=[]){if(0===t)return[n];const r=[];for(const o of e.keys)r.push(...Wu(e.children.get(o),t-1,[...n,o]));return r}var ju=(e,t)=>e<t?-1:e>t?1:0;function Eu({data:e,rows:t,cols:n=[],values:r,sortRows:o=ju,sortCols:i=ju,showTotals:a=!0,formatNumber:l=Iu,style:s,className:d}){if(0===r.length)throw new Error("TkxPivotTable: values must contain at least one entry");const{rowPaths:c,colPaths:u,lookup:h,rowTotals:f,colTotals:m,grandTotal:g}=p(()=>{const a=Au(),l=Au(),s=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,u=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0}));for(const o of e){const e=Pu(o,t),i=Pu(o,n),p=e.join(""),h=i.join("");let f=a;for(const t of e)f=Lu(f,t);let m=l;for(const t of i)m=Lu(m,t);let g=s.get(p);g||(g=/* @__PURE__ */new Map,s.set(p,g));let x=g.get(h);x||(x=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),g.set(h,x));let b=d.get(p);b||(b=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),d.set(p,b));let y=c.get(h);y||(y=r.map(()=>({sum:0,count:0,min:1/0,max:-1/0})),c.set(h,y)),r.forEach((e,t)=>{let n;if("count"===e.agg)n=1;else{const t=o[e.field??""];if("number"!=typeof t)return;n=t}Du(x[t],n),Du(b[t],n),Du(y[t],n),Du(u[t],n)})}return Tu(a,0,o),Tu(l,0,i),{rowPaths:t.length>0?Wu(a,t.length):[[]],colPaths:n.length>0?Wu(l,n.length):[[]],lookup:(e,t,n)=>{const o=s.get(e.join(""));if(!o)return null;const i=o.get(t.join(""));return i?Ru(i[n],r[n].agg):null},rowTotals:(e,t)=>{const n=d.get(e.join(""));return n?Ru(n[t],r[t].agg):null},colTotals:(e,t)=>{const n=c.get(e.join(""));return n?Ru(n[t],r[t].agg):null},grandTotal:e=>Ru(u[e],r[e].agg)}},[e,t,n,r,o,i]);u.length,r.length,a&&r.length;const y=n.length,v="6px 10px",w="var(--tkx-bg-subtle, #0d0d14)",k="var(--tkx-border, #2a2a3e)",$="var(--tkx-border-soft, #1a1a25)";/* @__PURE__ */
679
+ return x("div",{className:d,style:{overflow:"auto",border:`1px solid ${k}`,borderRadius:8,background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",...s},"data-testid":"tkx-pivot",children:/* @__PURE__ */b("table",{role:"table",style:{borderCollapse:"collapse",width:"100%",fontSize:13,fontFamily:"inherit"},children:[/* @__PURE__ */b("thead",{children:[Array.from({length:y}).map((e,n)=>/* @__PURE__ */b("tr",{children:[0===n&&/* @__PURE__ */x("th",{rowSpan:y+1,colSpan:t.length,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:"#888",textAlign:"left"},children:t.join(" / ")||""}),(()=>{const e=[];for(const t of u){const o=t[n]??"",i=e[e.length-1];i&&i.key===o?i.span+=r.length:e.push({key:o,span:r.length})}return e.map((e,t)=>/* @__PURE__ */x("th",{colSpan:e.span,"data-testid":`pivot-colhead-${n}-${e.key}`,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,textAlign:"center"},children:e.key},t))})(),a&&0===n&&/* @__PURE__ */x("th",{rowSpan:y,colSpan:r.length,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:"var(--tkx-accent, #00f5d4)",textAlign:"center"},children:"Total"})]},`ch${n}`)),/* @__PURE__ */b("tr",{children:[0===y&&/* @__PURE__ */x("th",{colSpan:t.length,style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:"#888",textAlign:"left"},children:t.join(" / ")||""}),u.map((e,t)=>r.map((e,n)=>/* @__PURE__ */x("th",{"data-testid":`pivot-vhead-${t}-${n}`,style:{background:w,border:`1px solid ${$}`,padding:v,fontSize:11,fontWeight:600,color:"#aaa",textAlign:"right"},children:Fu(e)},`${t}-${n}`))),a&&r.map((e,t)=>/* @__PURE__ */x("th",{style:{background:w,border:`1px solid ${$}`,padding:v,fontSize:11,fontWeight:600,color:"var(--tkx-accent, #00f5d4)",textAlign:"right"},children:Fu(e)},`tv-${t}`))]})]}),/* @__PURE__ */b("tbody",{children:[c.map((e,t)=>/* @__PURE__ */b("tr",{"data-testid":`pivot-row-${t}`,children:[e.map((e,t)=>/* @__PURE__ */x("th",{scope:"row",style:{background:"var(--tkx-bg-subtle, #12121a)",border:`1px solid ${$}`,padding:v,fontWeight:600,textAlign:"left"},children:e},t)),u.map((n,o)=>r.map((r,i)=>{const a=h(e,n,i);/* @__PURE__ */
653
680
  return x("td",{"data-testid":`pivot-cell-${t}-${o}-${i}`,style:{border:`1px solid ${$}`,padding:v,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:null===a?"":l(a)},`${o}-${i}`)})),a&&r.map((n,r)=>{const o=f(e,r);/* @__PURE__ */
654
681
  return x("td",{"data-testid":`pivot-rowtotal-${t}-${r}`,style:{border:`1px solid ${k}`,padding:v,textAlign:"right",fontWeight:700,background:"rgba(0,245,212,0.04)",fontVariantNumeric:"tabular-nums"},children:null===o?"":l(o)},`rt-${r}`)})]},t)),a&&/* @__PURE__ */b("tr",{"data-testid":"pivot-totals-row",children:[
655
682
  /* @__PURE__ */x("th",{colSpan:Math.max(t.length,1),scope:"row",style:{background:w,border:`1px solid ${k}`,padding:v,fontWeight:700,color:"var(--tkx-accent, #00f5d4)",textAlign:"left"},children:"Total"}),u.map((e,t)=>r.map((n,r)=>{const o=m(e,r);/* @__PURE__ */
656
683
  return x("td",{"data-testid":`pivot-coltotal-${t}-${r}`,style:{border:`1px solid ${k}`,padding:v,textAlign:"right",fontWeight:700,background:"rgba(0,245,212,0.04)",fontVariantNumeric:"tabular-nums"},children:null===o?"":l(o)},`ct-${t}-${r}`)})),r.map((e,t)=>{const n=g(t);/* @__PURE__ */
657
- return x("td",{"data-testid":`pivot-grandtotal-${t}`,style:{border:`1px solid ${k}`,padding:v,textAlign:"right",fontWeight:700,background:"rgba(0,245,212,0.1)",color:"var(--tkx-accent, #00f5d4)",fontVariantNumeric:"tabular-nums"},children:null===n?"":l(n)},`gt-${t}`)})]})]})]})})}var Pu=/^([A-Z]+)([0-9]+)$/;function Ru(e){let t="",n=e;for(;t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1,!(n<0););return t}function Fu(e){let t=0;for(let n=0;n<e.length;n++)t=26*t+(e.charCodeAt(n)-64);return t-1}function Iu(e,t){return`${Ru(e)}${t+1}`}function Au(e){const t=Pu.exec(e);return t?{col:Fu(t[1]),row:+t[2]-1}:null}function Lu(e,t){const n=/* @__PURE__ */new Map,r=e.cells,o=[];for(let a=0;a<t.cols;a++){const e=r[Iu(a,0)];o.push(e&&""!==e.trim()?e.trim():Iu(a,0))}const i=[];for(let a=1;a<t.rows;a++){const e={};let l=!1;for(let i=0;i<t.cols;i++){const t=Iu(i,a);let s;n.has(t)?s=n.get(t):(s=Wu(t,r),n.set(t,s)),""===s||void 0===s||"string"==typeof s&&s.startsWith("#")?e[o[i]]=null:(e[o[i]]=s,l=!0)}l&&i.push(e)}return i}function Tu(e,t={}){const{base:n,preserveExtraCells:r=!1}=t,o=[],i=/* @__PURE__ */new Set;for(const l of e)for(const e of Object.keys(l))i.has(e)||(i.add(e),o.push(e));const a={};if(r&&n)for(const[l,s]of Object.entries(n.cells))a[l]=s;if(o.forEach((e,t)=>{a[Iu(t,0)]=e}),e.forEach((e,t)=>{const n=t+1;o.forEach((t,o)=>{const i=e[t];null==i||""===i?r||delete a[Iu(o,n)]:a[Iu(o,n)]=String(i)})}),!r&&n){o.length,e.length;for(const[e]of Object.entries(n.cells)){const t=/^([A-Z]+)([0-9]+)$/.exec(e);t&&(Fu(t[1]),t[2])}}return{cells:a}}function Wu(e,t){return ju(e,{cells:t,stack:/* @__PURE__ */new Set,memo:/* @__PURE__ */new Map})}function ju(e,t){if(t.memo.has(e))return t.memo.get(e);if(t.stack.has(e))return"#CYCLE!";const n=t.cells[e];if(void 0===n||""===n)return"";let r;if(n.startsWith("=")){t.stack.add(e);try{r=function(e,t){const n=function(e){const t=[];let n=e.trim();for(;n.length;){if(" "===n[0]){n=n.slice(1);continue}if("("===n[0]||")"===n[0]){t.push({type:"paren",value:n[0]}),n=n.slice(1);continue}if(","===n[0]){t.push({type:"comma"}),n=n.slice(1);continue}if("+-*/^".includes(n[0])){t.push({type:"op",value:n[0]}),n=n.slice(1);continue}let e;if(e=Eu.exec(n),e)t.push({type:"fn",name:e[1]}),t.push({type:"paren",value:"("}),n=n.slice(e[0].length);else if(e=Bu.exec(n),e)t.push({type:"range",from:e[1],to:e[2]}),n=n.slice(e[0].length);else if(e=Vu.exec(n),e)t.push({type:"ref",addr:e[1]}),n=n.slice(e[0].length);else{if(e=Hu.exec(n),!e)throw new Error(`Unexpected token at "${n}"`);t.push({type:"num",value:+e[0]}),n=n.slice(e[0].length)}}return t}(e),r={tokens:n,pos:0},o=Ku(r,t,0);if(r.pos!==n.length)throw new Error("Trailing tokens");return o}(n.slice(1),t)}catch{r="#ERROR!"}t.stack.delete(e)}else{const e=Number(n);r=Number.isFinite(e)&&""!==n.trim()?e:n}return t.memo.set(e,r),r}var Eu=/^([A-Z][A-Z0-9_]*)\s*\(/,Bu=/^([A-Z]+[0-9]+):([A-Z]+[0-9]+)/,Vu=/^([A-Z]+[0-9]+)/,Hu=/^(\d+(?:\.\d+)?|\.\d+)/;function Ou(e){return e.tokens[e.pos]??null}function qu(e){return e.tokens[e.pos++]}var Uu={"+":1,"-":1,"*":2,"/":2,"^":3};function Ku(e,t,n){let r=function(e,t){const n=qu(e);if(!n)throw new Error("Unexpected end of formula");switch(n.type){case"num":return n.value;case"ref":return ju(n.addr,t);case"range":throw new Error("Range used outside a function");case"op":if("-"===n.value||"+"===n.value){const r=Xu(Ku(e,t,4));return"-"===n.value?-r:r}throw new Error(`Unexpected operator ${n.value}`);case"paren":{if("("!==n.value)throw new Error("Unexpected )");const r=Ku(e,t,0),o=qu(e);if(!o||"paren"!==o.type||")"!==o.value)throw new Error("Missing )");return r}case"fn":{const r=[],o=qu(e);if(!o||"paren"!==o.type||"("!==o.value)throw new Error("Function missing (");if("paren"===Ou(e)?.type&&")"===Ou(e).value)return qu(e),Gu(n.name,r);for(;;){const n=Ou(e);n&&"range"===n.type?(qu(e),r.push(Yu(n.from,n.to,t))):r.push([Ku(e,t,0)]);const o=Ou(e);if(!o||"comma"!==o.type)break;qu(e)}const i=qu(e);if(!i||"paren"!==i.type||")"!==i.value)throw new Error("Function missing )");return Gu(n.name,r)}default:throw new Error(`Unexpected token ${n.type}`)}}(e,t);for(;;){const o=Ou(e);if(!o||"op"!==o.type)break;const i=Uu[o.value];if(void 0===i||i<n)break;qu(e);const a=Ku(e,t,i+1);r=Zu(o.value,r,a)}return r}function Yu(e,t,n){const r=Au(e),o=Au(t);if(!r||!o)return["#REF!"];const i=Math.min(r.col,o.col),a=Math.max(r.col,o.col),l=Math.min(r.row,o.row),s=Math.max(r.row,o.row),d=[];for(let c=i;c<=a;c++)for(let e=l;e<=s;e++)d.push(ju(Iu(c,e),n));return d}function Xu(e){if("number"==typeof e)return e;if("string"==typeof e&&e.startsWith("#"))throw new Error(e);const t=Number(e);return Number.isFinite(t)?t:0}function Zu(e,t,n){const r=Xu(t),o=Xu(n);switch(e){case"+":return r+o;case"-":return r-o;case"*":return r*o;case"/":return 0===o?"#DIV/0!":r/o;case"^":return Math.pow(r,o);default:throw new Error(`Unknown op ${e}`)}}function Gu(e,t){const n=t.flat().filter(e=>"number"==typeof e||"string"==typeof e&&""!==e&&!e.startsWith("#")).map(Xu);switch(e.toUpperCase()){case"SUM":return n.reduce((e,t)=>e+t,0);case"AVG":case"AVERAGE":return 0===n.length?0:n.reduce((e,t)=>e+t,0)/n.length;case"MIN":return 0===n.length?0:Math.min(...n);case"MAX":return 0===n.length?0:Math.max(...n);case"COUNT":return n.length;case"ROUND":{const e=Xu(t[0]?.[0]??0),n=t[1]?Xu(t[1][0]):0,r=Math.pow(10,n);return Math.round(e*r)/r}case"IF":{const e=Xu(t[0]?.[0]??0),n=t[1]?.[0]??"",r=t[2]?.[0]??"";return e?n:r}default:return"#NAME?"}}function _u({cols:e=8,rows:t=20,data:n,onChange:r,colWidth:o=96,rowHeight:i=28,style:l,className:s}){const[d,c]=m({col:0,row:0}),[u,h]=m(!1),[g,y]=m(""),v=f(null),w=p(()=>{const e=/* @__PURE__ */new Map,t={cells:n.cells,stack:/* @__PURE__ */new Set,memo:e};return e=>ju(e,t)},[n]),k=Iu(d.col,d.row),$=a(e=>{y(e??n.cells[k]??""),h(!0),requestAnimationFrame(()=>v.current?.focus())},[k,n.cells]),S=a(()=>{const e={...n.cells};""===g?delete e[k]:e[k]=g,r({cells:e}),h(!1)},[k,n,g,r]),C=a(()=>{h(!1),y("")},[]),z=a((n,r)=>{c(o=>({col:Math.max(0,Math.min(e-1,o.col+n)),row:Math.max(0,Math.min(t-1,o.row+r))}))},[e,t]),M=e=>{switch(e.key){case"Enter":e.preventDefault(),S(),z(0,1);break;case"Tab":e.preventDefault(),S(),z(e.shiftKey?-1:1,0);break;case"Escape":e.preventDefault(),C()}};/* @__PURE__ */
658
- return b("div",{className:s,tabIndex:0,role:"grid","aria-rowcount":t,"aria-colcount":e,"data-testid":"tkx-spreadsheet",onKeyDown:e=>{if(!u)switch(e.key){case"ArrowUp":e.preventDefault(),z(0,-1);break;case"ArrowDown":e.preventDefault(),z(0,1);break;case"ArrowLeft":e.preventDefault(),z(-1,0);break;case"ArrowRight":e.preventDefault(),z(1,0);break;case"Tab":e.preventDefault(),z(e.shiftKey?-1:1,0);break;case"Enter":case"F2":e.preventDefault(),$();break;case"Delete":case"Backspace":if(e.preventDefault(),void 0!==n.cells[k]){const e={...n.cells};delete e[k],r({cells:e})}break;default:1!==e.key.length||e.metaKey||e.ctrlKey||(e.preventDefault(),$(e.key))}},style:{position:"relative",width:48+e*o,maxWidth:"100%",height:28+t*i,outline:"none",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,overflow:"auto",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:13,...l},children:[/* @__PURE__ */b("div",{role:"row",style:{display:"flex",height:28,position:"sticky",top:0,background:"var(--tkx-bg-subtle, #0d0d14)",zIndex:2,borderBottom:"1px solid var(--tkx-border, #2a2a3e)"},children:[/* @__PURE__ */x("div",{role:"columnheader",style:{width:48,flex:"0 0 48px",borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)"}}),Array.from({length:e}).map((e,t)=>/* @__PURE__ */x("div",{role:"columnheader","data-testid":`col-${Ru(t)}`,style:{width:o,flex:`0 0 ${o}px`,textAlign:"center",lineHeight:"28px",fontWeight:700,color:t===d.col?"var(--tkx-accent, #00f5d4)":"#888",borderRight:"1px solid var(--tkx-border-soft, #1a1a25)"},children:Ru(t)},t))]}),Array.from({length:t}).map((t,r)=>/* @__PURE__ */b("div",{role:"row","aria-rowindex":r+1,style:{display:"flex",height:i},children:[/* @__PURE__ */x("div",{role:"rowheader",style:{width:48,flex:"0 0 48px",textAlign:"center",lineHeight:`${i}px`,fontWeight:700,color:r===d.row?"var(--tkx-accent, #00f5d4)":"#888",background:"var(--tkx-bg-subtle, #0d0d14)",borderRight:"1px solid var(--tkx-border, #2a2a3e)",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",position:"sticky",left:0,zIndex:1},children:r+1}),Array.from({length:e}).map((e,t)=>{const a=Iu(t,r),l=t===d.col&&r===d.row,s=n.cells[a]??"",p=""===s?"":"number"==typeof(h=w(a))?Number.isFinite(h)?Number.isInteger(h)?String(h):String(Math.round(1e10*h)/1e10):"#NUM!":String(h);var h;const f=s.startsWith("=");/* @__PURE__ */
659
- return x("div",{role:"gridcell","aria-colindex":t+1,"aria-selected":l,"data-testid":`cell-${a}`,onClick:()=>c({col:t,row:r}),onDoubleClick:()=>{c({col:t,row:r}),$()},style:{width:o,flex:`0 0 ${o}px`,borderRight:"1px solid var(--tkx-border-soft, #1a1a25)",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",padding:"0 6px",lineHeight:`${i}px`,background:l?"rgba(0,245,212,0.08)":"transparent",outline:l?"2px solid var(--tkx-accent, #00f5d4)":"none",outlineOffset:-2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"string"==typeof w(a)&&w(a).startsWith("#")?"#ff006e":f?"var(--tkx-accent, #00f5d4)":"var(--tkx-fg, #e8e8f4)",cursor:"cell",position:"relative"},children:l&&u?/* @__PURE__ */x("input",{ref:v,value:g,onChange:e=>y(e.target.value),onBlur:S,onKeyDown:M,"data-testid":`cell-input-${a}`,style:{position:"absolute",inset:0,width:"100%",height:"100%",padding:"0 6px",border:"none",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}):p},t)})]},r))]})}function Ju({data:e,active:t,onChange:n,onActiveChange:r,showResult:o=!0,height:i=36,style:a,className:l}){const d=Iu(t.col,t.row),c=e.cells[d]??"",[u,p]=m(c),[h,f]=m(d);s(()=>{p(c),f(d)},[d]);const g=o&&c.startsWith("=")?Wu(d,e.cells):"",y=()=>{const t={...e.cells};""===u?delete t[d]:t[d]=u,n({cells:t})};/* @__PURE__ */
684
+ return x("td",{"data-testid":`pivot-grandtotal-${t}`,style:{border:`1px solid ${k}`,padding:v,textAlign:"right",fontWeight:700,background:"rgba(0,245,212,0.1)",color:"var(--tkx-accent, #00f5d4)",fontVariantNumeric:"tabular-nums"},children:null===n?"":l(n)},`gt-${t}`)})]})]})]})})}var Bu=/^([A-Z]+)([0-9]+)$/;function Vu(e){let t="",n=e;for(;t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1,!(n<0););return t}function Hu(e){let t=0;for(let n=0;n<e.length;n++)t=26*t+(e.charCodeAt(n)-64);return t-1}function Ou(e,t){return`${Vu(e)}${t+1}`}function qu(e){const t=Bu.exec(e);return t?{col:Hu(t[1]),row:+t[2]-1}:null}function Uu(e,t){const n=/* @__PURE__ */new Map,r=e.cells,o=[];for(let a=0;a<t.cols;a++){const e=r[Ou(a,0)];o.push(e&&""!==e.trim()?e.trim():Ou(a,0))}const i=[];for(let a=1;a<t.rows;a++){const e={};let l=!1;for(let i=0;i<t.cols;i++){const t=Ou(i,a);let s;n.has(t)?s=n.get(t):(s=Yu(t,r),n.set(t,s)),""===s||void 0===s||"string"==typeof s&&s.startsWith("#")?e[o[i]]=null:(e[o[i]]=s,l=!0)}l&&i.push(e)}return i}function Ku(e,t={}){const{base:n,preserveExtraCells:r=!1}=t,o=[],i=/* @__PURE__ */new Set;for(const l of e)for(const e of Object.keys(l))i.has(e)||(i.add(e),o.push(e));const a={};if(r&&n)for(const[l,s]of Object.entries(n.cells))a[l]=s;if(o.forEach((e,t)=>{a[Ou(t,0)]=e}),e.forEach((e,t)=>{const n=t+1;o.forEach((t,o)=>{const i=e[t];null==i||""===i?r||delete a[Ou(o,n)]:a[Ou(o,n)]=String(i)})}),!r&&n){o.length,e.length;for(const[e]of Object.entries(n.cells)){const t=/^([A-Z]+)([0-9]+)$/.exec(e);t&&(Hu(t[1]),t[2])}}return{cells:a}}function Yu(e,t){return Xu(e,{cells:t,stack:/* @__PURE__ */new Set,memo:/* @__PURE__ */new Map})}function Xu(e,t){if(t.memo.has(e))return t.memo.get(e);if(t.stack.has(e))return"#CYCLE!";const n=t.cells[e];if(void 0===n||""===n)return"";let r;if(n.startsWith("=")){t.stack.add(e);try{r=function(e,t){const n=function(e){const t=[];let n=e.trim();for(;n.length;){if(" "===n[0]){n=n.slice(1);continue}if("("===n[0]||")"===n[0]){t.push({type:"paren",value:n[0]}),n=n.slice(1);continue}if(","===n[0]){t.push({type:"comma"}),n=n.slice(1);continue}if("+-*/^".includes(n[0])){t.push({type:"op",value:n[0]}),n=n.slice(1);continue}let e;if(e=Zu.exec(n),e)t.push({type:"fn",name:e[1]}),t.push({type:"paren",value:"("}),n=n.slice(e[0].length);else if(e=Gu.exec(n),e)t.push({type:"range",from:e[1],to:e[2]}),n=n.slice(e[0].length);else if(e=_u.exec(n),e)t.push({type:"ref",addr:e[1]}),n=n.slice(e[0].length);else{if(e=Ju.exec(n),!e)throw new Error(`Unexpected token at "${n}"`);t.push({type:"num",value:+e[0]}),n=n.slice(e[0].length)}}return t}(e),r={tokens:n,pos:0},o=np(r,t,0);if(r.pos!==n.length)throw new Error("Trailing tokens");return o}(n.slice(1),t)}catch{r="#ERROR!"}t.stack.delete(e)}else{const e=Number(n);r=Number.isFinite(e)&&""!==n.trim()?e:n}return t.memo.set(e,r),r}var Zu=/^([A-Z][A-Z0-9_]*)\s*\(/,Gu=/^([A-Z]+[0-9]+):([A-Z]+[0-9]+)/,_u=/^([A-Z]+[0-9]+)/,Ju=/^(\d+(?:\.\d+)?|\.\d+)/;function Qu(e){return e.tokens[e.pos]??null}function ep(e){return e.tokens[e.pos++]}var tp={"+":1,"-":1,"*":2,"/":2,"^":3};function np(e,t,n){let r=function(e,t){const n=ep(e);if(!n)throw new Error("Unexpected end of formula");switch(n.type){case"num":return n.value;case"ref":return Xu(n.addr,t);case"range":throw new Error("Range used outside a function");case"op":if("-"===n.value||"+"===n.value){const r=op(np(e,t,4));return"-"===n.value?-r:r}throw new Error(`Unexpected operator ${n.value}`);case"paren":{if("("!==n.value)throw new Error("Unexpected )");const r=np(e,t,0),o=ep(e);if(!o||"paren"!==o.type||")"!==o.value)throw new Error("Missing )");return r}case"fn":{const r=[],o=ep(e);if(!o||"paren"!==o.type||"("!==o.value)throw new Error("Function missing (");if("paren"===Qu(e)?.type&&")"===Qu(e).value)return ep(e),ap(n.name,r);for(;;){const n=Qu(e);n&&"range"===n.type?(ep(e),r.push(rp(n.from,n.to,t))):r.push([np(e,t,0)]);const o=Qu(e);if(!o||"comma"!==o.type)break;ep(e)}const i=ep(e);if(!i||"paren"!==i.type||")"!==i.value)throw new Error("Function missing )");return ap(n.name,r)}default:throw new Error(`Unexpected token ${n.type}`)}}(e,t);for(;;){const o=Qu(e);if(!o||"op"!==o.type)break;const i=tp[o.value];if(void 0===i||i<n)break;ep(e);const a=np(e,t,i+1);r=ip(o.value,r,a)}return r}function rp(e,t,n){const r=qu(e),o=qu(t);if(!r||!o)return["#REF!"];const i=Math.min(r.col,o.col),a=Math.max(r.col,o.col),l=Math.min(r.row,o.row),s=Math.max(r.row,o.row),d=[];for(let c=i;c<=a;c++)for(let e=l;e<=s;e++)d.push(Xu(Ou(c,e),n));return d}function op(e){if("number"==typeof e)return e;if("string"==typeof e&&e.startsWith("#"))throw new Error(e);const t=Number(e);return Number.isFinite(t)?t:0}function ip(e,t,n){const r=op(t),o=op(n);switch(e){case"+":return r+o;case"-":return r-o;case"*":return r*o;case"/":return 0===o?"#DIV/0!":r/o;case"^":return Math.pow(r,o);default:throw new Error(`Unknown op ${e}`)}}function ap(e,t){const n=t.flat().filter(e=>"number"==typeof e||"string"==typeof e&&""!==e&&!e.startsWith("#")).map(op);switch(e.toUpperCase()){case"SUM":return n.reduce((e,t)=>e+t,0);case"AVG":case"AVERAGE":return 0===n.length?0:n.reduce((e,t)=>e+t,0)/n.length;case"MIN":return 0===n.length?0:Math.min(...n);case"MAX":return 0===n.length?0:Math.max(...n);case"COUNT":return n.length;case"ROUND":{const e=op(t[0]?.[0]??0),n=t[1]?op(t[1][0]):0,r=Math.pow(10,n);return Math.round(e*r)/r}case"IF":{const e=op(t[0]?.[0]??0),n=t[1]?.[0]??"",r=t[2]?.[0]??"";return e?n:r}default:return"#NAME?"}}function lp({cols:e=8,rows:t=20,data:n,onChange:r,colWidth:o=96,rowHeight:i=28,style:l,className:s}){const[d,c]=m({col:0,row:0}),[u,h]=m(!1),[g,y]=m(""),v=f(null),w=p(()=>{const e=/* @__PURE__ */new Map,t={cells:n.cells,stack:/* @__PURE__ */new Set,memo:e};return e=>Xu(e,t)},[n]),k=Ou(d.col,d.row),$=a(e=>{y(e??n.cells[k]??""),h(!0),requestAnimationFrame(()=>v.current?.focus())},[k,n.cells]),S=a(()=>{const e={...n.cells};""===g?delete e[k]:e[k]=g,r({cells:e}),h(!1)},[k,n,g,r]),C=a(()=>{h(!1),y("")},[]),z=a((n,r)=>{c(o=>({col:Math.max(0,Math.min(e-1,o.col+n)),row:Math.max(0,Math.min(t-1,o.row+r))}))},[e,t]),M=e=>{switch(e.key){case"Enter":e.preventDefault(),S(),z(0,1);break;case"Tab":e.preventDefault(),S(),z(e.shiftKey?-1:1,0);break;case"Escape":e.preventDefault(),C()}};/* @__PURE__ */
685
+ return b("div",{className:s,tabIndex:0,role:"grid","aria-rowcount":t,"aria-colcount":e,"data-testid":"tkx-spreadsheet",onKeyDown:e=>{if(!u)switch(e.key){case"ArrowUp":e.preventDefault(),z(0,-1);break;case"ArrowDown":e.preventDefault(),z(0,1);break;case"ArrowLeft":e.preventDefault(),z(-1,0);break;case"ArrowRight":e.preventDefault(),z(1,0);break;case"Tab":e.preventDefault(),z(e.shiftKey?-1:1,0);break;case"Enter":case"F2":e.preventDefault(),$();break;case"Delete":case"Backspace":if(e.preventDefault(),void 0!==n.cells[k]){const e={...n.cells};delete e[k],r({cells:e})}break;default:1!==e.key.length||e.metaKey||e.ctrlKey||(e.preventDefault(),$(e.key))}},style:{position:"relative",width:48+e*o,maxWidth:"100%",height:28+t*i,outline:"none",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,overflow:"auto",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:13,...l},children:[/* @__PURE__ */b("div",{role:"row",style:{display:"flex",height:28,position:"sticky",top:0,background:"var(--tkx-bg-subtle, #0d0d14)",zIndex:2,borderBottom:"1px solid var(--tkx-border, #2a2a3e)"},children:[/* @__PURE__ */x("div",{role:"columnheader",style:{width:48,flex:"0 0 48px",borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)"}}),Array.from({length:e}).map((e,t)=>/* @__PURE__ */x("div",{role:"columnheader","data-testid":`col-${Vu(t)}`,style:{width:o,flex:`0 0 ${o}px`,textAlign:"center",lineHeight:"28px",fontWeight:700,color:t===d.col?"var(--tkx-accent, #00f5d4)":"#888",borderRight:"1px solid var(--tkx-border-soft, #1a1a25)"},children:Vu(t)},t))]}),Array.from({length:t}).map((t,r)=>/* @__PURE__ */b("div",{role:"row","aria-rowindex":r+1,style:{display:"flex",height:i},children:[/* @__PURE__ */x("div",{role:"rowheader",style:{width:48,flex:"0 0 48px",textAlign:"center",lineHeight:`${i}px`,fontWeight:700,color:r===d.row?"var(--tkx-accent, #00f5d4)":"#888",background:"var(--tkx-bg-subtle, #0d0d14)",borderRight:"1px solid var(--tkx-border, #2a2a3e)",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",position:"sticky",left:0,zIndex:1},children:r+1}),Array.from({length:e}).map((e,t)=>{const a=Ou(t,r),l=t===d.col&&r===d.row,s=n.cells[a]??"",p=""===s?"":"number"==typeof(h=w(a))?Number.isFinite(h)?Number.isInteger(h)?String(h):String(Math.round(1e10*h)/1e10):"#NUM!":String(h);var h;const f=s.startsWith("=");/* @__PURE__ */
686
+ return x("div",{role:"gridcell","aria-colindex":t+1,"aria-selected":l,"data-testid":`cell-${a}`,onClick:()=>c({col:t,row:r}),onDoubleClick:()=>{c({col:t,row:r}),$()},style:{width:o,flex:`0 0 ${o}px`,borderRight:"1px solid var(--tkx-border-soft, #1a1a25)",borderBottom:"1px solid var(--tkx-border-soft, #1a1a25)",padding:"0 6px",lineHeight:`${i}px`,background:l?"rgba(0,245,212,0.08)":"transparent",outline:l?"2px solid var(--tkx-accent, #00f5d4)":"none",outlineOffset:-2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"string"==typeof w(a)&&w(a).startsWith("#")?"#ff006e":f?"var(--tkx-accent, #00f5d4)":"var(--tkx-fg, #e8e8f4)",cursor:"cell",position:"relative"},children:l&&u?/* @__PURE__ */x("input",{ref:v,value:g,onChange:e=>y(e.target.value),onBlur:S,onKeyDown:M,"data-testid":`cell-input-${a}`,style:{position:"absolute",inset:0,width:"100%",height:"100%",padding:"0 6px",border:"none",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}):p},t)})]},r))]})}function sp({data:e,active:t,onChange:n,onActiveChange:r,showResult:o=!0,height:i=36,style:a,className:l}){const d=Ou(t.col,t.row),c=e.cells[d]??"",[u,p]=m(c),[h,f]=m(d);s(()=>{p(c),f(d)},[d]);const g=o&&c.startsWith("=")?Yu(d,e.cells):"",y=()=>{const t={...e.cells};""===u?delete t[d]:t[d]=u,n({cells:t})};/* @__PURE__ */
660
687
  return b("div",{role:"toolbar","aria-label":"Formula bar","data-testid":"tkx-formula-bar",className:l,style:{display:"flex",alignItems:"stretch",gap:0,height:i,background:"var(--tkx-bg-subtle, #0d0d14)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,overflow:"hidden",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:13,...a},children:[
661
- /* @__PURE__ */x("input",{"aria-label":"Cell address","data-testid":"formula-bar-name",value:h,onChange:e=>f(He(e.target.value)),onKeyDown:e=>{if("Enter"===e.key){e.preventDefault();const t=Au(h.trim().toUpperCase());t?r?.(t):f(d)}else"Escape"===e.key&&(e.preventDefault(),f(d))},onBlur:()=>{Au(h.trim().toUpperCase())||f(d)},style:{width:90,flex:"0 0 90px",padding:"0 10px",border:"none",borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-accent, #00f5d4)",fontWeight:700,textAlign:"center",textTransform:"uppercase",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}),
688
+ /* @__PURE__ */x("input",{"aria-label":"Cell address","data-testid":"formula-bar-name",value:h,onChange:e=>f(He(e.target.value)),onKeyDown:e=>{if("Enter"===e.key){e.preventDefault();const t=qu(h.trim().toUpperCase());t?r?.(t):f(d)}else"Escape"===e.key&&(e.preventDefault(),f(d))},onBlur:()=>{qu(h.trim().toUpperCase())||f(d)},style:{width:90,flex:"0 0 90px",padding:"0 10px",border:"none",borderRight:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-accent, #00f5d4)",fontWeight:700,textAlign:"center",textTransform:"uppercase",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}),
662
689
  /* @__PURE__ */b("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",padding:"0 12px",color:"#888",fontStyle:"italic",fontFamily:"serif",fontSize:14,borderRight:"1px solid var(--tkx-border-soft, #1a1a25)"},children:["f",/* @__PURE__ */x("sub",{style:{fontSize:9},children:"x"})]}),
663
- /* @__PURE__ */x("input",{"aria-label":"Cell content","data-testid":"formula-bar-input",value:u,onChange:e=>p(He(e.target.value)),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),y()):"Escape"===e.key&&(e.preventDefault(),p(c))},onBlur:y,placeholder:"Type a value or =formula",style:{flex:1,minWidth:0,padding:"0 12px",border:"none",background:"transparent",color:u.startsWith("=")?"var(--tkx-accent, #00f5d4)":"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}),o&&c.startsWith("=")&&/* @__PURE__ */b("span",{"data-testid":"formula-bar-result","aria-label":"Evaluated value",style:{display:"inline-flex",alignItems:"center",padding:"0 12px",borderLeft:"1px solid var(--tkx-border-soft, #1a1a25)",background:"rgba(0,245,212,0.06)",color:"string"==typeof g&&g.startsWith("#")?"#ff006e":"#c4a8ff",fontWeight:600,minWidth:80,justifyContent:"flex-end"},children:["= ",String(g)]})]})}var Qu=["text","email","number","textarea","select","radio","checkbox","date"],ep={text:"Text",email:"Email",number:"Number",textarea:"Long text",select:"Dropdown",radio:"Radio group",checkbox:"Checkbox",date:"Date"},tp={text:"🔤",email:"✉️",number:"#️⃣",textarea:"📝",select:"🔽",radio:"🔘",checkbox:"☑️",date:"📅"};function np(e,t){return`${ep[e]} ${t}`}function rp(e,t){return`${e}_${t}`}function op(e,t){const n=null==t||""===t||Array.isArray(t)&&0===t.length;if(e.required&&n)return`${e.label} is required`;if(n)return null;if("email"===e.type&&"string"==typeof t&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return"Invalid email";if("number"===e.type&&"string"==typeof t){const n=Number(t);if(Number.isNaN(n))return"Must be a number";if(void 0!==e.min&&n<e.min)return`Must be ≥ ${e.min}`;if(void 0!==e.max&&n>e.max)return`Must be ≤ ${e.max}`}if(e.pattern&&"string"==typeof t)try{if(!new RegExp(e.pattern).test(t))return"Format is invalid"}catch{}return null}function ip({types:e,onAdd:t}){/* @__PURE__ */
664
- return b("div",{role:"toolbar","aria-label":"Field types",style:{display:"flex",flexDirection:"column",gap:6,padding:12,borderRight:"1px solid var(--tkx-border, #2a2a3e)",minWidth:180,background:"var(--tkx-bg-subtle, #0d0d14)"},children:[/* @__PURE__ */x("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"#888",marginBottom:4},children:"Add field"}),e.map(e=>/* @__PURE__ */b("button",{type:"button","data-testid":`palette-${e}`,onClick:()=>t(e),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",minHeight:44,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",fontSize:13,cursor:"pointer",textAlign:"left"},children:[/* @__PURE__ */x("span",{"aria-hidden":"true",children:tp[e]}),/* @__PURE__ */x("span",{children:ep[e]})]},e))]})}function ap({fields:e,selectedId:t,onSelect:n,onMove:r,onRemove:o}){/* @__PURE__ */
690
+ /* @__PURE__ */x("input",{"aria-label":"Cell content","data-testid":"formula-bar-input",value:u,onChange:e=>p(He(e.target.value)),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),y()):"Escape"===e.key&&(e.preventDefault(),p(c))},onBlur:y,placeholder:"Type a value or =formula",style:{flex:1,minWidth:0,padding:"0 12px",border:"none",background:"transparent",color:u.startsWith("=")?"var(--tkx-accent, #00f5d4)":"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",fontSize:"inherit",outline:"none"}}),o&&c.startsWith("=")&&/* @__PURE__ */b("span",{"data-testid":"formula-bar-result","aria-label":"Evaluated value",style:{display:"inline-flex",alignItems:"center",padding:"0 12px",borderLeft:"1px solid var(--tkx-border-soft, #1a1a25)",background:"rgba(0,245,212,0.06)",color:"string"==typeof g&&g.startsWith("#")?"#ff006e":"#c4a8ff",fontWeight:600,minWidth:80,justifyContent:"flex-end"},children:["= ",String(g)]})]})}var dp=["text","email","number","textarea","select","radio","checkbox","date"],cp={text:"Text",email:"Email",number:"Number",textarea:"Long text",select:"Dropdown",radio:"Radio group",checkbox:"Checkbox",date:"Date"},up={text:"🔤",email:"✉️",number:"#️⃣",textarea:"📝",select:"🔽",radio:"🔘",checkbox:"☑️",date:"📅"};function pp(e,t){return`${cp[e]} ${t}`}function hp(e,t){return`${e}_${t}`}function fp(e,t){const n=null==t||""===t||Array.isArray(t)&&0===t.length;if(e.required&&n)return`${e.label} is required`;if(n)return null;if("email"===e.type&&"string"==typeof t&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return"Invalid email";if("number"===e.type&&"string"==typeof t){const n=Number(t);if(Number.isNaN(n))return"Must be a number";if(void 0!==e.min&&n<e.min)return`Must be ≥ ${e.min}`;if(void 0!==e.max&&n>e.max)return`Must be ≤ ${e.max}`}if(e.pattern&&"string"==typeof t)try{if(!new RegExp(e.pattern).test(t))return"Format is invalid"}catch{}return null}function mp({types:e,onAdd:t}){/* @__PURE__ */
691
+ return b("div",{role:"toolbar","aria-label":"Field types",style:{display:"flex",flexDirection:"column",gap:6,padding:12,borderRight:"1px solid var(--tkx-border, #2a2a3e)",minWidth:180,background:"var(--tkx-bg-subtle, #0d0d14)"},children:[/* @__PURE__ */x("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"#888",marginBottom:4},children:"Add field"}),e.map(e=>/* @__PURE__ */b("button",{type:"button","data-testid":`palette-${e}`,onClick:()=>t(e),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",minHeight:44,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",fontSize:13,cursor:"pointer",textAlign:"left"},children:[/* @__PURE__ */x("span",{"aria-hidden":"true",children:up[e]}),/* @__PURE__ */x("span",{children:cp[e]})]},e))]})}function gp({fields:e,selectedId:t,onSelect:n,onMove:r,onRemove:o}){/* @__PURE__ */
665
692
  return b("div",{role:"list","aria-label":"Form fields",style:{flex:1,padding:16,display:"flex",flexDirection:"column",gap:8,minWidth:0,overflowY:"auto"},children:[0===e.length&&/* @__PURE__ */x("div",{style:{padding:32,textAlign:"center",color:"#888",border:"1px dashed var(--tkx-border, #2a2a3e)",borderRadius:8},children:"No fields yet — pick one from the palette to get started."}),e.map((i,a)=>{const l=i.id===t;/* @__PURE__ */
666
693
  return b("div",{role:"listitem","data-testid":`canvas-field-${i.id}`,onClick:()=>n(i.id),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n(i.id))},tabIndex:0,"aria-selected":l,style:{padding:12,borderRadius:8,border:"1px solid "+(l?"var(--tkx-accent, #00f5d4)":"var(--tkx-border, #2a2a3e)"),background:l?"rgba(0,245,212,0.06)":"var(--tkx-bg-subtle, #12121a)",cursor:"pointer",display:"flex",alignItems:"center",gap:12},children:[
667
- /* @__PURE__ */x("span",{"aria-hidden":"true",style:{fontSize:18},children:tp[i.type]}),
694
+ /* @__PURE__ */x("span",{"aria-hidden":"true",style:{fontSize:18},children:up[i.type]}),
668
695
  /* @__PURE__ */b("div",{style:{flex:1,minWidth:0},children:[/* @__PURE__ */b("div",{style:{fontWeight:600,fontSize:14,color:"var(--tkx-fg, #e8e8f4)"},children:[i.label,i.required&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{color:"#ff006e",marginLeft:4},children:"*"})]}),/* @__PURE__ */b("div",{style:{fontSize:11,color:"#888",fontFamily:"ui-monospace, monospace"},children:[i.type," · ",i.name]})]}),
669
696
  /* @__PURE__ */b("div",{style:{display:"flex",gap:4},children:[
670
- /* @__PURE__ */x("button",{type:"button","aria-label":`Move ${i.label} up`,disabled:0===a,onClick:e=>{e.stopPropagation(),r(i.id,-1)},style:lp,children:"↑"}),
671
- /* @__PURE__ */x("button",{type:"button","aria-label":`Move ${i.label} down`,disabled:a===e.length-1,onClick:e=>{e.stopPropagation(),r(i.id,1)},style:lp,children:"↓"}),
672
- /* @__PURE__ */x("button",{type:"button","aria-label":`Remove ${i.label}`,onClick:e=>{e.stopPropagation(),o(i.id)},style:{...lp,color:"#ff006e"},children:"✕"})]})]},i.id)})]})}var lp={width:32,height:32,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",cursor:"pointer",fontSize:14,display:"inline-flex",alignItems:"center",justifyContent:"center"};function sp({field:e,onPatch:t}){if(!e)/* @__PURE__ */return x("div",{style:{minWidth:260,padding:16,borderLeft:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)",color:"#888",fontSize:13},children:"Select a field to edit its properties."});const n="select"===e.type||"radio"===e.type,r="text"===e.type||"email"===e.type,o="number"===e.type;/* @__PURE__ */
697
+ /* @__PURE__ */x("button",{type:"button","aria-label":`Move ${i.label} up`,disabled:0===a,onClick:e=>{e.stopPropagation(),r(i.id,-1)},style:xp,children:"↑"}),
698
+ /* @__PURE__ */x("button",{type:"button","aria-label":`Move ${i.label} down`,disabled:a===e.length-1,onClick:e=>{e.stopPropagation(),r(i.id,1)},style:xp,children:"↓"}),
699
+ /* @__PURE__ */x("button",{type:"button","aria-label":`Remove ${i.label}`,onClick:e=>{e.stopPropagation(),o(i.id)},style:{...xp,color:"#ff006e"},children:"✕"})]})]},i.id)})]})}var xp={width:32,height:32,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",cursor:"pointer",fontSize:14,display:"inline-flex",alignItems:"center",justifyContent:"center"};function bp({field:e,onPatch:t}){if(!e)/* @__PURE__ */return x("div",{style:{minWidth:260,padding:16,borderLeft:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)",color:"#888",fontSize:13},children:"Select a field to edit its properties."});const n="select"===e.type||"radio"===e.type,r="text"===e.type||"email"===e.type,o="number"===e.type;/* @__PURE__ */
673
700
  return b("div",{style:{minWidth:260,padding:16,borderLeft:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)",display:"flex",flexDirection:"column",gap:12,overflowY:"auto"},children:[
674
701
  /* @__PURE__ */x("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"#888"},children:"Properties"}),
675
- /* @__PURE__ */x(dp,{label:"Label",value:e.label,onChange:e=>t({label:e})}),
676
- /* @__PURE__ */x(dp,{label:"Name (key)",value:e.name,onChange:e=>t({name:e.replace(/[^a-zA-Z0-9_]/g,"_")})}),
677
- /* @__PURE__ */x(dp,{label:"Placeholder",value:e.placeholder??"",onChange:e=>t({placeholder:e})}),
678
- /* @__PURE__ */x(dp,{label:"Help text",value:e.helpText??"",onChange:e=>t({helpText:e})}),
679
- /* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--tkx-fg, #e8e8f4)"},children:[/* @__PURE__ */x("input",{type:"checkbox",checked:!!e.required,onChange:e=>t({required:e.target.checked})}),"Required"]}),o&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x(dp,{label:"Min",value:e.min?.toString()??"",onChange:e=>t({min:""===e?void 0:Number(e)}),type:"number"}),/* @__PURE__ */x(dp,{label:"Max",value:e.max?.toString()??"",onChange:e=>t({max:""===e?void 0:Number(e)}),type:"number"})]}),r&&/* @__PURE__ */x(dp,{label:"Pattern (regex)",value:e.pattern??"",onChange:e=>t({pattern:e||void 0})}),n&&/* @__PURE__ */x(cp,{options:e.options??[],onChange:e=>t({options:e})})]})}function dp({label:e,value:t,onChange:n,type:r="text"}){const o=d();/* @__PURE__ */
680
- return b("label",{htmlFor:o,style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,color:"#aaa"},children:[e,/* @__PURE__ */x("input",{id:o,type:r,value:t,onChange:e=>n(e.target.value),style:{padding:"8px 10px",minHeight:36,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:13}})]})}function cp({options:e,onChange:t}){/* @__PURE__ */
702
+ /* @__PURE__ */x(yp,{label:"Label",value:e.label,onChange:e=>t({label:e})}),
703
+ /* @__PURE__ */x(yp,{label:"Name (key)",value:e.name,onChange:e=>t({name:e.replace(/[^a-zA-Z0-9_]/g,"_")})}),
704
+ /* @__PURE__ */x(yp,{label:"Placeholder",value:e.placeholder??"",onChange:e=>t({placeholder:e})}),
705
+ /* @__PURE__ */x(yp,{label:"Help text",value:e.helpText??"",onChange:e=>t({helpText:e})}),
706
+ /* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--tkx-fg, #e8e8f4)"},children:[/* @__PURE__ */x("input",{type:"checkbox",checked:!!e.required,onChange:e=>t({required:e.target.checked})}),"Required"]}),o&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x(yp,{label:"Min",value:e.min?.toString()??"",onChange:e=>t({min:""===e?void 0:Number(e)}),type:"number"}),/* @__PURE__ */x(yp,{label:"Max",value:e.max?.toString()??"",onChange:e=>t({max:""===e?void 0:Number(e)}),type:"number"})]}),r&&/* @__PURE__ */x(yp,{label:"Pattern (regex)",value:e.pattern??"",onChange:e=>t({pattern:e||void 0})}),n&&/* @__PURE__ */x(vp,{options:e.options??[],onChange:e=>t({options:e})})]})}function yp({label:e,value:t,onChange:n,type:r="text"}){const o=d();/* @__PURE__ */
707
+ return b("label",{htmlFor:o,style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,color:"#aaa"},children:[e,/* @__PURE__ */x("input",{id:o,type:r,value:t,onChange:e=>n(e.target.value),style:{padding:"8px 10px",minHeight:36,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:13}})]})}function vp({options:e,onChange:t}){/* @__PURE__ */
681
708
  return b("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[
682
709
  /* @__PURE__ */x("div",{style:{fontSize:12,color:"#aaa"},children:"Options"}),e.map((n,r)=>/* @__PURE__ */b("div",{style:{display:"flex",gap:4},children:[
683
- /* @__PURE__ */x("input",{"aria-label":`Option ${r+1} label`,value:n.label,onChange:n=>{const o=e.slice();o[r]={...o[r],label:n.target.value},t(o)},style:up}),
684
- /* @__PURE__ */x("input",{"aria-label":`Option ${r+1} value`,value:n.value,onChange:n=>{const o=e.slice();o[r]={...o[r],value:n.target.value},t(o)},style:up}),
685
- /* @__PURE__ */x("button",{type:"button","aria-label":`Remove option ${r+1}`,onClick:()=>t(e.filter((e,t)=>t!==r)),style:{...lp,color:"#ff006e"},children:"✕"})]},r)),
686
- /* @__PURE__ */x("button",{type:"button",onClick:()=>t([...e,{label:`Option ${e.length+1}`,value:`option_${e.length+1}`}]),style:{padding:"6px 10px",minHeight:36,borderRadius:6,border:"1px dashed var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",cursor:"pointer",fontSize:12},children:"+ Add option"})]})}var up={flex:1,minWidth:0,padding:"6px 8px",minHeight:32,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:12};function pp({schema:e}){const[t,n]=m({}),[r,o]=m({}),[i,a]=m(null);/* @__PURE__ */
687
- return b("form",{onSubmit:n=>{n.preventDefault();const r={};for(const o of e.fields)r[o.name]=op(o,t[o.name]);o(r),Object.values(r).every(e=>null===e)?a(t):a(null)},style:{flex:1,padding:24,overflowY:"auto",display:"flex",flexDirection:"column",gap:16,maxWidth:640,margin:"0 auto",width:"100%"},children:[e.title&&/* @__PURE__ */x("h2",{style:{margin:0,color:"var(--tkx-fg, #e8e8f4)"},children:e.title}),e.description&&/* @__PURE__ */x("p",{style:{margin:0,color:"#aaa"},children:e.description}),e.fields.map(e=>/* @__PURE__ */x(hp,{field:e,value:t[e.name],error:r[e.name]??null,onChange:t=>{return r=e.name,o=t,void n(e=>({...e,[r]:o}));var r,o}},e.id)),
688
- /* @__PURE__ */x("button",{type:"submit",style:{padding:"12px 20px",minHeight:44,borderRadius:8,border:"none",background:"var(--tkx-accent, #00f5d4)",color:"#0a0a0f",fontWeight:700,cursor:"pointer",alignSelf:"flex-start"},children:"Submit"}),i&&/* @__PURE__ */x("pre",{"data-testid":"preview-submitted",style:{background:"var(--tkx-bg-subtle, #0d0d14)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,padding:12,color:"#00f5d4",fontSize:12,overflowX:"auto"},children:JSON.stringify(i,null,2)})]})}function hp({field:e,value:t,error:n,onChange:r}){const o=d(),i=/* @__PURE__ */b("label",{htmlFor:o,style:{display:"block",marginBottom:4,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)"},children:[e.label,e.required&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{color:"#ff006e",marginLeft:4},children:"*"})]}),a=e.helpText&&/* @__PURE__ */x("div",{style:{fontSize:12,color:"#888",marginTop:4},children:e.helpText}),l=n&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:"#ff006e",marginTop:4},children:n});let s=null;switch(e.type){case"textarea":s=/* @__PURE__ */x("textarea",{id:o,value:t??"",placeholder:e.placeholder,onChange:e=>r(e.target.value),rows:4,style:fp});break;case"select":s=/* @__PURE__ */b("select",{id:o,value:t??"",onChange:e=>r(e.target.value),style:fp,children:[/* @__PURE__ */x("option",{value:"",children:e.placeholder??"Choose…"}),(e.options??[]).map(e=>/* @__PURE__ */x("option",{value:e.value,children:e.label},e.value))]});break;case"radio":s=/* @__PURE__ */x("div",{role:"radiogroup","aria-labelledby":o,style:{display:"flex",flexDirection:"column",gap:6},children:(e.options??[]).map(n=>/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--tkx-fg, #e8e8f4)"},children:[/* @__PURE__ */x("input",{type:"radio",name:e.name,value:n.value,checked:t===n.value,onChange:()=>r(n.value)}),n.label]},n.value))});break;case"checkbox":s=/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--tkx-fg, #e8e8f4)"},children:[/* @__PURE__ */x("input",{id:o,type:"checkbox",checked:!!t,onChange:e=>r(e.target.checked)}),e.placeholder||"Yes"]});break;default:s=/* @__PURE__ */x("input",{id:o,type:"number"===e.type?"number":"date"===e.type?"date":e.type,value:t??"",placeholder:e.placeholder,min:e.min,max:e.max,onChange:e=>r(e.target.value),style:fp})}/* @__PURE__ */
689
- return b("div",{children:[i,s,a,l]})}var fp={width:"100%",padding:"10px 12px",minHeight:44,borderRadius:8,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:14,boxSizing:"border-box"};function mp({schema:e,onChange:t,allowedTypes:n=Qu,defaultTab:r="design",style:o,className:i}){const[l,s]=m(r),[d,c]=m(e.fields[0]?.id??null),u=p(()=>e.fields.find(e=>e.id===d)??null,[e.fields,d]),h=a(n=>{const r=function(e,t){const n=t+1,r={id:`fld-${Math.random().toString(36).slice(2,9)}`,type:e,name:rp(e,n),label:np(e,n)};return"select"!==e&&"radio"!==e||(r.options=[{label:"Option 1",value:"option_1"},{label:"Option 2",value:"option_2"}]),r}(n,e.fields.length);t({...e,fields:[...e.fields,r]}),c(r.id)},[e,t]),f=a((n,r)=>{const o=e.fields.findIndex(e=>e.id===n);if(o<0)return;const i=o+r;if(i<0||i>=e.fields.length)return;const a=e.fields.slice();[a[o],a[i]]=[a[i],a[o]],t({...e,fields:a})},[e,t]),g=a(n=>{t({...e,fields:e.fields.filter(e=>e.id!==n)}),d===n&&c(null)},[e,t,d]),y=a(n=>{u&&t({...e,fields:e.fields.map(e=>e.id===u.id?{...e,...n}:e)})},[e,t,u]);/* @__PURE__ */
710
+ /* @__PURE__ */x("input",{"aria-label":`Option ${r+1} label`,value:n.label,onChange:n=>{const o=e.slice();o[r]={...o[r],label:n.target.value},t(o)},style:wp}),
711
+ /* @__PURE__ */x("input",{"aria-label":`Option ${r+1} value`,value:n.value,onChange:n=>{const o=e.slice();o[r]={...o[r],value:n.target.value},t(o)},style:wp}),
712
+ /* @__PURE__ */x("button",{type:"button","aria-label":`Remove option ${r+1}`,onClick:()=>t(e.filter((e,t)=>t!==r)),style:{...xp,color:"#ff006e"},children:"✕"})]},r)),
713
+ /* @__PURE__ */x("button",{type:"button",onClick:()=>t([...e,{label:`Option ${e.length+1}`,value:`option_${e.length+1}`}]),style:{padding:"6px 10px",minHeight:36,borderRadius:6,border:"1px dashed var(--tkx-border, #2a2a3e)",background:"transparent",color:"var(--tkx-fg, #e8e8f4)",cursor:"pointer",fontSize:12},children:"+ Add option"})]})}var wp={flex:1,minWidth:0,padding:"6px 8px",minHeight:32,borderRadius:6,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:12};function kp({schema:e}){const[t,n]=m({}),[r,o]=m({}),[i,a]=m(null);/* @__PURE__ */
714
+ return b("form",{onSubmit:n=>{n.preventDefault();const r={};for(const o of e.fields)r[o.name]=fp(o,t[o.name]);o(r),Object.values(r).every(e=>null===e)?a(t):a(null)},style:{flex:1,padding:24,overflowY:"auto",display:"flex",flexDirection:"column",gap:16,maxWidth:640,margin:"0 auto",width:"100%"},children:[e.title&&/* @__PURE__ */x("h2",{style:{margin:0,color:"var(--tkx-fg, #e8e8f4)"},children:e.title}),e.description&&/* @__PURE__ */x("p",{style:{margin:0,color:"#aaa"},children:e.description}),e.fields.map(e=>/* @__PURE__ */x($p,{field:e,value:t[e.name],error:r[e.name]??null,onChange:t=>{return r=e.name,o=t,void n(e=>({...e,[r]:o}));var r,o}},e.id)),
715
+ /* @__PURE__ */x("button",{type:"submit",style:{padding:"12px 20px",minHeight:44,borderRadius:8,border:"none",background:"var(--tkx-accent, #00f5d4)",color:"#0a0a0f",fontWeight:700,cursor:"pointer",alignSelf:"flex-start"},children:"Submit"}),i&&/* @__PURE__ */x("pre",{"data-testid":"preview-submitted",style:{background:"var(--tkx-bg-subtle, #0d0d14)",border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:8,padding:12,color:"#00f5d4",fontSize:12,overflowX:"auto"},children:JSON.stringify(i,null,2)})]})}function $p({field:e,value:t,error:n,onChange:r}){const o=d(),i=/* @__PURE__ */b("label",{htmlFor:o,style:{display:"block",marginBottom:4,fontWeight:600,color:"var(--tkx-fg, #e8e8f4)"},children:[e.label,e.required&&/* @__PURE__ */x("span",{"aria-hidden":"true",style:{color:"#ff006e",marginLeft:4},children:"*"})]}),a=e.helpText&&/* @__PURE__ */x("div",{style:{fontSize:12,color:"#888",marginTop:4},children:e.helpText}),l=n&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:"#ff006e",marginTop:4},children:n});let s=null;switch(e.type){case"textarea":s=/* @__PURE__ */x("textarea",{id:o,value:t??"",placeholder:e.placeholder,onChange:e=>r(e.target.value),rows:4,style:Sp});break;case"select":s=/* @__PURE__ */b("select",{id:o,value:t??"",onChange:e=>r(e.target.value),style:Sp,children:[/* @__PURE__ */x("option",{value:"",children:e.placeholder??"Choose…"}),(e.options??[]).map(e=>/* @__PURE__ */x("option",{value:e.value,children:e.label},e.value))]});break;case"radio":s=/* @__PURE__ */x("div",{role:"radiogroup","aria-labelledby":o,style:{display:"flex",flexDirection:"column",gap:6},children:(e.options??[]).map(n=>/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--tkx-fg, #e8e8f4)"},children:[/* @__PURE__ */x("input",{type:"radio",name:e.name,value:n.value,checked:t===n.value,onChange:()=>r(n.value)}),n.label]},n.value))});break;case"checkbox":s=/* @__PURE__ */b("label",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--tkx-fg, #e8e8f4)"},children:[/* @__PURE__ */x("input",{id:o,type:"checkbox",checked:!!t,onChange:e=>r(e.target.checked)}),e.placeholder||"Yes"]});break;default:s=/* @__PURE__ */x("input",{id:o,type:"number"===e.type?"number":"date"===e.type?"date":e.type,value:t??"",placeholder:e.placeholder,min:e.min,max:e.max,onChange:e=>r(e.target.value),style:Sp})}/* @__PURE__ */
716
+ return b("div",{children:[i,s,a,l]})}var Sp={width:"100%",padding:"10px 12px",minHeight:44,borderRadius:8,border:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontSize:14,boxSizing:"border-box"};function Cp({schema:e,onChange:t,allowedTypes:n=dp,defaultTab:r="design",style:o,className:i}){const[l,s]=m(r),[d,c]=m(e.fields[0]?.id??null),u=p(()=>e.fields.find(e=>e.id===d)??null,[e.fields,d]),h=a(n=>{const r=function(e,t){const n=t+1,r={id:`fld-${Math.random().toString(36).slice(2,9)}`,type:e,name:hp(e,n),label:pp(e,n)};return"select"!==e&&"radio"!==e||(r.options=[{label:"Option 1",value:"option_1"},{label:"Option 2",value:"option_2"}]),r}(n,e.fields.length);t({...e,fields:[...e.fields,r]}),c(r.id)},[e,t]),f=a((n,r)=>{const o=e.fields.findIndex(e=>e.id===n);if(o<0)return;const i=o+r;if(i<0||i>=e.fields.length)return;const a=e.fields.slice();[a[o],a[i]]=[a[i],a[o]],t({...e,fields:a})},[e,t]),g=a(n=>{t({...e,fields:e.fields.filter(e=>e.id!==n)}),d===n&&c(null)},[e,t,d]),y=a(n=>{u&&t({...e,fields:e.fields.map(e=>e.id===u.id?{...e,...n}:e)})},[e,t,u]);/* @__PURE__ */
690
717
  return b("div",{className:i,"data-testid":"tkx-form-builder",style:{display:"flex",flexDirection:"column",height:600,border:"1px solid var(--tkx-border, #2a2a3e)",borderRadius:12,overflow:"hidden",background:"var(--tkx-bg, #0a0a0f)",color:"var(--tkx-fg, #e8e8f4)",fontFamily:"inherit",...o},children:[
691
718
  /* @__PURE__ */x("div",{role:"tablist","aria-label":"Form builder views",style:{display:"flex",borderBottom:"1px solid var(--tkx-border, #2a2a3e)",background:"var(--tkx-bg-subtle, #0d0d14)"},children:["design","preview","json"].map(e=>/* @__PURE__ */x("button",{type:"button",role:"tab","aria-selected":l===e,"data-testid":`tab-${e}`,onClick:()=>s(e),style:{padding:"12px 18px",minHeight:44,border:"none",background:l===e?"var(--tkx-bg, #0a0a0f)":"transparent",color:l===e?"var(--tkx-accent, #00f5d4)":"#aaa",borderBottom:l===e?"2px solid var(--tkx-accent, #00f5d4)":"2px solid transparent",cursor:"pointer",fontSize:13,fontWeight:600,textTransform:"capitalize"},children:e},e))}),"design"===l&&/* @__PURE__ */b("div",{style:{display:"flex",flex:1,minHeight:0},children:[
692
- /* @__PURE__ */x(ip,{types:n,onAdd:h}),
693
- /* @__PURE__ */x(ap,{fields:e.fields,selectedId:d,onSelect:c,onMove:f,onRemove:g}),
694
- /* @__PURE__ */x(sp,{field:u,onPatch:y})]}),"preview"===l&&/* @__PURE__ */x("div",{style:{display:"flex",flex:1,minHeight:0},children:/* @__PURE__ */x(pp,{schema:e})}),"json"===l&&/* @__PURE__ */x("pre",{"data-testid":"json-view",style:{flex:1,margin:0,padding:16,overflow:"auto",background:"var(--tkx-bg-subtle, #0d0d14)",color:"#00f5d4",fontSize:12,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:JSON.stringify(e,null,2)})]})}export{us as COUNTRIES,vd as FocusTrap,xn as I18nContext,xd as I18nProvider,w as LRUCache,yd as LiveRegion,P as Quantum,nl as SIZE_BORDER_RADIUS,Qa as SIZE_FONT,Ja as SIZE_HEIGHT,rl as SIZE_ICON,el as SIZE_PADDING_X,tl as SIZE_PADDING_Y,Je as SecurityCore,Qe as Shield,bd as SkipNav,H as TKX,ae as ThemeContext,le as ThemeProvider,Gs as TkxAadhaarInput,$c as TkxAccessibilityChecker,fr as TkxAccordion,Ns as TkxAddressInput,Hl as TkxAffix,pn as TkxAlert,Kl as TkxAnchor,Vi as TkxAppBar,Ci as TkxAutocomplete,jn as TkxAvatar,on as TkxBadge,dd as TkxBillingCycleToggle,Oi as TkxBottomNav,wi as TkxBreadcrumb,Zt as TkxButton,wc as TkxCalendarHeatmap,Os as TkxCalendarLunar,ns as TkxCaptcha,_t as TkxCard,Qt as TkxCardBody,en as TkxCardFooter,Jt as TkxCardHeader,bi as TkxCarousel,Xl as TkxCascader,lo as TkxChat,ao as TkxChatBubble,Yn as TkxCheckbox,qs as TkxCheckout,Io as TkxClock,Ka as TkxCol,ni as TkxColorPicker,gi as TkxCommand,Vc as TkxCommandPalette,Is as TkxConfetti,Xa as TkxConfigProvider,Ea as TkxContent,Dl as TkxCountdown,Ps as TkxCurrencyInput,oa as TkxDataGrid,Rr as TkxDatePicker,Vn as TkxDivider,yr as TkxDrawer,ad as TkxDrivingLicenceInput,zd as TkxDropdown,Sl as TkxEmpty,Yr as TkxFileUpload,Fc as TkxFlowChart,ss as TkxFontProvider,Ba as TkxFooter,Da as TkxForm,mp as TkxFormBuilder,Pa as TkxFormField,Ju as TkxFormulaBar,au as TkxFunnelChart,bu as TkxGantt,Gc as TkxGauge,Ta as TkxHeader,ru as TkxHeatmap,Ad as TkxHolographicAvatar,jd as TkxHolographicBadge,Ed as TkxHolographicButton,Id as TkxHolographicCard,Hd as TkxHolographicGauge,Vd as TkxHolographicPanel,Od as TkxHolographicProgress,Fd as TkxHolographicSurface,qd as TkxHolographicTerminal,Or as TkxImage,ys as TkxImageEditor,tn as TkxInput,Ud as TkxKanban,La as TkxLayout,_l as TkxList,Sa as TkxMarkdown,aa as TkxMasonry,Fl as TkxMentions,No as TkxMenu,Nc as TkxMindMap,Sn as TkxModal,li as TkxNumberInput,ui as TkxOTP,fd as TkxOrgChart,Er as TkxPagination,Qs as TkxPanInput,gl as TkxParagraph,Ss as TkxPaymentButton,gs as TkxPhoneInput,Du as TkxPivotTable,sd as TkxPlanSelector,ki as TkxPopover,sn as TkxProgress,cd as TkxProrationPreview,Al as TkxQRCode,Gn as TkxRadio,_n as TkxRadioGroup,to as TkxRating,Tl as TkxResult,tc as TkxRichEditor,ca as TkxRichTextDisplay,Oa as TkxRow,Ws as TkxSEO,Rl as TkxSegmented,Un as TkxSelect,ja as TkxSider,Cs as TkxSignaturePad,Ln as TkxSkeleton,Wr as TkxSlider,Yi as TkxSnackbar,Rs as TkxSortable,Uc as TkxSparkline,Ei as TkxSpeedDial,wl as TkxSpin,_u as TkxSpreadsheet,Nl as TkxStatistic,Uo as TkxStepper,Dn as TkxTab,Nn as TkxTabList,Rn as TkxTabPanel,Pn as TkxTabPanels,Bn as TkxTable,Mn as TkxTabs,ho as TkxTag,fo as TkxTagInput,ml as TkxText,lc as TkxThemeStudio,io as TkxThinkingIndicator,vo as TkxTimeline,fl as TkxTitle,cr as TkxToastProvider,cn as TkxToggle,Pi as TkxToolbar,In as TkxTooltip,Wl as TkxTour,Ti as TkxTransferList,Ni as TkxTreeView,uu as TkxTreemap,Eo as TkxVideoPlayer,nd as TkxVoterIdInput,Bl as TkxWatermark,wd as VisuallyHidden,ee as WCAGEngine,Ne as audit,re as auroraLight,D as batchUpdate,fe as breakpoints,Oe as buildTkxCSP,Iu as cellAddr,Fu as colIndex,Ru as colLetter,q as contrastRatio,G as createFocusTrap,Ye as createRateLimiter,ie as createTheme,A as css,E as cssVar,jt as cx,mu as dayDiff,_e as deepFreeze,Pc as edgePath,Wu as evaluateCell,Tt as extractAtomicCSS,B as extractCSS,v as fnv1aHash,hu as formatDay,L as fromObject,Ec as fuzzyScore,ue as generatePalette,Y as getAccessibleForeground,De as getAuditLog,dl as getLocaleDisplayName,Dd as injectHolographicStyles,V as injectStyles,Ke as installFrameBuster,qe as installTrustedTypes,Ue as isFramed,gn as isRTL,sl as isRtlLocale,Ve as isSafeAttrName,Ys as isValidAadhaar,od as isValidDrivingLicence,Js as isValidPan,td as isValidVoterId,j as keyframes,ds as loadFontScript,U as meetsAA,K as meetsAAA,$ as memoize,Dc as nodeAnchors,Au as parseCellAddr,pu as parseDay,Q as prefersHighContrast,J as prefersReducedMotion,ne as quantumDark,xe as radii,Tu as recordsToSpreadsheet,Wt as resetAtomicCSS,Ot as resolvePluginUtility,W as responsive,We as sanitizeCSS,Le as sanitizeHTML,Re as sanitizeHref,Ee as sanitizeJSON,$e as sanitizeProps,ke as sanitizeString,He as sanitizeUnicode,ls as scriptsForLanguage,Ge as scrubPII,js as seoSchema,me as shadows,Xe as sniffMimeType,he as spacing,Lu as spreadsheetToRecords,At as tkx,Ht as tkxListPlugins,Bt as tkxPlugin,Vt as tkxRemovePlugin,Lt as tx,pe as typography,cs as unloadFontScript,rt as useAnnounce,it as useClickOutside,_a as useComponentSize,Za as useConfig,El as useDevtoolsOpen,vn as useDirection,ot as useEscapeKey,nt as useFocusTrap,tt as useHighContrast,bn as useI18n,yn as useLocale,il as useLogicalSpacing,de as usePrefersColorScheme,Ga as usePrefixCls,et as useReducedMotion,ol as useRtlFlip,se as useTheme,pi as useTkxCommand,Na as useTkxForm,ir as useToast,op as validateField,Ce as validateProps,Pe as verifyAuditIntegrity,ge as zIndex};
719
+ /* @__PURE__ */x(mp,{types:n,onAdd:h}),
720
+ /* @__PURE__ */x(gp,{fields:e.fields,selectedId:d,onSelect:c,onMove:f,onRemove:g}),
721
+ /* @__PURE__ */x(bp,{field:u,onPatch:y})]}),"preview"===l&&/* @__PURE__ */x("div",{style:{display:"flex",flex:1,minHeight:0},children:/* @__PURE__ */x(kp,{schema:e})}),"json"===l&&/* @__PURE__ */x("pre",{"data-testid":"json-view",style:{flex:1,margin:0,padding:16,overflow:"auto",background:"var(--tkx-bg-subtle, #0d0d14)",color:"#00f5d4",fontSize:12,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:JSON.stringify(e,null,2)})]})}export{ws as COUNTRIES,Rd as FocusTrap,xn as I18nContext,Md as I18nProvider,w as LRUCache,Dd as LiveRegion,R as Quantum,pl as SIZE_BORDER_RADIUS,dl as SIZE_FONT,sl as SIZE_HEIGHT,hl as SIZE_ICON,cl as SIZE_PADDING_X,ul as SIZE_PADDING_Y,Je as SecurityCore,Qe as Shield,Nd as SkipNav,H as TKX,ae as ThemeContext,le as ThemeProvider,ad as TkxAadhaarInput,Ic as TkxAccessibilityChecker,fr as TkxAccordion,js as TkxAddressInput,Jl as TkxAffix,pn as TkxAlert,ns as TkxAnchor,Zi as TkxAppBar,Ii as TkxAutocomplete,jn as TkxAvatar,on as TkxBadge,yd as TkxBillingCycleToggle,_i as TkxBottomNav,Di as TkxBreadcrumb,Zt as TkxButton,Pc as TkxCalendarHeatmap,Qs as TkxCalendarLunar,ps as TkxCaptcha,_t as TkxCard,Qt as TkxCardBody,en as TkxCardFooter,Jt as TkxCardHeader,zi as TkxCarousel,os as TkxCascader,lo as TkxChat,ao as TkxChatBubble,Yn as TkxCheckbox,ed as TkxCheckout,Vo as TkxClock,nl as TkxCol,ci as TkxColorPicker,Si as TkxCommand,_c as TkxCommandPalette,Os as TkxConfetti,ol as TkxConfigProvider,Za as TkxContent,El as TkxCountdown,Bs as TkxCurrencyInput,fa as TkxDataGrid,Pr as TkxDatePicker,Vn as TkxDivider,yr as TkxDrawer,gd as TkxDrivingLicenceInput,Td as TkxDropdown,Al as TkxEmpty,Yr as TkxFileUpload,Hc as TkxFlowChart,bs as TkxFontProvider,Ga as TkxFooter,Ea as TkxForm,Cp as TkxFormBuilder,Ba as TkxFormField,sp as TkxFormulaBar,gu as TkxFunnelChart,Nu as TkxGantt,au as TkxGauge,Ka as TkxHeader,hu as TkxHeatmap,qd as TkxHolographicAvatar,Xd as TkxHolographicBadge,Zd as TkxHolographicButton,Od as TkxHolographicCard,Jd as TkxHolographicGauge,_d as TkxHolographicPanel,Qd as TkxHolographicProgress,Hd as TkxHolographicSurface,ec as TkxHolographicTerminal,Or as TkxImage,Ds as TkxImageEditor,tn as TkxInput,tc as TkxKanban,Ua as TkxLayout,ls as TkxList,Aa as TkxMarkdown,ga as TkxMasonry,Hl as TkxMentions,To as TkxMenu,go as TkxMessageThread,go as TkxPeerChat,jc as TkxMindMap,Sn as TkxModal,mi as TkxNumberInput,yi as TkxOTP,Sd as TkxOrgChart,Er as TkxPagination,dd as TkxPanInput,zl as TkxParagraph,As as TkxPaymentButton,zs as TkxPhoneInput,Eu as TkxPivotTable,bd as TkxPlanSelector,Ri as TkxPopover,sn as TkxProgress,vd as TkxProrationPreview,ql as TkxQRCode,Gn as TkxRadio,_n as TkxRadioGroup,to as TkxRating,Kl as TkxResult,uc as TkxRichEditor,va as TkxRichTextDisplay,Qa as TkxRow,Ys as TkxSEO,Vl as TkxSegmented,Un as TkxSelect,Xa as TkxSider,Ls as TkxSignaturePad,Ln as TkxSkeleton,Wr as TkxSlider,ta as TkxSnackbar,Vs as TkxSortable,tu as TkxSparkline,Yi as TkxSpeedDial,Pl as TkxSpin,lp as TkxSpreadsheet,jl as TkxStatistic,Qo as TkxStepper,Dn as TkxTab,Nn as TkxTabList,Pn as TkxTabPanel,Rn as TkxTabPanels,Bn as TkxTable,Mn as TkxTabs,wo as TkxTag,ko as TkxTagInput,Cl as TkxText,xc as TkxThemeStudio,io as TkxThinkingIndicator,No as TkxTimeline,Sl as TkxTitle,cr as TkxToastProvider,cn as TkxToggle,ji as TkxToolbar,In as TkxTooltip,Yl as TkxTour,qi as TkxTransferList,Ti as TkxTreeView,wu as TkxTreemap,Yo as TkxVideoPlayer,pd as TkxVoterIdInput,Gl as TkxWatermark,Pd as VisuallyHidden,ee as WCAGEngine,Ne as audit,re as auroraLight,D as batchUpdate,fe as breakpoints,Oe as buildTkxCSP,Ou as cellAddr,Hu as colIndex,Vu as colLetter,q as contrastRatio,G as createFocusTrap,Ye as createRateLimiter,ie as createTheme,A as css,E as cssVar,jt as cx,Cu as dayDiff,_e as deepFreeze,Bc as edgePath,Yu as evaluateCell,Tt as extractAtomicCSS,B as extractCSS,v as fnv1aHash,$u as formatDay,L as fromObject,Zc as fuzzyScore,ue as generatePalette,Y as getAccessibleForeground,De as getAuditLog,yl as getLocaleDisplayName,Ed as injectHolographicStyles,V as injectStyles,Ke as installFrameBuster,qe as installTrustedTypes,Ue as isFramed,gn as isRTL,bl as isRtlLocale,Ve as isSafeAttrName,rd as isValidAadhaar,fd as isValidDrivingLicence,sd as isValidPan,ud as isValidVoterId,j as keyframes,ys as loadFontScript,U as meetsAA,K as meetsAAA,$ as memoize,Ec as nodeAnchors,qu as parseCellAddr,ku as parseDay,Q as prefersHighContrast,J as prefersReducedMotion,ne as quantumDark,xe as radii,Ku as recordsToSpreadsheet,Wt as resetAtomicCSS,Ot as resolvePluginUtility,W as responsive,We as sanitizeCSS,Le as sanitizeHTML,Pe as sanitizeHref,Ee as sanitizeJSON,$e as sanitizeProps,ke as sanitizeString,He as sanitizeUnicode,xs as scriptsForLanguage,Ge as scrubPII,Xs as seoSchema,me as shadows,Xe as sniffMimeType,he as spacing,Uu as spreadsheetToRecords,At as tkx,Ht as tkxListPlugins,Bt as tkxPlugin,Vt as tkxRemovePlugin,Lt as tx,pe as typography,vs as unloadFontScript,rt as useAnnounce,it as useClickOutside,ll as useComponentSize,il as useConfig,Zl as useDevtoolsOpen,vn as useDirection,ot as useEscapeKey,nt as useFocusTrap,tt as useHighContrast,bn as useI18n,yn as useLocale,ml as useLogicalSpacing,de as usePrefersColorScheme,al as usePrefixCls,et as useReducedMotion,fl as useRtlFlip,se as useTheme,vi as useTkxCommand,ja as useTkxForm,ir as useToast,fp as validateField,Ce as validateProps,Re as verifyAuditIntegrity,ge as zIndex};