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

2 lines
3.9 KiB
JavaScript
Raw Normal View History

/*! 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 s},COMMAND:function(){return L},CTRL:function(){return j},DELETE:function(){return S},DOWN:function(){return O},END:function(){return g},ENTER:function(){return p},ESCAPE:function(){return h},F10:function(){return b},HOME:function(){return v},LEFT:function(){return w},PAGEDOWN:function(){return A},PAGEUP:function(){return m},RIGHT:function(){return E},SHIFT:function(){return T},SPACE:function(){return y},TAB:function(){return d},UP:function(){return C},ZERO:function(){return _},displayShortcut:function(){return x},displayShortcutList:function(){return Z},isAppleOS:function(){return l},isKeyboardEvent:function(){return K},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"==typeof SuppressedError&&SuppressedError;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,a=void 0===f?i:f,l=n.transform,s=void 0===l?e:l,d=n.delimiter,p=void 0===d?" ":d,h=u(u(t,c,"$1\0$2"),a,"\0"),y=0,m=h.length;"\0"===h.charAt(y);)y++;for(;"\0"===h.charAt(m-1);)m--;return h.slice(y,m).split("\0").map(s).join(p)}(t,r({delimiter:" ",transform:c},n))}var a=window.wp.i18n;function l(t=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 s=8,d=9,p=13,h=27,y=32,m=33,A=34,g=35,v=36,w=37,C=38,E=39,O=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,r])=>[t,n(r)])))}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=>(n,r=l)=>[...t(r),n.toLowerCase()].join("+"))),Z=R(k,(t=>(n,r=l)=>{const e=r(),o={[P]:e?"⌥":"Alt",[j]:e?"⌃":"Ctrl",[L]:"⌘",[T]:e?"⇧":"Shift"};return[...t(r).reduce(((t,n)=>{var r;const i=null!==(r=o[n])&&void 0!==r?r:n;return e?[...t,i]:[...t,i,"+"]}),[]),f(n,{stripRegexp:/[^A-Z0-9~`,\.\\\-]/gi})]})),x=R(Z,(t=>(n,r=l)=>t(n,r).join(""))),D=R(k,(t=>(n,r=l)=>{const e=r(),o={[T]:"Shift",[L]:e?"Command":"Control",[j]:"Control",[P]:e?"Option":"Alt",",":(0,a.__)("Comma"),".":(0,a.__)("Period"),"`":(0,a.__)("Backtick"),"~":(0,a.__)("Tilde")};return[...t(r),n].map((t=>{var n;return f(null!==(n=o[t])&&void 0!==n?n:t)})).join(e?" ":" + ")}));const K=R(k,(t=>(n,r,e=l)=>{const o=t(e),i=function(t){return[P,j,L,T].filter((n=>t[`${n}Key`]))}(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 a=n.key.toLowerCase();return r?(n.altKey&&1===r.length&&(a=String.fromCharCode(n.keyCode).toLowerCase()),n.shiftKey&&1===r.length&&u[n.code]&&(a=u[n.code]),"del"===r&&(r="delete"),a===r.toLowerCase()):o.includes(a)}));(window.wp=window.wp||{}).keycodes=n}();