"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@dialpad/dialtone-icons/vue2"),d=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),c={"{win}":r.DtIconLayoutGrid,"{arrow-right}":r.DtIconArrowRight,"{arrow-left}":r.DtIconArrowLeft,"{arrow-up}":r.DtIconArrowUp,"{arrow-down}":r.DtIconArrowDown,"{cmd}":r.DtIconCommand,"{opt}":r.DtIconOption},a={"{cmd}":"Command","{opt}":"Option","{win}":"Windows","{arrow-right}":"Right Arrow","{arrow-left}":"Left Arrow","{arrow-up}":"Up Arrow","{arrow-down}":"Down Arrow","{plus}":"plus"},i={ctrl:"Control",alt:"Alt",esc:"Escape",del:"Delete",ins:"Insert",pgup:"Page Up",pgdn:"Page Down",num:"Number",caps:"Caps Lock"},u={name:"DtKeyboardShortcut",components:{DtIconLayoutGrid:r.DtIconLayoutGrid,DtIconArrowRight:r.DtIconArrowRight,DtIconArrowLeft:r.DtIconArrowLeft,DtIconArrowUp:r.DtIconArrowUp,DtIconArrowDown:r.DtIconArrowDown,DtIconCommand:r.DtIconCommand,DtIconOption:r.DtIconOption,DtIconPlus:r.DtIconPlus},props:{inverted:{type:Boolean,default:!1},shortcut:{type:String,required:!0},screenReaderText:{type:String,default:null}},data(){return{separator:/\+/gi}},computed:{icons(){return{...c,"{plus}":r.DtIconPlus}},shortcutWithSeparator(){return this.shortcut.replace(this.separator,"{plus}")},formattedShortcut(){return Object.keys(c).reduce((e,t)=>e.replace(new RegExp("{"+t+"}","gi"),c[t]),this.shortcutWithSeparator)},formattedShortcutSplit(){const e=Object.keys(this.icons).join("|"),t=new RegExp(`(${e})`,"gi");return this.formattedShortcut.split(t).filter(Boolean)},generatedScreenReaderText(){return this.formattedShortcutSplit.map(e=>{const t=e.trim();if(a[t])return a[t];const o=t.toLowerCase();return i[o]?i[o]:t}).filter(e=>e).join(" ")}}};var p=function(){var t=this,o=t._self._c;return o("kbd",{class:["d-keyboard-shortcut",{"d-keyboard-shortcut--inverted":t.inverted}]},[o("span",{staticClass:"d-keyboard-shortcut--sr-only"},[t._v(" "+t._s(t.screenReaderText||t.generatedScreenReaderText)+" ")]),t._l(t.formattedShortcutSplit,function(n,s){return[t.icons[n]?o(t.icons[n],{key:`icon-${s}-${n}`,tag:"component",class:["d-keyboard-shortcut__icon",{"d-keyboard-shortcut__icon--inverted":t.inverted}],attrs:{size:"100","aria-hidden":"true"}}):n.trim()?o("span",{key:`text-${s}-${n}`,class:["d-keyboard-shortcut__item",{"d-keyboard-shortcut__item--inverted":t.inverted}],attrs:{"aria-hidden":"true"},domProps:{innerHTML:t._s(n)}}):t._e()]})],2)},l=[],w=d.n(u,p,l);const _=w.exports;exports.default=_;
//# sourceMappingURL=keyboard-shortcut.cjs.map
