import{c as e,s as t,z as n}from"./useRouterState-DkU0JPAO.js";import{Ft as r,L as i,R as a,Vt as o,g as s,r as c,z as l}from"./button-cdxnqcgzwko8ooha-DW4HgSd6.js";import{t as u}from"./label-latndvb1ngem7we8-M6HmFWt4.js";var d=n(t(),1),f=e();function p({controlFirst:e=!1}={}){return o(`grid gap-2`,`has-[input[type=checkbox]]:grid-cols-[auto_1fr] has-[input[type=checkbox]]:items-center`,`has-[[role=switch]]:grid-cols-[auto_1fr] has-[[role=switch]]:items-center`,e&&[`has-[input[type=checkbox]]:flex has-[input[type=checkbox]]:flex-row-reverse has-[input[type=checkbox]]:flex-wrap has-[input[type=checkbox]]:items-center`,`has-[[role=switch]]:flex has-[[role=switch]]:flex-row-reverse has-[[role=switch]]:flex-wrap has-[[role=switch]]:items-center`,`[&>label]:flex-1`])}function m({children:e,label:t,required:n,labelTooltip:i,error:c,description:d,controlFirst:m=!1}){let h=n===!1;return(0,f.jsxs)(a,{className:p({controlFirst:m}),children:[(0,f.jsx)(l,{className:`m-0 text-base font-medium text-kumo-default`,children:(0,f.jsx)(u,{showOptional:h,tooltip:i,asContent:!0,children:t})}),e,c?(0,f.jsx)(s,{className:o(`text-sm leading-snug text-kumo-danger`,`col-span-full`),match:c.match,children:c.message}):d&&(0,f.jsx)(r,{className:o(`text-sm leading-snug text-kumo-subtle`,`col-span-full`),children:d})]})}var h={size:{xs:{classes:`h-5 gap-1 rounded-sm px-1.5 text-xs`,description:`Extra small input for compact UIs`},sm:{classes:`h-6.5 gap-1 rounded-md px-2 text-xs`,description:`Small input for secondary fields`},base:{classes:`h-9 gap-1.5 rounded-lg px-3 text-base`,description:`Default input size`},lg:{classes:`h-10 gap-2 rounded-lg px-4 text-base`,description:`Large input for prominent fields`}},variant:{default:{classes:`focus:ring-kumo-hairline`,description:`Default input appearance`},error:{classes:`!ring-kumo-danger focus:ring-kumo-danger`,description:`Error state for validation failures`}}},g={size:`base`,variant:`default`};function _({variant:e=g.variant,size:t=g.size,parentFocusIndicator:n=!1,focusIndicator:r=!1}={}){return o(`border-0 bg-kumo-control text-kumo-default ring ring-kumo-line`,`kumo-input-placeholder disabled:text-kumo-subtle`,h.size[t].classes,h.variant[e].classes,n&&`focus-within:ring-kumo-hairline`,r&&`focus:ring-kumo-hairline`)}var v=(0,d.forwardRef)((e,t)=>{let{className:n,size:r=`base`,variant:a,label:s,labelTooltip:c,description:l,error:u,...d}=e,p=a??(u?`error`:`default`),{required:h}=d,g=(0,f.jsx)(i,{ref:t,className:o(_({size:r,variant:p,focusIndicator:!0}),n),...d});return s?(0,f.jsx)(m,{label:s,required:h,labelTooltip:c,description:l,error:u?typeof u==`string`?{message:u,match:!0}:u:void 0,children:g}):g});v.displayName=`Input`;var y={focusMode:`container`},b=d.createContext(null);function x({size:e,children:t,className:n,focusMode:r=y.focusMode}){let i=d.useId(),a=d.useId(),s=d.useMemo(()=>({size:e,inputId:i,descriptionId:a,focusMode:r}),[e,i,a,r]),c=r===`individual`;return(0,f.jsx)(b.Provider,{value:s,children:(0,f.jsx)(`div`,{className:o(_({size:e,parentFocusIndicator:!c}),`flex w-full gap-0 border-0 px-0`,c?`isolate overflow-visible`:`overflow-hidden shadow-xs ring ring-kumo-line focus-within:ring-kumo-hairline`,n),children:t})})}function S({children:e}){let t=(0,d.useContext)(b),n=t?.focusMode===`individual`;return(0,f.jsx)(`label`,{htmlFor:t?.inputId,className:o(`flex h-full items-center p-0 px-2 text-kumo-subtle`,n&&`first:rounded-l-[inherit] last:rounded-r-[inherit]`),children:e})}function C(e){let t=(0,d.useContext)(b),n=t?.focusMode===`individual`;return(0,f.jsx)(v,{id:t?.inputId,"aria-describedby":t?.descriptionId,size:t?.size,...e,className:o(`flex h-full items-center rounded-none border-0 bg-kumo-base font-sans`,`grow px-2`,n?`relative ring ring-kumo-line first:rounded-l-[inherit] last:rounded-r-[inherit] focus:z-1 focus:outline`:`focus:border-kumo-fill`,e.className)})}function w({children:e}){let t=(0,d.useContext)(b),n=t?.focusMode===`individual`;return(0,f.jsx)(`span`,{id:t?.descriptionId,className:o(`flex h-full items-center p-0 px-2 text-kumo-subtle`,n&&`first:rounded-l-[inherit] last:rounded-r-[inherit]`),children:e})}function T({children:e,className:t,...n}){let r=(0,d.useContext)(b),i=r?.focusMode===`individual`;return(0,f.jsx)(c,{...n,size:r?.size,className:o(`h-full! rounded-none disabled:bg-kumo-overlay disabled:text-kumo-inactive!`,i&&`relative ring ring-kumo-line first:rounded-l-[inherit] last:rounded-r-[inherit] focus:z-1 focus:outline`,t),children:e})}var E=Object.assign(x,{Label:S,Input:C,Button:T,Description:w});export{_ as n,m as r,E as t};