tekivex-ui 3.4.0 → 3.18.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/LICENSE +21 -21
- package/README.md +146 -33
- package/dist/agent.cjs +1 -0
- package/dist/agent.js +17 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +41 -22
- package/dist/experimental.cjs +1 -0
- package/dist/experimental.js +39 -0
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +55 -1
- package/dist/i18n.cjs +1 -1
- package/dist/i18n.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +31 -6
- package/dist/index.js +694 -571
- package/dist/quantum.cjs +1 -1
- package/dist/quantum.js +59 -74
- package/dist/realtime.cjs +1 -1
- package/dist/realtime.js +1 -1
- package/dist/src/agent/a2a/A2AClient.d.ts +32 -0
- package/dist/src/agent/a2a/a2aTool.d.ts +11 -0
- package/dist/src/agent/a2a/createA2ARoute.d.ts +5 -0
- package/dist/src/agent/bindings/solid.d.ts +12 -0
- package/dist/src/agent/bindings/svelte.d.ts +10 -0
- package/dist/src/agent/bindings/vanilla.d.ts +17 -0
- package/dist/src/agent/bindings/vue.d.ts +15 -0
- package/dist/src/agent/components/TkxAgentMessage.d.ts +15 -0
- package/dist/src/agent/components/TkxReasoningTrace.d.ts +9 -0
- package/dist/src/agent/components/TkxToolCallCard.d.ts +12 -0
- package/dist/src/agent/content/helpers.d.ts +17 -0
- package/dist/src/agent/core/Agent.d.ts +29 -0
- package/dist/src/agent/core/Memory.d.ts +12 -0
- package/dist/src/agent/core/Middleware.d.ts +10 -0
- package/dist/src/agent/core/Provider.d.ts +44 -0
- package/dist/src/agent/core/Sanitizer.d.ts +4 -0
- package/dist/src/agent/core/Tool.d.ts +13 -0
- package/dist/src/agent/core/Transport.d.ts +18 -0
- package/dist/src/agent/core/events.d.ts +19 -0
- package/dist/src/agent/core/sse.d.ts +6 -0
- package/dist/src/agent/core/types.d.ts +39 -0
- package/dist/src/agent/devtools/DevToolsPanel.d.ts +8 -0
- package/dist/src/agent/devtools/useEventCollector.d.ts +8 -0
- package/dist/src/agent/eval/runEval.d.ts +31 -0
- package/dist/src/agent/index.d.ts +54 -0
- package/dist/src/agent/mcp/MCPClient.d.ts +33 -0
- package/dist/src/agent/mcp/mcpAdapter.d.ts +3 -0
- package/dist/src/agent/memory/SlidingWindowMemory.d.ts +10 -0
- package/dist/src/agent/memory/SummarizingMemory.d.ts +16 -0
- package/dist/src/agent/memory/VectorMemory.d.ts +17 -0
- package/dist/src/agent/middleware/guardrails.d.ts +20 -0
- package/dist/src/agent/middleware/otel.d.ts +13 -0
- package/dist/src/agent/middleware/retry.d.ts +11 -0
- package/dist/src/agent/middleware/tokenUsage.d.ts +27 -0
- package/dist/src/agent/multi/agentAsTool.d.ts +11 -0
- package/dist/src/agent/providers/anthropic.d.ts +16 -0
- package/dist/src/agent/providers/gemini.d.ts +16 -0
- package/dist/src/agent/providers/ollama.d.ts +14 -0
- package/dist/src/agent/providers/openai.d.ts +16 -0
- package/dist/src/agent/rag/Retriever.d.ts +13 -0
- package/dist/src/agent/rag/retrievalTool.d.ts +11 -0
- package/dist/src/agent/react/useAgent.d.ts +12 -0
- package/dist/src/agent/replay/ReplayProvider.d.ts +13 -0
- package/dist/src/agent/replay/recorder.d.ts +16 -0
- package/dist/src/agent/research/DeepResearch.d.ts +37 -0
- package/dist/src/agent/research/citations.d.ts +10 -0
- package/dist/src/agent/server/createAgentClient.d.ts +11 -0
- package/dist/src/agent/server/createAgentRoute.d.ts +10 -0
- package/dist/src/agent/structured/generateObject.d.ts +19 -0
- package/dist/src/agent/tools/cancellable.d.ts +6 -0
- package/dist/src/charts/TkxDataExplorer.d.ts +17 -0
- package/dist/src/charts/index.d.ts +2 -0
- package/dist/src/components/TkxAccessibilityChecker.d.ts +12 -0
- package/dist/src/components/TkxAppBar.d.ts +2 -1
- package/dist/src/components/TkxButton.d.ts +1 -0
- package/dist/src/components/TkxCommandPalette.d.ts +32 -0
- package/dist/src/components/TkxDataGrid.d.ts +37 -1
- package/dist/src/components/TkxFlowChart.d.ts +52 -0
- package/dist/src/components/TkxFormBuilder.d.ts +34 -0
- package/dist/src/components/TkxFormulaBar.d.ts +19 -0
- package/dist/src/components/TkxFunnelChart.d.ts +21 -0
- package/dist/src/components/TkxGantt.d.ts +29 -0
- package/dist/src/components/TkxGauge.d.ts +21 -0
- package/dist/src/components/TkxHeatmap.d.ts +25 -0
- package/dist/src/components/TkxHolographic.d.ts +2 -0
- package/dist/src/components/TkxHolographicAdvanced.d.ts +48 -0
- package/dist/src/components/TkxMindMap.d.ts +22 -0
- package/dist/src/components/TkxPivotTable.d.ts +21 -0
- package/dist/src/components/TkxSparkline.d.ts +15 -0
- package/dist/src/components/TkxSpreadsheet.d.ts +33 -0
- package/dist/src/components/TkxTreemap.d.ts +21 -0
- package/dist/src/components/TkxTypography.d.ts +1 -1
- package/dist/src/components/index.d.ts +5 -3
- package/dist/src/engine/security.d.ts +3 -0
- package/dist/src/experimental/index.d.ts +8 -0
- package/dist/src/headless/index.d.ts +6 -0
- package/dist/src/headless/rhfBindings.d.ts +59 -0
- package/dist/src/headless/useFormState.d.ts +12 -2
- package/dist/src/headless/valibotResolver.d.ts +25 -0
- package/dist/src/headless/zodResolver.d.ts +25 -0
- package/dist/src/i18n/index.d.ts +20 -0
- package/dist/src/i18n/plurals.d.ts +4 -0
- package/dist/src/quantum/index.d.ts +0 -2
- package/dist/src/themes/index.d.ts +7 -1
- package/dist/themes.cjs +1 -0
- package/dist/themes.js +1 -0
- package/package.json +32 -8
- package/dist/chunk-BHX35YDv.js +0 -1
- package/dist/chunk-BpuJ3-K8.js +0 -1
- package/dist/chunk-Bze40nDX.js +0 -1
- package/dist/chunk-C8Wy8P59.js +0 -1
- package/dist/chunk-D7-yknXg.js +0 -1
- package/dist/chunk-DTO-RrPx.js +0 -3
- package/dist/chunk-DcVMayoM.js +0 -1
- package/dist/chunk-DdHSYetV.js +0 -1
- package/dist/chunk-DmRB1Blb.js +0 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import{createContext as e,useCallback as t,useContext as r,useEffect as n,useRef as i,useState as o}from"react";import{Fragment as a,jsx as s,jsxs as l}from"react/jsx-runtime";new 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}}(512);var c=e({bg:"#0a0a0f",surface:"#12121a",surfaceAlt:"#1a1a2e",border:"#2a2a3e",text:"#e8e8f4",textMuted:"#8888aa",primary:"#00f5d4",secondary:"#7b2ff7",danger:"#f72585",warning:"#ffbe0b",success:"#06d6a0",info:"#3a86ff"});function d(){return r(c)}var u=class{amplify(e,t,r=.5){const n=e.length;if(0===n)return[];const i=e.map(t),o=i.filter(e=>e>r).length,a=Math.max(1,o);let s=Array(n).fill(1/Math.sqrt(n));const l=Math.max(1,Math.floor(Math.PI/4*Math.sqrt(n/a)));for(let c=0;c<l;c++){for(let t=0;t<n;t++)i[t]>r&&(s[t]=-s[t]);const e=s.reduce((e,t)=>e+t,0)/n;s=s.map(t=>2*e-t)}return e.map((e,t)=>({index:t,amplitude:s[t],probability:s[t]*s[t],classicalSimilarity:i[t],combined:s[t]*s[t]*.6+.4*i[t]})).sort((e,t)=>t.combined-e.combined)}},f=[{keywords:["email","e-mail","mail"],type:"email",validations:[{rule:"required",message:"Email is required"},{rule:"pattern",value:"^[^@]+@[^@]+\\.[^@]+$",message:"Enter a valid email address"},{rule:"maxLength",value:254,message:"Email too long"}],placeholder:"you@example.com",label:"Email Address",confidence:.98},{keywords:["password","passwd","pwd","pass"],type:"password",validations:[{rule:"required",message:"Password is required"},{rule:"minLength",value:8,message:"Password must be at least 8 characters"},{rule:"pattern",value:"(?=.*[A-Z])(?=.*[0-9])",message:"Include uppercase and a number"}],placeholder:"••••••••",label:"Password",confidence:.97},{keywords:["confirm_password","confirmpassword","confirm_pass","repassword","password2","repeat_password"],type:"password",validations:[{rule:"required",message:"Please confirm your password"},{rule:"match",value:"password",message:"Passwords do not match"}],placeholder:"••••••••",label:"Confirm Password",confidence:.95},{keywords:["phone","mobile","cell","tel","telephone","contact_number"],type:"tel",validations:[{rule:"pattern",value:"^[+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{4,6}$",message:"Enter a valid phone number"}],placeholder:"+1 (555) 000-0000",label:"Phone Number",confidence:.93},{keywords:["age"],type:"number",validations:[{rule:"min",value:0,message:"Age cannot be negative"},{rule:"max",value:150,message:"Enter a valid age"},{rule:"integer",message:"Age must be a whole number"}],placeholder:"25",label:"Age",confidence:.9},{keywords:["price","amount","cost","fee","payment","salary","wage","total"],type:"number",validations:[{rule:"min",value:0,message:"Amount cannot be negative"},{rule:"pattern",value:"^\\d+(\\.\\d{1,2})?$",message:"Enter a valid amount (e.g. 9.99)"}],placeholder:"0.00",label:"Amount",confidence:.88},{keywords:["url","website","site","link","homepage","web"],type:"url",validations:[{rule:"pattern",value:"https?://.+",message:"Enter a valid URL starting with http:// or https://"}],placeholder:"https://example.com",label:"Website URL",confidence:.92},{keywords:["zip","zipcode","postal","postcode","pin_code"],type:"text",validations:[{rule:"pattern",value:"^[0-9]{5}(-[0-9]{4})?$",message:"Enter a valid ZIP code (e.g. 12345)"}],placeholder:"12345",label:"ZIP / Postal Code",confidence:.91},{keywords:["date","dob","birthday","birth_date","birthdate","born"],type:"date",validations:[{rule:"required",message:"Date is required"}],placeholder:"YYYY-MM-DD",label:"Date of Birth",confidence:.89},{keywords:["first_name","firstname","fname","given_name"],type:"text",validations:[{rule:"minLength",value:2,message:"First name too short"},{rule:"maxLength",value:50,message:"First name too long"}],placeholder:"Jane",label:"First Name",confidence:.9},{keywords:["last_name","lastname","lname","surname","family_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Last name too short"},{rule:"maxLength",value:50,message:"Last name too long"}],placeholder:"Doe",label:"Last Name",confidence:.9},{keywords:["name","full_name","fullname","display_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Name too short"},{rule:"maxLength",value:100,message:"Name too long"}],placeholder:"Jane Doe",label:"Full Name",confidence:.85},{keywords:["username","user_name","handle","login","loginname"],type:"text",validations:[{rule:"minLength",value:3,message:"Username must be at least 3 characters"},{rule:"maxLength",value:32,message:"Username too long"},{rule:"pattern",value:"^[a-zA-Z0-9_.-]+$",message:"Only letters, numbers, _, - and . allowed"}],placeholder:"cooluser42",label:"Username",confidence:.94},{keywords:["bio","biography","about","description","summary","details"],type:"textarea",validations:[{rule:"maxLength",value:500,message:"Bio must be under 500 characters"}],placeholder:"Tell us about yourself...",label:"Bio",confidence:.87},{keywords:["message","comment","feedback","note","notes","remarks","body"],type:"textarea",validations:[{rule:"minLength",value:10,message:"Message too short"},{rule:"maxLength",value:2e3,message:"Message too long"}],placeholder:"Write your message here...",label:"Message",confidence:.86},{keywords:["search","query","q","keyword","find"],type:"search",validations:[],placeholder:"Search...",label:"Search",confidence:.9},{keywords:["otp","one_time_password","verification_code","pin","code"],type:"text",validations:[{rule:"minLength",value:4,message:"Code too short"},{rule:"maxLength",value:8,message:"Code too long"},{rule:"pattern",value:"^[0-9]+$",message:"Code must be numeric"}],placeholder:"123456",label:"Verification Code",confidence:.92},{keywords:["color","colour","hex_color","brand_color"],type:"color",validations:[],placeholder:"#3b82f6",label:"Color",confidence:.95},{keywords:["address","street","street_address","addr"],type:"text",validations:[{rule:"maxLength",value:200,message:"Address too long"}],placeholder:"123 Main Street",label:"Street Address",confidence:.87},{keywords:["city","town","municipality"],type:"text",validations:[{rule:"maxLength",value:100,message:"City name too long"}],placeholder:"San Francisco",label:"City",confidence:.89},{keywords:["country","nation","country_code"],type:"text",validations:[],placeholder:"United States",label:"Country",confidence:.88},{keywords:["company","organization","org","employer","company_name"],type:"text",validations:[{rule:"maxLength",value:200,message:"Company name too long"}],placeholder:"Acme Inc.",label:"Company",confidence:.87}],p={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"},m={...p,screen:"100vh"},g={"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%"},h={none:"0",sm:"2px","":"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px","3xl":"24px",full:"9999px"},b={sm:"0 1px 2px 0 rgba(0,0,0,.05)","":"0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1)",md:"0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)",lg:"0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1)",xl:"0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1)","2xl":"0 25px 50px -12px rgba(0,0,0,.25)",inner:"inset 0 2px 4px 0 rgba(0,0,0,.05)",none:"none"},x={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"]},y={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},w={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},v={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},k={none:"0",sm:"4px","":"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},$=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)])),z=new Set(["bg","surface","surfaceAlt","border","text","textMuted","primary","secondary","danger","warning","success","info"]),S={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},j=/javascript\s*:|vbscript\s*:|data\s*:\s*text\/html|data\s*:\s*text\/javascript|expression\s*\(|[\r\n\x00]/i,C=new Set(["behavior","-moz-binding","-webkit-binding","src"]),A=new Set(["width","min-width","max-width","height","min-height","max-height","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","position","top","right","bottom","left","z-index","inset","flex","flex-grow","flex-shrink","flex-basis","flex-direction","flex-wrap","align-items","align-self","align-content","justify-content","justify-items","justify-self","gap","row-gap","column-gap","grid-template-columns","grid-template-rows","grid-column","grid-row","grid-area","grid-template-areas","font-size","font-weight","font-family","font-style","line-height","letter-spacing","text-align","text-decoration","text-transform","text-overflow","white-space","word-break","word-wrap","overflow-wrap","color","background","background-color","background-image","background-position","background-size","background-repeat","opacity","border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-radius","outline","outline-offset","box-shadow","text-shadow","filter","backdrop-filter","transform","transition","animation","display","overflow","overflow-x","overflow-y","visibility","pointer-events","cursor","user-select","aspect-ratio","object-fit","object-position","list-style","vertical-align","float","clear","resize","scroll-behavior","content"]);function M(e){return j.test(e)||e.includes("}")||e.includes("{")||e.includes("<")||e.includes(">")?null:e}function _(e){const t=e.match(/^\[(.+)]$/);return t?M(t[1]):null}function I(e){return z.has(e)?`var(--tkx-${e})`:"transparent"===e?"transparent":"current"===e?"currentColor":"white"===e?"#ffffff":"black"===e?"#000000":"inherit"===e?"inherit":_(e)||(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),e)}function L(e){const t=e.match(/^\[(--[a-zA-Z0-9_-]+):(.+)]$/);if(t){const e=M(t[2]);return e?{[t[1]]:e}:null}const r=e.match(/^\[([a-zA-Z-]+):(.+)]$/);if(r){const e=function(e){const t=e.toLowerCase().trim();return C.has(t)?null:A.has(t)?t:null}(r[1]),t=M(r[2]);return e&&t?{[e]:t}:null}const n={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(n[e])return{display:n[e]};const i={"flex-row":"row","flex-col":"column","flex-row-reverse":"row-reverse","flex-col-reverse":"column-reverse"};if(i[e])return{"flex-direction":i[e]};const o={"flex-wrap":"wrap","flex-nowrap":"nowrap","flex-wrap-reverse":"wrap-reverse"};if(o[e])return{"flex-wrap":o[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 s={"items-start":"flex-start","items-end":"flex-end","items-center":"center","items-stretch":"stretch","items-baseline":"baseline"};if(s[e])return{"align-items":s[e]};const l={"justify-start":"flex-start","justify-end":"flex-end","justify-center":"center","justify-between":"space-between","justify-around":"space-around","justify-evenly":"space-evenly","justify-stretch":"stretch","justify-normal":"normal"};if(l[e])return{"justify-content":l[e]};const c={"self-auto":"auto","self-start":"flex-start","self-end":"flex-end","self-center":"center","self-stretch":"stretch","self-baseline":"baseline"};if(c[e])return{"align-self":c[e]};const d={"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(d[e])return{"align-content":d[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=p[u[1]]??_(u[1]);if(e)return{padding:e}}if(u=e.match(/^px-(.+)$/)){const e=p[u[1]]??_(u[1]);if(e)return{"padding-left":e,"padding-right":e}}if(u=e.match(/^py-(.+)$/)){const e=p[u[1]]??_(u[1]);if(e)return{"padding-top":e,"padding-bottom":e}}if(u=e.match(/^pt-(.+)$/)){const e=p[u[1]]??_(u[1]);if(e)return{"padding-top":e}}if(u=e.match(/^pr-(.+)$/)){const e=p[u[1]]??_(u[1]);if(e)return{"padding-right":e}}if(u=e.match(/^pb-(.+)$/)){const e=p[u[1]]??_(u[1]);if(e)return{"padding-bottom":e}}if(u=e.match(/^pl-(.+)$/)){const e=p[u[1]]??_(u[1]);if(e)return{"padding-left":e}}if(u=e.match(/^-?m-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??_(u[1]);if(r)return{margin:t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?mx-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??_(u[1]);if(r){const e=t&&"0"!==r?`-${r}`:r;return{"margin-left":e,"margin-right":e}}}if(u=e.match(/^-?my-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??_(u[1]);if(r){const e=t&&"0"!==r?`-${r}`:r;return{"margin-top":e,"margin-bottom":e}}}if(u=e.match(/^-?mt-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??_(u[1]);if(r)return{"margin-top":t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?mr-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??_(u[1]);if(r)return{"margin-right":t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?mb-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??_(u[1]);if(r)return{"margin-bottom":t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?ml-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??_(u[1]);if(r)return{"margin-left":t&&"0"!==r?`-${r}`:r}}if("mx-auto"===e)return{"margin-left":"auto","margin-right":"auto"};if("my-auto"===e)return{"margin-top":"auto","margin-bottom":"auto"};if(u=e.match(/^gap-(.+)$/)){const e=p[u[1]]??_(u[1]);if(e)return{gap:e}}if(u=e.match(/^gap-x-(.+)$/)){const e=p[u[1]]??_(u[1]);if(e)return{"column-gap":e}}if(u=e.match(/^gap-y-(.+)$/)){const e=p[u[1]]??_(u[1]);if(e)return{"row-gap":e}}if(u=e.match(/^w-(.+)$/)){const e=u[1],t=p[e]??g[e]??_(e);if(t)return{width:t}}if(u=e.match(/^min-w-(.+)$/)){const e=p[u[1]]??_(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]]??p[u[1]]??_(u[1]);if(e)return{"max-width":e}}if(u=e.match(/^h-(.+)$/)){const e=u[1],t=m[e]??g[e]??_(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]]??p[u[1]]??_(u[1]);if(e)return{"min-height":e}}if(u=e.match(/^max-h-(.+)$/)){const e=m[u[1]]??_(u[1]);if(e)return{"max-height":e}}if(u=e.match(/^size-(.+)$/)){const e=p[u[1]]??g[u[1]]??_(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]=x[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":y[u[1]]??u[1]};if(u=e.match(/^leading-(.+)$/)){const e=w[u[1]]??_(u[1]);if(e)return{"line-height":e}}if(u=e.match(/^tracking-(.+)$/)){const e=v[u[1]]??_(u[1]);if(e)return{"letter-spacing":e}}const f={"text-left":"left","text-center":"center","text-right":"right","text-justify":"justify","text-start":"start","text-end":"end"};if(f[e])return{"text-align":f[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=p[u[1]]??_(u[1]);if(e)return{"text-indent":e}}if(u=e.match(/^line-clamp-(\d+)$/))return{overflow:"hidden",display:"-webkit-box","-webkit-line-clamp":u[1],"-webkit-box-orient":"vertical"};if(u=e.match(/^text-(.+)$/)){const[e,t]=u[1].split("/"),r=I(e);if(!["left","center","right","justify","start","end","xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl","9xl"].includes(e)){if(t){const e=parseInt(t)/100;return{color:r,opacity:String(e)}}return{color:r}}}if(u=e.match(/^bg-(.+)$/)){const[e,t]=u[1].split("/"),r=I(e);return t?{"background-color":r,opacity:String(parseInt(t)/100)}:"none"===e?{background:"none"}:{"background-color":r}}if(u=e.match(/^border-color-(.+)$/))return{"border-color":I(u[1])};if(u=e.match(/^fill-(.+)$/))return{fill:I(u[1])};if(u=e.match(/^stroke-(.+)$/))return{stroke:I(u[1])};if(u=e.match(/^shadow-color-(.+)$/))return{"--tkx-shadow-color":I(u[1])};if(u=e.match(/^ring-color-(.+)$/))return{"--tkx-ring-color":I(u[1])};if(u=e.match(/^accent-(.+)$/))return{"accent-color":I(u[1])};if(u=e.match(/^caret-(.+)$/))return{"caret-color":I(u[1])};if(u=e.match(/^outline-color-(.+)$/))return{"outline-color":I(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].*)$/))&&z.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":h[""]};if(u=e.match(/^rounded-(none|sm|md|lg|xl|2xl|3xl|full|\[.+])$/))return{"border-radius":h[u[1]]??_(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=h[u[2]??""]??h[""];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 S={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+)$/))&&S[u[1]])return{"box-shadow":`0 0 0 ${S[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":b[""]};if(u=e.match(/^shadow-(sm|md|lg|xl|2xl|inner|none)$/))return{"box-shadow":b[u[1]]};if(u=e.match(/^opacity-(\d+)$/)){const e=$[u[1]];if(void 0!==e)return{opacity:e}}if("bg-none"===e)return{background:"none"};const j={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"};if(j[e])return{"background-size":j[e]};const L={"bg-center":"center","bg-top":"top","bg-bottom":"bottom","bg-left":"left","bg-right":"right"};if(L[e])return{"background-position":L[e]};const F={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y"};if(F[e])return{"background-repeat":F[e]};if("backdrop-blur"===e)return{"backdrop-filter":`blur(${k[""]})`};if(u=e.match(/^backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{"backdrop-filter":`blur(${k[u[1]]})`};if("blur"===e)return{filter:`blur(${k[""]})`};if(u=e.match(/^blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{filter:`blur(${k[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 R={static:"static",relative:"relative",absolute:"absolute",fixed:"fixed",sticky:"sticky"};if(R[e])return{position:R[e]};if("inset-0"===e)return{top:"0",right:"0",bottom:"0",left:"0"};if("inset-auto"===e)return{top:"auto",right:"auto",bottom:"auto",left:"auto"};if("inset-full"===e)return{top:"100%",right:"100%",bottom:"100%",left:"100%"};if("inset-x-0"===e)return{left:"0",right:"0"};if("inset-y-0"===e)return{top:"0",bottom:"0"};if(u=e.match(/^-?top-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??g[u[1]]??_(u[1]);if(r)return{top:t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?right-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??g[u[1]]??_(u[1]);if(r)return{right:t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?bottom-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??g[u[1]]??_(u[1]);if(r)return{bottom:t&&"0"!==r?`-${r}`:r}}if(u=e.match(/^-?left-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??g[u[1]]??_(u[1]);if(r)return{left:t&&"0"!==r?`-${r}`:r}}const q={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=q[u[1]]??_(u[1]);if(e)return{"z-index":e}}const N={"overflow-auto":"auto","overflow-hidden":"hidden","overflow-visible":"visible","overflow-scroll":"scroll","overflow-clip":"clip"};if(N[e])return{overflow:N[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 W={"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(W[e])return{cursor:W[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 D={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=D[u[1]]??_(u[1]);if(e)return{transform:`scale(${e})`}}if(u=e.match(/^scale-x-(.+)$/)){const e=D[u[1]]??_(u[1]);if(e)return{transform:`scaleX(${e})`}}if(u=e.match(/^scale-y-(.+)$/)){const e=D[u[1]]??_(u[1]);if(e)return{transform:`scaleY(${e})`}}const O={0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg"};if(u=e.match(/^-?rotate-(.+)$/)){const t=e.startsWith("-"),r=O[u[1]]??_(u[1]);if(r)return{transform:t?`rotate(-${r})`:`rotate(${r})`}}if(u=e.match(/^-?translate-x-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??g[u[1]]??_(u[1]);if(r)return{transform:`translateX(${t&&"0"!==r?`-${r}`:r})`}}if(u=e.match(/^-?translate-y-(.+)$/)){const t=e.startsWith("-"),r=p[u[1]]??g[u[1]]??_(u[1]);if(r)return{transform:`translateY(${t&&"0"!==r?`-${r}`:r})`}}if(u=e.match(/^-?skew-x-(.+)$/)){const t=e.startsWith("-"),r=_(u[1])??`${u[1]}deg`;return{transform:t?`skewX(-${r})`:`skewX(${r})`}}if(u=e.match(/^-?skew-y-(.+)$/)){const t=e.startsWith("-"),r=_(u[1])??`${u[1]}deg`;return{transform:t?`skewY(-${r})`:`skewY(${r})`}}const B={"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(B[e])return{"transform-origin":B[e]};const T={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(T[e])return{"transition-property":T[e],"transition-timing-function":"cubic-bezier(0.4,0,0.2,1)","transition-duration":"150ms"};const P={75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"};if(u=e.match(/^duration-(.+)$/)){const e=P[u[1]]??_(u[1]);if(e)return{"transition-duration":e}}if(u=e.match(/^delay-(.+)$/)){const e=P[u[1]]??_(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 Y={"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(Y[e])return{animation:Y[e]};const U={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"};return U[e]?{"object-fit":U[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]}:function(e){for(const t of E.values())if(t[e])return t[e];return null}(e)||null}function F(e){let t=0,r=-1;for(let n=0;n<e.length;n++)if("["===e[n])t++;else if("]"===e[n])t--;else if(":"===e[n]&&0===t){r=n;break}return-1===r?{variant:null,utility:e}:{variant:e.slice(0,r),utility:e.slice(r+1)}}function R(e,t){for(const[r,n]of Object.entries(t))e[r]=n}function q(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}var N=/* @__PURE__ */new Map,W=null,D=null;function O(){return W&&W.isConnected||(W=document.getElementById("tkx-atomic"))||((W=document.createElement("style")).id="tkx-atomic",document.head.appendChild(W)),W}function B(e){const t=[];for(const r of e)if(r)if("string"==typeof r)t.push(...r.split(/\s+/).filter(Boolean));else if(Array.isArray(r))t.push(...B(r));else if("object"==typeof r)for(const[e,n]of Object.entries(r))n&&t.push(e);return t}function T(...e){const t=B(e);if(0===t.length)return"";const r={base:{},variants:{}};for(const s of t){const{variant:e,utility:t}=F(s),n=L(t);n&&(e?(r.variants[e]||(r.variants[e]={}),R(r.variants[e],n)):R(r.base,n))}const n=[],i=q(r.base),o=function(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}([i,...Object.entries(r.variants).map(([e,t])=>`${e}{${q(t)}}`)].join("|")),a=`tkx-${o}`;i&&n.push(`.${a}{${i}}`);for(const[s,l]of Object.entries(r.variants)){const e=q(l);if(e)if(s.startsWith("@")){const t=S[s.slice(1)];t&&n.push(`@media(min-width:${t}){.${a}{${e}}}`)}else if("motion-safe"===s)n.push(`@media(prefers-reduced-motion:no-preference){.${a}{${e}}}`);else if("motion-reduce"===s)n.push(`@media(prefers-reduced-motion:reduce){.${a}{${e}}}`);else if("contrast-more"===s)n.push(`@media(prefers-contrast:more){.${a}{${e}}}`);else if("forced-colors"===s)n.push(`@media(forced-colors:active){.${a}{${e}}}`);else if("dark"===s)n.push(`@media(prefers-color-scheme:dark){.${a}{${e}}}`);else if("print"===s)n.push(`@media print{.${a}{${e}}}`);else if("group-hover"===s)n.push(`.group:hover .${a}{${e}}`);else if("group-focus"===s)n.push(`.group:focus-within .${a}{${e}}`);else if("peer-hover"===s)n.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"}[s]??`:${s}`;n.push(`.${a}${t}{${e}}`)}}return n.length>0&&function(e,t){if(N.has(e))return;if(N.set(e,t),"undefined"==typeof document)return;const r=function(){if(D)return D;try{const e=new CSSStyleSheet;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],D=e,e}catch{return null}}();if(r){const e=function(e){const t=[];let r=0,n=0;for(let i=0;i<e.length;i++)if("{"===e[i])r++;else if("}"===e[i]&&(r--,0===r)){const r=e.slice(n,i+1).trim();r&&t.push(r),n=i+1}return t}(t);for(const t of e)try{r.insertRule(t,r.cssRules.length)}catch{O().textContent+=t+"\n"}}else O().textContent+=t+"\n"}(o,n.join("")),a}function P(...e){return e.filter(Boolean).join(" ")}var E=/* @__PURE__ */new Map;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]);var Z={"<":"<",">":">","&":"&","'":"'",'"':""","`":"`"};function Y(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=>Z[e]??e)}function U(e){if("string"!=typeof e)return null;const t=e.trim();if(!t)return null;const r=t.replace(/[\u0000-\u001F\u007F]/g,"");return/^javascript:/i.test(r)||/^vbscript:/i.test(r)||/^data:/i.test(r)&&!/^data:image\//i.test(r)||/^file:/i.test(r)?null:r}var H=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"]),Q={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"])},V=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 J(e){if("string"!=typeof e)return"";if("undefined"==typeof DOMParser)return Y(e);const t=(new DOMParser).parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;return t?(X(t),t.innerHTML):""}function X(e){const t=Array.from(e.children);for(const r of t){const e=r.tagName.toLowerCase();if(H.has(e)){for(const t of Array.from(r.attributes)){const n=t.name.toLowerCase();if(n.startsWith("on"))r.removeAttribute(t.name);else if(V.has(n))r.removeAttribute(t.name);else if("style"!==n)if((Q[e]??/* @__PURE__ */new Set).has(n)||Q["*"].has(n)){if(("href"===n||"src"===n)&&"string"==typeof t.value){const e=U(t.value);null===e?r.removeAttribute(t.name):r.setAttribute(t.name,e)}"name"!==n&&"id"!==n||!V.has(t.value.toLowerCase())||r.removeAttribute(t.name)}else r.removeAttribute(t.name);else r.setAttribute("style",G(t.value))}X(r)}else r.remove()}}function G(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 K=new Set(["__proto__","constructor","prototype"]);function ee(e){if(Array.isArray(e))return e.map(ee);if(e&&"object"==typeof e){const t={};for(const[r,n]of Object.entries(e))K.has(r)||(t[r]=ee(n));return t}return e}function te(){if("undefined"==typeof window)return!1;try{return window.top!==window.self}catch{return!0}}var re=[{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,r=!1;for(let n=e.length-1;n>=0;n--){let i=e.charCodeAt(n)-48;if(i<0||i>9)return!1;r&&(i*=2,i>9&&(i-=9)),t+=i,r=!r}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 ne(e,t,r,n){const i=r.trim();switch(e){case"required":return""!==i;case"email":case"pattern":if("string"==typeof t)try{return""===i||new RegExp(t).test(i)}catch{return!0}return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i);case"phone":return""===i||/^\+?[\d\s\-()]{7,15}$/.test(i);case"url":return""===i||/^https?:\/\/.+/.test(i);case"minLength":case"min":{const e=Number(t??0);return""===i||(isNaN(Number(i))?i.length>=e:Number(i)>=e)}case"maxLength":case"max":{const e=Number(t??1/0);return""===i||(isNaN(Number(i))?i.length<=e:Number(i)<=e)}case"integer":return""===i||/^\d+$/.test(i);case"alphanumeric":return""===i||/^[a-zA-Z0-9]+$/.test(i);case"match":return i===(n["string"==typeof t?t:"password"]??"");default:return!0}}function ie({phase:e,collapsed:t,primaryColor:r,borderColor:n}){const i=12,o=t?0:e,a=t?0:1.618*e,c=i+10*Math.sin(o)*Math.cos(a),d=12-10*Math.cos(o);/* @__PURE__ */
|
|
2
|
+
return l("svg",{width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",style:{flexShrink:0,opacity:t?.4:1,transition:"opacity 0.6s"},children:[
|
|
3
|
+
/* @__PURE__ */s("circle",{cx:i,cy:12,r:10,fill:"none",stroke:n,strokeWidth:"0.8"}),
|
|
4
|
+
/* @__PURE__ */s("ellipse",{cx:i,cy:12,rx:10,ry:3,fill:"none",stroke:n,strokeWidth:"0.5",strokeDasharray:"2 2"}),
|
|
5
|
+
/* @__PURE__ */s("line",{x1:i,y1:2,x2:i,y2:22,stroke:n,strokeWidth:"0.5"}),
|
|
6
|
+
/* @__PURE__ */s("line",{x1:i,y1:12,x2:c,y2:d,stroke:r,strokeWidth:"1.5",style:{transition:t?"all 0.6s ease-out":"none"}}),
|
|
7
|
+
/* @__PURE__ */s("circle",{cx:c,cy:d,r:"2",fill:r,style:{transition:t?"all 0.6s ease-out":"none"}})]})}function oe({confidence:e,theme:t}){const r=Math.round(100*e),n=r>=80?t.success:r>=60?t.warning:t.danger;/* @__PURE__ */
|
|
8
|
+
return l("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",fontSize:"10px",fontWeight:600,padding:"1px 5px",borderRadius:"999px",backgroundColor:`${n}22`,color:n,border:`1px solid ${n}44`,marginLeft:"6px",verticalAlign:"middle",letterSpacing:"0.03em"},children:["⚛ ",r,"%"]})}function ae({config:e,intel:t,qubitPhase:r,value:n,error:i,touched:o,showConfidence:a,showQuantumState:c,collapsed:d,onChange:u,onBlur:f,theme:p,mounted:m,index:g}){const h=e.type??t.type,b=e.label??t.label,x=e.placeholder??t.placeholder,y=void 0!==e.required?e.required:t.validations.some(e=>"required"===e.rule),w=Y(b),v="textarea"===h,k=o&&""!==i,$=`qf-${e.name}`,z={width:"100%",padding:"9px 12px",border:`1.5px solid ${k?p.danger:p.border}`,borderRadius:"8px",backgroundColor:p.surface,color:p.text,fontSize:"14px",fontFamily:"inherit",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",resize:v?"vertical":void 0,minHeight:v?"80px":void 0};/* @__PURE__ */
|
|
9
|
+
return l("div",{style:{display:"flex",flexDirection:"column",gap:"4px",opacity:m?1:0,transform:m?"scaleY(1)":"scaleY(0.92)",transition:`opacity 0.35s ease ${60*g}ms, transform 0.35s ease ${60*g}ms`,transformOrigin:"top"},children:[
|
|
10
|
+
/* @__PURE__ */l("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[c&&/* @__PURE__ */s(ie,{phase:r,collapsed:d,primaryColor:p.primary,borderColor:p.border}),
|
|
11
|
+
/* @__PURE__ */l("label",{htmlFor:$,style:{fontSize:"13px",fontWeight:500,color:p.text,cursor:"pointer"},children:[w,y&&/* @__PURE__ */s("span",{"aria-hidden":"true",style:{color:p.danger,marginLeft:"3px"},children:"*"})]}),a&&/* @__PURE__ */s(oe,{confidence:t.confidence,theme:p})]}),v?/* @__PURE__ */s("textarea",{id:$,value:n,onChange:e=>u(e.target.value),onBlur:f,placeholder:x,"aria-invalid":k,"aria-required":y,style:z}):/* @__PURE__ */s("input",{id:$,type:h,value:n,onChange:e=>u(e.target.value),onBlur:f,placeholder:x,"aria-invalid":k,"aria-required":y,style:z}),k&&/* @__PURE__ */l("span",{role:"alert",style:{fontSize:"12px",color:p.danger,display:"flex",alignItems:"center",gap:"4px"},children:[/* @__PURE__ */s("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */s("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"})}),Y(i)]})]})}function se(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return(65535&t)/65535*Math.PI*2}function le({fields:e,onSubmit:r,submitLabel:i="Submit",layout:c="vertical",showConfidence:p=!0,showQuantumState:m=!1}){const g=d(),h=e.map(e=>function(e){const t=e.toLowerCase().replace(/[\s-]/g,"_"),r=(new u).amplify(f,e=>{let r=0;for(const n of e.keywords)t===n?r=Math.max(r,1):t.includes(n)||n.includes(t)?r=Math.max(r,.8):n.split("_").some(e=>t.includes(e))&&(r=Math.max(r,.5));return r},.3);if(r.length>0&&r[0].combined>.1){const e=f[r[0].index];return{type:e.type,validations:e.validations,placeholder:e.placeholder,confidence:Math.min(e.confidence*r[0].combined*2,.99),label:e.label}}return{type:"text",validations:[{rule:"maxLength",value:255,message:"Input too long"}],placeholder:e.replace(/_/g," "),confidence:.3,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}}(e.name)),[b,x]=o(()=>Object.fromEntries(e.map(e=>[e.name,""]))),[y,w]=o({}),[v,k]=o({}),[$,z]=o(!1),[S,j]=o(!1),[C,A]=o(!1);n(()=>{const e=requestAnimationFrame(()=>j(!0));return()=>cancelAnimationFrame(e)},[]);const M=t((t,r)=>{const n=e.find(e=>e.name===t),i=h[e.findIndex(e=>e.name===t)];if(!n||!i)return"";const o=r[t]??"";for(const{rule:e,value:a,message:s}of i.validations)if(("required"!==e||!1!==n.required)&&!ne(e,a,o,r))return s;return""},[e]),_=t(t=>{const r={};for(const n of e){const e=M(n.name,t);e&&(r[n.name]=e)}return r},[e,M]),I=t((t,r)=>{x(n=>{const i={...n,[t]:r};if(v[t]&&(w(e=>({...e,[t]:M(t,i)})),"password"===t)){const t=e.find(e=>["confirmpassword","confirm_password","passwordconfirm"].includes(e.name.toLowerCase().replace(/[\s_-]/g,"")))?.name;t&&v[t]&&w(e=>({...e,[t]:M(t,i)}))}return i}),A(!0)},[e,v,M]),L=t(e=>{k(t=>({...t,[e]:!0})),w(t=>({...t,[e]:M(e,b)}))},[b,M]),F=t(async t=>{t.preventDefault(),k(Object.fromEntries(e.map(e=>[e.name,!0])));const n=_(b);if(w(n),!(Object.keys(n).length>0)){z(!0);try{await r(b)}finally{z(!1)}}},[e,b,_,r]),R=h.length>0?Math.round(h.reduce((e,t)=>e+t.confidence,0)/h.length*100):0,q=R>=80?g.success:R>=60?g.warning:g.danger,N="horizontal"===c;/* @__PURE__ */
|
|
12
|
+
return l("form",{onSubmit:F,noValidate:!0,className:T("w-full"),style:{backgroundColor:g.surface,border:`1px solid ${g.border}`,borderRadius:"12px",padding:"24px",position:"relative",boxSizing:"border-box"},children:[
|
|
13
|
+
/* @__PURE__ */s("span",{"aria-label":"Powered by Quantum AI",style:{position:"absolute",top:"16px",right:"16px",fontSize:"10px",fontWeight:700,padding:"3px 8px",borderRadius:"999px",backgroundColor:`${g.primary}20`,color:g.primary,border:`1px solid ${g.primary}44`,letterSpacing:"0.04em",userSelect:"none"},children:"⚛ Quantum AI"}),p&&/* @__PURE__ */l("div",{style:{marginBottom:"20px",paddingRight:"100px"},children:[/* @__PURE__ */l("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"},children:[/* @__PURE__ */s("span",{style:{fontSize:"11px",color:g.textMuted,fontWeight:500},children:"Form Intelligence Confidence"}),/* @__PURE__ */l("span",{style:{fontSize:"11px",fontWeight:700,color:q},children:[R,"%"]})]}),/* @__PURE__ */s("div",{style:{height:"4px",borderRadius:"4px",backgroundColor:g.border,overflow:"hidden"},children:/* @__PURE__ */s("div",{style:{height:"100%",width:`${R}%`,backgroundColor:q,borderRadius:"4px",transition:"width 0.8s ease"}})})]}),
|
|
14
|
+
/* @__PURE__ */s("div",{style:{display:"grid",gridTemplateColumns:N?"repeat(auto-fill, minmax(260px, 1fr))":"1fr",gap:"16px",marginBottom:"20px"},children:e.map((e,t)=>/* @__PURE__ */s(ae,{config:e,intel:h[t],qubitPhase:se(e.name),value:b[e.name]??"",error:y[e.name]??"",touched:v[e.name]??!1,showConfidence:p,showQuantumState:m,collapsed:C,onChange:t=>I(e.name,t),onBlur:()=>L(e.name),theme:g,mounted:S,index:t},e.name))}),
|
|
15
|
+
/* @__PURE__ */s("button",{type:"submit",disabled:$,style:{width:"100%",padding:"10px 20px",borderRadius:"8px",border:"none",backgroundColor:$?`${g.primary}88`:g.primary,color:g.bg,fontSize:"14px",fontWeight:700,fontFamily:"inherit",cursor:$?"not-allowed":"pointer",transition:"background-color 0.15s, opacity 0.15s",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:$?/* @__PURE__ */l(a,{children:[/* @__PURE__ */l("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{animation:"qf-spin 0.8s linear infinite"},"aria-hidden":"true",children:[/* @__PURE__ */s("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),/* @__PURE__ */s("path",{d:"M12 2a10 10 0 0 1 10 10"})]}),"Processing…"]}):Y(i)}),
|
|
16
|
+
/* @__PURE__ */s("style",{children:"@keyframes qf-spin { to { transform: rotate(360deg); } }"})]})}Object.freeze({sanitizeString:Y,sanitizeHref:U,sanitizeHTML:J,sanitizeCSS:G,sanitizeJSON:function(e){try{return ee(JSON.parse(e,(e,t)=>{if(!K.has(e))return t}))}catch{return null}},sanitizeUnicode:function(e){return"string"!=typeof e?"":e.replace(/[\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFEFF\u00AD]/g,"")},isSafeAttrName:function(e){return!("string"!=typeof e||!e||/[\u0000-\u001F\u007F<>"]/.test(e)||V.has(e.toLowerCase()))},buildTkxCSP:function(e={}){const{allowInlineStyles:t=!0,imgHosts:r=[],connectHosts:n=[],fontHosts:i=[],scriptNonce:o,reportUri:a}=e,s=["default-src 'self'","script-src "+(o?`'self' 'nonce-${o}'`:"'self'"),"style-src "+(t?"'self' 'unsafe-inline'":"'self'"),`img-src ${["'self'","data:","https:",...r].join(" ")}`,`font-src ${["'self'","https:","data:",...i].join(" ")}`,`connect-src ${["'self'",...n].join(" ")}`,"frame-ancestors 'none'","form-action 'self'","base-uri 'self'","object-src 'none'","upgrade-insecure-requests"];return a&&s.push(`report-uri ${a}`),s.join("; ")},installTrustedTypes:function(){if("undefined"==typeof window)return;const e=window.trustedTypes;if(e)try{e.createPolicy("tkx",{createHTML:J,createScriptURL:e=>U(e)??"",createScript:()=>{throw new Error("TekiVex: inline script creation forbidden")}})}catch{}},isFramed:te,installFrameBuster:function(e){if("undefined"!=typeof window&&te())if(e)e();else try{window.top.location.href=window.self.location.href}catch{}},createRateLimiter:function(e,t){let r=e,n=Date.now();return{check(){const i=Date.now(),o=i-n,a=Math.floor(o/t);return a>0&&(r=Math.min(e,r+a),n=i),!(r<=0||(r-=1,0))},reset(){r=e,n=Date.now()}}},sniffMimeType:async function(e){const t=new Uint8Array(await e.slice(0,12).arrayBuffer()),r=(...e)=>e.every((e,r)=>t[r]===e);return r(137,80,78,71)?"image/png":r(255,216,255)?"image/jpeg":r(71,73,70,56)?"image/gif":r(66,77)?"image/bmp":r(82,73,70,70)&&87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?"image/webp":r(37,80,68,70)?"application/pdf":r(80,75,3,4)?"application/zip":123===t[0]||91===t[0]?"application/json":[...t].includes(0)?null:"text/plain"},scrubPII:function(e){if("string"!=typeof e)return"";let t=e;for(const{re:r,repl:n}of re)t=t.replace(r,n);return t},deepFreeze:function e(t){if(t&&"object"==typeof t&&!Object.isFrozen(t)){for(const r of Object.keys(t))e(t[r]);Object.freeze(t)}return t},__brand:"TekiVex SecurityCore v2.6.0 © 007krcs"}),le.displayName="TkxQuantumForm";var ce={sm:4,md:8,lg:12};function de({value:e,label:t,showLabel:r=!0,size:o="md",animate:a=!0,className:c,style:u}){const f=d(),p=i(null),m=Math.max(0,Math.min(100,e)),g=function(e,t){return e>=80?"#10b981":e>=55?t:e>=30?"#f59e0b":"#ef4444"}(m,f.primary),h=ce[o];n(()=>{if(!a||!p.current)return;const e=p.current;e.style.width="0%";const t=requestAnimationFrame(()=>{e.style.transition="width 0.9s cubic-bezier(0.4, 0, 0.2, 1)",e.style.width=`${m}%`});return()=>cancelAnimationFrame(t)},[m,a]);const b="number"==typeof m?`${m.toFixed(0)}% AI confidence${t?` for ${t}`:""}`:t;/* @__PURE__ */
|
|
17
|
+
return l("div",{className:P(T("flex flex-col gap-1"),c),style:u,role:"meter","aria-valuenow":m,"aria-valuemin":0,"aria-valuemax":100,"aria-label":b,children:[(t||r)&&/* @__PURE__ */l("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:4},children:[t&&/* @__PURE__ */s("span",{style:{fontSize:12,fontWeight:600,color:f.textMuted},children:t}),r&&/* @__PURE__ */l("span",{style:{fontSize:12,fontWeight:700,color:g,marginLeft:"auto"},children:[m.toFixed(0),"%"]})]}),
|
|
18
|
+
/* @__PURE__ */l("div",{style:{height:h,borderRadius:h,background:`${f.border}`,overflow:"hidden",position:"relative"},children:[/* @__PURE__ */s("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.12) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"tkx-ai-shimmer 2s linear infinite",pointerEvents:"none",zIndex:1}}),/* @__PURE__ */s("div",{ref:p,style:{height:"100%",width:a?"0%":`${m}%`,background:`linear-gradient(90deg, ${g}cc, ${g})`,borderRadius:h,boxShadow:`0 0 8px ${g}66`,transition:a?void 0:"width 0.3s ease"}})]}),
|
|
19
|
+
/* @__PURE__ */l("div",{style:{fontSize:10,color:f.textMuted,marginTop:2,display:"flex",gap:4,alignItems:"center"},children:[/* @__PURE__ */s("span",{style:{width:6,height:6,borderRadius:"50%",background:g,display:"inline-block",flexShrink:0}}),m>=80?"High confidence":m>=55?"Moderate confidence":m>=30?"Low confidence":"Very low — review manually"]}),
|
|
20
|
+
/* @__PURE__ */s("style",{children:"\n @keyframes tkx-ai-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n }\n "})]})}function ue({color:e}){/* @__PURE__ */
|
|
21
|
+
return s("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[0,1,2].map(t=>/* @__PURE__ */s("div",{style:{width:7,height:7,borderRadius:"50%",background:e,animation:`tkx-thinking-dot 1.2s ease-in-out ${.18*t}s infinite`}},t))})}function fe({color:e}){/* @__PURE__ */
|
|
22
|
+
return l("div",{style:{position:"relative",width:24,height:24},children:[
|
|
23
|
+
/* @__PURE__ */s("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.15,animation:"tkx-thinking-pulse 1.5s ease-out infinite"}}),
|
|
24
|
+
/* @__PURE__ */s("div",{style:{position:"absolute",inset:4,borderRadius:"50%",background:e,opacity:.6,animation:"tkx-thinking-pulse 1.5s ease-out 0.3s infinite"}}),
|
|
25
|
+
/* @__PURE__ */s("div",{style:{position:"absolute",inset:8,borderRadius:"50%",background:e}})]})}function pe({color:e}){/* @__PURE__ */
|
|
26
|
+
return s("div",{style:{display:"flex",gap:3,alignItems:"center",height:20},children:[0,1,2,3,4].map(t=>/* @__PURE__ */s("div",{style:{width:3,borderRadius:3,background:e,animation:`tkx-thinking-wave 1s ease-in-out ${.1*t}s infinite`}},t))})}function me({color:e}){/* @__PURE__ */
|
|
27
|
+
return l("div",{style:{position:"relative",width:28,height:28},children:[
|
|
28
|
+
/* @__PURE__ */s("div",{style:{position:"absolute",inset:0,borderRadius:"50%",border:`2px solid ${e}33`}}),
|
|
29
|
+
/* @__PURE__ */s("div",{style:{position:"absolute",inset:0,borderRadius:"50%",border:"2px solid transparent",borderTopColor:e,animation:"tkx-thinking-orbit 0.8s linear infinite"}}),
|
|
30
|
+
/* @__PURE__ */s("div",{style:{position:"absolute",inset:"38%",borderRadius:"50%",background:e,opacity:.8}})]})}var ge={sm:12,md:14,lg:16};function he({label:e="Thinking…",steps:t,size:r="md",variant:i="dots",active:a=!0,className:c,style:u}){const f=d(),[p,m]=o(0);n(()=>{if(!t?.length||!a)return;const e=setInterval(()=>{m(e=>(e+1)%t.length)},1800);return()=>clearInterval(e)},[t,a]);const g=f.primary,h=ge[r],b={dots:/* @__PURE__ */s(ue,{color:g}),pulse:/* @__PURE__ */s(fe,{color:g}),wave:/* @__PURE__ */s(pe,{color:g}),orbit:/* @__PURE__ */s(me,{color:g})}[i];/* @__PURE__ */
|
|
31
|
+
return l("div",{className:P(T("inline-flex flex-col gap-2"),c),style:u,role:"status","aria-live":"polite","aria-label":a?e:"Done thinking",children:[
|
|
32
|
+
/* @__PURE__ */l("div",{style:{display:"flex",alignItems:"center",gap:10},children:[/* @__PURE__ */s("div",{style:{opacity:a?1:.35,transition:"opacity 0.3s"},children:a?b:/* @__PURE__ */s("div",{style:{width:20,height:20,borderRadius:"50%",background:"#10b981",display:"flex",alignItems:"center",justifyContent:"center"},children:/* @__PURE__ */s("span",{style:{color:"#fff",fontSize:11,fontWeight:900},children:"✓"})})}),/* @__PURE__ */l("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[/* @__PURE__ */s("span",{style:{fontSize:h,fontWeight:600,color:a?f.text:f.textMuted,transition:"color 0.3s"},children:a?t?t[p]:e:"Done"}),a&&/* @__PURE__ */s("span",{style:{fontSize:h-2,color:f.textMuted},children:"⚛ Quantum AI · Amplitude Amplification"})]})]}),t&&t.length>1&&/* @__PURE__ */s("div",{style:{display:"flex",gap:4,paddingLeft:2},children:t.map((e,t)=>/* @__PURE__ */s("div",{style:{width:t===p?16:6,height:4,borderRadius:4,background:t===p?g:`${g}44`,transition:"all 0.3s ease"}},t))}),
|
|
33
|
+
/* @__PURE__ */s("style",{children:"\n @keyframes tkx-thinking-dot {\n 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }\n 40% { transform: scale(1); opacity: 1; }\n }\n @keyframes tkx-thinking-pulse {\n 0% { transform: scale(0.6); opacity: 0.8; }\n 100% { transform: scale(2); opacity: 0; }\n }\n @keyframes tkx-thinking-wave {\n 0%, 100% { height: 6px; }\n 50% { height: 18px; }\n }\n @keyframes tkx-thinking-orbit {\n to { transform: rotate(360deg); }\n }\n "})]})}function be({src:e,name:t,size:r=32}){const n=d(),i=t?t.split(" ").map(e=>e[0]).join("").slice(0,2).toUpperCase():"?";return e?/* @__PURE__ */s("img",{src:e,alt:t??"avatar",width:r,height:r,style:{borderRadius:"50%",objectFit:"cover",flexShrink:0}}):/* @__PURE__ */s("div",{style:{width:r,height:r,borderRadius:"50%",flexShrink:0,background:`${n.primary}22`,border:`1px solid ${n.primary}44`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:.35*r,fontWeight:700,color:n.primary},children:i})}function xe({role:e,content:t,avatar:r,name:c,timestamp:u,streaming:f=!1,confidence:p,copyable:m=!1,className:g,style:h}){const b=d(),x="user"===e,y="system"===e,w="string"==typeof t?Y(t):"",[v,k]=o(f?"":w),[$,z]=o(!1),[S,j]=o(f?"":w),C=i(0),A=i(null);if(n(()=>{if(!f||"string"!=typeof t)return void j(w);C.current=0,k(""),j("");const e=setInterval(()=>{C.current++;const t=w.slice(0,C.current);k(t),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>j(t),350),C.current>=w.length&&(clearInterval(e),A.current&&clearTimeout(A.current),j(w))},18);return()=>{clearInterval(e),A.current&&clearTimeout(A.current)}},[w,f,t]),y)/* @__PURE__ */return s("div",{style:{display:"flex",justifyContent:"center",padding:"8px 0"},children:/* @__PURE__ */s("div",{style:{padding:"6px 16px",borderRadius:999,fontSize:12,background:`${b.border}`,color:b.textMuted,fontStyle:"italic"},children:"string"==typeof t?Y(t):t})});const M={maxWidth:"75%",padding:"12px 16px",borderRadius:x?"18px 18px 4px 18px":"18px 18px 18px 4px",background:x?`linear-gradient(135deg, ${b.primary}, ${b.primary}cc)`:`${b.surface}`,border:x?"none":`1px solid ${b.border}`,color:x?"#fff":b.text,fontSize:14,lineHeight:1.65,boxShadow:x?`0 4px 16px -4px ${b.primary}55`:"0 2px 8px -2px rgba(0,0,0,0.2)",position:"relative",wordBreak:"break-word"};/* @__PURE__ */
|
|
34
|
+
return l("div",{className:P(T("flex gap-2"),g),style:{flexDirection:x?"row-reverse":"row",alignItems:"flex-end",...h},children:[
|
|
35
|
+
/* @__PURE__ */s(be,{src:r,name:c??(x?"You":"AI")}),
|
|
36
|
+
/* @__PURE__ */l("div",{style:{display:"flex",flexDirection:"column",gap:4,alignItems:x?"flex-end":"flex-start"},children:[(c||u)&&/* @__PURE__ */l("div",{style:{display:"flex",gap:8,alignItems:"center",paddingInline:4},children:[c&&/* @__PURE__ */s("span",{style:{fontSize:11,fontWeight:700,color:b.textMuted},children:c}),u&&/* @__PURE__ */s("span",{style:{fontSize:10,color:b.textMuted},children:u})]}),
|
|
37
|
+
/* @__PURE__ */l("div",{style:M,role:"article","aria-label":x?"Your message":"Assistant message",children:["string"==typeof t?/* @__PURE__ */l(a,{children:[
|
|
38
|
+
/* @__PURE__ */s("span",{"aria-hidden":f?"true":void 0,children:f?v:Y(t)}),f&&v.length<w.length&&/* @__PURE__ */s("span",{"aria-hidden":"true",style:{display:"inline-block",width:2,height:14,background:x?"#fff":b.primary,marginLeft:2,animation:"tkx-blink 1s step-end infinite",verticalAlign:"text-bottom"}}),f&&/* @__PURE__ */s("span",{"aria-live":"polite","aria-atomic":"false",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0},children:S})]}):t,m&&!x&&/* @__PURE__ */s("button",{onClick:()=>{navigator.clipboard?.writeText(w),z(!0),setTimeout(()=>z(!1),2e3)},title:"Copy message",style:{position:"absolute",top:8,right:8,background:"none",border:"none",cursor:"pointer",fontSize:13,color:$?"#10b981":b.textMuted,padding:"2px 4px",borderRadius:4,transition:"color 0.2s"},children:$?"✓":"⎘"})]}),!x&&void 0!==p&&/* @__PURE__ */s("div",{style:{paddingInline:4,width:"100%",maxWidth:240},children:/* @__PURE__ */l("div",{style:{display:"flex",alignItems:"center",gap:6},children:[/* @__PURE__ */s("div",{style:{flex:1,height:3,borderRadius:3,background:b.border,overflow:"hidden"},children:/* @__PURE__ */s("div",{style:{height:"100%",width:`${p}%`,background:(_=p,I=b.primary,_>=80?"#10b981":_>=55?I:_>=30?"#f59e0b":"#ef4444"),borderRadius:3,transition:"width 0.8s ease"}})}),/* @__PURE__ */l("span",{style:{fontSize:10,color:b.textMuted,whiteSpace:"nowrap"},children:[p,"% confident"]})]})})]}),
|
|
39
|
+
/* @__PURE__ */s("style",{children:"\n @keyframes tkx-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }\n "})]});var _,I}export{xe as TkxAIChatBubble,de as TkxAIConfidenceBar,he as TkxAIThinking,le as TkxQuantumForm};
|
package/dist/headless.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunk-BpuJ3-K8.js"),r=require("./chunk-D7-yknXg.js"),s=require("./chunk-C8Wy8P59.js"),o=require("./chunk-Bze40nDX.js");exports.contrastRatio=e.contrastRatio,exports.cssVar=e.cssVar,exports.cx=r.cx,exports.extractAtomicCSS=r.extractAtomicCSS,exports.extractCSS=e.extractCSS,exports.injectStyles=e.injectStyles,exports.meetsAA=e.meetsAA,exports.meetsAAA=e.meetsAAA,exports.resetAtomicCSS=r.resetAtomicCSS,exports.resetStyles=e.resetStyles,exports.sanitizeProps=r.sanitizeProps,exports.sanitizeString=r.sanitizeString,exports.tkxListPlugins=r.tkxListPlugins,exports.tkxPlugin=r.tkxPlugin,exports.tkxRemovePlugin=r.tkxRemovePlugin,exports.useAnnounce=s.useAnnounce,exports.useClickOutside=s.useClickOutside,exports.useControllable=o.useControllable,exports.useDebounce=o.useDebounce,exports.useDisclosure=o.useDisclosure,exports.useEscapeKey=s.useEscapeKey,exports.useFocusTrap=s.useFocusTrap,exports.useFormState=o.useFormState,exports.useHighContrast=s.useHighContrast,exports.useInfiniteQuery=o.useInfiniteQuery,exports.useIntersectionObserver=o.useIntersectionObserver,exports.useListSelection=o.useListSelection,exports.useLocalStorage=o.useLocalStorage,exports.useMediaQuery=o.useMediaQuery,exports.useReducedMotion=s.useReducedMotion,exports.useRovingTabIndex=o.useRovingTabIndex,exports.useSSE=o.useSSE,exports.useThrottle=o.useThrottle,exports.useTkxForm=o.useTkxForm,exports.useWebSocket=o.useWebSocket;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let e=require("react"),t=require("react/jsx-runtime"),n=require("react-dom");function r(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 o(e,t){const n=r(e),o=r(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function i(e,t){const n=t??["#ffffff","#000000"];return n.reduce((t,n)=>o(n,e)>o(t,e)?n:t,n[0])}var l=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])',"details > summary"].join(", ");function a(){const[t,n]=(0,e.useState)(()=>"undefined"!=typeof window&&"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,e.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),t=e=>n(e.matches);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),t}new class{constructor(e=512){this.cache=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}}(512);var s=new Map;function c(){return Array.from(s.entries()).map(([e,t])=>`.${e} { ${t} }`).join("\n")}var d=(0,e.createContext)({bg:"#0a0a0f",surface:"#12121a",surfaceAlt:"#1a1a2e",border:"#2a2a3e",text:"#e8e8f4",textMuted:"#8888aa",primary:"#00f5d4",secondary:"#7b2ff7",danger:"#f72585",warning:"#ffbe0b",success:"#06d6a0",info:"#3a86ff"});function u(){return(0,e.useContext)(d)}var f=(0,e.createContext)({locale:"en-US",direction:"ltr",strings:{close:"Close",cancel:"Cancel",confirm:"Confirm",save:"Save",delete:"Delete",search:"Search",loading:"Loading...",noResults:"No results found",required:"Required",previous:"Previous",next:"Next",pageOf:(e,t)=>`Page ${e} of ${t}`,selectPlaceholder:"Select...",clearSelection:"Clear selection",selectDate:"Select a date",today:"Today",dropFiles:"Drop files here or",browse:"Browse",noData:"No data available",sortAscending:"Sort ascending",sortDescending:"Sort descending",filterPlaceholder:"Filter...",exportCsv:"Export CSV",rowsSelected:e=>`${e} row${1===e?"":"s"} selected`}});function p(){return(0,e.useContext)(f).strings}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]);var h={"<":"<",">":">","&":"&","'":"'",'"':""","`":"`"};function x(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=>h[e]??e)}function g(e){const t={};for(const n of Object.keys(e))t[n]=m(e[n]);return t}function m(e){return"string"==typeof e?x(e):Array.isArray(e)?e.map(m):null===e||"object"!=typeof e||function(e){return"object"==typeof e&&null!==e&&"$$typeof"in e}(e)?e:g(e)}function b(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 y=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"]),w={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"])},v=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 k(e){if("string"!=typeof e)return"";if("undefined"==typeof DOMParser)return x(e);const t=(new DOMParser).parseFromString(`<div>${e}</div>`,"text/html").body.firstElementChild;return t?($(t),t.innerHTML):""}function $(e){const t=Array.from(e.children);for(const n of t){const e=n.tagName.toLowerCase();if(y.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(v.has(r))n.removeAttribute(t.name);else if("style"!==r)if((w[e]??new Set).has(r)||w["*"].has(r)){if(("href"===r||"src"===r)&&"string"==typeof t.value){const e=b(t.value);null===e?n.removeAttribute(t.name):n.setAttribute(t.name,e)}"name"!==r&&"id"!==r||!v.has(t.value.toLowerCase())||n.removeAttribute(t.name)}else n.removeAttribute(t.name);else n.setAttribute("style",S(t.value))}$(n)}else n.remove()}}function S(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 z=new Set(["__proto__","constructor","prototype"]);function C(e){try{return D(JSON.parse(e,(e,t)=>{if(!z.has(e))return t}))}catch{return null}}function D(e){if(Array.isArray(e))return e.map(D);if(e&&"object"==typeof e){const t={};for(const[n,r]of Object.entries(e))z.has(n)||(t[n]=D(r));return t}return e}function M(e){return"string"!=typeof e?"":e.replace(/[\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFEFF\u00AD]/g,"")}function F(){if("undefined"==typeof window)return!1;try{return window.top!==window.self}catch{return!0}}var j=[{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]"}];Object.freeze({sanitizeString:x,sanitizeHref:b,sanitizeHTML:k,sanitizeCSS:S,sanitizeJSON:C,sanitizeUnicode:M,isSafeAttrName:function(e){return!("string"!=typeof e||!e||/[\u0000-\u001F\u007F<>"]/.test(e)||v.has(e.toLowerCase()))},buildTkxCSP:function(e={}){const{allowInlineStyles:t=!0,imgHosts:n=[],connectHosts:r=[],fontHosts:o=[],scriptNonce:i,reportUri:l}=e,a=["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 l&&a.push(`report-uri ${l}`),a.join("; ")},installTrustedTypes:function(){if("undefined"==typeof window)return;const e=window.trustedTypes;if(e)try{e.createPolicy("tkx",{createHTML:k,createScriptURL:e=>b(e)??"",createScript:()=>{throw new Error("TekiVex: inline script creation forbidden")}})}catch{}},isFramed:F,installFrameBuster:function(e){if("undefined"!=typeof window&&F())if(e)e();else try{window.top.location.href=window.self.location.href}catch{}},createRateLimiter:function(e,t){let n=e,r=Date.now();return{check(){const o=Date.now(),i=o-r,l=Math.floor(i/t);return l>0&&(n=Math.min(e,n+l),r=o),!(n<=0||(n-=1,0))},reset(){n=e,r=Date.now()}}},sniffMimeType:async function(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"},scrubPII:function(e){if("string"!=typeof e)return"";let t=e;for(const{re:n,repl:r}of j)t=t.replace(n,r);return t},deepFreeze:function e(t){if(t&&"object"==typeof t&&!Object.isFrozen(t)){for(const n of Object.keys(t))e(t[n]);Object.freeze(t)}return t},__brand:"TekiVex SecurityCore v2.6.0 © 007krcs"});var T={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"},A={...T,screen:"100vh"},I={"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%"},N={none:"0",sm:"2px","":"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px","3xl":"24px",full:"9999px"},W={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"},O={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"]},L={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},R={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"},V={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},B={none:"0",sm:"4px","":"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},E=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)])),H=new Set(["bg","surface","surfaceAlt","border","text","textMuted","primary","secondary","danger","warning","success","info"]),P={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Y=/javascript\s*:|vbscript\s*:|data\s*:\s*text\/html|data\s*:\s*text\/javascript|expression\s*\(|[\r\n\x00]/i,q=new Set(["behavior","-moz-binding","-webkit-binding","src"]),U=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 _(e){return Y.test(e)||e.includes("}")||e.includes("{")||e.includes("<")||e.includes(">")?null:e}function J(e){const t=e.match(/^\[(.+)]$/);return t?_(t[1]):null}function Z(e){return H.has(e)?`var(--tkx-${e})`:"transparent"===e?"transparent":"current"===e?"currentColor":"white"===e?"#ffffff":"black"===e?"#000000":"inherit"===e?"inherit":J(e)||(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),e)}function K(e){const t=e.match(/^\[(--[a-zA-Z0-9_-]+):(.+)]$/);if(t){const e=_(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 q.has(t)?null:U.has(t)?t:null}(n[1]),t=_(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 l={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-none":"none","flex-initial":"0 1 auto"};if(l[e])return{flex:l[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 a={"items-start":"flex-start","items-end":"flex-end","items-center":"center","items-stretch":"stretch","items-baseline":"baseline"};if(a[e])return{"align-items":a[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 c={"self-auto":"auto","self-start":"flex-start","self-end":"flex-end","self-center":"center","self-stretch":"stretch","self-baseline":"baseline"};if(c[e])return{"align-self":c[e]};const d={"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(d[e])return{"align-content":d[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=T[u[1]]??J(u[1]);if(e)return{padding:e}}if(u=e.match(/^px-(.+)$/)){const e=T[u[1]]??J(u[1]);if(e)return{"padding-left":e,"padding-right":e}}if(u=e.match(/^py-(.+)$/)){const e=T[u[1]]??J(u[1]);if(e)return{"padding-top":e,"padding-bottom":e}}if(u=e.match(/^pt-(.+)$/)){const e=T[u[1]]??J(u[1]);if(e)return{"padding-top":e}}if(u=e.match(/^pr-(.+)$/)){const e=T[u[1]]??J(u[1]);if(e)return{"padding-right":e}}if(u=e.match(/^pb-(.+)$/)){const e=T[u[1]]??J(u[1]);if(e)return{"padding-bottom":e}}if(u=e.match(/^pl-(.+)$/)){const e=T[u[1]]??J(u[1]);if(e)return{"padding-left":e}}if(u=e.match(/^-?m-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??J(u[1]);if(n)return{margin:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mx-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??J(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=T[u[1]]??J(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=T[u[1]]??J(u[1]);if(n)return{"margin-top":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mr-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??J(u[1]);if(n)return{"margin-right":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?mb-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??J(u[1]);if(n)return{"margin-bottom":t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?ml-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??J(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=T[u[1]]??J(u[1]);if(e)return{gap:e}}if(u=e.match(/^gap-x-(.+)$/)){const e=T[u[1]]??J(u[1]);if(e)return{"column-gap":e}}if(u=e.match(/^gap-y-(.+)$/)){const e=T[u[1]]??J(u[1]);if(e)return{"row-gap":e}}if(u=e.match(/^w-(.+)$/)){const e=u[1],t=T[e]??I[e]??J(e);if(t)return{width:t}}if(u=e.match(/^min-w-(.+)$/)){const e=T[u[1]]??J(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]]??T[u[1]]??J(u[1]);if(e)return{"max-width":e}}if(u=e.match(/^h-(.+)$/)){const e=u[1],t=A[e]??I[e]??J(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]]??T[u[1]]??J(u[1]);if(e)return{"min-height":e}}if(u=e.match(/^max-h-(.+)$/)){const e=A[u[1]]??J(u[1]);if(e)return{"max-height":e}}if(u=e.match(/^size-(.+)$/)){const e=T[u[1]]??I[u[1]]??J(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]=O[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":L[u[1]]??u[1]};if(u=e.match(/^leading-(.+)$/)){const e=R[u[1]]??J(u[1]);if(e)return{"line-height":e}}if(u=e.match(/^tracking-(.+)$/)){const e=V[u[1]]??J(u[1]);if(e)return{"letter-spacing":e}}const f={"text-left":"left","text-center":"center","text-right":"right","text-justify":"justify","text-start":"start","text-end":"end"};if(f[e])return{"text-align":f[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=T[u[1]]??J(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=Z(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=Z(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":Z(u[1])};if(u=e.match(/^fill-(.+)$/))return{fill:Z(u[1])};if(u=e.match(/^stroke-(.+)$/))return{stroke:Z(u[1])};if(u=e.match(/^shadow-color-(.+)$/))return{"--tkx-shadow-color":Z(u[1])};if(u=e.match(/^ring-color-(.+)$/))return{"--tkx-ring-color":Z(u[1])};if(u=e.match(/^accent-(.+)$/))return{"accent-color":Z(u[1])};if(u=e.match(/^caret-(.+)$/))return{"caret-color":Z(u[1])};if(u=e.match(/^outline-color-(.+)$/))return{"outline-color":Z(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].*)$/))&&H.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":N[""]};if(u=e.match(/^rounded-(none|sm|md|lg|xl|2xl|3xl|full|\[.+])$/))return{"border-radius":N[u[1]]??J(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=N[u[2]??""]??N[""];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 p={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+)$/))&&p[u[1]])return{"box-shadow":`0 0 0 ${p[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":W[""]};if(u=e.match(/^shadow-(sm|md|lg|xl|2xl|inner|none)$/))return{"box-shadow":W[u[1]]};if(u=e.match(/^opacity-(\d+)$/)){const e=E[u[1]];if(void 0!==e)return{opacity:e}}if("bg-none"===e)return{background:"none"};const h={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"};if(h[e])return{"background-size":h[e]};const x={"bg-center":"center","bg-top":"top","bg-bottom":"bottom","bg-left":"left","bg-right":"right"};if(x[e])return{"background-position":x[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(${B[""]})`};if(u=e.match(/^backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{"backdrop-filter":`blur(${B[u[1]]})`};if("blur"===e)return{filter:`blur(${B[""]})`};if(u=e.match(/^blur-(none|sm|md|lg|xl|2xl|3xl)$/))return{filter:`blur(${B[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 m={static:"static",relative:"relative",absolute:"absolute",fixed:"fixed",sticky:"sticky"};if(m[e])return{position:m[e]};if("inset-0"===e)return{top:"0",right:"0",bottom:"0",left:"0"};if("inset-auto"===e)return{top:"auto",right:"auto",bottom:"auto",left:"auto"};if("inset-full"===e)return{top:"100%",right:"100%",bottom:"100%",left:"100%"};if("inset-x-0"===e)return{left:"0",right:"0"};if("inset-y-0"===e)return{top:"0",bottom:"0"};if(u=e.match(/^-?top-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??I[u[1]]??J(u[1]);if(n)return{top:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?right-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??I[u[1]]??J(u[1]);if(n)return{right:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?bottom-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??I[u[1]]??J(u[1]);if(n)return{bottom:t&&"0"!==n?`-${n}`:n}}if(u=e.match(/^-?left-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??I[u[1]]??J(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]]??J(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 w={"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(w[e])return{cursor:w[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 v={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=v[u[1]]??J(u[1]);if(e)return{transform:`scale(${e})`}}if(u=e.match(/^scale-x-(.+)$/)){const e=v[u[1]]??J(u[1]);if(e)return{transform:`scaleX(${e})`}}if(u=e.match(/^scale-y-(.+)$/)){const e=v[u[1]]??J(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]]??J(u[1]);if(n)return{transform:t?`rotate(-${n})`:`rotate(${n})`}}if(u=e.match(/^-?translate-x-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??I[u[1]]??J(u[1]);if(n)return{transform:`translateX(${t&&"0"!==n?`-${n}`:n})`}}if(u=e.match(/^-?translate-y-(.+)$/)){const t=e.startsWith("-"),n=T[u[1]]??I[u[1]]??J(u[1]);if(n)return{transform:`translateY(${t&&"0"!==n?`-${n}`:n})`}}if(u=e.match(/^-?skew-x-(.+)$/)){const t=e.startsWith("-"),n=J(u[1])??`${u[1]}deg`;return{transform:t?`skewX(-${n})`:`skewX(${n})`}}if(u=e.match(/^-?skew-y-(.+)$/)){const t=e.startsWith("-"),n=J(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 z={75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"};if(u=e.match(/^duration-(.+)$/)){const e=z[u[1]]??J(u[1]);if(e)return{"transition-duration":e}}if(u=e.match(/^delay-(.+)$/)){const e=z[u[1]]??J(u[1]);if(e)return{"transition-delay":e}}const C={"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(C[e])return{"transition-timing-function":C[e]};const D={"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(D[e])return{animation:D[e]};const M={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"};return M[e]?{"object-fit":M[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]}:function(e){for(const t of ae.values())if(t[e])return t[e];return null}(e)||null}function X(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 G(e,t){for(const[n,r]of Object.entries(t))e[n]=r}function Q(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}var ee=new Map,te=null,ne=null;function re(){return te&&te.isConnected||(te=document.getElementById("tkx-atomic"))||((te=document.createElement("style")).id="tkx-atomic",document.head.appendChild(te)),te}function oe(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(...oe(n));else if("object"==typeof n)for(const[e,r]of Object.entries(n))r&&t.push(e);return t}function ie(...e){const t=oe(e);if(0===t.length)return"";const n={base:{},variants:{}};for(const a of t){const{variant:e,utility:t}=X(a),r=K(t);r&&(e?(n.variants[e]||(n.variants[e]={}),G(n.variants[e],r)):G(n.base,r))}const r=[],o=Q(n.base),i=function(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")}([o,...Object.entries(n.variants).map(([e,t])=>`${e}{${Q(t)}}`)].join("|")),l=`tkx-${i}`;o&&r.push(`.${l}{${o}}`);for(const[a,s]of Object.entries(n.variants)){const e=Q(s);if(e)if(a.startsWith("@")){const t=P[a.slice(1)];t&&r.push(`@media(min-width:${t}){.${l}{${e}}}`)}else if("motion-safe"===a)r.push(`@media(prefers-reduced-motion:no-preference){.${l}{${e}}}`);else if("motion-reduce"===a)r.push(`@media(prefers-reduced-motion:reduce){.${l}{${e}}}`);else if("contrast-more"===a)r.push(`@media(prefers-contrast:more){.${l}{${e}}}`);else if("forced-colors"===a)r.push(`@media(forced-colors:active){.${l}{${e}}}`);else if("dark"===a)r.push(`@media(prefers-color-scheme:dark){.${l}{${e}}}`);else if("print"===a)r.push(`@media print{.${l}{${e}}}`);else if("group-hover"===a)r.push(`.group:hover .${l}{${e}}`);else if("group-focus"===a)r.push(`.group:focus-within .${l}{${e}}`);else if("peer-hover"===a)r.push(`.peer:hover~.${l}{${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"}[a]??`:${a}`;r.push(`.${l}${t}{${e}}`)}}return r.length>0&&function(e,t){if(ee.has(e))return;if(ee.set(e,t),"undefined"==typeof document)return;const n=function(){if(ne)return ne;try{const e=new CSSStyleSheet;return document.adoptedStyleSheets=[...document.adoptedStyleSheets,e],ne=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{re().textContent+=t+"\n"}}else re().textContent+=t+"\n"}(i,r.join("")),l}function le(...e){return e.filter(Boolean).join(" ")}var ae=new Map,se=(0,e.createContext)(null),ce=!1;function de({initialValues:t,validate:n,validateAsync:r,debounceMs:o=300}){const[i,l]=(0,e.useState)({...t}),[a,s]=(0,e.useState)({}),[c,d]=(0,e.useState)({}),[u,f]=(0,e.useState)({}),[p,h]=(0,e.useState)(void 0),[x,g]=(0,e.useState)({}),m=(0,e.useRef)(t),b=(0,e.useRef)({}),y=(0,e.useRef)({}),w=(0,e.useRef)(i);(0,e.useEffect)(()=>{w.current=i},[i]);const v=(0,e.useRef)(r);(0,e.useEffect)(()=>{v.current=r},[r]);const k=(0,e.useCallback)(e=>{const t=v.current?.[e];if(!t)return;const n=b.current[e];n&&clearTimeout(n),b.current[e]=setTimeout(()=>{const n=(y.current[e]??0)+1;y.current[e]=n,f(t=>({...t,[e]:!0})),Promise.resolve().then(()=>t(w.current[e],w.current)).then(t=>{y.current[e]===n&&(f(t=>{const n={...t};return delete n[e],n}),d(n=>{const r={...n};return t?r[e]=t:delete r[e],r}))}).catch(()=>{y.current[e]===n&&f(t=>{const n={...t};return delete n[e],n})})},o)},[o]),$=(0,e.useCallback)((e,t)=>{l(n=>({...n,[e]:t})),y.current[e]=(y.current[e]??0)+1,k(e)},[k]),S=(0,e.useCallback)(e=>{l(t=>({...t,...e}));for(const t of Object.keys(e))y.current[t]=(y.current[t]??0)+1,k(t)},[k]),z=(0,e.useCallback)(e=>{g(t=>({...t,[e]:!0}))},[]),C=(0,e.useCallback)(()=>{if(!n)return!0;const{o:e,...t}=n(i),r=Object.fromEntries(Object.entries(t).filter(([,e])=>null!=e));return s(r),h(e||void 0),g(Object.fromEntries(Object.keys(i).map(e=>[e,!0]))),0===Object.keys(r).length&&!e},[i,n]),D=(0,e.useCallback)(()=>{for(const e of Object.keys(b.current)){const t=b.current[e];t&&clearTimeout(t),y.current[e]=(y.current[e]??0)+1}b.current={},l({...m.current}),s({}),d({}),f({}),h(void 0),g({})},[]);(0,e.useEffect)(()=>()=>{for(const e of Object.keys(b.current)){const t=b.current[e];t&&clearTimeout(t)}},[]);const M={...a,...c};return{values:i,errors:M,asyncErrors:c,validating:u,rootError:p,touched:x,dirty:Object.keys(i).some(e=>i[e]!==m.current[e]),isValid:0===Object.keys(M).length&&!p,setValue:$,setValues:S,touchField:z,validate:C,reset:D,getFieldProps:(0,e.useCallback)(e=>({value:i[e],onChange:t=>{$(e,t.target.value)},onBlur:()=>z(e),"aria-invalid":!(!x[e]||!M[e])||void 0,"aria-describedby":M[e]?`${String(e)}-error`:void 0}),[i,M,x,$,z])}}function ue(e){return t=>{const n=e.safeParse(t);if(n.success)return{};const r={};for(const e of n.error?.issues??[]){const t=e.path.length>0?e.path.join("."):"_root";r[t]||(r[t]=e.message)}return r}}function fe(e,t){return n=>{const r=e(t,n);if(r.success)return{};const o={};for(const e of r.issues??[]){const t=(e.path??[]).map(e=>String(e.key)),n=t.length>0?t.join("."):"_root";o[n]||(o[n]=e.message)}return o}}!function(){if(ce)return;if("undefined"==typeof document)return;ce=!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 pe=(0,e.forwardRef)(({label:n,id:r,error:o,hint:i,leftAddon:l,rightAddon:a,isInvalid:s,isRequired:c,disabled:d,className:f,style:p,unicodeSafe:h=!0,onChange:g,...m},b)=>{const y=u(),w=(0,e.useId)(),v=r??w,k=`${v}-hint`,$=`${v}-error`,S=s||!!o,z=[i&&k,S&&$].filter(Boolean).join(" ")||void 0,C=x(n),D=o?x(o):void 0,F=i?x(i):void 0,j=S?y.danger:y.border;return(0,t.jsxs)("div",{className:le(ie("flex flex-col gap-1 w-full"),f),style:p,children:[(0,t.jsxs)("label",{htmlFor:v,className:ie("text-sm font-medium font-sans"),style:{color:y.text},children:[C,c&&(0,t.jsx)("span",{"aria-hidden":"true",className:ie("ml-1"),style:{color:y.danger},children:"*"})]}),(0,t.jsxs)("div",{className:ie("flex items-center rounded-lg overflow-hidden","transition-colors duration-150",d?"opacity-60":""),style:{border:`1.5px solid ${j}`,backgroundColor:y.surface},children:[l&&(0,t.jsx)("div",{className:ie("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:y.surfaceAlt,color:y.textMuted,borderRight:`1px solid ${y.border}`},children:l}),(0,t.jsx)("input",{ref:b,id:v,"aria-invalid":S,"aria-required":c,"aria-describedby":z,disabled:d,className:le(ie("flex-1 border-none bg-transparent text-sm font-sans py-2.5 px-3 outline-none min-w-0 focus-visible:focus-ring")),style:{color:y.text},onChange:h?e=>{const t=M(e.target.value);t!==e.target.value&&(e.target.value=t),g?.(e)}:g,...m}),a&&(0,t.jsx)("div",{className:ie("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:y.surfaceAlt,color:y.textMuted,borderLeft:`1px solid ${y.border}`},children:a})]}),F&&!D&&(0,t.jsx)("span",{id:k,className:ie("text-xs"),style:{color:y.textMuted},children:F}),D&&(0,t.jsxs)("span",{id:$,role:"alert",className:ie("text-xs flex items-center gap-1"),style:{color:y.danger},children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),D]})]})});pe.displayName="TkxInput";var he={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 xe(e){return void 0===e?[]:Array.isArray(e)?e:[e]}function ge({size:e,color:n}){return(0,t.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",style:{animation:"tkx-spin 0.7s linear infinite"},children:[(0,t.jsx)("style",{children:"@keyframes tkx-spin{to{transform:rotate(360deg)}}"}),(0,t.jsx)("path",{d:"M12 2a10 10 0 0 1 10 10"})]})}function me({options:r,value:o,defaultValue:i,placeholder:l,size:a="md",isDisabled:s=!1,isInvalid:c=!1,label:d,hint:f,errorMessage:h,multiple:g=!1,searchable:m=!1,clearable:b=!1,isLoading:y=!1,onChange:w,renderOption:v,maxMenuHeight:k=280,virtualScroll:$,optionHeight:S=36,id:z,className:C,style:D}){const M=u(),F=p(),j=l??F.selectPlaceholder,T=(0,e.useId)(),A=z??T,I=`${A}-listbox`,N=`${A}-hint`,W=`${A}-error`,O=void 0!==o,[L,R]=(0,e.useState)(xe(i)),V=O?xe(o):L,[B,E]=(0,e.useState)(!1),[H,P]=(0,e.useState)(""),[Y,q]=(0,e.useState)(-1),[U,_]=(0,e.useState)(null),[J,Z]=(0,e.useState)(""),K=(0,e.useRef)(null),X=(0,e.useRef)(null),G=(0,e.useRef)(null),Q=(0,e.useRef)(null),ee=(0,e.useRef)(null),te=he[a],ne=c||!!h,re=(0,e.useRef)(null),[oe,ae]=(0,e.useState)(0),[se,ce]=(0,e.useState)(0),de=(0,e.useCallback)(()=>{re.current&&ae(re.current.scrollTop)},[]);(0,e.useEffect)(()=>{if(!B)return void ae(0);const e=re.current;if(!e)return;ce(e.clientHeight);const t=new ResizeObserver(()=>{ce(e.clientHeight)});return t.observe(e),()=>t.disconnect()},[B]);const ue=m&&H?r.filter(e=>e.label.toLowerCase().includes(H.toLowerCase())):r,fe=ue.filter(e=>!e.disabled),pe=ue.some(e=>!!e.group),me=(void 0!==$?$:ue.length>=100)&&!pe,be=ue.length*S,ye=me?Math.max(0,Math.floor(oe/S)-8):0,we=me?Math.min(ue.length,Math.ceil((oe+se)/S)+8):ue.length,ve=me?ue.slice(ye,we):ue,ke=ye*S,$e=ue.reduce((e,t)=>{const n=t.group??"";return e[n]||(e[n]=[]),e[n].push(t),e},{}),Se=(0,e.useCallback)(e=>{let t;t=g?V.includes(e)?V.filter(t=>t!==e):[...V,e]:[e],O||R(t),w?.(g?t:t[0]??""),g||(E(!1),P(""),q(-1),X.current?.focus())},[O,g,w,V]),ze=(0,e.useCallback)((e,t)=>{t.stopPropagation();const n=V.filter(t=>t!==e);O||R(n),w?.(g?n:n[0]??"")},[O,g,w,V]),Ce=(0,e.useCallback)(e=>{e.stopPropagation(),O||R([]),w?.(g?[]:"")},[O,g,w]),De=(0,e.useCallback)(()=>{X.current&&B&&_(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}}(X.current,k))},[B,k]);function Me(){if(s||y)return;E(!0);const e=fe.findIndex(e=>V.includes(e.value));q(e>=0?e:0)}(0,e.useEffect)(()=>{if(B)return De(),window.addEventListener("scroll",De,!0),window.addEventListener("resize",De),()=>{window.removeEventListener("scroll",De,!0),window.removeEventListener("resize",De)}},[B,De]),(0,e.useEffect)(()=>{if(!B)return;const e=e=>{const t=e.target;X.current?.contains(t)||Q.current?.contains(t)||(E(!1),P(""))};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[B]),(0,e.useEffect)(()=>{B&&m&&setTimeout(()=>G.current?.focus(),0)},[B,m]),(0,e.useEffect)(()=>{if(B&&!(Y<0))if(me&&re.current){const e=Y*S,t=e+S,n=re.current;e<n.scrollTop?n.scrollTop=e:t>n.scrollTop+n.clientHeight&&(n.scrollTop=t-n.clientHeight)}else(ee.current?.querySelector(`[data-idx="${Y}"]`))?.scrollIntoView({block:"nearest"})},[Y,B,me,S]);const Fe=ne?M.danger:B?M.primary:M.border,je=Y>=0&&fe[Y]?`${A}-opt-${fe[Y].value}`:void 0,Te=[f&&N,ne&&W].filter(Boolean).join(" ")||void 0,Ae=V.map(e=>r.find(t=>t.value===e)).filter(Boolean),Ie=B&&U?(0,n.createPortal)((0,t.jsxs)("div",{ref:Q,role:"listbox",id:I,"aria-label":d?x(d):"Options","aria-multiselectable":g,style:{position:"absolute",top:U.top,left:U.left,width:U.width,zIndex:9999,backgroundColor:M.surface,border:`1.5px solid ${M.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:U.width,maxHeight:k,display:"flex",flexDirection:"column"},children:[m&&(0,t.jsxs)("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${M.border}`,flexShrink:0,display:"flex",alignItems:"center",gap:6},children:[(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:M.textMuted,strokeWidth:"2","aria-hidden":"true",style:{flexShrink:0},children:[(0,t.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,t.jsx)("path",{d:"M21 21l-4.35-4.35"})]}),(0,t.jsx)("input",{ref:G,type:"text",value:H,onChange:e=>{P(e.target.value),q(0)},onKeyDown:e=>{switch(e.key){case"Escape":e.preventDefault(),E(!1),P(""),X.current?.focus();break;case"ArrowDown":e.preventDefault(),q(e=>Math.min(e+1,fe.length-1));break;case"ArrowUp":e.preventDefault(),q(e=>Math.max(e-1,0));break;case"Home":e.preventDefault(),q(0);break;case"End":e.preventDefault(),q(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:M.text,fontSize:te.fontSize,fontFamily:"inherit",width:"100%"}})]}),(0,t.jsx)("div",{ref:e=>{ee.current=e,re.current=e},onScroll:me?de:void 0,style:{overflowY:"auto",flexGrow:1,maxHeight:k-(m?48:0)},children:me?(0,t.jsxs)("div",{style:{height:be,position:"relative"},children:[(0,t.jsx)("div",{style:{position:"absolute",top:ke,left:0,right:0},children:ve.map(e=>{const n=fe.indexOf(e),r=n===Y,o=V.includes(e.value),i=v?v(e,o):(0,t.jsxs)("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[(0,t.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.icon&&(0,t.jsx)("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),(0,t.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x(e.label)})]}),e.description&&(0,t.jsx)("span",{style:{fontSize:"12px",color:M.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x(e.description)})]});return(0,t.jsxs)("div",{id:`${A}-opt-${e.value}`,"data-idx":n>=0?n:void 0,role:"option","aria-selected":o,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&Se(e.value),onMouseEnter:()=>!e.disabled&&n>=0&&q(n),style:{height:S,boxSizing:"border-box",padding:`0 ${te.px}`,fontSize:te.fontSize,fontFamily:"inherit",color:e.disabled?M.textMuted:M.text,backgroundColor:r?`${M.primary}22`:o?`${M.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:[i,o&&!v&&(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:M.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:(0,t.jsx)("path",{d:"M20 6L9 17l-5-5"})})]},e.value)})}),0===ue.length&&(0,t.jsx)("div",{style:{padding:`${te.py} ${te.px}`,fontSize:te.fontSize,fontFamily:"inherit",color:M.textMuted,textAlign:"center",position:"absolute",top:0,left:0,right:0},children:y?"Loading…":"No options found"})]}):(0,t.jsxs)(t.Fragment,{children:[Object.entries($e).map(([e,n])=>(0,t.jsxs)("div",{children:[e&&(0,t.jsx)("div",{"aria-hidden":"true",style:{padding:"8px 12px 4px",fontSize:"11px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:M.textMuted,fontFamily:"inherit",position:"sticky",top:0,backgroundColor:M.surface,zIndex:1,borderBottom:`1px solid ${M.border}`},children:x(e)}),n.map(e=>{const n=fe.indexOf(e),r=n===Y,o=V.includes(e.value),i=v?v(e,o):(0,t.jsxs)("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[(0,t.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.icon&&(0,t.jsx)("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),(0,t.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x(e.label)})]}),e.description&&(0,t.jsx)("span",{style:{fontSize:"12px",color:M.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x(e.description)})]});return(0,t.jsxs)("div",{id:`${A}-opt-${e.value}`,"data-idx":n>=0?n:void 0,role:"option","aria-selected":o,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&Se(e.value),onMouseEnter:()=>!e.disabled&&n>=0&&q(n),style:{padding:`${te.py} ${te.px}`,fontSize:te.fontSize,fontFamily:"inherit",color:e.disabled?M.textMuted:M.text,backgroundColor:r?`${M.primary}22`:o?`${M.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:[i,o&&!v&&(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:M.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:(0,t.jsx)("path",{d:"M20 6L9 17l-5-5"})})]},e.value)})]},e)),0===ue.length&&(0,t.jsx)("div",{style:{padding:`${te.py} ${te.px}`,fontSize:te.fontSize,fontFamily:"inherit",color:M.textMuted,textAlign:"center"},children:y?"Loading…":"No options found"})]})})]}),document.body):null,Ne=b&&V.length>0&&!s&&!y;return(0,t.jsxs)("div",{className:le(ie("flex flex-col gap-1 w-full"),C),style:D,children:[d&&(0,t.jsx)("label",{htmlFor:A,style:{fontSize:"14px",fontWeight:500,fontFamily:"inherit",color:M.text,userSelect:"none"},children:x(d)}),(0,t.jsx)("div",{style:{position:"relative",width:"100%",opacity:s?.55:1},children:(0,t.jsxs)("button",{ref:X,id:A,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":B,"aria-controls":I,"aria-activedescendant":je,"aria-invalid":ne||void 0,"aria-describedby":Te,"aria-multiselectable":g,disabled:s,onClick:()=>B?E(!1):Me(),onKeyDown:e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),B?Y>=0&&fe[Y]&&Se(fe[Y].value):Me();break;case"Escape":e.preventDefault(),E(!1),P("");break;case"ArrowDown":e.preventDefault(),B?q(e=>Math.min(e+1,fe.length-1)):Me();break;case"ArrowUp":e.preventDefault(),B?q(e=>Math.max(e-1,0)):Me();break;case"Home":e.preventDefault(),B&&q(0);break;case"End":e.preventDefault(),B&&q(fe.length-1);break;default:1!==e.key.length||e.ctrlKey||e.metaKey||(B||Me(),function(e){K.current&&clearTimeout(K.current);const t=J+e.toLowerCase();Z(t);const n=fe.findIndex(e=>e.label.toLowerCase().startsWith(t));n>=0&&q(n),K.current=setTimeout(()=>Z(""),800)}(e.key))}},style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:g&&V.length>0?`4px ${te.px}`:`${te.py} ${te.px}`,fontSize:te.fontSize,fontFamily:"inherit",backgroundColor:M.surface,color:V.length>0?M.text:M.textMuted,border:`1.5px solid ${Fe}`,borderRadius:8,boxSizing:"border-box",transition:"border-color 150ms",textAlign:"left",cursor:s?"not-allowed":"pointer",outline:"none",minHeight:"sm"===a?34:"lg"===a?50:42,flexWrap:"wrap",touchAction:"manipulation"},children:[(0,t.jsx)("span",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4,flex:1,minWidth:0},children:g&&Ae.length>0?Ae.map(e=>(0,t.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:`${te.tagPy} ${te.tagPx}`,fontSize:`calc(${te.fontSize} - 1px)`,fontFamily:"inherit",backgroundColor:`${M.primary}22`,color:M.primary,borderRadius:6,border:`1px solid ${M.primary}44`,lineHeight:1.4,maxWidth:150,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[(0,t.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},children:x(e.label)}),(0,t.jsx)("span",{role:"button","aria-label":`Remove ${x(e.label)}`,tabIndex:-1,onClick:t=>ze(e.value,t),style:{cursor:"pointer",flexShrink:0,display:"flex",alignItems:"center",opacity:.8},children:(0,t.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]},e.value)):!g&&V.length>0?(()=>{const e=r.find(e=>e.value===V[0]);return(0,t.jsxs)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},children:[e?.icon&&(0,t.jsx)("span",{style:{flexShrink:0,display:"flex"},children:e.icon}),e?x(e.label):""]})})():(0,t.jsx)("span",{style:{opacity:.6},children:x(j)})}),(0,t.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,color:M.textMuted},children:[y&&(0,t.jsx)(ge,{size:te.iconSize,color:M.primary}),Ne&&!y&&(0,t.jsx)("span",{role:"button","aria-label":F.clearSelection,tabIndex:-1,onClick:Ce,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:(0,t.jsx)("svg",{width:te.iconSize,height:te.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})}),(0,t.jsx)("svg",{width:te.iconSize,height:te.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",style:{transform:B?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms",flexShrink:0},children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})]})]})}),f&&!ne&&(0,t.jsx)("span",{id:N,style:{fontSize:"12px",color:M.textMuted,fontFamily:"inherit"},children:x(f)}),ne&&h&&(0,t.jsxs)("span",{id:W,role:"alert",style:{fontSize:"12px",color:M.danger,display:"flex",alignItems:"center",gap:4,fontFamily:"inherit"},children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),x(h)]}),Ie]})}me.displayName="TkxSelect";var be={sm:{box:16,fontSize:"13px",iconStroke:2.5},md:{box:20,fontSize:"14px",iconStroke:2.5},lg:{box:24,fontSize:"15px",iconStroke:2}},ye=(0,e.forwardRef)(({label:n,hint:r,isInvalid:o,errorMessage:l,isIndeterminate:s=!1,size:c="md",colorScheme:d="primary",checked:f,defaultChecked:p,onChange:h,disabled:g,className:m,style:b,id:y,...w},v)=>{const k=u(),$=a(),S=(0,e.useId)(),z=y??S,C=`${z}-hint`,D=`${z}-error`,M=(0,e.useRef)(null),[F,j]=(0,e.useState)(!1),T=be[c],A=o||!!l,I={primary:k.primary,success:k.success,danger:k.danger,warning:k.warning}[d]??k.primary,N=void 0!==f?f:void 0;(0,e.useEffect)(()=>{const e=v?.current??M.current;e&&(e.indeterminate=s)},[s,v]);const W=s||(N??!1),O=W?I:k.surface,L=A?k.danger:W?I:k.border,R=i(I),V=F?{outline:`2px solid ${I}`,outlineOffset:"2px"}:{},B=[r&&C,A&&D].filter(Boolean).join(" ")||void 0,E=!$&&W?{animation:"tkx-check-scale-in 120ms ease forwards"}:{};return(0,t.jsxs)("div",{className:le(ie("flex flex-col gap-1"),m),style:{opacity:g?.5:1,...b},children:[(0,t.jsx)("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 "}),(0,t.jsxs)("label",{htmlFor:z,className:ie("flex items-center gap-2 select-none"),style:{cursor:g?"not-allowed":"pointer",fontFamily:"inherit"},children:[(0,t.jsx)("input",{ref:e=>{M.current=e,"function"==typeof v?v(e):v&&(v.current=e)},id:z,type:"checkbox",checked:f,defaultChecked:p,onChange:h,disabled:g,"aria-invalid":A,"aria-describedby":B,onFocus:e=>{e.target.matches(":focus-visible")&&j(!0)},onBlur:()=>j(!1),className:ie("sr-only"),...w}),(0,t.jsx)("span",{"aria-hidden":"true",style:{width:T.box,height:T.box,minWidth:T.box,borderRadius:"4px",border:`2px solid ${L}`,backgroundColor:O,display:"flex",alignItems:"center",justifyContent:"center",transition:$?"none":"background-color 120ms, border-color 120ms",boxSizing:"border-box",...V},children:s?(0,t.jsx)("span",{"aria-hidden":"true",style:{display:"block",width:.5*T.box,height:2,backgroundColor:R,borderRadius:"1px",...E}}):W?(0,t.jsx)("svg",{width:.6*T.box,height:.6*T.box,viewBox:"0 0 24 24",fill:"none",stroke:R,strokeWidth:T.iconStroke,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:E,children:(0,t.jsx)("path",{d:"M20 6L9 17l-5-5"})}):null}),n&&(0,t.jsx)("span",{style:{fontSize:T.fontSize,color:k.text,lineHeight:1.4},children:"string"==typeof n?x(n):n})]}),r&&!A&&(0,t.jsx)("span",{id:C,className:ie("text-xs ml-7"),style:{color:k.textMuted,marginLeft:T.box+8},children:x(r)}),A&&l&&(0,t.jsxs)("span",{id:D,role:"alert",className:ie("text-xs flex items-center gap-1"),style:{color:k.danger,marginLeft:T.box+8},children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),x(l)]})]})});ye.displayName="TkxCheckbox";var we={sm:{tw:28,th:16,td:10,gap:3},md:{tw:40,th:22,td:14,gap:4},lg:{tw:52,th:28,td:18,gap:5}},ve=(0,e.forwardRef)(({checked:n,onChange:r,label:o,size:i="md",hideLabel:l,disabled:s,className:c,style:d,...f},p)=>{const h=u(),x=a(),g=(0,e.useId)();!function(e){const t=[];for(const[n,r]of Object.entries({label:{type:"string",required:!0},checked:{type:"boolean",required:!0}})){const o=e[n],i=null==o;r.required&&i?t.push(`prop '${n}' is required`):i||(typeof o===r.type?("number"===r.type&&"number"==typeof o&&(void 0!==r.min&&o<r.min&&t.push(`prop '${n}' must be >= ${r.min}`),void 0!==r.max&&o>r.max&&t.push(`prop '${n}' must be <= ${r.max}`)),"string"===r.type&&"string"==typeof o&&r.pattern&&!r.pattern.test(o)&&t.push(`prop '${n}' does not match pattern ${r.pattern}`),r.enum&&!r.enum.includes(o)&&t.push(`prop '${n}' must be one of: ${r.enum.join(", ")}`)):t.push(`prop '${n}' must be of type ${r.type}, got ${typeof o}`))}t.length}({label:o,checked:n});const{tw:m,th:b,td:y,gap:w}=we[i],v=n?m-y-w:w,k=n?h.primary:h.border;return(0,t.jsxs)("div",{className:le(ie("inline-flex items-center gap-2",s?"opacity-50":""),c),style:d,children:[!l&&(0,t.jsx)("label",{htmlFor:g,className:ie("text-sm font-sans",s?"cursor-not-allowed":"cursor-pointer","select-none"),style:{color:h.text},children:o}),(0,t.jsx)("button",{ref:p,id:g,role:"switch","aria-checked":n,"aria-label":l?o:void 0,disabled:s,onClick:()=>!s&&r(!n),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||s||(e.preventDefault(),r(!n))},className:le(ie("relative border-none p-0 outline-none shrink-0 focus-visible:focus-ring",s?"cursor-not-allowed":"cursor-pointer",!x&&"transition-colors duration-200")),style:{width:m,height:b,borderRadius:b,backgroundColor:k},...f,children:(0,t.jsx)("span",{"aria-hidden":"true",className:ie("absolute rounded-full"),style:{top:"50%",left:v,width:y,height:y,transform:"translateY(-50%)",backgroundColor:"#ffffff",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",transition:x?"none":"left 200ms ease"}})})]})});ve.displayName="TkxToggle";var ke=(0,e.createContext)(null),$e={sm:{outer:16,inner:7,fontSize:"13px"},md:{outer:20,inner:9,fontSize:"14px"},lg:{outer:24,inner:11,fontSize:"15px"}},Se=(0,e.forwardRef)(({label:n,hint:r,size:o="md",colorScheme:l="primary",value:s,checked:c,onChange:d,disabled:f,name:p,className:h,style:g,id:m,...b},y)=>{const w=u(),v=a(),k=(0,e.useId)(),$=m??k,S=(0,e.useContext)(ke),z=S?S.value===String(s??""):c??!1,C=f??S?.isDisabled??!1,D=p??S?.name??"",M=$e[o],F={primary:w.primary,success:w.success,danger:w.danger}[l]??w.primary;i(F);const j=z?F:w.border,T=w.surface;return(0,t.jsxs)("div",{className:le(ie("flex flex-col gap-0.5"),h),style:{opacity:C?.5:1,...g},children:[(0,t.jsx)("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 "}),(0,t.jsxs)("label",{htmlFor:$,className:ie("flex items-center gap-2 select-none"),style:{cursor:C?"not-allowed":"pointer",fontFamily:"inherit"},children:[(0,t.jsx)("input",{ref:y,id:$,type:"radio",name:D,value:s,checked:z,onChange:()=>{C||(S?S.onChange(String(s??"")):d?.({target:{value:String(s??"")}}))},disabled:C,"aria-invalid":S?.isInvalid,className:ie("sr-only"),...b}),(0,t.jsx)("span",{"aria-hidden":"true",style:{position:"relative",width:M.outer,height:M.outer,minWidth:M.outer,borderRadius:"50%",border:`2px solid ${j}`,backgroundColor:T,display:"inline-block",boxSizing:"border-box",transition:v?"none":"border-color 120ms"},children:z&&(0,t.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",width:M.inner,height:M.inner,borderRadius:"50%",backgroundColor:F,transform:"translate(-50%, -50%)",transformOrigin:"center",...v?{}:{animation:"tkx-radio-dot-in 130ms ease forwards"}}})}),n&&(0,t.jsx)("span",{style:{fontSize:M.fontSize,color:w.text,lineHeight:1.4},children:"string"==typeof n?x(n):n})]}),r&&(0,t.jsx)("span",{className:ie("text-xs"),style:{color:w.textMuted,marginLeft:M.outer+8},children:x(r)})]})});Se.displayName="TkxRadio";var ze={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 Ce(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 De(e,t){if(void 0===t)return e;const n=Math.pow(10,t);return Math.round(e*n)/n}function Me({direction:n,isDisabled:r,btnW:o,height:i,primaryColor:l,borderColor:a,textMuted:s,iconSz:c,onStep:d,incrementLabel:u,decrementLabel:f}){const p=(0,e.useRef)(null),h=(0,e.useRef)(null),x="inc"===n?1:-1,g=(0,e.useCallback)(()=>{d(x),p.current=setTimeout(()=>{h.current=setInterval(()=>d(x),60)},400)},[x,d]),m=(0,e.useCallback)(()=>{p.current&&(clearTimeout(p.current),p.current=null),h.current&&(clearInterval(h.current),h.current=null)},[]);(0,e.useEffect)(()=>()=>m(),[m]);const b="inc"===n;return(0,t.jsx)("button",{type:"button","aria-label":b?u:f,disabled:r,onMouseDown:g,onMouseUp:m,onMouseLeave:m,onTouchStart:e=>{e.preventDefault(),g()},onTouchEnd:m,style:{width:o,height:i,minWidth:o,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",borderRight:b?void 0:`1px solid ${a}`,borderLeft:b?`1px solid ${a}`:void 0,cursor:r?"not-allowed":"pointer",color:r?s:l,transition:"color 120ms ease, background 120ms ease",outline:"none"},onFocus:e=>{r||(e.currentTarget.style.background=`${l}12`)},onBlur:e=>{e.currentTarget.style.background="transparent"},children:b?(0,t.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[(0,t.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,t.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):(0,t.jsx)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:(0,t.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})}function Fe({value:n,defaultValue:r=0,onChange:o,min:i,max:l,step:a=1,precision:s,prefix:c,suffix:d,format:f,currency:h,locale:g,clampOnBlur:m=!0,allowMouseWheel:b=!1,size:y="md",label:w,hint:v,isDisabled:k=!1,isReadOnly:$=!1,isInvalid:S=!1,errorMessage:z,id:C,className:D,style:F}){const j=u(),T=p(),A=T.increment??"Increment",I=T.decrement??"Decrement",N=(0,e.useId)(),W=C??N,O=`${W}-hint`,L=`${W}-error`,R=void 0!==n,[V,B]=(0,e.useState)(r),E=R?n:V,[H,P]=(0,e.useState)(!1),[Y,q]=(0,e.useState)(""),U=ze[y],_=S||!!z,J=_?j.danger:H?j.primary:j.border,Z=[v&&O,_&&L].filter(Boolean).join(" ")||void 0,K=w?x(w):void 0,X=v?x(v):void 0,G=z?x(z):void 0,Q=c?x(c):void 0,ee=d?x(d):void 0,te=(0,e.useCallback)(e=>{const t=De(e,s);R||B(t),o?.(t)},[R,o,s]),ne=(0,e.useCallback)(e=>{k||$||te(Ce(De(E+e*a,s),i,l))},[k,$,E,a,s,i,l,te]),re=H?Y: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)}(E,f,h,g,s),oe=(Q||ee)&&!H;return(0,t.jsxs)("div",{className:le(ie("flex flex-col gap-1 w-full"),D),style:F,children:[K&&(0,t.jsx)("label",{htmlFor:W,className:ie("text-sm font-medium font-sans"),style:{color:j.text},children:K}),(0,t.jsxs)("div",{className:ie("flex items-stretch overflow-hidden rounded-lg transition-colors duration-150"),style:{border:`1.5px solid ${J}`,backgroundColor:k?j.surfaceAlt:j.surface,opacity:k?.65:1,height:U.height},children:[(0,t.jsx)(Me,{direction:"dec",isDisabled:k||$,btnW:U.btnW,height:U.height,primaryColor:j.primary,borderColor:j.border,textMuted:j.textMuted,iconSz:U.iconSz,onStep:ne,incrementLabel:A,decrementLabel:I}),(0,t.jsxs)("div",{className:ie("relative flex-1 flex items-center overflow-hidden"),children:[oe&&Q&&(0,t.jsx)("span",{style:{position:"absolute",left:U.px,fontSize:U.fontSize,color:j.textMuted,pointerEvents:"none",userSelect:"none"},children:Q}),(0,t.jsx)("input",{id:W,type:"text",inputMode:"decimal",value:H?Y:re,readOnly:$,disabled:k,"aria-invalid":_,"aria-describedby":Z,"aria-valuemin":i,"aria-valuemax":l,"aria-valuenow":E,style:{width:"100%",height:"100%",border:"none",background:"transparent",outline:"none",textAlign:"center",fontSize:U.fontSize,fontFamily:"inherit",color:j.text,paddingLeft:oe&&Q?`calc(${U.px} + 1.2em)`:U.px,paddingRight:oe&&ee?`calc(${U.px} + 1.2em)`:U.px,cursor:k?"not-allowed":$?"default":"text"},onFocus:()=>{P(!0),q(String(E))},onBlur:()=>{P(!1);const e=parseFloat(Y);if(isNaN(e))return o?.(null),void q(String(E));let t=De(e,s);m&&(t=Ce(t,i,l)),te(t)},onChange:e=>{q(M(e.target.value))},onKeyDown:e=>{"ArrowUp"===e.key&&(e.preventDefault(),ne(1)),"ArrowDown"===e.key&&(e.preventDefault(),ne(-1))},onWheel:e=>{b&&H&&(e.preventDefault(),ne(e.deltaY<0?1:-1))}}),oe&&ee&&(0,t.jsx)("span",{style:{position:"absolute",right:U.px,fontSize:U.fontSize,color:j.textMuted,pointerEvents:"none",userSelect:"none"},children:ee})]}),(0,t.jsx)(Me,{direction:"inc",isDisabled:k||$,btnW:U.btnW,height:U.height,primaryColor:j.primary,borderColor:j.border,textMuted:j.textMuted,iconSz:U.iconSz,onStep:ne,incrementLabel:A,decrementLabel:I})]}),X&&!G&&(0,t.jsx)("span",{id:O,className:ie("text-xs"),style:{color:j.textMuted},children:X}),G&&(0,t.jsxs)("span",{id:L,role:"alert",className:ie("text-xs flex items-center gap-1"),style:{color:j.danger},children:[(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),G]})]})}Fe.displayName="TkxNumberInput";var je=["Su","Mo","Tu","We","Th","Fr","Sa"],Te=["January","February","March","April","May","June","July","August","September","October","November","December"],Ae=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ie(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Ne(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function We(e,t,n){return!(!t||!Ie(e,t))||!(!n||!Ie(e,n))}function Oe(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"),l=Ae[e.getMonth()],a=Te[e.getMonth()],s=e.getDate(),c=String(s).padStart(2,"0");return n.replace(/YYYY/g,t).replace(/YY/g,r).replace(/MMMM/g,a).replace(/MMM/g,l).replace(/MM/g,i).replace(/\bM\b/g,String(o)).replace(/DD/g,c).replace(/\bD\b/g,String(s))}return e.toLocaleDateString(t,{month:"2-digit",day:"2-digit",year:"numeric"})}function Le(e,t){return new Date(e,t+1,0).getDate()}function Re(e){return 10*Math.floor(e/10)}function Ve({values:n,selected:r,onSelect:o,label:i,theme:l,format:a}){const s=(0,e.useRef)([]),c=(0,e.useRef)(null);(0,e.useEffect)(()=>{const e=s.current[r];e&&c.current&&e.scrollIntoView({block:"nearest"})},[r]);const d=a??(e=>String(e).padStart(2,"0"));return(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[(0,t.jsx)("div",{style:{fontSize:"11px",fontWeight:600,color:l.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:i}),(0,t.jsx)("div",{ref:c,style:{height:"160px",overflowY:"auto",width:"52px",scrollbarWidth:"thin",border:`1px solid ${l.border}`,borderRadius:"8px",padding:"4px"},children:n.map(e=>{const n=e===r;return(0,t.jsx)("button",{ref:t=>{s.current[e]=t},type:"button",onClick:()=>o(e),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"32px",borderRadius:"6px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:n?600:400,backgroundColor:n?l.primary:"transparent",color:n?l.bg:l.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:d(e)},e)})})]})}function Be({year:e,month:n,today:r,mode:o,selectedDate:i,selectedRange:l,multiDates:a,hoverDate:s,focusedDate:c,isDateDisabled:d,onSelectDate:u,onHoverDate:f,onSetFocused:p,theme:h,locale:x}){const g=function(e,t){const n=new Date(e,t,1).getDay(),r=Le(e,t),o=[],i=Le(e,t-1);for(let a=n-1;a>=0;a--)o.push(new Date(e,t-1,i-a));for(let a=1;a<=r;a++)o.push(new Date(e,t,a));let l=1;for(;o.length<42;)o.push(new Date(e,t+1,l++));return o}(e,n);return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:je.map(e=>(0,t.jsx)("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:h.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:e},e))}),(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:g.map((e,g)=>{const m=e.getMonth()===n,b=Ie(e,r),y=0===e.getDay()||6===e.getDay(),w=d(e),v="single"===o&&null!=i&&Ie(e,i),k="multiple"===o&&a.some(t=>Ie(t,e)),$="range"===o&&We(e,l[0],null),S="range"===o&&We(e,null,l[1]),z=$||S,C="range"===o&&l[0]&&!l[1]&&s?s:l[1],D="range"===o&&function(e,t,n){if(!t||!n)return!1;const r=Ne(e).getTime(),o=Ne(t).getTime(),i=Ne(n).getTime();return r>Math.min(o,i)&&r<Math.max(o,i)}(e,l[0],C),M="range"===o&&l[0]&&!l[1]&&s&&Ie(e,s),F=v||k||z,j=null!=c&&Ie(e,c);let T="transparent",A=m?y?`${h.text}cc`:h.text:`${h.textMuted}60`,I="none",N=400;return F||M?(T=h.primary,A=h.bg,N=600):D&&(T=`${h.primary}18`),b&&!F&&(I=`2px solid ${h.primary}`,N=600),w&&(A=`${h.textMuted}50`),j&&!F&&(I=`2px solid ${h.secondary}`),(0,t.jsx)("button",{type:"button","aria-label":e.toLocaleDateString(x,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),"aria-pressed":F,"aria-disabled":w,disabled:w,onClick:()=>!w&&u(e),onMouseEnter:()=>f(e),onMouseLeave:()=>f(null),onFocus:()=>p(e),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:T,color:A,border:I,fontSize:"13px",fontWeight:N,cursor:w?"not-allowed":"pointer",opacity:w?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:w?"line-through":"none",transition:"background-color 80ms ease"},children:e.getDate()},g)})})]})}function Ee({value:r,onChange:o,rangeValue:i,onRangeChange:l,multiValue:s,onMultiChange:c,mode:d="single",minDate:f,maxDate:h,disabledDates:g,locale:m="en-US",dateFormat:b,showTime:y=!1,timeValue:w,onTimeChange:v,showPresets:k=!1,customPresets:$,label:S,placeholder:z="MM/DD/YYYY",hint:C,isDisabled:D=!1,isInvalid:M=!1,errorMessage:F,numberOfMonths:j=1,id:T,className:A,style:I}){const N=u(),W=p(),O=(0,e.useId)(),L=T??O,R=a(),V=Ne(new Date),B=void 0!==r,[E,H]=(0,e.useState)(null),P=B?r??null:E,Y=void 0!==i,[q,U]=(0,e.useState)([null,null]),_=Y?i:q,J=void 0!==s,[Z,K]=(0,e.useState)([]),X=J?s:Z,[G,Q]=(0,e.useState)("start"),ee="range"===d||"single"===d&&y,[te,ne]=(0,e.useState)([null,null]),[re,oe]=(0,e.useState)(null),ie=P??_[0]??V,[le,ae]=(0,e.useState)(ie.getFullYear()),[se,ce]=(0,e.useState)(ie.getMonth()),[de,ue]=(0,e.useState)("day"),[fe,pe]=(0,e.useState)({h:0,m:0}),he=w??fe,[xe,ge]=(0,e.useState)(!1),[me,be]=(0,e.useState)(()=>{if("single"===d)return Oe(P,m,b);if("range"===d){const[e,t]=_;if(e&&t)return`${Oe(e,m,b)} – ${Oe(t,m,b)}`}return""}),[ye,we]=(0,e.useState)(null),[ve,ke]=(0,e.useState)(null),[$e,Se]=(0,e.useState)({top:0,left:0,flipUp:!1}),[,ze]=(0,e.useReducer)(e=>e+1,0),Ce=(0,e.useRef)(null),De=(0,e.useRef)(null),Me=(0,e.useRef)(null),Fe=(0,e.useRef)(!1),je=k?420:y?480:360;(0,e.useEffect)(()=>{if("single"===d)be(Oe(P,m,b));else if("range"===d){const[e,t]=_;be(e&&t?`${Oe(e,m,b)} – ${Oe(t,m,b)}`:e?Oe(e,m,b):"")}else"multiple"===d&&be(X.length>0?`${X.length} date${1!==X.length?"s":""} selected`:"")},[P,_,X,d,m,b]);const We=(0,e.useCallback)(()=>{Ce.current&&Se(function(e,t){const n=e.getBoundingClientRect(),r=window.innerHeight,o=window.scrollY,i=window.scrollX,l=r-n.bottom<t+8&&n.top>t+8;return{top:l?o+n.top-t-4:o+n.bottom+4,left:i+n.left,flipUp:l}}(Ce.current,je))},[je]);(0,e.useEffect)(()=>{if(xe)return We(),window.addEventListener("scroll",We,!0),window.addEventListener("resize",We),()=>{window.removeEventListener("scroll",We,!0),window.removeEventListener("resize",We)}},[xe,We]),(0,e.useEffect)(()=>{if(!xe)return;const e=e=>{Ce.current?.contains(e.target)||De.current?.contains(e.target)||ge(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[xe]),(0,e.useEffect)(()=>{if(!xe)return;const e=e=>{"Escape"===e.key&&(ge(!1),Fe.current=!0,Me.current?.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[xe]);const Le=(0,e.useCallback)(e=>!!(f&&Ne(e)<Ne(f))||!!(h&&Ne(e)>Ne(h))||!!g&&("function"==typeof g?g(e):g.some(t=>Ie(t,e))),[f,h,g]),Ee=(0,e.useCallback)(e=>{if(!Le(e)){if("single"===d)ee?oe(e):(B||H(e),o?.(e),be(Oe(e,m,b)),ge(!1));else if("range"===d)if("start"===G){const t=[e,null];ne(t),Y||U(t),l?.(t),Q("end")}else{const t=te[0]??_[0],n=t&&e<t?[e,t]:[t,e];ne(n),ee?Q("start"):(Y||U(n),l?.(n),Q("start"),ge(!1))}else if("multiple"===d){const t=X.some(t=>Ie(t,e))?X.filter(t=>!Ie(t,e)):[...X,e];J||K(t),c?.(t)}ze()}},[d,Le,B,Y,J,o,l,c,G,te,_,X,ee,m]),He=(0,e.useCallback)(()=>{if("single"===d){const e=re??P;B||H(e),o?.(e)}else"range"===d&&(Y||U(te),l?.(te));ge(!1),Q("start")},[d,re,te,P,B,Y,o,l]),Pe=(0,e.useCallback)(()=>{oe(null),ne([null,null]),Q("start"),ge(!1)},[]),Ye=$??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=Ne(new Date);return[e,e]}},{label:t.yesterday,getValue:()=>{const e=Ne(new Date);return e.setDate(e.getDate()-1),[e,e]}},{label:t.last7,getValue:()=>{const e=Ne(new Date),t=new Date(e);return t.setDate(t.getDate()-6),[t,e]}},{label:t.last30,getValue:()=>{const e=Ne(new Date),t=new Date(e);return t.setDate(t.getDate()-29),[t,e]}},{label:t.last90,getValue:()=>{const e=Ne(new Date),t=new Date(e);return t.setDate(t.getDate()-89),[t,e]}},{label:t.thisWeek,getValue:()=>{const e=Ne(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=Ne(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=new Date;return[new Date(e.getFullYear(),e.getMonth(),1),new Date(e.getFullYear(),e.getMonth()+1,0)]}},{label:t.lastMonth,getValue:()=>{const e=new Date;return[new Date(e.getFullYear(),e.getMonth()-1,1),new Date(e.getFullYear(),e.getMonth(),0)]}},{label:"This quarter",getValue:()=>{const e=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=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=(new Date).getFullYear();return[new Date(e,0,1),new Date(e,11,31)]}},{label:"Last year",getValue:()=>{const e=(new Date).getFullYear()-1;return[new Date(e,0,1),new Date(e,11,31)]}}]}(W),qe=11===se?0:se+1,Ue=11===se?le+1:le,_e=j>=2,Je=S?x(S):void 0,Ze=C?x(C):void 0,Ke=F?x(F):void 0,Xe=x(z),Ge="single"===d&&null!=P||"range"===d&&(null!=_[0]||null!=_[1])||"multiple"===d&&X.length>0,Qe="range"===d?ee?te:_:[null,null],et=M?N.danger:xe?N.primary:N.border,tt=Array.from({length:24},(e,t)=>t),nt=Array.from({length:60},(e,t)=>t),rt=(0,t.jsxs)("div",{ref:De,role:"dialog","aria-label":"Date picker","aria-modal":"false",onKeyDown:e=>{if("day"!==de)return;const t=ye??P??V;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&&ye)return void Ee(ye);n&&(e.preventDefault(),we(n),n.getMonth()===se&&n.getFullYear()===le||(ce(n.getMonth()),ae(n.getFullYear())))},style:{position:"absolute",top:$e.top,left:$e.left,zIndex:9999,backgroundColor:N.surface,border:`1px solid ${N.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:_e?"580px":"300px",maxWidth:_e&&k?"780px":_e?"620px":k?"520px":"300px",opacity:xe?1:0,transform:xe?"translateY(0) scale(1)":$e.flipUp?"translateY(4px) scale(0.98)":"translateY(-4px) scale(0.98)",transition:R?"none":"opacity 120ms ease, transform 120ms ease",fontFamily:"inherit"},children:[k&&"range"===d&&(0,t.jsxs)("div",{style:{width:"148px",flexShrink:0,borderRight:`1px solid ${N.border}`,padding:"8px 6px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"1px"},children:[(0,t.jsx)("div",{style:{fontSize:"11px",fontWeight:600,color:N.textMuted,textTransform:"uppercase",letterSpacing:"0.07em",padding:"4px 8px 8px"},children:"Quick select"}),Ye.map(e=>{const[n,r]=e.getValue(),o=Qe[0]&&Qe[1]&&Ie(Qe[0],n)&&Ie(Qe[1],r);return(0,t.jsx)("button",{type:"button",onClick:()=>(e=>{const[t,n]=e.getValue(),r=[t,n];ne(r),Y||U(r),l?.(r),ae(t.getFullYear()),ce(t.getMonth()),Q("start"),ee||ge(!1)})(e),style:{width:"100%",textAlign:"left",padding:"7px 10px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",backgroundColor:o?`${N.primary}20`:"transparent",color:o?N.primary:N.text,fontWeight:o?600:400,fontFamily:"inherit",transition:"background-color 80ms ease"},onMouseEnter:e=>{o||(e.currentTarget.style.backgroundColor=`${N.surfaceAlt}`)},onMouseLeave:e=>{o||(e.currentTarget.style.backgroundColor="transparent")},children:e.label},e.label)})]}),(0,t.jsxs)("div",{style:{flex:1,padding:"16px",display:"flex",flexDirection:"column",gap:"12px",minWidth:0},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("button",{type:"button","aria-label":"day"===de?"Previous month":"month"===de?"Previous year":"Previous decade",onClick:()=>{"day"===de?(0===se?(ce(11),ae(e=>e-1)):ce(e=>e-1),ue("day")):ae("month"===de?e=>e-1:e=>e-10)},style:{border:"none",background:"transparent",cursor:"pointer",color:N.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("polyline",{points:"15 18 9 12 15 6"})})}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:["day"===de&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:()=>ue("month"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:N.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:Te[se]}),(0,t.jsx)("button",{type:"button",onClick:()=>ue("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:N.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:le}),_e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{style:{color:N.textMuted,fontSize:"14px"},children:"–"}),(0,t.jsxs)("span",{style:{fontSize:"14px",fontWeight:600,color:N.text},children:[Te[qe]," ",Ue]})]})]}),"month"===de&&(0,t.jsx)("button",{type:"button",onClick:()=>ue("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:N.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:le}),"year"===de&&(0,t.jsxs)("span",{style:{fontSize:"14px",fontWeight:600,color:N.text},children:[Re(le),"–",Re(le)+9]})]}),(0,t.jsx)("button",{type:"button","aria-label":"day"===de?"Next month":"month"===de?"Next year":"Next decade",onClick:()=>{"day"===de?(11===se?(ce(0),ae(e=>e+1)):ce(e=>e+1),ue("day")):ae("month"===de?e=>e+1:e=>e+10)},style:{border:"none",background:"transparent",cursor:"pointer",color:N.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("polyline",{points:"9 18 15 12 9 6"})})})]}),"day"===de&&(0,t.jsxs)("div",{style:{display:"flex",gap:"20px"},children:[(0,t.jsx)(Be,{year:le,month:se,today:V,mode:d,selectedDate:P,selectedRange:Qe,multiDates:X,hoverDate:ve,focusedDate:ye,isDateDisabled:Le,onSelectDate:Ee,onHoverDate:ke,onSetFocused:we,theme:N,locale:m}),_e&&(0,t.jsx)(Be,{year:Ue,month:qe,today:V,mode:d,selectedDate:P,selectedRange:Qe,multiDates:X,hoverDate:ve,focusedDate:ye,isDateDisabled:Le,onSelectDate:Ee,onHoverDate:ke,onSetFocused:we,theme:N,locale:m})]}),"month"===de&&(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"6px"},children:Ae.map((e,n)=>{const r=n===se;return(0,t.jsx)("button",{type:"button",onClick:()=>{ce(n),ue("day")},style:{padding:"10px",borderRadius:"8px",border:n!==V.getMonth()||le!==V.getFullYear()||r?"none":`2px solid ${N.primary}`,cursor:"pointer",fontSize:"13px",fontWeight:r?600:400,backgroundColor:r?N.primary:"transparent",color:r?N.bg:N.text,fontFamily:"inherit",transition:"background-color 80ms ease"},children:e},e)})}),"year"===de&&(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"6px"},children:Array.from({length:12},(e,n)=>{const r=Re(le)-1+n,o=r===le,i=r===V.getFullYear(),l=0===n||11===n;return(0,t.jsx)("button",{type:"button",onClick:()=>{ae(r),ue("month")},style:{padding:"10px 6px",borderRadius:"8px",border:i&&!o?`2px solid ${N.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:o?600:400,backgroundColor:o?N.primary:"transparent",color:o?N.bg:l?N.textMuted:N.text,fontFamily:"inherit",transition:"background-color 80ms ease",opacity:l?.5:1},children:r},r)})}),y&&"day"===de&&(0,t.jsxs)("div",{style:{borderTop:`1px solid ${N.border}`,paddingTop:"12px",display:"flex",alignItems:"flex-start",gap:"8px",justifyContent:"center"},children:[(0,t.jsx)(Ve,{values:tt,selected:he.h,onSelect:e=>{w||pe(t=>({...t,h:e})),v?.({...he,h:e})},label:"Hour",theme:N}),(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",height:"40px",marginTop:"28px",fontSize:"16px",fontWeight:700,color:N.textMuted},children:":"}),(0,t.jsx)(Ve,{values:nt,selected:he.m,onSelect:e=>{w||pe(t=>({...t,m:e})),v?.({...he,m:e})},label:"Min",theme:N})]}),"multiple"===d&&"day"===de&&X.length>0&&(0,t.jsxs)("div",{style:{borderTop:`1px solid ${N.border}`,paddingTop:"8px",fontSize:"12px",color:N.textMuted,textAlign:"center"},children:[X.length," date",1!==X.length?"s":""," selected"]}),(0,t.jsxs)("div",{style:{borderTop:`1px solid ${N.border}`,paddingTop:"10px",display:"flex",alignItems:"center",justifyContent:ee?"space-between":"flex-start",gap:"8px"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>{ae(V.getFullYear()),ce(V.getMonth()),ue("day"),Ee(V)},style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"13px",color:N.primary,fontWeight:500,padding:"6px 10px",borderRadius:"6px",fontFamily:"inherit"},children:"Today"}),ee&&(0,t.jsxs)("div",{style:{display:"flex",gap:"6px"},children:[(0,t.jsx)("button",{type:"button",onClick:Pe,style:{padding:"6px 14px",borderRadius:"7px",border:`1px solid ${N.border}`,cursor:"pointer",fontSize:"13px",fontWeight:500,backgroundColor:"transparent",color:N.text,fontFamily:"inherit"},children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:He,style:{padding:"6px 14px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:600,backgroundColor:N.primary,color:N.bg,fontFamily:"inherit"},children:"Apply"})]})]})]})]});return(0,t.jsxs)("div",{className:A,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...I},children:[Je&&(0,t.jsx)("label",{htmlFor:L,style:{fontSize:"13px",fontWeight:500,color:N.text,marginBottom:"2px"},children:Je}),(0,t.jsxs)("div",{ref:Ce,style:{display:"flex",alignItems:"center",border:`1.5px solid ${et}`,borderRadius:"8px",backgroundColor:N.surface,overflow:"hidden",transition:R?"none":"border-color 120ms ease",opacity:D?.5:1},children:[(0,t.jsx)("span",{style:{display:"flex",alignItems:"center",paddingLeft:"10px",color:N.textMuted,flexShrink:0},children:(0,t.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),(0,t.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,t.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,t.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),(0,t.jsx)("input",{ref:Me,id:L,type:"text",value:me,placeholder:Xe,disabled:D,"aria-invalid":M,"aria-haspopup":"dialog","aria-expanded":xe,readOnly:"range"===d||"multiple"===d,onChange:e=>(e=>{if(be(e),"single"===d){const t=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,b);t&&!Le(t)&&(B||H(t),o?.(t),ae(t.getFullYear()),ce(t.getMonth()))}})(e.target.value),onFocus:()=>{D||(Fe.current?Fe.current=!1:ge(!0))},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:N.text,cursor:"single"!==d?"pointer":"text",fontFamily:"inherit",minWidth:0}}),Ge&&!D&&(0,t.jsx)("button",{type:"button","aria-label":"Clear selection",onClick:e=>{if(e.stopPropagation(),"single"===d)B||H(null),o?.(null),be("");else if("range"===d){const e=[null,null];Y||U(e),l?.(e),ne(e),be(""),Q("start")}else"multiple"===d&&(J||K([]),c?.([]),be(""))},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",background:"transparent",cursor:"pointer",color:N.textMuted,flexShrink:0,borderRadius:"4px",marginRight:"4px"},children:(0,t.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,t.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),(0,t.jsx)("button",{type:"button","aria-label":xe?"Close calendar":"Open calendar",tabIndex:-1,disabled:D,onClick:()=>{D||ge(e=>!e)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"34px",height:"36px",border:"none",background:"transparent",cursor:D?"not-allowed":"pointer",color:N.textMuted,flexShrink:0},children:(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:xe?"rotate(180deg)":"rotate(0deg)",transition:R?"none":"transform 160ms ease"},children:(0,t.jsx)("polyline",{points:"6 9 12 15 18 9"})})})]}),Ze&&!M&&(0,t.jsx)("span",{style:{fontSize:"12px",color:N.textMuted},children:Ze}),M&&Ke&&(0,t.jsx)("span",{role:"alert",style:{fontSize:"12px",color:N.danger},children:Ke}),xe&&"undefined"!=typeof document&&(0,n.createPortal)(rt,document.body)]})}Ee.displayName="TkxDatePicker",exports.contrastRatio=o,exports.createRHFBindings=function(e){const{Controller:n}=e;return{TkxRHFInput:({name:e,control:r,rules:o,defaultValue:i,...l})=>(0,t.jsx)(n,{name:e,control:r,rules:o,defaultValue:i??"",render:({field:e,fieldState:n})=>(0,t.jsx)(pe,{...l,name:e.name,value:e.value??"",onChange:t=>e.onChange(t.target.value),onBlur:e.onBlur,ref:e.ref,error:n.error?.message})}),TkxRHFSelect:({name:e,control:r,rules:o,defaultValue:i,...l})=>(0,t.jsx)(n,{name:e,control:r,rules:o,defaultValue:i??"",render:({field:e,fieldState:n})=>(0,t.jsx)(me,{...l,value:e.value,onChange:t=>e.onChange(t),errorMessage:n.error?.message})}),TkxRHFCheckbox:({name:e,control:r,rules:o,defaultValue:i,...l})=>(0,t.jsx)(n,{name:e,control:r,rules:o,defaultValue:i??!1,render:({field:e,fieldState:n})=>(0,t.jsx)(ye,{...l,name:e.name,checked:Boolean(e.value),onChange:t=>e.onChange(t.target.checked),onBlur:e.onBlur,ref:e.ref,errorMessage:n.error?.message})}),TkxRHFToggle:({name:e,control:r,rules:o,defaultValue:i,...l})=>(0,t.jsx)(n,{name:e,control:r,rules:o,defaultValue:i??!1,render:({field:e})=>(0,t.jsx)(ve,{...l,checked:Boolean(e.value),onChange:t=>e.onChange(t),onBlur:e.onBlur,ref:e.ref})}),TkxRHFRadio:({name:e,control:r,rules:o,defaultValue:i,value:l,...a})=>(0,t.jsx)(n,{name:e,control:r,rules:o,defaultValue:i??"",render:({field:e})=>(0,t.jsx)(Se,{...a,name:e.name,value:l,checked:String(e.value??"")===String(l??""),onChange:()=>e.onChange(l),onBlur:e.onBlur,ref:e.ref})}),TkxRHFNumberInput:({name:e,control:r,rules:o,defaultValue:i,...l})=>(0,t.jsx)(n,{name:e,control:r,rules:o,defaultValue:i,render:({field:e,fieldState:n})=>(0,t.jsx)(Fe,{...l,value:e.value??void 0,onChange:t=>e.onChange(t),errorMessage:n.error?.message})}),TkxRHFDatePicker:({name:e,control:r,rules:o,defaultValue:i,...l})=>(0,t.jsx)(n,{name:e,control:r,rules:o,defaultValue:i??null,render:({field:e})=>(0,t.jsx)(Ee,{...l,value:e.value??null,onChange:t=>e.onChange(t)})})}},exports.cssVar=function(e,t){return void 0!==t?`--tkx-${e}: ${t};`:`var(--tkx-${e})`},exports.cx=le,exports.extractAtomicCSS=function(){return Array.from(ee.values()).join("\n")},exports.extractCSS=c,exports.injectStyles=function(){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=c()},exports.meetsAA=function(e,t,n=!1){return o(e,t)>=(n?3:4.5)},exports.meetsAAA=function(e,t,n=!1){return o(e,t)>=(n?4.5:7)},exports.resetAtomicCSS=function(){ee.clear(),te=null,ne&&"undefined"!=typeof document&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==ne),ne=null)},exports.resetStyles=function(){s.clear()},exports.sanitizeProps=g,exports.sanitizeString=x,exports.tkxListPlugins=function(){return Array.from(ae.keys())},exports.tkxPlugin=function(e){ae.set(e.name,e.utilities)},exports.tkxRemovePlugin=function(e){ae.delete(e)},exports.useAnnounce=function(){const t=(0,e.useRef)(null);return(0,e.useEffect)(()=>{if("undefined"!=typeof document)return t.current=function(){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()}}}(),()=>{t.current?.destroy()}},[]),(0,e.useCallback)((e,n="polite")=>{t.current?.announce(e,n)},[])},exports.useClickOutside=function(t,n){const r=(0,e.useRef)(n);r.current=n,(0,e.useEffect)(()=>{const e=e=>{t.current&&!t.current.contains(e.target)&&r.current()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[t])},exports.useControllable=function({value:t,onChange:n,defaultValue:r}){const o=void 0!==t,[i,l]=(0,e.useState)(r),a=(0,e.useRef)(n);a.current=n;const s=(0,e.useCallback)(e=>{o||l(e),a.current?.(e)},[o]);return[o?t:i,s]},exports.useDebounce=function(t,n){const[r,o]=(0,e.useState)(t);return(0,e.useEffect)(()=>{const e=setTimeout(()=>o(t),n);return()=>clearTimeout(e)},[t,n]),r},exports.useDisclosure=function(t=!1){const[n,r]=(0,e.useState)(t);return{isOpen:n,open:(0,e.useCallback)(()=>r(!0),[]),close:(0,e.useCallback)(()=>r(!1),[]),toggle:(0,e.useCallback)(()=>r(e=>!e),[])}},exports.useEscapeKey=function(t,n=!0){const r=(0,e.useRef)(t);r.current=t,(0,e.useEffect)(()=>{if(!n||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&r.current()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n])},exports.useFocusTrap=function(t){const n=(0,e.useRef)(null);return(0,e.useEffect)(()=>{if(!t||!n.current)return;const e=function(e){let t=null,n=null;function r(){return Array.from(e.querySelectorAll(l)).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}}}(n.current);return e.activate(),()=>e.deactivate()},[t]),n},exports.useFormState=de,exports.useFormWithValibot=function(t){const n=de({initialValues:t.initialValues,validate:fe(t.safeParse,t.schema)}),r=(0,e.useCallback)(async e=>{e?.preventDefault?.(),n.validate()&&t.onSubmit&&await t.onSubmit(n.values)},[n,t]);return{...n,handleSubmit:r}},exports.useFormWithZod=function(t){const n=de({initialValues:t.initialValues,validate:ue(t.schema)}),r=(0,e.useCallback)(async e=>{e?.preventDefault?.(),n.validate()&&t.onSubmit&&await t.onSubmit(n.values)},[n,t]);return{...n,handleSubmit:r}},exports.useHighContrast=function(){const[t,n]=(0,e.useState)(()=>"undefined"!=typeof window&&"undefined"!=typeof window&&window.matchMedia("(forced-colors: active)").matches);return(0,e.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(forced-colors: active)"),t=e=>n(e.matches);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),t},exports.useInfiniteQuery=function(t){const{queryFn:n,initialCursor:r=null,enabled:o=!0,dedupKey:i}=t,[l,a]=(0,e.useState)([]),[s,c]=(0,e.useState)("idle"),[d,u]=(0,e.useState)(null),[f,p]=(0,e.useState)(!1),[h,x]=(0,e.useState)(0),g=(0,e.useRef)(r??null),m=(0,e.useRef)(!1),b=(0,e.useRef)(!0),y=(0,e.useRef)(void 0),w=(0,e.useRef)(n);w.current=n;const v=(0,e.useCallback)(async(e,t,n)=>{if(m.current)return;if(void 0!==i&&i===y.current)return;m.current=!0;let r=!1;b.current&&(c(n?"loading":"fetching-more"),u(null));try{const o=await w.current(e,t);if(r||!b.current)return;void 0!==i&&(y.current=i),g.current=o.nextCursor,a(e=>n?[o.data]:[...e,o.data]),p(o.hasMore),x(t),c("success")}catch(o){if(r||!b.current)return;u(o instanceof Error?o:new Error(String(o))),c("error")}finally{r||(m.current=!1)}return()=>{r=!0}},[i]),k=(0,e.useCallback)(()=>{f&&!m.current&&v(g.current,h+1,!1)},[f,h,v]),$=(0,e.useCallback)(()=>{m.current=!1,y.current=void 0,g.current=r??null,a([]),c("idle"),u(null),p(!1),x(0)},[r]);(0,e.useEffect)(()=>(b.current=!0,o&&v(r??null,0,!0),()=>{b.current=!1}),[o]);const S=l.flat();return{data:S,pages:l,status:s,error:d,hasMore:f,isFetchingMore:"fetching-more"===s,fetchMore:k,reset:$,pageIndex:h,totalLoaded:S.length}},exports.useIntersectionObserver=function({threshold:t=0,rootMargin:n="0px",root:r=null,once:o=!1}={}){const i=(0,e.useRef)(null),[l,a]=(0,e.useState)(null),s=(0,e.useRef)(null);return(0,e.useEffect)(()=>{const e=i.current;if(e&&"undefined"!=typeof IntersectionObserver)return s.current=new IntersectionObserver(([t])=>{a(t),o&&t.isIntersecting&&s.current?.unobserve(e)},{threshold:t,rootMargin:n,root:r}),s.current.observe(e),()=>s.current?.disconnect()},[t,n,r,o]),{ref:i,isIntersecting:l?.isIntersecting??!1,entry:l}},exports.useListSelection=function({items:t,initialSelected:n=[],multiple:r=!0}){const[o,i]=(0,e.useState)(()=>new Set(n)),l=(0,e.useCallback)(e=>{i(t=>{const n=new Set(t);return n.has(e)?n.delete(e):(r||n.clear(),n.add(e)),n})},[r]),a=(0,e.useCallback)(e=>{i(t=>{if(t.has(e))return t;const n=r?new Set(t):new Set;return n.add(e),n})},[r]),s=(0,e.useCallback)(e=>{i(t=>{if(!t.has(e))return t;const n=new Set(t);return n.delete(e),n})},[]),c=(0,e.useCallback)(()=>{r&&i(new Set(t))},[t,r]),d=(0,e.useCallback)(()=>i(new Set),[]),u=(0,e.useCallback)(()=>{i(e=>t.every(t=>e.has(t))?new Set:new Set(t))},[t]),f=t.length>0&&t.every(e=>o.has(e)),p=t.some(e=>o.has(e)),h=(0,e.useMemo)(()=>Array.from(o),[o]);return{selected:o,isSelected:(0,e.useCallback)(e=>o.has(e),[o]),toggle:l,select:a,deselect:s,selectAll:c,deselectAll:d,toggleAll:u,allSelected:f,someSelected:p,selectedCount:o.size,selectedArray:h}},exports.useLocalStorage=function(t,n){const[r,o]=(0,e.useState)(()=>{if("undefined"==typeof window)return n;try{const e=window.localStorage.getItem(t);return null!==e?JSON.parse(e):n}catch{return n}});return[r,(0,e.useCallback)(e=>{o(n=>{const r="function"==typeof e?e(n):e;if("undefined"!=typeof window)try{window.localStorage.setItem(t,JSON.stringify(r))}catch{}return r})},[t]),(0,e.useCallback)(()=>{if(o(n),"undefined"!=typeof window)try{window.localStorage.removeItem(t)}catch{}},[t,n])]},exports.useMediaQuery=function(t){const[n,r]=(0,e.useState)(()=>"undefined"!=typeof window&&window.matchMedia(t).matches);return(0,e.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia(t);r(e.matches);const n=e=>r(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[t]),n},exports.useReducedMotion=a,exports.useRovingTabIndex=function({count:t,initialIndex:n=0,orientation:r="horizontal",loop:o=!0}){const[i,l]=(0,e.useState)(n),a=(0,e.useRef)([]),s=(0,e.useCallback)(e=>{l(n=>{let r=n+e;return r=o?(r%t+t)%t:Math.max(0,Math.min(t-1,r)),requestAnimationFrame(()=>{a.current[r]?.focus()}),r})},[t,o]);return{focusedIndex:i,setFocusedIndex:l,getItemProps:(0,e.useCallback)(e=>({tabIndex:e===i?0:-1,"data-focused":e===i,onFocus:()=>l(e),onKeyDown:e=>{const n="horizontal"===r||"both"===r,o="vertical"===r||"both"===r;n&&"ArrowRight"===e.key&&(e.preventDefault(),s(1)),n&&"ArrowLeft"===e.key&&(e.preventDefault(),s(-1)),o&&"ArrowDown"===e.key&&(e.preventDefault(),s(1)),o&&"ArrowUp"===e.key&&(e.preventDefault(),s(-1)),"Home"===e.key&&(e.preventDefault(),l(0),requestAnimationFrame(()=>a.current[0]?.focus())),"End"===e.key&&(e.preventDefault(),l(t-1),requestAnimationFrame(()=>a.current[t-1]?.focus()))}}),[i,s,r,t])}},exports.useSSE=function(t){const{url:n,events:r=["message"],withCredentials:o=!1,reconnect:i=!0,reconnectDelay:l=3e3,onOpen:a,onError:s}=t,[c,d]=(0,e.useState)("connecting"),[u,f]=(0,e.useState)(null),[p,h]=(0,e.useState)([]),[x,g]=(0,e.useState)(0),m=(0,e.useRef)(null),b=(0,e.useRef)(null),y=(0,e.useRef)(!0),w=(0,e.useRef)(!1),v=(0,e.useRef)(a),k=(0,e.useRef)(s);v.current=a,k.current=s;const $=(0,e.useCallback)(()=>{b.current&&(clearTimeout(b.current),b.current=null)},[]),S=(0,e.useCallback)(()=>{if("undefined"==typeof EventSource)return void(y.current&&d("error"));w.current=!1,$(),m.current&&(m.current.close(),m.current=null),y.current&&d("connecting");const e=new EventSource(n,{withCredentials:o});m.current=e,e.onopen=()=>{y.current&&(d("connected"),v.current?.())},e.onerror=e=>{y.current&&(d("error"),k.current?.(e),!w.current&&i&&($(),b.current=setTimeout(()=>{y.current&&S()},l)))};const t=e=>t=>{if(!y.current)return;let n;try{n=JSON.parse(t.data)}catch{n=t.data}const r={type:e,data:n,timestamp:Date.now(),...t.lastEventId?{id:t.lastEventId}:{}};f({type:r.type,data:r.data,id:r.id}),h(e=>{const t=[...e,r];return t.length>200?t.slice(t.length-200):t}),g(e=>e+1)};for(const n of r)e.addEventListener(n,t(n))},[n,o,i,l,$]),z=(0,e.useCallback)(()=>{w.current=!0,$(),m.current&&(m.current.close(),m.current=null),y.current&&d("closed")},[$]);return(0,e.useEffect)(()=>(y.current=!0,S(),()=>{y.current=!1,w.current=!0,$(),m.current&&(m.current.close(),m.current=null)}),[]),{status:c,lastEvent:u,events:p,connect:S,disconnect:z,eventCount:x}},exports.useThrottle=function(t,n){const[r,o]=(0,e.useState)(t),i=(0,e.useRef)(Date.now());return(0,e.useEffect)(()=>{const e=Date.now(),r=n-(e-i.current);if(!(r<=0)){const e=setTimeout(()=>{i.current=Date.now(),o(t)},r);return()=>clearTimeout(e)}i.current=e,o(t)},[t,n]),r},exports.useTkxForm=function(){const t=(0,e.useContext)(se),n=(0,e.useRef)({}),r=(0,e.useRef)({}),o=(0,e.useRef)({}),i=(0,e.useMemo)(()=>({getFieldValue:e=>n.current[e],setFieldValue:(e,t)=>{n.current[e]=t},getFieldsValue:()=>({...n.current}),setFieldsValue:e=>{Object.assign(n.current,e)},validateFields:()=>Promise.resolve({...n.current}),validateField:e=>Promise.resolve(!0),resetFields:()=>{n.current={},r.current={},o.current={}},getFieldError:e=>r.current[e]??null,isFieldTouched:e=>o.current[e]??!1}),[]);return t?t.instance:i},exports.useWebSocket=function(t){const{url:n,protocols:r,reconnect:o=!0,reconnectDelay:i=1e3,reconnectAttempts:l=10,heartbeatInterval:a=3e4,heartbeatMessage:s="ping",onOpen:c,onClose:d,onError:u,onMessage:f}=t,[p,h]=(0,e.useState)("disconnected"),[x,g]=(0,e.useState)(null),[m,b]=(0,e.useState)([]),[y,w]=(0,e.useState)(0),[v,k]=(0,e.useState)(null),$=(0,e.useRef)(null),S=(0,e.useRef)(0),z=(0,e.useRef)(null),D=(0,e.useRef)(null),M=(0,e.useRef)(null),F=(0,e.useRef)([]),j=(0,e.useRef)(!0),T=(0,e.useRef)(!1),A=(0,e.useRef)(c),I=(0,e.useRef)(d),N=(0,e.useRef)(u),W=(0,e.useRef)(f);A.current=c,I.current=d,N.current=u,W.current=f;const O=(0,e.useCallback)(()=>{z.current&&(clearTimeout(z.current),z.current=null),D.current&&(clearInterval(D.current),D.current=null)},[]),L=(0,e.useCallback)(e=>{for(;F.current.length>0;){const t=F.current.shift();void 0!==t&&e.send("string"==typeof t?t:JSON.stringify(t))}},[]),R=(0,e.useCallback)(()=>{if($.current&&$.current.readyState===WebSocket.OPEN)return;T.current=!1,O(),j.current&&h("connecting");const e=new WebSocket(n,r);$.current=e,e.onopen=t=>{j.current&&(h("connected"),S.current=0,w(0),A.current?.(t),L(e),D.current=setInterval(()=>{if(e.readyState===WebSocket.OPEN){M.current=Date.now();try{e.send(JSON.stringify({type:"ping",t:M.current}))}catch{}}},a))},e.onmessage=e=>{if(!j.current)return;const t=C(e.data),n=null!==t?t:e.data,r=n;if(r&&"object"==typeof r&&"pong"===r.type&&"number"==typeof r.t)k(Date.now()-r.t);else{if(n===s&&null!==M.current)return k(Date.now()-M.current),void(M.current=null);g(n),b(e=>{const t=[...e,n];return t.length>100?t.slice(t.length-100):t}),W.current?.(n)}},e.onerror=e=>{j.current&&(h("error"),N.current?.(e))},e.onclose=e=>{if(j.current&&(O(),h("disconnected"),I.current?.(e),!T.current&&o&&S.current<l)){const e=S.current,t=i*Math.pow(1.5,e);S.current+=1,w(S.current),z.current=setTimeout(()=>{j.current&&R()},t)}}},[n,r,o,i,l,a,s,O,L]),V=(0,e.useCallback)(()=>{T.current=!0,O(),$.current&&($.current.close(),$.current=null),j.current&&h("disconnected")},[O]),B=(0,e.useCallback)(e=>{$.current&&$.current.readyState===WebSocket.OPEN?$.current.send("string"==typeof e?e:JSON.stringify(e)):F.current.push(e)},[]);return(0,e.useEffect)(()=>(j.current=!0,R(),()=>{j.current=!1,T.current=!0,O(),$.current&&($.current.close(),$.current=null)}),[]),{status:p,lastMessage:x,messages:m,send:B,connect:R,disconnect:V,reconnectCount:y,latency:v}},exports.valibotResolver=fe,exports.zodResolver=ue;
|