Viewing File: /usr/local/cpanel/base/frontend/jupiter/koality/_nuxt/DYAeJWb9.js

import{cj as _,ck as $,A,s as m,bj as E,cl as D}from"./EJiqiqZX.js";import{u as S}from"./CZ4rlL_s.js";const x={settings:"s",advisor:"i",metricview:"v",help:"h",commandcenter:"meta_k",showAllEntries:"ctrl_n",piniaDebug:"meta_d"},j=/^[^-]+.*-.*[^-]+$/,L=/^[^_]+.*_.*[^_]+$/,v=["arrowleft","arrowright","arrowup","arrowright","tab","escape","enter","backspace"];function h(l){return/^[a-z]$/i.test(l)?`Key${l.toUpperCase()}`:/^\d$/.test(l)?`Digit${l}`:/^f\d+$/i.test(l)?l.toUpperCase():{space:"Space",enter:"Enter",escape:"Escape",tab:"Tab",backspace:"Backspace",delete:"Delete",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight"}[l.toLowerCase()]||l}function R(l,u={}){const r=A([]),f=()=>{r.value.splice(0,r.value.length)},b=_(f,u.chainDelay??800),{macOS:w}=S(),d=D(),i=u.layoutIndependent??!1,g=v.map(e=>h(e)),I=e=>{if(!e.key)return;const a=i?/^Key[A-Z]$/i.test(e.code):/^[a-z]{1}$/i.test(e.key),t=i?g.includes(e.code):v.includes(e.key.toLowerCase());let c;if(r.value.push(i?e.code:e.key),r.value.length>=2){c=r.value.slice(-2).join("-");for(const n of K.value.filter(s=>s.chained))if(n.key===c){n.enabled&&(e.preventDefault(),n.handler(e)),f();return}}for(const n of K.value.filter(s=>!s.chained)){if(i){if(e.code!==n.key)continue}else if(e.key.toLowerCase()!==n.key)continue;if(e.metaKey===n.metaKey&&e.ctrlKey===n.ctrlKey&&!((a||t||n.shiftKey||e.shiftKey)&&e.shiftKey!==n.shiftKey)){n.enabled&&(e.preventDefault(),n.handler(e)),f();return}}b()},y=m(()=>{const e=d.value?.tagName,a=d.value?.contentEditable;return e==="INPUT"||e==="TEXTAREA"||a==="true"||a==="plaintext-only"?d.value?.name||!0:!1}),K=m(()=>Object.entries(E(l)).map(([e,a])=>{if(!a)return null;let t;e.includes("-")&&e!=="-"&&!e.includes("_")&&!e.match(j)?.length&&console.trace(`[Shortcut] Invalid key: "${e}"`),e.includes("_")&&e!=="_"&&!e.match(L)?.length&&console.trace(`[Shortcut] Invalid key: "${e}"`);const c=e.includes("-")&&e!=="-"&&!e.includes("_");if(c)i?t={key:e.split("-").map(o=>h(o)).join("-"),metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1}:t={key:e.toLowerCase(),metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1};else{const s=e.toLowerCase().split("_").map(p=>p);let o=s.filter(p=>!["meta","command","ctrl","shift","alt","option"].includes(p)).join("_");i&&(o=h(o)),t={key:o,metaKey:s.includes("meta")||s.includes("command"),ctrlKey:s.includes("ctrl"),shiftKey:s.includes("shift"),altKey:s.includes("alt")||s.includes("option")}}if(t.chained=c,!w.value&&t.metaKey&&!t.ctrlKey&&(t.metaKey=!1,t.ctrlKey=!0),typeof a=="function"?t.handler=a:typeof a=="object"&&(t={...t,handler:a.handler}),!t.handler)return console.trace("[Shortcut] Invalid value"),null;let n=!0;return a.usingInput?typeof a.usingInput=="string"&&(n=y.value===a.usingInput):n=!y.value,t.enabled=n,t}).filter(Boolean));return $("keydown",I)}export{R as d,x as s};
Back to Directory File Manager