1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-CtADqAVq.js";import{i as n,v as r,y as i}from"./useTranslation-By_2sPNM.js";import{t as a}from"./jsx-runtime-BdxMnOeJ.js";import{t as o}from"./classNameConstructor-B_CJRpZB.js";var s,c=new Uint8Array(16);function l(){if(!s&&(s=typeof crypto<`u`&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!s))throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);return s(c)}var u=[];for(let e=0;e<256;++e)u.push((e+256).toString(16).slice(1));function d(e,t=0){return u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+`-`+u[e[t+4]]+u[e[t+5]]+`-`+u[e[t+6]]+u[e[t+7]]+`-`+u[e[t+8]]+u[e[t+9]]+`-`+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]}var f={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function p(e,t,n){if(f.randomUUID&&!t&&!e)return f.randomUUID();e||={};let r=e.random||(e.rng||l)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n||=0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return d(r)}var m=e(t()),h=a(),g=i({slots:{base:[`group/button pointer-events-auto relative flex w-fit items-center justify-center`,`text-text-default`,`font-semibold text-base leading-none no-underline`,`ring-inset focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black`,`rounded-xl transition-[color,background-color,box-shadow] duration-200 ease-out`],prefix:[`font-semibold text-text-subdued`,`no-touch:group-hover/button:text-[var(--primary-800)] group-active/button:text-[var(--primary-800)]`,`ms-2`],icon:[`shrink-0 text-inherit`],text:`mx-2`,spinner:[`shrink-0 text-inherit`]},variants:{variant:{basic:`bg-action-secondary-default no-touch:hover:bg-action-secondary-hovered touch-any:active:bg-action-secondary-pressed`,primary:`text-text-on-primary no-touch:hover:text-text-on-primary touch-any:active:text-text-on-primary bg-action-primary-default no-touch:hover:bg-action-primary-hovered touch-any:active:bg-action-primary-pressed font-bold`,white:`bg-surface-default no-touch:hover:bg-action-tertiary-hovered touch-any:active:bg-action-tertiary-pressed`,outline:`bg-transparent no-touch:hover:bg-action-secondary-hovered touch-any:active:bg-action-secondary-pressed ring-1 ring-border-default no-touch:hover:ring-border-hovered touch-any:active:ring-border-pressed`,shapeless:`bg-transparent no-touch:hover:bg-action-secondary-hovered touch-any:active:bg-action-secondary-pressed`,shadow:`bg-white shadow-lg no-touch:hover:shadow-md touch-any:active:shadow no-touch:hover:bg-action-secondary-hovered touch-any:active:bg-action-secondary-pressed ring-inset ring-2 ring-white`},size:{xl:`h-14 p-4`,lg:`h-11 p-3`,md:`h-9 p-2`,sm:`h-7 p-1 text-sm`},square:{true:`aspect-square`},pillShaped:{true:{base:`rounded-full`},false:{base:`rounded-xl`,text:`mx-1.5`}},disabled:{true:{base:`pointer-events-none text-text-disabled`}},critical:{true:{base:`text-text-critical no-touch:hover:text-text-critical touch-any:active:text-text-critical no-touch:hover:bg-surface-critical-subdued-hovered touch-any:active:bg-surface-critical-subdued-pressed font-bold`,icon:`no-touch:hover:text-icon-critical touch-any:active:text-icon-critical`}},width:{max:`w-full`},textSubdued:{true:`text-text-subdued no-touch:hover:text-[var(--primary-800)] touch-any:active:text-[var(--primary-800)]`},isLogo:{true:{},false:{}}},compoundVariants:[{variant:`basic`,critical:!0,class:{base:[`bg-surface-critical-subdued`]}},{variant:`primary`,critical:!0,class:{base:[`text-text-on-critical no-touch:hover:text-text-on-critical touch-any:active:text-text-on-critical`,`bg-action-critical-default no-touch:hover:bg-action-critical-hovered touch-any:active:bg-action-critical-pressed`]}},{variant:`outline`,critical:!0,class:{base:[`text-text-critical`,`no-touch:hover:bg-surface-critical-subdued-hovered touch-any:active:bg-surface-critical-subdued-pressed`,`ring-border-critical-default no-touch:hover:ring-border-critical-default touch-any:active:ring-border-critical-default`],spinner:`text-icon-critical`,icon:`text-icon-critical`}},{variant:`primary`,textSubdued:!0,class:`text-[var(--primary-800)] bg-[var(--primary-200)] n
1o-touch:hover:bg-[var(--primary-300)] touch-any:active:bg-[var(--primary-400)]`},{disabled:!0,textSubdued:!0,class:{base:`text-text-disabled`}},{disabled:!0,critical:!0,class:{base:`text-text-disabled`,icon:`text-icon-disabled`}},{variant:`primary`,disabled:!0,class:{base:`bg-action-primary-disabled`}},{variant:`basic`,disabled:!0,class:{base:`bg-action-secondary-disabled`}},{variant:`outline`,disabled:!0,class:{base:`ring-border-disabled`}},{variant:`primary`,isLogo:!0,class:{base:`[&_path]:fill-current`}}],defaultVariants:{variant:`basic`,pillShaped:!0,square:!1,size:`md`,isLogo:!1}}),_=m.forwardRef(({id:e,trackId:t,className:i,width:a,loading:s,leadingIcon:c,trailingIcon:l,leadingIconProps:u,trailingIconProps:d,pillShaped:f,onClick:_,dataCy:v,tooltipLabel:y,text:b,children:x,variant:S,disabled:C,critical:w,disabledNotice:T,classNameWrapper:E,classNames:D,role:O,square:k=!1,size:A=`md`,tag:j=`button`,prefix:M,tooltipProps:N,textSubdued:P,...F},I)=>{let L=m.useRef(e||t||`tooltip-${p()}`),R=m.useRef(null),z=c&&s?`loading`:c,B=l&&!c&&s?`loading`:l,V=s&&!(z||B),H=m.useCallback(e=>{(e.key===`Enter`||e.key===` `)&&_&&typeof _==`function`&&!C&&(e.preventDefault(),_(e))},[_,C]),U=j,W=g({disabled:!!C,critical:!!w,size:A,square:k||!b&&!x&&!!(c?!l:l),variant:S,pillShaped:f,width:a,textSubdued:!!P,isLogo:z?.toString().includes(`logo/`)}),G=(0,h.jsxs)(U,{"data-cy":v,id:L.current,ref:I||R,type:j===`button`?`button`:void 0,role:j===`button`?O:`button`,tabIndex:0,onKeyDown:H,"aria-label":y??(typeof b==`string`?b:void 0),"aria-disabled":C,disabled:C,className:o(W.base(),i,t&&`button umami--click--${t}`),...F,children:[M&&(0,h.jsx)(`span`,{className:o(W.prefix()),children:M}),z&&(0,h.jsx)(r,{...u,name:z,"aria-hidden":`true`,className:o(W.icon(),u?.className,!!(x||b)&&`translate-x-0.5`,D?.leadingIcon)},typeof z==`string`?z:void 0),x&&(0,h.jsx)(`span`,{className:o(W.text(),D?.children),children:x}),V&&(0,h.jsx)(r,{name:`loading`,className:o(W.spinner(),b?`absolute`:``,D?.spinner)}),b&&(0,h.jsx)(`span`,{style:{opacity:+!V},className:o(W.text(),D?.text),children:b}),B&&(0,h.jsx)(r,{...d,name:B,"aria-hidden":`true`,className:o(W.icon(),d?.className,!!(x||b)&&`-translate-x-0.5`,x||b?`ms-auto`:``,z&&!(x||b)&&`ms-1`,D?.trailingIcon)})]});return(0,h.jsx)(n,{critical:!!C&&!!T,disabled:C,primaryContent:C&&T||y,noTooltip:!y&&!C,onClick:_,className:o(E,D?.wrapper,a===`max`&&`w-full`,C&&`cursor-not-allowed`),id:e,tooltipProps:N,children:G})});_.displayName=`Button`;var v=m.memo(_);export{p as n,v as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.