import{s as g}from"./chunk-LvLJmgfZ.js";import{u as d}from"./useEvent-WUlsM6MC.js";import{t as A}from"./compiler-runtime-B3qBwwSJ.js";import{i as b,u as v}from"./useEventListener-CjXriKgk.js";import{p}from"./utils-CORJ8yYa.js";import{t as D}from"./jsx-runtime-CP2fAiZX.js";import{t as y}from"./cn-d_A4rA-x.js";import{l as S}from"./dropdown-menu-CKhrfxsx.js";import{t as h}from"./tooltip-DOQlecCr.js";import{t as x}from"./kbd-CVbqSkT8.js";var f=A(),m=g(D(),1);function _(o,e=!0){return(0,m.jsx)(E,{shortcut:o,includeName:e})}var E=o=>{let e=(0,f.c)(11),{shortcut:l,includeName:s}=o,t=s===void 0?!0:s,a=d(p),n;e[0]!==a||e[1]!==l?(n=a.getHotkey(l),e[0]=a,e[1]=l,e[2]=n):n=e[2];let r=n,c;e[3]!==r.name||e[4]!==t?(c=t&&(0,m.jsx)("span",{className:"mr-2",children:r.name}),e[3]=r.name,e[4]=t,e[5]=c):c=e[5];let i;e[6]===r.key?i=e[7]:(i=(0,m.jsx)(j,{shortcut:r.key}),e[6]=r.key,e[7]=i);let u;return e[8]!==c||e[9]!==i?(u=(0,m.jsxs)("span",{className:"inline-flex",children:[c,i]}),e[8]=c,e[9]=i,e[10]=u):u=e[10],u};const j=o=>{let e=(0,f.c)(10),{shortcut:l,className:s}=o;if(l===b||l===""){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,m.jsx)("span",{}),e[0]=r):r=e[0],r}let t,a;if(e[1]!==s||e[2]!==l){let r=l.split("-");e[5]===s?t=e[6]:(t=y("flex gap-1",s),e[5]=s,e[6]=t),a=r.map(k).map(L),e[1]=s,e[2]=l,e[3]=t,e[4]=a}else t=e[3],a=e[4];let n;return e[7]!==t||e[8]!==a?(n=(0,m.jsx)("div",{className:t,children:a}),e[7]=t,e[8]=a,e[9]=n):n=e[9],n};function H(o){return(0,m.jsx)(w,{shortcut:o})}const w=o=>{let e=(0,f.c)(6),{className:l,shortcut:s}=o,t=d(p),a;e[0]!==t||e[1]!==s?(a=t.getHotkey(s),e[0]=t,e[1]=s,e[2]=a):a=e[2];let n=a,r;return e[3]!==l||e[4]!==n.key?(r=(0,m.jsx)(C,{shortcut:n.key,className:l}),e[3]=l,e[4]=n.key,e[5]=r):r=e[5],r},C=o=>{let e=(0,f.c)(12),{shortcut:l,className:s}=o;if(l===b||l===""){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,m.jsx)("span",{}),e[0]=c):c=e[0],c}let t,a,n;if(e[1]!==s||e[2]!==l){let c=l.split("-");t=S,e[6]===s?a=e[7]:(a=y("flex gap-1 items-center",s),e[6]=s,e[7]=a),n=c.map(k).map(F),e[1]=s,e[2]=l,e[3]=t,e[4]=a,e[5]=n}else t=e[3],a=e[4],n=e[5];let r;return e[8]!==t||e[9]!==a||e[10]!==n?(r=(0,m.jsx)(t,{className:a,children:n}),e[8]=t,e[9]=a,e[10]=n,e[11]=r):r=e[11],r};function k(o){let e=v()?"mac":"default",l=o.toLowerCase(),s=I[o.toLowerCase()];if(s){let t=s.symbols[e]||s.symbols.default;return[s.label,t]}return[l]}var I={ctrl:{symbols:{mac:"\u2303",default:"Ctrl"},label:"Control"},control:{symbols:{mac:"\u2303",default:"Ctrl"},label:"Control"},shift:{symbols:{mac:"\u21E7",default:"Shift"},label:"Shift"},alt:{symbols:{mac:"\u2325",default:"Alt"},label:"Alt/Option"},escape:{symbols:{mac:"\u238B",default:"Esc"},label:"Escape"},arrowup:{symbols:{default:"\u2191"},label:"Arrow Up"},arrowdown:{symbols:{default:"\u2193"},label:"Arrow Down"},arrowleft:{symbols:{default:"\u2190"},label:"Arrow Left"},arrowright:{symbols:{default:"\u2192"},label:"Arrow Right"},backspace:{symbols:{mac:"\u232B",default:"\u27F5"},label:"Backspace"},tab:{symbols:{mac:"\u21E5",default:"\u2B7E"},label:"Tab"},capslock:{symbols:{default:"\u21EA"},label:"Caps Lock"},fn:{symbols:{default:"Fn"},label:"Fn"},cmd:{symbols:{mac:"\u2318",windows:"\u229E Win",default:"Command"},label:"Command"},insert:{symbols:{default:"Ins"},label:"Insert"},delete:{symbols:{mac:"\u2326",default:"Del"},label:"Delete"},home:{symbols:{mac:"\u2196",default:"Home"},label:"Home"},end:{symbols:{mac:"\u2198",default:"End"},label:"End"},mod:{symbols:{mac:"\u2318",windows:"\u229E Win",default:"Ctrl"},label:"Control"}};function N(o){return o.charAt(0).toUpperCase()+o.slice(1)}function L(o){let[e,l]=o;return l?(0,m.jsx)(h,{asChild:!1,tabIndex:-1,content:e,delayDuration:300,children:(0,m.jsx)(x,{children:l},e)},e):(0,m.jsx)(x,{children:N(e)},e)}function F(o){let[e,l]=o;return l?(0,m.jsx)(h,{content:e,delayDuration:300,tabIndex:-1,children:(0,m.jsx)("span",{children:l},e)},e):(0,m.jsx)("span",{children:N(e)},e)}export{_ as a,H as i,C as n,w as r,j as t};
