WordPress/wp-includes/js/dist/keycodes.min.js

2 lines
4.3 KiB
JavaScript

/*! This file is auto-generated */
!function(){"use strict";var t={d:function(n,r){for(var e in r)t.o(r,e)&&!t.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:r[e]})},o:function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{ALT:function(){return P},BACKSPACE:function(){return d},COMMAND:function(){return L},CTRL:function(){return j},DELETE:function(){return S},DOWN:function(){return E},END:function(){return m},ENTER:function(){return p},ESCAPE:function(){return h},F10:function(){return b},HOME:function(){return A},LEFT:function(){return w},PAGEDOWN:function(){return y},PAGEUP:function(){return v},RIGHT:function(){return O},SHIFT:function(){return T},SPACE:function(){return g},TAB:function(){return s},UP:function(){return C},ZERO:function(){return _},displayShortcut:function(){return x},displayShortcutList:function(){return Z},isAppleOS:function(){return a},isKeyboardEvent:function(){return N},modifiers:function(){return k},rawShortcut:function(){return M},shortcutAriaLabel:function(){return D}});var r=function(){return r=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},r.apply(this,arguments)};Object.create;Object.create;function e(t){return t.toLowerCase()}var o=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],i=/[^A-Z0-9]+/gi;function u(t,n,r){return n instanceof RegExp?t.replace(n,r):n.reduce((function(t,n){return t.replace(n,r)}),t)}function c(t){return function(t){return t.charAt(0).toUpperCase()+t.substr(1)}(t.toLowerCase())}function f(t,n){return void 0===n&&(n={}),function(t,n){void 0===n&&(n={});for(var r=n.splitRegexp,c=void 0===r?o:r,f=n.stripRegexp,l=void 0===f?i:f,a=n.transform,d=void 0===a?e:a,s=n.delimiter,p=void 0===s?" ":s,h=u(u(t,c,"$1\0$2"),l,"\0"),g=0,v=h.length;"\0"===h.charAt(g);)g++;for(;"\0"===h.charAt(v-1);)v--;return h.slice(g,v).split("\0").map(d).join(p)}(t,r({delimiter:" ",transform:c},n))}var l=window.wp.i18n;function a(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!t){if("undefined"==typeof window)return!1;t=window}const{platform:n}=t.navigator;return-1!==n.indexOf("Mac")||["iPad","iPhone"].includes(n)}const d=8,s=9,p=13,h=27,g=32,v=33,y=34,m=35,A=36,w=37,C=38,O=39,E=40,S=46,b=121,P="alt",j="ctrl",L="meta",T="shift",_=48;function R(t,n){return Object.fromEntries(Object.entries(t).map((t=>{let[r,e]=t;return[r,n(e)]})))}const k={primary:t=>t()?[L]:[j],primaryShift:t=>t()?[T,L]:[j,T],primaryAlt:t=>t()?[P,L]:[j,P],secondary:t=>t()?[T,P,L]:[j,T,P],access:t=>t()?[j,P]:[T,P],ctrl:()=>[j],alt:()=>[P],ctrlShift:()=>[j,T],shift:()=>[T],shiftAlt:()=>[T,P],undefined:()=>[]},M=R(k,(t=>function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;return[...t(r),n.toLowerCase()].join("+")})),Z=R(k,(t=>function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;const e=r(),o={[P]:e?"⌥":"Alt",[j]:e?"⌃":"Ctrl",[L]:"⌘",[T]:e?"⇧":"Shift"},i=t(r).reduce(((t,n)=>{var r;const i=null!==(r=o[n])&&void 0!==r?r:n;return e?[...t,i]:[...t,i,"+"]}),[]),u=f(n,{stripRegexp:/[^A-Z0-9~`,\.\\\-]/gi});return[...i,u]})),x=R(Z,(t=>function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;return t(n,r).join("")})),D=R(k,(t=>function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;const e=r(),o={[T]:"Shift",[L]:e?"Command":"Control",[j]:"Control",[P]:e?"Option":"Alt",",":(0,l.__)("Comma"),".":(0,l.__)("Period"),"`":(0,l.__)("Backtick"),"~":(0,l.__)("Tilde")};return[...t(r),n].map((t=>{var n;return f(null!==(n=o[t])&&void 0!==n?n:t)})).join(e?" ":" + ")}));function K(t){return[P,j,L,T].filter((n=>t[`${n}Key`]))}const N=R(k,(t=>function(n,r){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a;const o=t(e),i=K(n),u={Comma:",",Backslash:"\\",IntlRo:"\\",IntlYen:"\\"},c=o.filter((t=>!i.includes(t))),f=i.filter((t=>!o.includes(t)));if(c.length>0||f.length>0)return!1;let l=n.key.toLowerCase();return r?(n.altKey&&1===r.length&&(l=String.fromCharCode(n.keyCode).toLowerCase()),n.shiftKey&&1===r.length&&u[n.code]&&(l=u[n.code]),"del"===r&&(r="delete"),l===r.toLowerCase()):o.includes(l)}));(window.wp=window.wp||{}).keycodes=n}();