diff --git a/build/css/index.css b/build/css/index.css index 70bad8bc2..c9fd91264 100644 --- a/build/css/index.css +++ b/build/css/index.css @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v3.7.68 + * simple-keyboard v3.7.69 * https://github.com/hodgef/simple-keyboard * * Copyright (c) Francisco Hodge (https://github.com/hodgef) and project contributors. diff --git a/build/index.js b/build/index.js index 77707504e..bb88dd9a9 100644 --- a/build/index.js +++ b/build/index.js @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v3.7.68 + * simple-keyboard v3.7.69 * https://github.com/hodgef/simple-keyboard * * Copyright (c) Francisco Hodge (https://github.com/hodgef) and project contributors. @@ -9,4 +9,4 @@ * LICENSE file in the root directory of this source tree. * */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SimpleKeyboard=e():t.SimpleKeyboard=e()}(this,(function(){return function(){"use strict";var t={9306:function(t,e,n){var o=n(4901),r=n(6823),i=TypeError;t.exports=function(t){if(o(t))return t;throw new i(r(t)+" is not a function")}},5548:function(t,e,n){var o=n(3517),r=n(6823),i=TypeError;t.exports=function(t){if(o(t))return t;throw new i(r(t)+" is not a constructor")}},3506:function(t,e,n){var o=n(3925),r=String,i=TypeError;t.exports=function(t){if(o(t))return t;throw new i("Can't set "+r(t)+" as a prototype")}},6469:function(t,e,n){var o=n(8227),r=n(2360),i=n(4913).f,a=o("unscopables"),s=Array.prototype;void 0===s[a]&&i(s,a,{configurable:!0,value:r(null)}),t.exports=function(t){s[a][t]=!0}},7829:function(t,e,n){var o=n(8183).charAt;t.exports=function(t,e,n){return e+(n?o(t,e).length:1)}},8551:function(t,e,n){var o=n(34),r=String,i=TypeError;t.exports=function(t){if(o(t))return t;throw new i(r(t)+" is not an object")}},235:function(t,e,n){var o=n(9213).forEach,r=n(4598)("forEach");t.exports=r?[].forEach:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}},7916:function(t,e,n){var o=n(6080),r=n(9565),i=n(8981),a=n(6319),s=n(4209),u=n(3517),c=n(6198),l=n(4659),f=n(81),d=n(851),p=Array;t.exports=function(t){var e=i(t),n=u(this),h=arguments.length,v=h>1?arguments[1]:void 0,y=void 0!==v;y&&(v=o(v,h>2?arguments[2]:void 0));var g,m,b,x,w,E,O=d(e),S=0;if(!O||this===p&&s(O))for(g=c(e),m=n?new this(g):p(g);g>S;S++)E=y?v(e[S],S):e[S],l(m,S,E);else for(m=n?new this:[],w=(x=f(e,O)).next;!(b=r(w,x)).done;S++)E=y?a(x,v,[b.value,S],!0):b.value,l(m,S,E);return m.length=S,m}},9617:function(t,e,n){var o=n(5397),r=n(5610),i=n(6198),a=function(t){return function(e,n,a){var s=o(e),u=i(s);if(0===u)return!t&&-1;var c,l=r(a,u);if(t&&n!=n){for(;u>l;)if((c=s[l++])!=c)return!0}else for(;u>l;l++)if((t||l in s)&&s[l]===n)return t||l||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},9213:function(t,e,n){var o=n(6080),r=n(9504),i=n(7055),a=n(8981),s=n(6198),u=n(1469),c=r([].push),l=function(t){var e=1===t,n=2===t,r=3===t,l=4===t,f=6===t,d=7===t,p=5===t||f;return function(h,v,y,g){for(var m,b,x=a(h),w=i(x),E=s(w),O=o(v,y),S=0,k=g||u,P=e?k(h,E):n||d?k(h,0):void 0;E>S;S++)if((p||S in w)&&(b=O(m=w[S],S,x),t))if(e)P[S]=b;else if(b)switch(t){case 3:return!0;case 5:return m;case 6:return S;case 2:c(P,m)}else switch(t){case 4:return!1;case 7:c(P,m)}return f?-1:r||l?l:P}};t.exports={forEach:l(0),map:l(1),filter:l(2),some:l(3),every:l(4),find:l(5),findIndex:l(6),filterReject:l(7)}},597:function(t,e,n){var o=n(9039),r=n(8227),i=n(7388),a=r("species");t.exports=function(t){return i>=51||!o((function(){var e=[];return(e.constructor={})[a]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},4598:function(t,e,n){var o=n(9039);t.exports=function(t,e){var n=[][t];return!!n&&o((function(){n.call(null,e||function(){return 1},1)}))}},926:function(t,e,n){var o=n(9306),r=n(8981),i=n(7055),a=n(6198),s=TypeError,u="Reduce of empty array with no initial value",c=function(t){return function(e,n,c,l){var f=r(e),d=i(f),p=a(f);if(o(n),0===p&&c<2)throw new s(u);var h=t?p-1:0,v=t?-1:1;if(c<2)for(;;){if(h in d){l=d[h],h+=v;break}if(h+=v,t?h<0:p<=h)throw new s(u)}for(;t?h>=0:p>h;h+=v)h in d&&(l=n(l,d[h],h,f));return l}};t.exports={left:c(!1),right:c(!0)}},4527:function(t,e,n){var o=n(3724),r=n(4376),i=TypeError,a=Object.getOwnPropertyDescriptor,s=o&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=s?function(t,e){if(r(t)&&!a(t,"length").writable)throw new i("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},7680:function(t,e,n){var o=n(9504);t.exports=o([].slice)},4488:function(t,e,n){var o=n(7680),r=Math.floor,i=function(t,e){var n=t.length;if(n<8)for(var a,s,u=1;u0;)t[s]=t[--s];s!==u++&&(t[s]=a)}else for(var c=r(n/2),l=i(o(t,0,c),e),f=i(o(t,c),e),d=l.length,p=f.length,h=0,v=0;h9007199254740991)throw e("Maximum allowed index exceeded");return t}},7400:function(t){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},9296:function(t,e,n){var o=n(4055)("span").classList,r=o&&o.constructor&&o.constructor.prototype;t.exports=r===Object.prototype?void 0:r},8834:function(t,e,n){var o=n(9392).match(/firefox\/(\d+)/i);t.exports=!!o&&+o[1]},3202:function(t,e,n){var o=n(9392);t.exports=/MSIE|Trident/.test(o)},9088:function(t,e,n){var o=n(4475),r=n(4576);t.exports="process"===r(o.process)},9392:function(t){t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7388:function(t,e,n){var o,r,i=n(4475),a=n(9392),s=i.process,u=i.Deno,c=s&&s.versions||u&&u.version,l=c&&c.v8;l&&(r=(o=l.split("."))[0]>0&&o[0]<4?1:+(o[0]+o[1])),!r&&a&&(!(o=a.match(/Edge\/(\d+)/))||o[1]>=74)&&(o=a.match(/Chrome\/(\d+)/))&&(r=+o[1]),t.exports=r},9160:function(t,e,n){var o=n(9392).match(/AppleWebKit\/(\d+)\./);t.exports=!!o&&+o[1]},8727:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6518:function(t,e,n){var o=n(4475),r=n(7347).f,i=n(6699),a=n(6840),s=n(9433),u=n(7740),c=n(2796);t.exports=function(t,e){var n,l,f,d,p,h=t.target,v=t.global,y=t.stat;if(n=v?o:y?o[h]||s(h,{}):o[h]&&o[h].prototype)for(l in e){if(d=e[l],f=t.dontCallGetSet?(p=r(n,l))&&p.value:n[l],!c(v?l:h+(y?".":"#")+l,t.forced)&&void 0!==f){if(typeof d==typeof f)continue;u(d,f)}(t.sham||f&&f.sham)&&i(d,"sham",!0),a(n,l,d,t)}}},9039:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},9228:function(t,e,n){n(7495);var o=n(9565),r=n(6840),i=n(7323),a=n(9039),s=n(8227),u=n(6699),c=s("species"),l=RegExp.prototype;t.exports=function(t,e,n,f){var d=s(t),p=!a((function(){var e={};return e[d]=function(){return 7},7!==""[t](e)})),h=p&&!a((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[c]=function(){return n},n.flags="",n[d]=/./[d]),n.exec=function(){return e=!0,null},n[d](""),!e}));if(!p||!h||n){var v=/./[d],y=e(d,""[t],(function(t,e,n,r,a){var s=e.exec;return s===i||s===l.exec?p&&!a?{done:!0,value:o(v,e,n,r)}:{done:!0,value:o(t,n,e,r)}:{done:!1}}));r(String.prototype,t,y[0]),r(l,d,y[1])}f&&u(l[d],"sham",!0)}},8745:function(t,e,n){var o=n(616),r=Function.prototype,i=r.apply,a=r.call;t.exports="object"==typeof Reflect&&Reflect.apply||(o?a.bind(i):function(){return a.apply(i,arguments)})},6080:function(t,e,n){var o=n(7476),r=n(9306),i=n(616),a=o(o.bind);t.exports=function(t,e){return r(t),void 0===e?t:i?a(t,e):function(){return t.apply(e,arguments)}}},616:function(t,e,n){var o=n(9039);t.exports=!o((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},9565:function(t,e,n){var o=n(616),r=Function.prototype.call;t.exports=o?r.bind(r):function(){return r.apply(r,arguments)}},350:function(t,e,n){var o=n(3724),r=n(9297),i=Function.prototype,a=o&&Object.getOwnPropertyDescriptor,s=r(i,"name"),u=s&&"something"===function(){}.name,c=s&&(!o||o&&a(i,"name").configurable);t.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},6706:function(t,e,n){var o=n(9504),r=n(9306);t.exports=function(t,e,n){try{return o(r(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(t){}}},7476:function(t,e,n){var o=n(4576),r=n(9504);t.exports=function(t){if("Function"===o(t))return r(t)}},9504:function(t,e,n){var o=n(616),r=Function.prototype,i=r.call,a=o&&r.bind.bind(i,i);t.exports=o?a:function(t){return function(){return i.apply(t,arguments)}}},7751:function(t,e,n){var o=n(4475),r=n(4901);t.exports=function(t,e){return arguments.length<2?(n=o[t],r(n)?n:void 0):o[t]&&o[t][e];var n}},851:function(t,e,n){var o=n(6955),r=n(5966),i=n(4117),a=n(6269),s=n(8227)("iterator");t.exports=function(t){if(!i(t))return r(t,s)||r(t,"@@iterator")||a[o(t)]}},81:function(t,e,n){var o=n(9565),r=n(9306),i=n(8551),a=n(6823),s=n(851),u=TypeError;t.exports=function(t,e){var n=arguments.length<2?s(t):e;if(r(n))return i(o(n,t));throw new u(a(t)+" is not iterable")}},6933:function(t,e,n){var o=n(9504),r=n(4376),i=n(4901),a=n(4576),s=n(655),u=o([].push);t.exports=function(t){if(i(t))return t;if(r(t)){for(var e=t.length,n=[],o=0;o]*>)/g,l=/\$([$&'`]|\d{1,2})/g;t.exports=function(t,e,n,o,f,d){var p=n+t.length,h=o.length,v=l;return void 0!==f&&(f=r(f),v=c),s(d,v,(function(r,s){var c;switch(a(s,0)){case"$":return"$";case"&":return t;case"`":return u(e,0,n);case"'":return u(e,p);case"<":c=f[u(s,1,-1)];break;default:var l=+s;if(0===l)return r;if(l>h){var d=i(l/10);return 0===d?r:d<=h?void 0===o[d-1]?a(s,1):o[d-1]+a(s,1):r}c=o[l-1]}return void 0===c?"":c}))}},4475:function(t,e,n){var o=function(t){return t&&t.Math===Math&&t};t.exports=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof n.g&&n.g)||o("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:function(t,e,n){var o=n(9504),r=n(8981),i=o({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(r(t),e)}},421:function(t){t.exports={}},397:function(t,e,n){var o=n(7751);t.exports=o("document","documentElement")},5917:function(t,e,n){var o=n(3724),r=n(9039),i=n(4055);t.exports=!o&&!r((function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},7055:function(t,e,n){var o=n(9504),r=n(9039),i=n(4576),a=Object,s=o("".split);t.exports=r((function(){return!a("z").propertyIsEnumerable(0)}))?function(t){return"String"===i(t)?s(t,""):a(t)}:a},3167:function(t,e,n){var o=n(4901),r=n(34),i=n(2967);t.exports=function(t,e,n){var a,s;return i&&o(a=e.constructor)&&a!==n&&r(s=a.prototype)&&s!==n.prototype&&i(t,s),t}},3706:function(t,e,n){var o=n(9504),r=n(4901),i=n(7629),a=o(Function.toString);r(i.inspectSource)||(i.inspectSource=function(t){return a(t)}),t.exports=i.inspectSource},1181:function(t,e,n){var o,r,i,a=n(8622),s=n(4475),u=n(34),c=n(6699),l=n(9297),f=n(7629),d=n(6119),p=n(421),h="Object already initialized",v=s.TypeError,y=s.WeakMap;if(a||f.state){var g=f.state||(f.state=new y);g.get=g.get,g.has=g.has,g.set=g.set,o=function(t,e){if(g.has(t))throw new v(h);return e.facade=t,g.set(t,e),e},r=function(t){return g.get(t)||{}},i=function(t){return g.has(t)}}else{var m=d("state");p[m]=!0,o=function(t,e){if(l(t,m))throw new v(h);return e.facade=t,c(t,m,e),e},r=function(t){return l(t,m)?t[m]:{}},i=function(t){return l(t,m)}}t.exports={set:o,get:r,has:i,enforce:function(t){return i(t)?r(t):o(t,{})},getterFor:function(t){return function(e){var n;if(!u(e)||(n=r(e)).type!==t)throw new v("Incompatible receiver, "+t+" required");return n}}}},4209:function(t,e,n){var o=n(8227),r=n(6269),i=o("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||a[i]===t)}},4376:function(t,e,n){var o=n(4576);t.exports=Array.isArray||function(t){return"Array"===o(t)}},4901:function(t){var e="object"==typeof document&&document.all;t.exports=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},3517:function(t,e,n){var o=n(9504),r=n(9039),i=n(4901),a=n(6955),s=n(7751),u=n(3706),c=function(){},l=s("Reflect","construct"),f=/^\s*(?:class|function)\b/,d=o(f.exec),p=!f.test(c),h=function(t){if(!i(t))return!1;try{return l(c,[],t),!0}catch(t){return!1}},v=function(t){if(!i(t))return!1;switch(a(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!d(f,u(t))}catch(t){return!0}};v.sham=!0,t.exports=!l||r((function(){var t;return h(h.call)||!h(Object)||!h((function(){t=!0}))||t}))?v:h},2796:function(t,e,n){var o=n(9039),r=n(4901),i=/#|\.prototype\./,a=function(t,e){var n=u[s(t)];return n===l||n!==c&&(r(e)?o(e):!!e)},s=a.normalize=function(t){return String(t).replace(i,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",l=a.POLYFILL="P";t.exports=a},2087:function(t,e,n){var o=n(34),r=Math.floor;t.exports=Number.isInteger||function(t){return!o(t)&&isFinite(t)&&r(t)===t}},4117:function(t){t.exports=function(t){return null==t}},34:function(t,e,n){var o=n(4901);t.exports=function(t){return"object"==typeof t?null!==t:o(t)}},3925:function(t,e,n){var o=n(34);t.exports=function(t){return o(t)||null===t}},6395:function(t){t.exports=!1},788:function(t,e,n){var o=n(34),r=n(4576),i=n(8227)("match");t.exports=function(t){var e;return o(t)&&(void 0!==(e=t[i])?!!e:"RegExp"===r(t))}},757:function(t,e,n){var o=n(7751),r=n(4901),i=n(1625),a=n(7040),s=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=o("Symbol");return r(e)&&i(e.prototype,s(t))}},9539:function(t,e,n){var o=n(9565),r=n(8551),i=n(5966);t.exports=function(t,e,n){var a,s;r(t);try{if(!(a=i(t,"return"))){if("throw"===e)throw n;return n}a=o(a,t)}catch(t){s=!0,a=t}if("throw"===e)throw n;if(s)throw a;return r(a),n}},3994:function(t,e,n){var o=n(7657).IteratorPrototype,r=n(2360),i=n(6980),a=n(687),s=n(6269),u=function(){return this};t.exports=function(t,e,n,c){var l=e+" Iterator";return t.prototype=r(o,{next:i(+!c,n)}),a(t,l,!1,!0),s[l]=u,t}},1088:function(t,e,n){var o=n(6518),r=n(9565),i=n(6395),a=n(350),s=n(4901),u=n(3994),c=n(2787),l=n(2967),f=n(687),d=n(6699),p=n(6840),h=n(8227),v=n(6269),y=n(7657),g=a.PROPER,m=a.CONFIGURABLE,b=y.IteratorPrototype,x=y.BUGGY_SAFARI_ITERATORS,w=h("iterator"),E="keys",O="values",S="entries",k=function(){return this};t.exports=function(t,e,n,a,h,y,P){u(n,e,a);var I,C,A,M=function(t){if(t===h&&R)return R;if(!x&&t&&t in j)return j[t];switch(t){case E:case O:case S:return function(){return new n(this,t)}}return function(){return new n(this)}},T=e+" Iterator",D=!1,j=t.prototype,N=j[w]||j["@@iterator"]||h&&j[h],R=!x&&N||M(h),L="Array"===e&&j.entries||N;if(L&&(I=c(L.call(new t)))!==Object.prototype&&I.next&&(i||c(I)===b||(l?l(I,b):s(I[w])||p(I,w,k)),f(I,T,!0,!0),i&&(v[T]=k)),g&&h===O&&N&&N.name!==O&&(!i&&m?d(j,"name",O):(D=!0,R=function(){return r(N,this)})),h)if(C={values:M(O),keys:y?R:M(E),entries:M(S)},P)for(A in C)(x||D||!(A in j))&&p(j,A,C[A]);else o({target:e,proto:!0,forced:x||D},C);return i&&!P||j[w]===R||p(j,w,R,{name:h}),v[e]=R,C}},7657:function(t,e,n){var o,r,i,a=n(9039),s=n(4901),u=n(34),c=n(2360),l=n(2787),f=n(6840),d=n(8227),p=n(6395),h=d("iterator"),v=!1;[].keys&&("next"in(i=[].keys())?(r=l(l(i)))!==Object.prototype&&(o=r):v=!0),!u(o)||a((function(){var t={};return o[h].call(t)!==t}))?o={}:p&&(o=c(o)),s(o[h])||f(o,h,(function(){return this})),t.exports={IteratorPrototype:o,BUGGY_SAFARI_ITERATORS:v}},6269:function(t){t.exports={}},6198:function(t,e,n){var o=n(8014);t.exports=function(t){return o(t.length)}},283:function(t,e,n){var o=n(9504),r=n(9039),i=n(4901),a=n(9297),s=n(3724),u=n(350).CONFIGURABLE,c=n(3706),l=n(1181),f=l.enforce,d=l.get,p=String,h=Object.defineProperty,v=o("".slice),y=o("".replace),g=o([].join),m=s&&!r((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),x=t.exports=function(t,e,n){"Symbol("===v(p(e),0,7)&&(e="["+y(p(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!a(t,"name")||u&&t.name!==e)&&(s?h(t,"name",{value:e,configurable:!0}):t.name=e),m&&n&&a(n,"arity")&&t.length!==n.arity&&h(t,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var o=f(t);return a(o,"source")||(o.source=g(b,"string"==typeof e?e:"")),t};Function.prototype.toString=x((function(){return i(this)&&d(this).source||c(this)}),"toString")},741:function(t){var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var o=+t;return(o>0?n:e)(o)}},5749:function(t,e,n){var o=n(788),r=TypeError;t.exports=function(t){if(o(t))throw new r("The method doesn't accept regular expressions");return t}},4213:function(t,e,n){var o=n(3724),r=n(9504),i=n(9565),a=n(9039),s=n(1072),u=n(3717),c=n(8773),l=n(8981),f=n(7055),d=Object.assign,p=Object.defineProperty,h=r([].concat);t.exports=!d||a((function(){if(o&&1!==d({b:1},d(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol("assign detection"),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!==d({},t)[n]||s(d({},e)).join("")!==r}))?function(t,e){for(var n=l(t),r=arguments.length,a=1,d=u.f,p=c.f;r>a;)for(var v,y=f(arguments[a++]),g=d?h(s(y),d(y)):s(y),m=g.length,b=0;m>b;)v=g[b++],o&&!i(p,y,v)||(n[v]=y[v]);return n}:d},2360:function(t,e,n){var o,r=n(8551),i=n(6801),a=n(8727),s=n(421),u=n(397),c=n(4055),l=n(6119),f="prototype",d="script",p=l("IE_PROTO"),h=function(){},v=function(t){return"<"+d+">"+t+""},y=function(t){t.write(v("")),t.close();var e=t.parentWindow.Object;return t=null,e},g=function(){try{o=new ActiveXObject("htmlfile")}catch(t){}var t,e,n;g="undefined"!=typeof document?document.domain&&o?y(o):(e=c("iframe"),n="java"+d+":",e.style.display="none",u.appendChild(e),e.src=String(n),(t=e.contentWindow.document).open(),t.write(v("document.F=Object")),t.close(),t.F):y(o);for(var r=a.length;r--;)delete g[f][a[r]];return g()};s[p]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(h[f]=r(t),n=new h,h[f]=null,n[p]=t):n=g(),void 0===e?n:i.f(n,e)}},6801:function(t,e,n){var o=n(3724),r=n(8686),i=n(4913),a=n(8551),s=n(5397),u=n(1072);e.f=o&&!r?Object.defineProperties:function(t,e){a(t);for(var n,o=s(e),r=u(e),c=r.length,l=0;c>l;)i.f(t,n=r[l++],o[n]);return t}},4913:function(t,e,n){var o=n(3724),r=n(5917),i=n(8686),a=n(8551),s=n(6969),u=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",d="configurable",p="writable";e.f=o?i?function(t,e,n){if(a(t),e=s(e),a(n),"function"==typeof t&&"prototype"===e&&"value"in n&&p in n&&!n[p]){var o=l(t,e);o&&o[p]&&(t[e]=n.value,n={configurable:d in n?n[d]:o[d],enumerable:f in n?n[f]:o[f],writable:!1})}return c(t,e,n)}:c:function(t,e,n){if(a(t),e=s(e),a(n),r)try{return c(t,e,n)}catch(t){}if("get"in n||"set"in n)throw new u("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},7347:function(t,e,n){var o=n(3724),r=n(9565),i=n(8773),a=n(6980),s=n(5397),u=n(6969),c=n(9297),l=n(5917),f=Object.getOwnPropertyDescriptor;e.f=o?f:function(t,e){if(t=s(t),e=u(e),l)try{return f(t,e)}catch(t){}if(c(t,e))return a(!r(i.f,t,e),t[e])}},298:function(t,e,n){var o=n(4576),r=n(5397),i=n(8480).f,a=n(7680),s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return s&&"Window"===o(t)?function(t){try{return i(t)}catch(t){return a(s)}}(t):i(r(t))}},8480:function(t,e,n){var o=n(1828),r=n(8727).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return o(t,r)}},3717:function(t,e){e.f=Object.getOwnPropertySymbols},2787:function(t,e,n){var o=n(9297),r=n(4901),i=n(8981),a=n(6119),s=n(2211),u=a("IE_PROTO"),c=Object,l=c.prototype;t.exports=s?c.getPrototypeOf:function(t){var e=i(t);if(o(e,u))return e[u];var n=e.constructor;return r(n)&&e instanceof n?n.prototype:e instanceof c?l:null}},1625:function(t,e,n){var o=n(9504);t.exports=o({}.isPrototypeOf)},1828:function(t,e,n){var o=n(9504),r=n(9297),i=n(5397),a=n(9617).indexOf,s=n(421),u=o([].push);t.exports=function(t,e){var n,o=i(t),c=0,l=[];for(n in o)!r(s,n)&&r(o,n)&&u(l,n);for(;e.length>c;)r(o,n=e[c++])&&(~a(l,n)||u(l,n));return l}},1072:function(t,e,n){var o=n(1828),r=n(8727);t.exports=Object.keys||function(t){return o(t,r)}},8773:function(t,e){var n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,r=o&&!n.call({1:2},1);e.f=r?function(t){var e=o(this,t);return!!e&&e.enumerable}:n},2551:function(t,e,n){var o=n(6395),r=n(4475),i=n(9039),a=n(9160);t.exports=o||!i((function(){if(!(a&&a<535)){var t=Math.random();__defineSetter__.call(null,t,(function(){})),delete r[t]}}))},2967:function(t,e,n){var o=n(6706),r=n(34),i=n(7750),a=n(3506);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=o(Object.prototype,"__proto__","set"))(n,[]),e=n instanceof Array}catch(t){}return function(n,o){return i(n),a(o),r(n)?(e?t(n,o):n.__proto__=o,n):n}}():void 0)},3179:function(t,e,n){var o=n(2140),r=n(6955);t.exports=o?{}.toString:function(){return"[object "+r(this)+"]"}},4270:function(t,e,n){var o=n(9565),r=n(4901),i=n(34),a=TypeError;t.exports=function(t,e){var n,s;if("string"===e&&r(n=t.toString)&&!i(s=o(n,t)))return s;if(r(n=t.valueOf)&&!i(s=o(n,t)))return s;if("string"!==e&&r(n=t.toString)&&!i(s=o(n,t)))return s;throw new a("Can't convert object to primitive value")}},5031:function(t,e,n){var o=n(7751),r=n(9504),i=n(8480),a=n(3717),s=n(8551),u=r([].concat);t.exports=o("Reflect","ownKeys")||function(t){var e=i.f(s(t)),n=a.f;return n?u(e,n(t)):e}},9167:function(t,e,n){var o=n(4475);t.exports=o},1056:function(t,e,n){var o=n(4913).f;t.exports=function(t,e,n){n in t||o(t,n,{configurable:!0,get:function(){return e[n]},set:function(t){e[n]=t}})}},6682:function(t,e,n){var o=n(9565),r=n(8551),i=n(4901),a=n(4576),s=n(7323),u=TypeError;t.exports=function(t,e){var n=t.exec;if(i(n)){var c=o(n,t,e);return null!==c&&r(c),c}if("RegExp"===a(t))return o(s,t,e);throw new u("RegExp#exec called on incompatible receiver")}},7323:function(t,e,n){var o,r,i=n(9565),a=n(9504),s=n(655),u=n(7979),c=n(8429),l=n(5745),f=n(2360),d=n(1181).get,p=n(3635),h=n(8814),v=l("native-string-replace",String.prototype.replace),y=RegExp.prototype.exec,g=y,m=a("".charAt),b=a("".indexOf),x=a("".replace),w=a("".slice),E=(r=/b*/g,i(y,o=/a/,"a"),i(y,r,"a"),0!==o.lastIndex||0!==r.lastIndex),O=c.BROKEN_CARET,S=void 0!==/()??/.exec("")[1];(E||S||O||p||h)&&(g=function(t){var e,n,o,r,a,c,l,p=this,h=d(p),k=s(t),P=h.raw;if(P)return P.lastIndex=p.lastIndex,e=i(g,P,k),p.lastIndex=P.lastIndex,e;var I=h.groups,C=O&&p.sticky,A=i(u,p),M=p.source,T=0,D=k;if(C&&(A=x(A,"y",""),-1===b(A,"g")&&(A+="g"),D=w(k,p.lastIndex),p.lastIndex>0&&(!p.multiline||p.multiline&&"\n"!==m(k,p.lastIndex-1))&&(M="(?: "+M+")",D=" "+D,T++),n=new RegExp("^(?:"+M+")",A)),S&&(n=new RegExp("^"+M+"$(?!\\s)",A)),E&&(o=p.lastIndex),r=i(y,C?n:p,D),C?r?(r.input=w(r.input,T),r[0]=w(r[0],T),r.index=p.lastIndex,p.lastIndex+=r[0].length):p.lastIndex=0:E&&r&&(p.lastIndex=p.global?r.index+r[0].length:o),S&&r&&r.length>1&&i(v,r[0],n,(function(){for(a=1;ab)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$c")}))},7750:function(t,e,n){var o=n(4117),r=TypeError;t.exports=function(t){if(o(t))throw new r("Can't call method on "+t);return t}},7633:function(t,e,n){var o=n(7751),r=n(2106),i=n(8227),a=n(3724),s=i("species");t.exports=function(t){var e=o(t);a&&e&&!e[s]&&r(e,s,{configurable:!0,get:function(){return this}})}},687:function(t,e,n){var o=n(4913).f,r=n(9297),i=n(8227)("toStringTag");t.exports=function(t,e,n){t&&!n&&(t=t.prototype),t&&!r(t,i)&&o(t,i,{configurable:!0,value:e})}},6119:function(t,e,n){var o=n(5745),r=n(3392),i=o("keys");t.exports=function(t){return i[t]||(i[t]=r(t))}},7629:function(t,e,n){var o=n(6395),r=n(4475),i=n(9433),a="__core-js_shared__",s=t.exports=r[a]||i(a,{});(s.versions||(s.versions=[])).push({version:"3.36.1",mode:o?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:function(t,e,n){var o=n(7629);t.exports=function(t,e){return o[t]||(o[t]=e||{})}},2293:function(t,e,n){var o=n(8551),r=n(5548),i=n(4117),a=n(8227)("species");t.exports=function(t,e){var n,s=o(t).constructor;return void 0===s||i(n=o(s)[a])?e:r(n)}},8183:function(t,e,n){var o=n(9504),r=n(1291),i=n(655),a=n(7750),s=o("".charAt),u=o("".charCodeAt),c=o("".slice),l=function(t){return function(e,n){var o,l,f=i(a(e)),d=r(n),p=f.length;return d<0||d>=p?t?"":void 0:(o=u(f,d))<55296||o>56319||d+1===p||(l=u(f,d+1))<56320||l>57343?t?s(f,d):o:t?c(f,d,d+2):l-56320+(o-55296<<10)+65536}};t.exports={codeAt:l(!1),charAt:l(!0)}},706:function(t,e,n){var o=n(350).PROPER,r=n(9039),i=n(7452);t.exports=function(t){return r((function(){return!!i[t]()||"​…᠎"!=="​…᠎"[t]()||o&&i[t].name!==t}))}},3802:function(t,e,n){var o=n(9504),r=n(7750),i=n(655),a=n(7452),s=o("".replace),u=RegExp("^["+a+"]+"),c=RegExp("(^|[^"+a+"])["+a+"]+$"),l=function(t){return function(e){var n=i(r(e));return 1&t&&(n=s(n,u,"")),2&t&&(n=s(n,c,"$1")),n}};t.exports={start:l(1),end:l(2),trim:l(3)}},4495:function(t,e,n){var o=n(7388),r=n(9039),i=n(4475).String;t.exports=!!Object.getOwnPropertySymbols&&!r((function(){var t=Symbol("symbol detection");return!i(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&o&&o<41}))},8242:function(t,e,n){var o=n(9565),r=n(7751),i=n(8227),a=n(6840);t.exports=function(){var t=r("Symbol"),e=t&&t.prototype,n=e&&e.valueOf,s=i("toPrimitive");e&&!e[s]&&a(e,s,(function(t){return o(n,this)}),{arity:1})}},1296:function(t,e,n){var o=n(4495);t.exports=o&&!!Symbol.for&&!!Symbol.keyFor},1240:function(t,e,n){var o=n(9504);t.exports=o(1..valueOf)},5610:function(t,e,n){var o=n(1291),r=Math.max,i=Math.min;t.exports=function(t,e){var n=o(t);return n<0?r(n+e,0):i(n,e)}},5397:function(t,e,n){var o=n(7055),r=n(7750);t.exports=function(t){return o(r(t))}},1291:function(t,e,n){var o=n(741);t.exports=function(t){var e=+t;return e!=e||0===e?0:o(e)}},8014:function(t,e,n){var o=n(1291),r=Math.min;t.exports=function(t){var e=o(t);return e>0?r(e,9007199254740991):0}},8981:function(t,e,n){var o=n(7750),r=Object;t.exports=function(t){return r(o(t))}},2777:function(t,e,n){var o=n(9565),r=n(34),i=n(757),a=n(5966),s=n(4270),u=n(8227),c=TypeError,l=u("toPrimitive");t.exports=function(t,e){if(!r(t)||i(t))return t;var n,u=a(t,l);if(u){if(void 0===e&&(e="default"),n=o(u,t,e),!r(n)||i(n))return n;throw new c("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},6969:function(t,e,n){var o=n(2777),r=n(757);t.exports=function(t){var e=o(t,"string");return r(e)?e:e+""}},2140:function(t,e,n){var o={};o[n(8227)("toStringTag")]="z",t.exports="[object z]"===String(o)},655:function(t,e,n){var o=n(6955),r=String;t.exports=function(t){if("Symbol"===o(t))throw new TypeError("Cannot convert a Symbol value to a string");return r(t)}},6823:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},3392:function(t,e,n){var o=n(9504),r=0,i=Math.random(),a=o(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++r+i,36)}},7040:function(t,e,n){var o=n(4495);t.exports=o&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:function(t,e,n){var o=n(3724),r=n(9039);t.exports=o&&r((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8622:function(t,e,n){var o=n(4475),r=n(4901),i=o.WeakMap;t.exports=r(i)&&/native code/.test(String(i))},511:function(t,e,n){var o=n(9167),r=n(9297),i=n(1951),a=n(4913).f;t.exports=function(t){var e=o.Symbol||(o.Symbol={});r(e,t)||a(e,t,{value:i.f(t)})}},1951:function(t,e,n){var o=n(8227);e.f=o},8227:function(t,e,n){var o=n(4475),r=n(5745),i=n(9297),a=n(3392),s=n(4495),u=n(7040),c=o.Symbol,l=r("wks"),f=u?c.for||c:c&&c.withoutSetter||a;t.exports=function(t){return i(l,t)||(l[t]=s&&i(c,t)?c[t]:f("Symbol."+t)),l[t]}},7452:function(t){t.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},8706:function(t,e,n){var o=n(6518),r=n(9039),i=n(4376),a=n(34),s=n(8981),u=n(6198),c=n(6837),l=n(4659),f=n(1469),d=n(597),p=n(8227),h=n(7388),v=p("isConcatSpreadable"),y=h>=51||!r((function(){var t=[];return t[v]=!1,t.concat()[0]!==t})),g=function(t){if(!a(t))return!1;var e=t[v];return void 0!==e?!!e:i(t)};o({target:"Array",proto:!0,arity:1,forced:!y||!d("concat")},{concat:function(t){var e,n,o,r,i,a=s(this),d=f(a,0),p=0;for(e=-1,o=arguments.length;e1?arguments[1]:void 0)}})},3418:function(t,e,n){var o=n(6518),r=n(7916);o({target:"Array",stat:!0,forced:!n(4428)((function(t){Array.from(t)}))},{from:r})},4423:function(t,e,n){var o=n(6518),r=n(9617).includes,i=n(9039),a=n(6469);o({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}}),a("includes")},5276:function(t,e,n){var o=n(6518),r=n(7476),i=n(9617).indexOf,a=n(4598),s=r([].indexOf),u=!!s&&1/s([1],1,-0)<0;o({target:"Array",proto:!0,forced:u||!a("indexOf")},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return u?s(this,t,e)||0:i(this,t,e)}})},3792:function(t,e,n){var o=n(5397),r=n(6469),i=n(6269),a=n(1181),s=n(4913).f,u=n(1088),c=n(2529),l=n(6395),f=n(3724),d="Array Iterator",p=a.set,h=a.getterFor(d);t.exports=u(Array,"Array",(function(t,e){p(this,{type:d,target:o(t),index:0,kind:e})}),(function(){var t=h(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=void 0,c(void 0,!0);switch(t.kind){case"keys":return c(n,!1);case"values":return c(e[n],!1)}return c([n,e[n]],!1)}),"values");var v=i.Arguments=i.Array;if(r("keys"),r("values"),r("entries"),!l&&f&&"values"!==v.name)try{s(v,"name",{value:"values"})}catch(t){}},8598:function(t,e,n){var o=n(6518),r=n(9504),i=n(7055),a=n(5397),s=n(4598),u=r([].join);o({target:"Array",proto:!0,forced:i!==Object||!s("join",",")},{join:function(t){return u(a(this),void 0===t?",":t)}})},2062:function(t,e,n){var o=n(6518),r=n(9213).map;o({target:"Array",proto:!0,forced:!n(597)("map")},{map:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}})},2712:function(t,e,n){var o=n(6518),r=n(926).left,i=n(4598),a=n(7388);o({target:"Array",proto:!0,forced:!n(9088)&&a>79&&a<83||!i("reduce")},{reduce:function(t){var e=arguments.length;return r(this,t,e,e>1?arguments[1]:void 0)}})},4782:function(t,e,n){var o=n(6518),r=n(4376),i=n(3517),a=n(34),s=n(5610),u=n(6198),c=n(5397),l=n(4659),f=n(8227),d=n(597),p=n(7680),h=d("slice"),v=f("species"),y=Array,g=Math.max;o({target:"Array",proto:!0,forced:!h},{slice:function(t,e){var n,o,f,d=c(this),h=u(d),m=s(t,h),b=s(void 0===e?h:e,h);if(r(d)&&(n=d.constructor,(i(n)&&(n===y||r(n.prototype))||a(n)&&null===(n=n[v]))&&(n=void 0),n===y||void 0===n))return p(d,m,b);for(o=new(void 0===n?y:n)(g(b-m,0)),f=0;m3)){if(h)return!0;if(y)return y<603;var t,e,n,o,r="";for(t=65;t<76;t++){switch(e=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(o=0;o<47;o++)g.push({k:e+o,v:n})}for(g.sort((function(t,e){return e.v-t.v})),o=0;oc(n)?1:-1}}(t)),n=s(r),o=0;ox-o+n;y--)d(b,y-1)}else if(n>o)for(y=x-o;y>w;y--)m=y+n-1,(g=y+o-1)in b?b[m]=b[g]:d(b,m);for(y=0;y2)if(c=x(c),43===(e=I(c,0))||45===e){if(88===(n=I(c,2))||120===n)return NaN}else if(48===e){switch(I(c,1)){case 66:case 98:o=2,r=49;break;case 79:case 111:o=8,r=55;break;default:return+c}for(a=(i=P(c,2)).length,s=0;sr)return NaN;return parseInt(i,o)}return+c},A=c(w,!E(" 0o1")||!E("0b1")||E("+0x1")),M=function(t){var e,n=arguments.length<1?0:E(function(t){var e=h(t,"number");return"bigint"==typeof e?e:C(e)}(t));return d(S,e=this)&&v((function(){b(e)}))?f(Object(n),this,M):n};M.prototype=S,A&&!r&&(S.constructor=M),o({global:!0,constructor:!0,wrap:!0,forced:A},{Number:M});var T=function(t,e){for(var n,o=i?y(e):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),r=0;o.length>r;r++)l(e,n=o[r])&&!l(t,n)&&m(t,n,g(e,n))};r&&O&&T(s[w],O),(A||r)&&T(s[w],E)},2637:function(t,e,n){n(6518)({target:"Number",stat:!0},{isInteger:n(2087)})},9085:function(t,e,n){var o=n(6518),r=n(4213);o({target:"Object",stat:!0,arity:2,forced:Object.assign!==r},{assign:r})},7427:function(t,e,n){var o=n(6518),r=n(3724),i=n(2551),a=n(9306),s=n(8981),u=n(4913);r&&o({target:"Object",proto:!0,forced:i},{__defineGetter__:function(t,e){u.f(s(this),t,{get:a(e),enumerable:!0,configurable:!0})}})},3851:function(t,e,n){var o=n(6518),r=n(9039),i=n(5397),a=n(7347).f,s=n(3724);o({target:"Object",stat:!0,forced:!s||r((function(){a(1)})),sham:!s},{getOwnPropertyDescriptor:function(t,e){return a(i(t),e)}})},1278:function(t,e,n){var o=n(6518),r=n(3724),i=n(5031),a=n(5397),s=n(7347),u=n(4659);o({target:"Object",stat:!0,sham:!r},{getOwnPropertyDescriptors:function(t){for(var e,n,o=a(t),r=s.f,c=i(o),l={},f=0;c.length>f;)void 0!==(n=r(o,e=c[f++]))&&u(l,e,n);return l}})},1480:function(t,e,n){var o=n(6518),r=n(9039),i=n(298).f;o({target:"Object",stat:!0,forced:r((function(){return!Object.getOwnPropertyNames(1)}))},{getOwnPropertyNames:i})},9773:function(t,e,n){var o=n(6518),r=n(4495),i=n(9039),a=n(3717),s=n(8981);o({target:"Object",stat:!0,forced:!r||i((function(){a.f(1)}))},{getOwnPropertySymbols:function(t){var e=a.f;return e?e(s(t)):[]}})},9432:function(t,e,n){var o=n(6518),r=n(8981),i=n(1072);o({target:"Object",stat:!0,forced:n(9039)((function(){i(1)}))},{keys:function(t){return i(r(t))}})},6099:function(t,e,n){var o=n(2140),r=n(6840),i=n(3179);o||r(Object.prototype,"toString",i,{unsafe:!0})},4864:function(t,e,n){var o=n(3724),r=n(4475),i=n(9504),a=n(2796),s=n(3167),u=n(6699),c=n(2360),l=n(8480).f,f=n(1625),d=n(788),p=n(655),h=n(1034),v=n(8429),y=n(1056),g=n(6840),m=n(9039),b=n(9297),x=n(1181).enforce,w=n(7633),E=n(8227),O=n(3635),S=n(8814),k=E("match"),P=r.RegExp,I=P.prototype,C=r.SyntaxError,A=i(I.exec),M=i("".charAt),T=i("".replace),D=i("".indexOf),j=i("".slice),N=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,R=/a/g,L=/a/g,B=new P(R)!==R,K=v.MISSED_STICKY,F=v.UNSUPPORTED_Y,_=o&&(!B||K||O||S||m((function(){return L[k]=!1,P(R)!==R||P(L)===L||"/a/i"!==String(P(R,"i"))})));if(a("RegExp",_)){for(var H=function(t,e){var n,o,r,i,a,l,v=f(I,this),y=d(t),g=void 0===e,m=[],w=t;if(!v&&y&&g&&t.constructor===H)return t;if((y||f(I,t))&&(t=t.source,g&&(e=h(w))),t=void 0===t?"":p(t),e=void 0===e?"":p(e),w=t,O&&"dotAll"in R&&(o=!!e&&D(e,"s")>-1)&&(e=T(e,/s/g,"")),n=e,K&&"sticky"in R&&(r=!!e&&D(e,"y")>-1)&&F&&(e=T(e,/y/g,"")),S&&(i=function(t){for(var e,n=t.length,o=0,r="",i=[],a=c(null),s=!1,u=!1,l=0,f="";o<=n;o++){if("\\"===(e=M(t,o)))e+=M(t,++o);else if("]"===e)s=!1;else if(!s)switch(!0){case"["===e:s=!0;break;case"("===e:A(N,j(t,o+1))&&(o+=2,u=!0),r+=e,l++;continue;case">"===e&&u:if(""===f||b(a,f))throw new C("Invalid capture group name");a[f]=!0,i[i.length]=[f,l],u=!1,f="";continue}u?f+=e:r+=e}return[r,i]}(t),t=i[0],m=i[1]),a=s(P(t,e),v?this:I,H),(o||r||m.length)&&(l=x(a),o&&(l.dotAll=!0,l.raw=H(function(t){for(var e,n=t.length,o=0,r="",i=!1;o<=n;o++)"\\"!==(e=M(t,o))?i||"."!==e?("["===e?i=!0:"]"===e&&(i=!1),r+=e):r+="[\\s\\S]":r+=e+M(t,++o);return r}(t),n)),r&&(l.sticky=!0),m.length&&(l.groups=m)),t!==w)try{u(a,"source",""===w?"(?:)":w)}catch(t){}return a},U=l(P),$=0;U.length>$;)y(H,P,U[$++]);I.constructor=H,H.prototype=I,g(r,"RegExp",H,{constructor:!0})}w("RegExp")},7495:function(t,e,n){var o=n(6518),r=n(7323);o({target:"RegExp",proto:!0,forced:/./.exec!==r},{exec:r})},8781:function(t,e,n){var o=n(350).PROPER,r=n(6840),i=n(8551),a=n(655),s=n(9039),u=n(1034),c="toString",l=RegExp.prototype,f=l[c],d=s((function(){return"/a/b"!==f.call({source:"a",flags:"b"})})),p=o&&f.name!==c;(d||p)&&r(l,c,(function(){var t=i(this);return"/"+a(t.source)+"/"+a(u(t))}),{unsafe:!0})},1699:function(t,e,n){var o=n(6518),r=n(9504),i=n(5749),a=n(7750),s=n(655),u=n(1436),c=r("".indexOf);o({target:"String",proto:!0,forced:!u("includes")},{includes:function(t){return!!~c(s(a(this)),s(i(t)),arguments.length>1?arguments[1]:void 0)}})},7764:function(t,e,n){var o=n(8183).charAt,r=n(655),i=n(1181),a=n(1088),s=n(2529),u="String Iterator",c=i.set,l=i.getterFor(u);a(String,"String",(function(t){c(this,{type:u,string:r(t),index:0})}),(function(){var t,e=l(this),n=e.string,r=e.index;return r>=n.length?s(void 0,!0):(t=o(n,r),e.index+=t.length,s(t,!1))}))},8543:function(t,e,n){var o=n(6518),r=n(9565),i=n(7476),a=n(3994),s=n(2529),u=n(7750),c=n(8014),l=n(655),f=n(8551),d=n(4117),p=n(4576),h=n(788),v=n(1034),y=n(5966),g=n(6840),m=n(9039),b=n(8227),x=n(2293),w=n(7829),E=n(6682),O=n(1181),S=n(6395),k=b("matchAll"),P="RegExp String",I=P+" Iterator",C=O.set,A=O.getterFor(I),M=RegExp.prototype,T=TypeError,D=i("".indexOf),j=i("".matchAll),N=!!j&&!m((function(){j("a",/./)})),R=a((function(t,e,n,o){C(this,{type:I,regexp:t,string:e,global:n,unicode:o,done:!1})}),P,(function(){var t=A(this);if(t.done)return s(void 0,!0);var e=t.regexp,n=t.string,o=E(e,n);return null===o?(t.done=!0,s(void 0,!0)):t.global?(""===l(o[0])&&(e.lastIndex=w(n,c(e.lastIndex),t.unicode)),s(o,!1)):(t.done=!0,s(o,!1))})),L=function(t){var e,n,o,r=f(this),i=l(t),a=x(r,RegExp),s=l(v(r));return e=new a(a===RegExp?r.source:r,s),n=!!~D(s,"g"),o=!!~D(s,"u"),e.lastIndex=c(r.lastIndex),new R(e,i,n,o)};o({target:"String",proto:!0,forced:N},{matchAll:function(t){var e,n,o,i,a=u(this);if(d(t)){if(N)return j(a,t)}else{if(h(t)&&(e=l(u(v(t))),!~D(e,"g")))throw new T("`.matchAll` does not allow non-global regexes");if(N)return j(a,t);if(void 0===(o=y(t,k))&&S&&"RegExp"===p(t)&&(o=L),o)return r(o,t,a)}return n=l(a),i=new RegExp(t,"g"),S?r(L,i,n):i[k](n)}}),S||k in M||g(M,k,L)},1761:function(t,e,n){var o=n(9565),r=n(9228),i=n(8551),a=n(4117),s=n(8014),u=n(655),c=n(7750),l=n(5966),f=n(7829),d=n(6682);r("match",(function(t,e,n){return[function(e){var n=c(this),r=a(e)?void 0:l(e,t);return r?o(r,e,n):new RegExp(e)[t](u(n))},function(t){var o=i(this),r=u(t),a=n(e,o,r);if(a.done)return a.value;if(!o.global)return d(o,r);var c=o.unicode;o.lastIndex=0;for(var l,p=[],h=0;null!==(l=d(o,r));){var v=u(l[0]);p[h]=v,""===v&&(o.lastIndex=f(r,s(o.lastIndex),c)),h++}return 0===h?null:p}]}))},5440:function(t,e,n){var o=n(8745),r=n(9565),i=n(9504),a=n(9228),s=n(9039),u=n(8551),c=n(4901),l=n(4117),f=n(1291),d=n(8014),p=n(655),h=n(7750),v=n(7829),y=n(5966),g=n(2478),m=n(6682),b=n(8227)("replace"),x=Math.max,w=Math.min,E=i([].concat),O=i([].push),S=i("".indexOf),k=i("".slice),P="$0"==="a".replace(/./,"$0"),I=!!/./[b]&&""===/./[b]("a","$0");a("replace",(function(t,e,n){var i=I?"$":"$0";return[function(t,n){var o=h(this),i=l(t)?void 0:y(t,b);return i?r(i,t,o,n):r(e,p(o),t,n)},function(t,r){var a=u(this),s=p(t);if("string"==typeof r&&-1===S(r,i)&&-1===S(r,"$<")){var l=n(e,a,s,r);if(l.done)return l.value}var h=c(r);h||(r=p(r));var y,b=a.global;b&&(y=a.unicode,a.lastIndex=0);for(var P,I=[];null!==(P=m(a,s))&&(O(I,P),b);){""===p(P[0])&&(a.lastIndex=v(s,d(a.lastIndex),y))}for(var C,A="",M=0,T=0;T=M&&(A+=k(s,M,N)+D,M=N+j.length)}return A+k(s,M)}]}),!!s((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}))||!P||I)},744:function(t,e,n){var o=n(9565),r=n(9504),i=n(9228),a=n(8551),s=n(4117),u=n(7750),c=n(2293),l=n(7829),f=n(8014),d=n(655),p=n(5966),h=n(6682),v=n(8429),y=n(9039),g=v.UNSUPPORTED_Y,m=Math.min,b=r([].push),x=r("".slice),w=!y((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),E="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length;i("split",(function(t,e,n){var r="0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:o(e,this,t,n)}:e;return[function(e,n){var i=u(this),a=s(e)?void 0:p(e,t);return a?o(a,e,i,n):o(r,d(i),e,n)},function(t,o){var i=a(this),s=d(t);if(!E){var u=n(r,i,s,o,r!==e);if(u.done)return u.value}var p=c(i,RegExp),v=i.unicode,y=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(g?"g":"y"),w=new p(g?"^(?:"+i.source+")":i,y),O=void 0===o?4294967295:o>>>0;if(0===O)return[];if(0===s.length)return null===h(w,s)?[s]:[];for(var S=0,k=0,P=[];kt.length)&&(e=t.length);for(var n=0,o=new Array(e);n2&&void 0!==arguments[2]&&arguments[2]?Object.assign({},this.getDefaultDiplay(),e):e||this.getDefaultDiplay())[t]||t}},{key:"getUpdatedInput",value:function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=this.getOptions(),a=[n,o,r],s=e;return("{bksp}"===t||"{backspace}"===t)&&s.length>0?s=this.removeAt.apply(this,[s].concat(a)):("{delete}"===t||"{forwarddelete}"===t)&&s.length>0?s=this.removeForwardsAt.apply(this,[s].concat(a)):"{space}"===t?s=this.addStringAt.apply(this,[s," "].concat(a)):"{tab}"!==t||"boolean"==typeof i.tabCharOnTab&&!1===i.tabCharOnTab?"{enter}"!==t&&"{numpadenter}"!==t||!i.newLineOnEnter?t.includes("numpad")&&Number.isInteger(Number(t[t.length-2]))?s=this.addStringAt.apply(this,[s,t[t.length-2]].concat(a)):"{numpaddivide}"===t?s=this.addStringAt.apply(this,[s,"/"].concat(a)):"{numpadmultiply}"===t?s=this.addStringAt.apply(this,[s,"*"].concat(a)):"{numpadsubtract}"===t?s=this.addStringAt.apply(this,[s,"-"].concat(a)):"{numpadadd}"===t?s=this.addStringAt.apply(this,[s,"+"].concat(a)):"{numpaddecimal}"===t?s=this.addStringAt.apply(this,[s,"."].concat(a)):"{"===t||"}"===t?s=this.addStringAt.apply(this,[s,t].concat(a)):t.includes("{")||t.includes("}")||(s=this.addStringAt.apply(this,[s,t].concat(a))):s=this.addStringAt.apply(this,[s,"\n"].concat(a)):s=this.addStringAt.apply(this,[s,"\t"].concat(a)),i.debug&&console.log("Input will be: "+s),s}},{key:"updateCaretPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.updateCaretPosAction(t,e);this.dispatch((function(t){t.setCaretPosition(n)}))}},{key:"updateCaretPosAction",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getOptions(),o=this.getCaretPosition();return null!=o&&(e?o>0&&(o-=t):o+=t),n.debug&&console.log("Caret at:",o),o}},{key:"addStringAt",value:function(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return o||0===o?(n=[t.slice(0,o),e,t.slice(r)].join(""),this.isMaxLengthReached()||i&&this.updateCaretPos(e.length)):n=t+e,n}},{key:"removeAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0===n&&0===o)return t;if(n===o){var i=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;n&&n>=0?t.substring(n-2,n).match(i)?(e=t.substr(0,n-2)+t.substr(n),r&&this.updateCaretPos(2,!0)):(e=t.substr(0,n-1)+t.substr(n),r&&this.updateCaretPos(1,!0)):t.slice(-2).match(i)?(e=t.slice(0,-2),r&&this.updateCaretPos(2,!0)):(e=t.slice(0,-1),r&&this.updateCaretPos(1,!0))}else e=t.slice(0,n)+t.slice(o),r&&this.dispatch((function(t){t.setCaretPosition(n)}));return e}},{key:"removeForwardsAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return null!=t&&t.length&&null!==n?(n===o?e=t.substring(n,n+2).match(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g)?t.substr(0,n)+t.substr(n+2):t.substr(0,n)+t.substr(n+1):(e=t.slice(0,n)+t.slice(o),r&&this.dispatch((function(t){t.setCaretPosition(n)}))),e):t}},{key:"handleMaxLength",value:function(t,e){var n=this.getOptions(),o=n.maxLength,r=t[n.inputName||"default"],a=e.length-1>=o;if(e.length<=r.length)return!1;if(Number.isInteger(o))return n.debug&&console.log("maxLength (num) reached:",a),a?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===i(o)){var s=e.length-1>=o[n.inputName||"default"];return n.debug&&console.log("maxLength (obj) reached:",s),s?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return Boolean(this.maxLengthReached)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return!!window.PointerEvent}},{key:"camelCase",value:function(t){return t?t.toLowerCase().trim().split(/[.\-_\s]/g).reduce((function(t,e){return e.length?t+e[0].toUpperCase()+e.slice(1):t})):""}},{key:"chunkArray",value:function(e,n){return t(Array(Math.ceil(e.length/n))).map((function(t,o){return e.slice(n*o,n+n*o)}))}},{key:"escapeRegex",value:function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},{key:"getRtlOffset",value:function(t,e){var n=t,o=e.indexOf("‫");return o=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){o=o.call(t)},n:function(){var t=o.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==o.return||o.return()}finally{if(u)throw a}}}}(Object.getOwnPropertyNames(t.prototype));try{for(r.s();!(o=r.n()).done;){var i=o.value;"constructor"===i||"bindMethods"===i||(n[i]=n[i].bind(n))}}catch(t){r.e(t)}finally{r.f()}}}],r&&a(o.prototype,r),u&&a(o,u),Object.defineProperty(o,"prototype",{writable:!1}),n}();s(c,"noop",(function(){}));var l=c;function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function d(t,e){for(var n=0;n1?null===(e=n)||void 0===e?void 0:e.toLowerCase():n}},{key:"keyCodeToKey",value:function(t){return{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[t]||""}}])&&d(e.prototype,n),o&&d(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function g(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:r();return s(t,e)},u.appendChild(o)}));var c=i>0,l=document.createElement("div");l.classList.add("hg-candidate-box-prev"),c&&l.classList.add("hg-candidate-box-btn-active");var f=function(){c&&n.renderPage({candidateListPages:o,targetElement:r,pageIndex:i-1,nbPages:a,onItemSelected:s})};this.options.useTouchEvents?l.ontouchstart=f:l.onclick=f,this.candidateBoxElement.appendChild(l),this.candidateBoxElement.appendChild(u);var d=it.length)&&(e=t.length);for(var n=0,o=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:t;this.caretPosition=t,this.caretPositionEnd=e}},{key:"getInputCandidates",value:function(t){var e=this,n=this.options,o=n.layoutCandidates,r=n.layoutCandidatesCaseSensitiveMatch;if(!o||"object"!==S(o))return{};var i=Object.keys(o).filter((function(n){var o=t.substring(0,e.getCaretPositionEnd()||0)||t,i=new RegExp("".concat(e.utilities.escapeRegex(n),"$"),r?"g":"gi");return!!E(o.matchAll(i)).length}));if(i.length>1){var a=i.sort((function(t,e){return e.length-t.length}))[0];return{candidateKey:a,candidateValue:o[a]}}if(i.length){var s=i[0];return{candidateKey:s,candidateValue:o[s]}}return{}}},{key:"showCandidatesBox",value:function(t,e,n){var o=this;this.candidateBox&&this.candidateBox.show({candidateValue:e,targetElement:n,onSelect:function(e,n){var r=o.options,i=r.layoutCandidatesCaseSensitiveMatch,a=r.disableCandidateNormalization,s=r.enableLayoutCandidatesKeyPress,u=e;a||(u=e.normalize("NFD"));var c=o.getInput(o.options.inputName,!0),l=o.getCaretPositionEnd()||0,f=c.substring(0,l||0)||c,d=new RegExp("".concat(o.utilities.escapeRegex(t),"$"),i?"g":"gi"),p=f.replace(d,u),h=c.replace(f,p),v=p.length-f.length,y=(l||c.length)+v;y<0&&(y=0),o.setInput(h,o.options.inputName,!0),o.setCaretPosition(y),s&&"function"==typeof o.options.onKeyPress&&o.options.onKeyPress(e,n),"function"==typeof o.options.onChange&&o.options.onChange(o.getInput(o.options.inputName,!0),n),"function"==typeof o.options.onChangeAll&&o.options.onChangeAll(o.getAllInputs(),n)}})}},{key:"handleButtonClicked",value:function(t,e){var n=this.options,o=n.inputName,r=void 0===o?this.defaultName:o,i=n.debug;if("{//}"!==t){this.input[r]||(this.input[r]="");var a=this.utilities.getUpdatedInput(t,this.input[r],this.caretPosition,this.caretPositionEnd);if(this.utilities.isStandardButton(t)&&this.activeInputElement&&this.input[r]&&this.input[r]===a&&0===this.caretPosition&&this.caretPositionEnd===a.length)return this.setInput("",this.options.inputName,!0),this.setCaretPosition(0),this.activeInputElement.value="",this.activeInputElement.setSelectionRange(0,0),void this.handleButtonClicked(t,e);if("function"==typeof this.options.onKeyPress&&this.options.onKeyPress(t,e),this.input[r]!==a&&(!this.options.inputPattern||this.options.inputPattern&&this.inputPatternIsValid(a))){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,a))return;var s=this.utilities.getUpdatedInput(t,this.input[r],this.caretPosition,this.caretPositionEnd,!0);if(this.setInput(s,this.options.inputName,!0),i&&console.log("Input changed:",this.getAllInputs()),this.options.debug&&console.log("Caret at: ",this.getCaretPosition(),this.getCaretPositionEnd(),"(".concat(this.keyboardDOMClass,")"),null==e?void 0:e.type),this.options.syncInstanceInputs&&this.syncInstanceInputs(),"function"==typeof this.options.onChange&&this.options.onChange(this.getInput(this.options.inputName,!0),e),"function"==typeof this.options.onChangeAll&&this.options.onChangeAll(this.getAllInputs(),e),null!=e&&e.target&&this.options.enableLayoutCandidates){var u,c=this.getInputCandidates(a),l=c.candidateKey,f=c.candidateValue;l&&f?this.showCandidatesBox(l,f,this.keyboardDOM):null===(u=this.candidateBox)||void 0===u||u.destroy()}}this.caretPositionEnd&&this.caretPosition!==this.caretPositionEnd&&(this.setCaretPosition(this.caretPositionEnd,this.caretPositionEnd),this.activeInputElement&&this.activeInputElement.setSelectionRange(this.caretPositionEnd,this.caretPositionEnd),this.options.debug&&console.log("Caret position aligned",this.caretPosition)),i&&console.log("Key pressed:",t)}}},{key:"getMouseHold",value:function(){return this.isMouseHold}},{key:"setMouseHold",value:function(t){this.options.syncInstanceInputs?this.dispatch((function(e){e.isMouseHold=t})):this.isMouseHold=t}},{key:"handleButtonMouseDown",value:function(t,e){var n=this;e&&(this.options.preventMouseDownDefault&&e.preventDefault(),this.options.stopMouseDownPropagation&&e.stopPropagation(),e.target.classList.add(this.activeButtonClass)),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.setMouseHold(!0),this.options.disableButtonHold||(this.holdTimeout=window.setTimeout((function(){(n.getMouseHold()&&(!t.includes("{")&&!t.includes("}")||"{delete}"===t||"{backspace}"===t||"{bksp}"===t||"{space}"===t||"{tab}"===t)||"{arrowright}"===t||"{arrowleft}"===t||"{arrowup}"===t||"{arrowdown}"===t)&&(n.options.debug&&console.log("Button held:",t),n.handleButtonHold(t)),clearTimeout(n.holdTimeout)}),500))}},{key:"handleButtonMouseUp",value:function(t,e){var n=this;e&&(this.options.preventMouseUpDefault&&e.preventDefault&&e.preventDefault(),this.options.stopMouseUpPropagation&&e.stopPropagation&&e.stopPropagation(),!(e.target===this.keyboardDOM||e.target&&this.keyboardDOM.contains(e.target)||this.candidateBox&&this.candidateBox.candidateBoxElement&&(e.target===this.candidateBox.candidateBoxElement||e.target&&this.candidateBox.candidateBoxElement.contains(e.target)))&&this.candidateBox&&this.candidateBox.destroy()),this.recurseButtons((function(t){t.classList.remove(n.activeButtonClass)})),this.setMouseHold(!1),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),t&&"function"==typeof this.options.onKeyReleased&&this.options.onKeyReleased(t,e)}},{key:"handleKeyboardContainerMouseDown",value:function(t){this.options.preventMouseDownDefault&&t.preventDefault()}},{key:"handleButtonHold",value:function(t){var e=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=window.setTimeout((function(){e.getMouseHold()?(e.handleButtonClicked(t),e.handleButtonHold(t)):clearTimeout(e.holdInteractionTimeout)}),100)}},{key:"syncInstanceInputs",value:function(){var t=this;this.dispatch((function(e){e.replaceInput(t.input),e.setCaretPosition(t.caretPosition,t.caretPositionEnd)}))}},{key:"clearInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName;this.input[t]="",this.setCaretPosition(0),this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"getInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.options.syncInstanceInputs&&!e&&this.syncInstanceInputs(),this.options.rtl?"‫"+this.input[t].replace("‫","").replace("‬","")+"‬":this.input[t]}},{key:"getAllInputs",value:function(){var t=this,e={};return Object.keys(this.input).forEach((function(n){e[n]=t.getInput(n,!0)})),e}},{key:"setInput",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.inputName||this.defaultName,n=arguments.length>2?arguments[2]:void 0;this.input[e]=t,!n&&this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"replaceInput",value:function(t){this.input=t}},{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.changedOptions(t);this.options=Object.assign(this.options,t),e.length&&(this.options.debug&&console.log("changedOptions",e),this.onSetOptions(e),this.render())}},{key:"changedOptions",value:function(t){var e=this;return Object.keys(t).filter((function(n){return JSON.stringify(t[n])!==JSON.stringify(e.options[n])}))}},{key:"onSetOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.includes("layoutName")&&this.candidateBox&&this.candidateBox.destroy(),(t.includes("layoutCandidatesPageSize")||t.includes("layoutCandidates"))&&this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=new w({utilities:this.utilities,options:this.options}))}},{key:"resetRows",value:function(){this.keyboardRowsDOM&&this.keyboardRowsDOM.remove(),this.keyboardDOM.className=this.keyboardDOMClass,this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.buttonElements={}}},{key:"dispatch",value:function(t){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach((function(e){t(window.SimpleKeyboardInstances[e],e)}))}},{key:"addButtonTheme",value:function(t,e){var n=this;e&&t&&(t.split(" ").forEach((function(o){e.split(" ").forEach((function(e){n.options.buttonTheme||(n.options.buttonTheme=[]);var r=!1;n.options.buttonTheme.map((function(t){if(null!=t&&t.class.split(" ").includes(e)){r=!0;var n=t.buttons.split(" ");n.includes(o)||(r=!0,n.push(o),t.buttons=n.join(" "))}return t})),r||n.options.buttonTheme.push({class:e,buttons:t})}))})),this.render())}},{key:"removeButtonTheme",value:function(t,e){var n=this;if(!t&&!e)return this.options.buttonTheme=[],void this.render();t&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(t.split(" ").forEach((function(t){var o;null===(o=n.options)||void 0===o||null===(o=o.buttonTheme)||void 0===o||o.map((function(o,r){if(o&&e&&e.includes(o.class)||!e){var i,a,s=null===(i=o)||void 0===i?void 0:i.buttons.split(" ").filter((function(e){return e!==t}));o&&null!=s&&s.length?o.buttons=s.join(" "):(null===(a=n.options.buttonTheme)||void 0===a||a.splice(r,1),o=null)}return o}))})),this.render())}},{key:"getButtonElement",value:function(t){var e,n=this.buttonElements[t];return n&&(e=n.length>1?n:n[0]),e}},{key:"inputPatternIsValid",value:function(t){var e,n=this.options.inputPattern;if((e=n instanceof RegExp?n:n[this.options.inputName||this.defaultName])&&t){var o=e.test(t);return this.options.debug&&console.log('inputPattern ("'.concat(e,'"): ').concat(o?"passed":"did not pass!")),o}return!0}},{key:"setEventListeners",value:function(){if(this.isFirstKeyboardInstance||!this.allKeyboardInstances){this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")"));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.addEventListener("keyup",this.handleKeyUp,e),document.addEventListener("keydown",this.handleKeyDown,e),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd),document.addEventListener("selectionchange",this.handleSelectionChange),document.addEventListener("select",this.handleSelect)}}},{key:"handleKeyUp",value:function(t){this.caretEventHandler(t),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(t)}},{key:"handleKeyDown",value:function(t){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(t)}},{key:"handleMouseUp",value:function(t){this.caretEventHandler(t)}},{key:"handleTouchEnd",value:function(t){this.caretEventHandler(t)}},{key:"handleSelect",value:function(t){this.caretEventHandler(t)}},{key:"handleSelectionChange",value:function(t){navigator.userAgent.includes("Firefox")||this.caretEventHandler(t)}},{key:"caretEventHandler",value:function(t){var e,n=this;t.target.tagName&&(e=t.target.tagName.toLowerCase()),this.dispatch((function(o){var r=t.target===o.keyboardDOM||t.target&&o.keyboardDOM.contains(t.target);if(n.options.syncInstanceInputs&&Array.isArray(t.path)&&(r=t.path.some((function(t){var e;return null==t||null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-skInstance")}))),("textarea"===e||"input"===e&&["text","search","url","tel","password"].includes(t.target.type))&&!o.options.disableCaretPositioning){var i=t.target.selectionStart,a=t.target.selectionEnd;o.options.rtl&&(i=o.utilities.getRtlOffset(i,o.getInput()),a=o.utilities.getRtlOffset(a,o.getInput())),o.setCaretPosition(i,a),n.activeInputElement=t.target,o.options.debug&&console.log("Caret at: ",o.getCaretPosition(),o.getCaretPositionEnd(),t&&t.target.tagName.toLowerCase(),"(".concat(o.keyboardDOMClass,")"),null==t?void 0:t.type)}else!o.options.disableCaretPositioning&&r||"selectionchange"===(null==t?void 0:t.type)||(o.setCaretPosition(null),n.activeInputElement=null,o.options.debug&&console.log('Caret position reset due to "'.concat(null==t?void 0:t.type,'" event'),t))}))}},{key:"recurseButtons",value:function(t){var e=this;t&&Object.keys(this.buttonElements).forEach((function(n){return e.buttonElements[n].forEach(t)}))}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.removeEventListener("keyup",this.handleKeyUp,e),document.removeEventListener("keydown",this.handleKeyDown,e),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("select",this.handleSelect),document.removeEventListener("selectionchange",this.handleSelectionChange),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null,this.recurseButtons((function(t){t&&(t.onpointerdown=null,t.onpointerup=null,t.onpointercancel=null,t.ontouchstart=null,t.ontouchend=null,t.ontouchcancel=null,t.onclick=null,t.onmousedown=null,t.onmouseup=null,t.remove(),t=null)})),this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.resetRows(),this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=null),this.activeInputElement=null,this.keyboardDOM.removeAttribute("data-skInstance"),this.keyboardDOM.innerHTML="",window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(t){var e=this.options.buttonTheme,n=[];return Array.isArray(e)&&e.forEach((function(e){if(e&&e.class&&"string"==typeof e.class&&e.buttons&&"string"==typeof e.buttons){var o=e.class.split(" ");e.buttons.split(" ").includes(t)&&(n=[].concat(E(n),E(o)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',e)})),n}},{key:"setDOMButtonAttributes",value:function(t,e){var n=this.options.buttonAttributes;Array.isArray(n)&&n.forEach((function(n){n.attribute&&"string"==typeof n.attribute&&n.value&&"string"==typeof n.value&&n.buttons&&"string"==typeof n.buttons?n.buttons.split(" ").includes(t)&&e(n.attribute,n.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',n)}))}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(t){if(t.target.classList.contains("hg-button"))return t.preventDefault(),t.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),"function"==typeof this.options.onInit&&this.options.onInit(this)}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),"function"==typeof this.options.beforeFirstRender&&this.options.beforeFirstRender(this),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){"function"==typeof this.options.beforeRender&&this.options.beforeRender(this)}},{key:"onRender",value:function(){"function"==typeof this.options.onRender&&this.options.onRender(this)}},{key:"onModulesLoaded",value:function(){"function"==typeof this.options.onModulesLoaded&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var t=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach((function(e){var n=new e(t);n.init&&n.init(t)})),this.keyboardPluginClasses="modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(t,e){return!!this.modules[t]&&this.modules[t][e]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(t,e,n,o){var r=this,i=Array.from(t.children),a=0;return i.length&&n.forEach((function(n,s){var u=o[s];if(!(u&&u>n))return!1;var c=n-a,l=u-a,f=document.createElement("div");f.className+="hg-button-container";var d="".concat(r.options.layoutName,"-r").concat(e,"c").concat(s);f.setAttribute("data-skUID",d);var p=i.splice(c,l-c+1);a=l-c,p.forEach((function(t){return f.appendChild(t)})),i.splice(c,0,f),t.innerHTML="",i.forEach((function(e){return t.appendChild(e)})),r.options.debug&&console.log("rowDOMContainer",p,c,l,a+1)})),t}},{key:"render",value:function(){var t=this;this.resetRows(),this.initialized||this.beforeFirstRender(),this.beforeRender();var e="hg-layout-".concat(this.options.layoutName),n=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},o=this.options.useTouchEvents||!1,r=o?"hg-touch-events":"",i=this.options.useMouseEvents||!1,a=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,e,this.keyboardPluginClasses,r),this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.keyboardRowsDOM=document.createElement("div"),this.keyboardRowsDOM.className="hg-rows",n[this.options.layoutName||this.defaultName].forEach((function(e,n){var r=e.split(" ");t.options.excludeFromLayout&&t.options.excludeFromLayout[t.options.layoutName||t.defaultName]&&(r=r.filter((function(e){return t.options.excludeFromLayout&&!t.options.excludeFromLayout[t.options.layoutName||t.defaultName].includes(e)})));var s=document.createElement("div");s.className+="hg-row";var u=[],c=[];r.forEach((function(e,r){var l,f=!a&&"string"==typeof e&&e.length>1&&0===e.indexOf("["),d=!a&&"string"==typeof e&&e.length>1&&e.indexOf("]")===e.length-1;f&&(u.push(r),e=e.replace(/\[/g,"")),d&&(c.push(r),e=e.replace(/\]/g,""));var p=t.utilities.getButtonClass(e),h=t.utilities.getButtonDisplayName(e,t.options.display,t.options.mergeDisplay),v=t.options.useButtonTag?"button":"div",y=document.createElement(v);y.className+="hg-button ".concat(p),(l=y.classList).add.apply(l,E(t.getButtonThemeClasses(e))),t.setDOMButtonAttributes(e,(function(t,e){y.setAttribute(t,e)})),t.activeButtonClass="hg-activeButton",!t.utilities.pointerEventsSupported()||o||i?o?(y.ontouchstart=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},y.ontouchend=function(n){t.handleButtonMouseUp(e,n)},y.ontouchcancel=function(n){t.handleButtonMouseUp(e,n)}):(y.onclick=function(n){t.setMouseHold(!1),"function"!=typeof t.options.onKeyReleased&&t.handleButtonClicked(e,n)},y.onmousedown=function(n){"function"!=typeof t.options.onKeyReleased||t.isMouseHold||t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},y.onmouseup=function(n){t.handleButtonMouseUp(e,n)}):(y.onpointerdown=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},y.onpointerup=function(n){t.handleButtonMouseUp(e,n)},y.onpointercancel=function(n){t.handleButtonMouseUp(e,n)}),y.setAttribute("data-skBtn",e);var g="".concat(t.options.layoutName,"-r").concat(n,"b").concat(r);y.setAttribute("data-skBtnUID",g);var m=document.createElement("span");m.innerHTML=h,y.appendChild(m),t.buttonElements[e]||(t.buttonElements[e]=[]),t.buttonElements[e].push(y),s.appendChild(y)})),s=t.parseRowDOMContainers(s,n,u,c),t.keyboardRowsDOM.appendChild(s)})),this.keyboardDOM.appendChild(this.keyboardRowsDOM),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||o||i?o?(document.ontouchend=function(e){return t.handleButtonMouseUp(void 0,e)},document.ontouchcancel=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.ontouchstart=function(e){return t.handleKeyboardContainerMouseDown(e)}):o||(document.onmouseup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onmousedown=function(e){return t.handleKeyboardContainerMouseDown(e)}):(document.onpointerup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onpointerdown=function(e){return t.handleKeyboardContainerMouseDown(e)}),this.onInit())}}],n&&P(e.prototype,n),o&&P(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}(),M=A,T=A}(),o}()})); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SimpleKeyboard=e():t.SimpleKeyboard=e()}(this,(function(){return function(){"use strict";var t={9306:function(t,e,n){var o=n(4901),r=n(6823),i=TypeError;t.exports=function(t){if(o(t))return t;throw new i(r(t)+" is not a function")}},5548:function(t,e,n){var o=n(3517),r=n(6823),i=TypeError;t.exports=function(t){if(o(t))return t;throw new i(r(t)+" is not a constructor")}},3506:function(t,e,n){var o=n(3925),r=String,i=TypeError;t.exports=function(t){if(o(t))return t;throw new i("Can't set "+r(t)+" as a prototype")}},6469:function(t,e,n){var o=n(8227),r=n(2360),i=n(4913).f,a=o("unscopables"),s=Array.prototype;void 0===s[a]&&i(s,a,{configurable:!0,value:r(null)}),t.exports=function(t){s[a][t]=!0}},7829:function(t,e,n){var o=n(8183).charAt;t.exports=function(t,e,n){return e+(n?o(t,e).length:1)}},8551:function(t,e,n){var o=n(34),r=String,i=TypeError;t.exports=function(t){if(o(t))return t;throw new i(r(t)+" is not an object")}},235:function(t,e,n){var o=n(9213).forEach,r=n(4598)("forEach");t.exports=r?[].forEach:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}},7916:function(t,e,n){var o=n(6080),r=n(9565),i=n(8981),a=n(6319),s=n(4209),u=n(3517),c=n(6198),l=n(4659),f=n(81),d=n(851),p=Array;t.exports=function(t){var e=i(t),n=u(this),h=arguments.length,v=h>1?arguments[1]:void 0,y=void 0!==v;y&&(v=o(v,h>2?arguments[2]:void 0));var g,m,b,x,w,E,O=d(e),S=0;if(!O||this===p&&s(O))for(g=c(e),m=n?new this(g):p(g);g>S;S++)E=y?v(e[S],S):e[S],l(m,S,E);else for(m=n?new this:[],w=(x=f(e,O)).next;!(b=r(w,x)).done;S++)E=y?a(x,v,[b.value,S],!0):b.value,l(m,S,E);return m.length=S,m}},9617:function(t,e,n){var o=n(5397),r=n(5610),i=n(6198),a=function(t){return function(e,n,a){var s=o(e),u=i(s);if(0===u)return!t&&-1;var c,l=r(a,u);if(t&&n!=n){for(;u>l;)if((c=s[l++])!=c)return!0}else for(;u>l;l++)if((t||l in s)&&s[l]===n)return t||l||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},9213:function(t,e,n){var o=n(6080),r=n(9504),i=n(7055),a=n(8981),s=n(6198),u=n(1469),c=r([].push),l=function(t){var e=1===t,n=2===t,r=3===t,l=4===t,f=6===t,d=7===t,p=5===t||f;return function(h,v,y,g){for(var m,b,x=a(h),w=i(x),E=s(w),O=o(v,y),S=0,k=g||u,P=e?k(h,E):n||d?k(h,0):void 0;E>S;S++)if((p||S in w)&&(b=O(m=w[S],S,x),t))if(e)P[S]=b;else if(b)switch(t){case 3:return!0;case 5:return m;case 6:return S;case 2:c(P,m)}else switch(t){case 4:return!1;case 7:c(P,m)}return f?-1:r||l?l:P}};t.exports={forEach:l(0),map:l(1),filter:l(2),some:l(3),every:l(4),find:l(5),findIndex:l(6),filterReject:l(7)}},597:function(t,e,n){var o=n(9039),r=n(8227),i=n(7388),a=r("species");t.exports=function(t){return i>=51||!o((function(){var e=[];return(e.constructor={})[a]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},4598:function(t,e,n){var o=n(9039);t.exports=function(t,e){var n=[][t];return!!n&&o((function(){n.call(null,e||function(){return 1},1)}))}},926:function(t,e,n){var o=n(9306),r=n(8981),i=n(7055),a=n(6198),s=TypeError,u="Reduce of empty array with no initial value",c=function(t){return function(e,n,c,l){var f=r(e),d=i(f),p=a(f);if(o(n),0===p&&c<2)throw new s(u);var h=t?p-1:0,v=t?-1:1;if(c<2)for(;;){if(h in d){l=d[h],h+=v;break}if(h+=v,t?h<0:p<=h)throw new s(u)}for(;t?h>=0:p>h;h+=v)h in d&&(l=n(l,d[h],h,f));return l}};t.exports={left:c(!1),right:c(!0)}},4527:function(t,e,n){var o=n(3724),r=n(4376),i=TypeError,a=Object.getOwnPropertyDescriptor,s=o&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=s?function(t,e){if(r(t)&&!a(t,"length").writable)throw new i("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},7680:function(t,e,n){var o=n(9504);t.exports=o([].slice)},4488:function(t,e,n){var o=n(7680),r=Math.floor,i=function(t,e){var n=t.length;if(n<8)for(var a,s,u=1;u0;)t[s]=t[--s];s!==u++&&(t[s]=a)}else for(var c=r(n/2),l=i(o(t,0,c),e),f=i(o(t,c),e),d=l.length,p=f.length,h=0,v=0;h9007199254740991)throw e("Maximum allowed index exceeded");return t}},7400:function(t){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},9296:function(t,e,n){var o=n(4055)("span").classList,r=o&&o.constructor&&o.constructor.prototype;t.exports=r===Object.prototype?void 0:r},8834:function(t,e,n){var o=n(9392).match(/firefox\/(\d+)/i);t.exports=!!o&&+o[1]},3202:function(t,e,n){var o=n(9392);t.exports=/MSIE|Trident/.test(o)},9088:function(t,e,n){var o=n(4475),r=n(4576);t.exports="process"===r(o.process)},9392:function(t){t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7388:function(t,e,n){var o,r,i=n(4475),a=n(9392),s=i.process,u=i.Deno,c=s&&s.versions||u&&u.version,l=c&&c.v8;l&&(r=(o=l.split("."))[0]>0&&o[0]<4?1:+(o[0]+o[1])),!r&&a&&(!(o=a.match(/Edge\/(\d+)/))||o[1]>=74)&&(o=a.match(/Chrome\/(\d+)/))&&(r=+o[1]),t.exports=r},9160:function(t,e,n){var o=n(9392).match(/AppleWebKit\/(\d+)\./);t.exports=!!o&&+o[1]},8727:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6518:function(t,e,n){var o=n(4475),r=n(7347).f,i=n(6699),a=n(6840),s=n(9433),u=n(7740),c=n(2796);t.exports=function(t,e){var n,l,f,d,p,h=t.target,v=t.global,y=t.stat;if(n=v?o:y?o[h]||s(h,{}):o[h]&&o[h].prototype)for(l in e){if(d=e[l],f=t.dontCallGetSet?(p=r(n,l))&&p.value:n[l],!c(v?l:h+(y?".":"#")+l,t.forced)&&void 0!==f){if(typeof d==typeof f)continue;u(d,f)}(t.sham||f&&f.sham)&&i(d,"sham",!0),a(n,l,d,t)}}},9039:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},9228:function(t,e,n){n(7495);var o=n(9565),r=n(6840),i=n(7323),a=n(9039),s=n(8227),u=n(6699),c=s("species"),l=RegExp.prototype;t.exports=function(t,e,n,f){var d=s(t),p=!a((function(){var e={};return e[d]=function(){return 7},7!==""[t](e)})),h=p&&!a((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[c]=function(){return n},n.flags="",n[d]=/./[d]),n.exec=function(){return e=!0,null},n[d](""),!e}));if(!p||!h||n){var v=/./[d],y=e(d,""[t],(function(t,e,n,r,a){var s=e.exec;return s===i||s===l.exec?p&&!a?{done:!0,value:o(v,e,n,r)}:{done:!0,value:o(t,n,e,r)}:{done:!1}}));r(String.prototype,t,y[0]),r(l,d,y[1])}f&&u(l[d],"sham",!0)}},8745:function(t,e,n){var o=n(616),r=Function.prototype,i=r.apply,a=r.call;t.exports="object"==typeof Reflect&&Reflect.apply||(o?a.bind(i):function(){return a.apply(i,arguments)})},6080:function(t,e,n){var o=n(7476),r=n(9306),i=n(616),a=o(o.bind);t.exports=function(t,e){return r(t),void 0===e?t:i?a(t,e):function(){return t.apply(e,arguments)}}},616:function(t,e,n){var o=n(9039);t.exports=!o((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},9565:function(t,e,n){var o=n(616),r=Function.prototype.call;t.exports=o?r.bind(r):function(){return r.apply(r,arguments)}},350:function(t,e,n){var o=n(3724),r=n(9297),i=Function.prototype,a=o&&Object.getOwnPropertyDescriptor,s=r(i,"name"),u=s&&"something"===function(){}.name,c=s&&(!o||o&&a(i,"name").configurable);t.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},6706:function(t,e,n){var o=n(9504),r=n(9306);t.exports=function(t,e,n){try{return o(r(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(t){}}},7476:function(t,e,n){var o=n(4576),r=n(9504);t.exports=function(t){if("Function"===o(t))return r(t)}},9504:function(t,e,n){var o=n(616),r=Function.prototype,i=r.call,a=o&&r.bind.bind(i,i);t.exports=o?a:function(t){return function(){return i.apply(t,arguments)}}},7751:function(t,e,n){var o=n(4475),r=n(4901);t.exports=function(t,e){return arguments.length<2?(n=o[t],r(n)?n:void 0):o[t]&&o[t][e];var n}},851:function(t,e,n){var o=n(6955),r=n(5966),i=n(4117),a=n(6269),s=n(8227)("iterator");t.exports=function(t){if(!i(t))return r(t,s)||r(t,"@@iterator")||a[o(t)]}},81:function(t,e,n){var o=n(9565),r=n(9306),i=n(8551),a=n(6823),s=n(851),u=TypeError;t.exports=function(t,e){var n=arguments.length<2?s(t):e;if(r(n))return i(o(n,t));throw new u(a(t)+" is not iterable")}},6933:function(t,e,n){var o=n(9504),r=n(4376),i=n(4901),a=n(4576),s=n(655),u=o([].push);t.exports=function(t){if(i(t))return t;if(r(t)){for(var e=t.length,n=[],o=0;o]*>)/g,l=/\$([$&'`]|\d{1,2})/g;t.exports=function(t,e,n,o,f,d){var p=n+t.length,h=o.length,v=l;return void 0!==f&&(f=r(f),v=c),s(d,v,(function(r,s){var c;switch(a(s,0)){case"$":return"$";case"&":return t;case"`":return u(e,0,n);case"'":return u(e,p);case"<":c=f[u(s,1,-1)];break;default:var l=+s;if(0===l)return r;if(l>h){var d=i(l/10);return 0===d?r:d<=h?void 0===o[d-1]?a(s,1):o[d-1]+a(s,1):r}c=o[l-1]}return void 0===c?"":c}))}},4475:function(t,e,n){var o=function(t){return t&&t.Math===Math&&t};t.exports=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof n.g&&n.g)||o("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:function(t,e,n){var o=n(9504),r=n(8981),i=o({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(r(t),e)}},421:function(t){t.exports={}},397:function(t,e,n){var o=n(7751);t.exports=o("document","documentElement")},5917:function(t,e,n){var o=n(3724),r=n(9039),i=n(4055);t.exports=!o&&!r((function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},7055:function(t,e,n){var o=n(9504),r=n(9039),i=n(4576),a=Object,s=o("".split);t.exports=r((function(){return!a("z").propertyIsEnumerable(0)}))?function(t){return"String"===i(t)?s(t,""):a(t)}:a},3167:function(t,e,n){var o=n(4901),r=n(34),i=n(2967);t.exports=function(t,e,n){var a,s;return i&&o(a=e.constructor)&&a!==n&&r(s=a.prototype)&&s!==n.prototype&&i(t,s),t}},3706:function(t,e,n){var o=n(9504),r=n(4901),i=n(7629),a=o(Function.toString);r(i.inspectSource)||(i.inspectSource=function(t){return a(t)}),t.exports=i.inspectSource},1181:function(t,e,n){var o,r,i,a=n(8622),s=n(4475),u=n(34),c=n(6699),l=n(9297),f=n(7629),d=n(6119),p=n(421),h="Object already initialized",v=s.TypeError,y=s.WeakMap;if(a||f.state){var g=f.state||(f.state=new y);g.get=g.get,g.has=g.has,g.set=g.set,o=function(t,e){if(g.has(t))throw new v(h);return e.facade=t,g.set(t,e),e},r=function(t){return g.get(t)||{}},i=function(t){return g.has(t)}}else{var m=d("state");p[m]=!0,o=function(t,e){if(l(t,m))throw new v(h);return e.facade=t,c(t,m,e),e},r=function(t){return l(t,m)?t[m]:{}},i=function(t){return l(t,m)}}t.exports={set:o,get:r,has:i,enforce:function(t){return i(t)?r(t):o(t,{})},getterFor:function(t){return function(e){var n;if(!u(e)||(n=r(e)).type!==t)throw new v("Incompatible receiver, "+t+" required");return n}}}},4209:function(t,e,n){var o=n(8227),r=n(6269),i=o("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||a[i]===t)}},4376:function(t,e,n){var o=n(4576);t.exports=Array.isArray||function(t){return"Array"===o(t)}},4901:function(t){var e="object"==typeof document&&document.all;t.exports=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},3517:function(t,e,n){var o=n(9504),r=n(9039),i=n(4901),a=n(6955),s=n(7751),u=n(3706),c=function(){},l=s("Reflect","construct"),f=/^\s*(?:class|function)\b/,d=o(f.exec),p=!f.test(c),h=function(t){if(!i(t))return!1;try{return l(c,[],t),!0}catch(t){return!1}},v=function(t){if(!i(t))return!1;switch(a(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!d(f,u(t))}catch(t){return!0}};v.sham=!0,t.exports=!l||r((function(){var t;return h(h.call)||!h(Object)||!h((function(){t=!0}))||t}))?v:h},2796:function(t,e,n){var o=n(9039),r=n(4901),i=/#|\.prototype\./,a=function(t,e){var n=u[s(t)];return n===l||n!==c&&(r(e)?o(e):!!e)},s=a.normalize=function(t){return String(t).replace(i,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",l=a.POLYFILL="P";t.exports=a},2087:function(t,e,n){var o=n(34),r=Math.floor;t.exports=Number.isInteger||function(t){return!o(t)&&isFinite(t)&&r(t)===t}},4117:function(t){t.exports=function(t){return null==t}},34:function(t,e,n){var o=n(4901);t.exports=function(t){return"object"==typeof t?null!==t:o(t)}},3925:function(t,e,n){var o=n(34);t.exports=function(t){return o(t)||null===t}},6395:function(t){t.exports=!1},788:function(t,e,n){var o=n(34),r=n(4576),i=n(8227)("match");t.exports=function(t){var e;return o(t)&&(void 0!==(e=t[i])?!!e:"RegExp"===r(t))}},757:function(t,e,n){var o=n(7751),r=n(4901),i=n(1625),a=n(7040),s=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=o("Symbol");return r(e)&&i(e.prototype,s(t))}},9539:function(t,e,n){var o=n(9565),r=n(8551),i=n(5966);t.exports=function(t,e,n){var a,s;r(t);try{if(!(a=i(t,"return"))){if("throw"===e)throw n;return n}a=o(a,t)}catch(t){s=!0,a=t}if("throw"===e)throw n;if(s)throw a;return r(a),n}},3994:function(t,e,n){var o=n(7657).IteratorPrototype,r=n(2360),i=n(6980),a=n(687),s=n(6269),u=function(){return this};t.exports=function(t,e,n,c){var l=e+" Iterator";return t.prototype=r(o,{next:i(+!c,n)}),a(t,l,!1,!0),s[l]=u,t}},1088:function(t,e,n){var o=n(6518),r=n(9565),i=n(6395),a=n(350),s=n(4901),u=n(3994),c=n(2787),l=n(2967),f=n(687),d=n(6699),p=n(6840),h=n(8227),v=n(6269),y=n(7657),g=a.PROPER,m=a.CONFIGURABLE,b=y.IteratorPrototype,x=y.BUGGY_SAFARI_ITERATORS,w=h("iterator"),E="keys",O="values",S="entries",k=function(){return this};t.exports=function(t,e,n,a,h,y,P){u(n,e,a);var I,C,A,M=function(t){if(t===h&&R)return R;if(!x&&t&&t in N)return N[t];switch(t){case E:case O:case S:return function(){return new n(this,t)}}return function(){return new n(this)}},T=e+" Iterator",D=!1,N=t.prototype,j=N[w]||N["@@iterator"]||h&&N[h],R=!x&&j||M(h),L="Array"===e&&N.entries||j;if(L&&(I=c(L.call(new t)))!==Object.prototype&&I.next&&(i||c(I)===b||(l?l(I,b):s(I[w])||p(I,w,k)),f(I,T,!0,!0),i&&(v[T]=k)),g&&h===O&&j&&j.name!==O&&(!i&&m?d(N,"name",O):(D=!0,R=function(){return r(j,this)})),h)if(C={values:M(O),keys:y?R:M(E),entries:M(S)},P)for(A in C)(x||D||!(A in N))&&p(N,A,C[A]);else o({target:e,proto:!0,forced:x||D},C);return i&&!P||N[w]===R||p(N,w,R,{name:h}),v[e]=R,C}},7657:function(t,e,n){var o,r,i,a=n(9039),s=n(4901),u=n(34),c=n(2360),l=n(2787),f=n(6840),d=n(8227),p=n(6395),h=d("iterator"),v=!1;[].keys&&("next"in(i=[].keys())?(r=l(l(i)))!==Object.prototype&&(o=r):v=!0),!u(o)||a((function(){var t={};return o[h].call(t)!==t}))?o={}:p&&(o=c(o)),s(o[h])||f(o,h,(function(){return this})),t.exports={IteratorPrototype:o,BUGGY_SAFARI_ITERATORS:v}},6269:function(t){t.exports={}},6198:function(t,e,n){var o=n(8014);t.exports=function(t){return o(t.length)}},283:function(t,e,n){var o=n(9504),r=n(9039),i=n(4901),a=n(9297),s=n(3724),u=n(350).CONFIGURABLE,c=n(3706),l=n(1181),f=l.enforce,d=l.get,p=String,h=Object.defineProperty,v=o("".slice),y=o("".replace),g=o([].join),m=s&&!r((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),x=t.exports=function(t,e,n){"Symbol("===v(p(e),0,7)&&(e="["+y(p(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!a(t,"name")||u&&t.name!==e)&&(s?h(t,"name",{value:e,configurable:!0}):t.name=e),m&&n&&a(n,"arity")&&t.length!==n.arity&&h(t,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var o=f(t);return a(o,"source")||(o.source=g(b,"string"==typeof e?e:"")),t};Function.prototype.toString=x((function(){return i(this)&&d(this).source||c(this)}),"toString")},741:function(t){var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var o=+t;return(o>0?n:e)(o)}},5749:function(t,e,n){var o=n(788),r=TypeError;t.exports=function(t){if(o(t))throw new r("The method doesn't accept regular expressions");return t}},4213:function(t,e,n){var o=n(3724),r=n(9504),i=n(9565),a=n(9039),s=n(1072),u=n(3717),c=n(8773),l=n(8981),f=n(7055),d=Object.assign,p=Object.defineProperty,h=r([].concat);t.exports=!d||a((function(){if(o&&1!==d({b:1},d(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol("assign detection"),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!==d({},t)[n]||s(d({},e)).join("")!==r}))?function(t,e){for(var n=l(t),r=arguments.length,a=1,d=u.f,p=c.f;r>a;)for(var v,y=f(arguments[a++]),g=d?h(s(y),d(y)):s(y),m=g.length,b=0;m>b;)v=g[b++],o&&!i(p,y,v)||(n[v]=y[v]);return n}:d},2360:function(t,e,n){var o,r=n(8551),i=n(6801),a=n(8727),s=n(421),u=n(397),c=n(4055),l=n(6119),f="prototype",d="script",p=l("IE_PROTO"),h=function(){},v=function(t){return"<"+d+">"+t+""},y=function(t){t.write(v("")),t.close();var e=t.parentWindow.Object;return t=null,e},g=function(){try{o=new ActiveXObject("htmlfile")}catch(t){}var t,e,n;g="undefined"!=typeof document?document.domain&&o?y(o):(e=c("iframe"),n="java"+d+":",e.style.display="none",u.appendChild(e),e.src=String(n),(t=e.contentWindow.document).open(),t.write(v("document.F=Object")),t.close(),t.F):y(o);for(var r=a.length;r--;)delete g[f][a[r]];return g()};s[p]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(h[f]=r(t),n=new h,h[f]=null,n[p]=t):n=g(),void 0===e?n:i.f(n,e)}},6801:function(t,e,n){var o=n(3724),r=n(8686),i=n(4913),a=n(8551),s=n(5397),u=n(1072);e.f=o&&!r?Object.defineProperties:function(t,e){a(t);for(var n,o=s(e),r=u(e),c=r.length,l=0;c>l;)i.f(t,n=r[l++],o[n]);return t}},4913:function(t,e,n){var o=n(3724),r=n(5917),i=n(8686),a=n(8551),s=n(6969),u=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",d="configurable",p="writable";e.f=o?i?function(t,e,n){if(a(t),e=s(e),a(n),"function"==typeof t&&"prototype"===e&&"value"in n&&p in n&&!n[p]){var o=l(t,e);o&&o[p]&&(t[e]=n.value,n={configurable:d in n?n[d]:o[d],enumerable:f in n?n[f]:o[f],writable:!1})}return c(t,e,n)}:c:function(t,e,n){if(a(t),e=s(e),a(n),r)try{return c(t,e,n)}catch(t){}if("get"in n||"set"in n)throw new u("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},7347:function(t,e,n){var o=n(3724),r=n(9565),i=n(8773),a=n(6980),s=n(5397),u=n(6969),c=n(9297),l=n(5917),f=Object.getOwnPropertyDescriptor;e.f=o?f:function(t,e){if(t=s(t),e=u(e),l)try{return f(t,e)}catch(t){}if(c(t,e))return a(!r(i.f,t,e),t[e])}},298:function(t,e,n){var o=n(4576),r=n(5397),i=n(8480).f,a=n(7680),s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return s&&"Window"===o(t)?function(t){try{return i(t)}catch(t){return a(s)}}(t):i(r(t))}},8480:function(t,e,n){var o=n(1828),r=n(8727).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return o(t,r)}},3717:function(t,e){e.f=Object.getOwnPropertySymbols},2787:function(t,e,n){var o=n(9297),r=n(4901),i=n(8981),a=n(6119),s=n(2211),u=a("IE_PROTO"),c=Object,l=c.prototype;t.exports=s?c.getPrototypeOf:function(t){var e=i(t);if(o(e,u))return e[u];var n=e.constructor;return r(n)&&e instanceof n?n.prototype:e instanceof c?l:null}},1625:function(t,e,n){var o=n(9504);t.exports=o({}.isPrototypeOf)},1828:function(t,e,n){var o=n(9504),r=n(9297),i=n(5397),a=n(9617).indexOf,s=n(421),u=o([].push);t.exports=function(t,e){var n,o=i(t),c=0,l=[];for(n in o)!r(s,n)&&r(o,n)&&u(l,n);for(;e.length>c;)r(o,n=e[c++])&&(~a(l,n)||u(l,n));return l}},1072:function(t,e,n){var o=n(1828),r=n(8727);t.exports=Object.keys||function(t){return o(t,r)}},8773:function(t,e){var n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,r=o&&!n.call({1:2},1);e.f=r?function(t){var e=o(this,t);return!!e&&e.enumerable}:n},2551:function(t,e,n){var o=n(6395),r=n(4475),i=n(9039),a=n(9160);t.exports=o||!i((function(){if(!(a&&a<535)){var t=Math.random();__defineSetter__.call(null,t,(function(){})),delete r[t]}}))},2967:function(t,e,n){var o=n(6706),r=n(34),i=n(7750),a=n(3506);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=o(Object.prototype,"__proto__","set"))(n,[]),e=n instanceof Array}catch(t){}return function(n,o){return i(n),a(o),r(n)?(e?t(n,o):n.__proto__=o,n):n}}():void 0)},3179:function(t,e,n){var o=n(2140),r=n(6955);t.exports=o?{}.toString:function(){return"[object "+r(this)+"]"}},4270:function(t,e,n){var o=n(9565),r=n(4901),i=n(34),a=TypeError;t.exports=function(t,e){var n,s;if("string"===e&&r(n=t.toString)&&!i(s=o(n,t)))return s;if(r(n=t.valueOf)&&!i(s=o(n,t)))return s;if("string"!==e&&r(n=t.toString)&&!i(s=o(n,t)))return s;throw new a("Can't convert object to primitive value")}},5031:function(t,e,n){var o=n(7751),r=n(9504),i=n(8480),a=n(3717),s=n(8551),u=r([].concat);t.exports=o("Reflect","ownKeys")||function(t){var e=i.f(s(t)),n=a.f;return n?u(e,n(t)):e}},9167:function(t,e,n){var o=n(4475);t.exports=o},1056:function(t,e,n){var o=n(4913).f;t.exports=function(t,e,n){n in t||o(t,n,{configurable:!0,get:function(){return e[n]},set:function(t){e[n]=t}})}},6682:function(t,e,n){var o=n(9565),r=n(8551),i=n(4901),a=n(4576),s=n(7323),u=TypeError;t.exports=function(t,e){var n=t.exec;if(i(n)){var c=o(n,t,e);return null!==c&&r(c),c}if("RegExp"===a(t))return o(s,t,e);throw new u("RegExp#exec called on incompatible receiver")}},7323:function(t,e,n){var o,r,i=n(9565),a=n(9504),s=n(655),u=n(7979),c=n(8429),l=n(5745),f=n(2360),d=n(1181).get,p=n(3635),h=n(8814),v=l("native-string-replace",String.prototype.replace),y=RegExp.prototype.exec,g=y,m=a("".charAt),b=a("".indexOf),x=a("".replace),w=a("".slice),E=(r=/b*/g,i(y,o=/a/,"a"),i(y,r,"a"),0!==o.lastIndex||0!==r.lastIndex),O=c.BROKEN_CARET,S=void 0!==/()??/.exec("")[1];(E||S||O||p||h)&&(g=function(t){var e,n,o,r,a,c,l,p=this,h=d(p),k=s(t),P=h.raw;if(P)return P.lastIndex=p.lastIndex,e=i(g,P,k),p.lastIndex=P.lastIndex,e;var I=h.groups,C=O&&p.sticky,A=i(u,p),M=p.source,T=0,D=k;if(C&&(A=x(A,"y",""),-1===b(A,"g")&&(A+="g"),D=w(k,p.lastIndex),p.lastIndex>0&&(!p.multiline||p.multiline&&"\n"!==m(k,p.lastIndex-1))&&(M="(?: "+M+")",D=" "+D,T++),n=new RegExp("^(?:"+M+")",A)),S&&(n=new RegExp("^"+M+"$(?!\\s)",A)),E&&(o=p.lastIndex),r=i(y,C?n:p,D),C?r?(r.input=w(r.input,T),r[0]=w(r[0],T),r.index=p.lastIndex,p.lastIndex+=r[0].length):p.lastIndex=0:E&&r&&(p.lastIndex=p.global?r.index+r[0].length:o),S&&r&&r.length>1&&i(v,r[0],n,(function(){for(a=1;ab)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$c")}))},7750:function(t,e,n){var o=n(4117),r=TypeError;t.exports=function(t){if(o(t))throw new r("Can't call method on "+t);return t}},7633:function(t,e,n){var o=n(7751),r=n(2106),i=n(8227),a=n(3724),s=i("species");t.exports=function(t){var e=o(t);a&&e&&!e[s]&&r(e,s,{configurable:!0,get:function(){return this}})}},687:function(t,e,n){var o=n(4913).f,r=n(9297),i=n(8227)("toStringTag");t.exports=function(t,e,n){t&&!n&&(t=t.prototype),t&&!r(t,i)&&o(t,i,{configurable:!0,value:e})}},6119:function(t,e,n){var o=n(5745),r=n(3392),i=o("keys");t.exports=function(t){return i[t]||(i[t]=r(t))}},7629:function(t,e,n){var o=n(6395),r=n(4475),i=n(9433),a="__core-js_shared__",s=t.exports=r[a]||i(a,{});(s.versions||(s.versions=[])).push({version:"3.36.1",mode:o?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:function(t,e,n){var o=n(7629);t.exports=function(t,e){return o[t]||(o[t]=e||{})}},2293:function(t,e,n){var o=n(8551),r=n(5548),i=n(4117),a=n(8227)("species");t.exports=function(t,e){var n,s=o(t).constructor;return void 0===s||i(n=o(s)[a])?e:r(n)}},8183:function(t,e,n){var o=n(9504),r=n(1291),i=n(655),a=n(7750),s=o("".charAt),u=o("".charCodeAt),c=o("".slice),l=function(t){return function(e,n){var o,l,f=i(a(e)),d=r(n),p=f.length;return d<0||d>=p?t?"":void 0:(o=u(f,d))<55296||o>56319||d+1===p||(l=u(f,d+1))<56320||l>57343?t?s(f,d):o:t?c(f,d,d+2):l-56320+(o-55296<<10)+65536}};t.exports={codeAt:l(!1),charAt:l(!0)}},706:function(t,e,n){var o=n(350).PROPER,r=n(9039),i=n(7452);t.exports=function(t){return r((function(){return!!i[t]()||"​…᠎"!=="​…᠎"[t]()||o&&i[t].name!==t}))}},3802:function(t,e,n){var o=n(9504),r=n(7750),i=n(655),a=n(7452),s=o("".replace),u=RegExp("^["+a+"]+"),c=RegExp("(^|[^"+a+"])["+a+"]+$"),l=function(t){return function(e){var n=i(r(e));return 1&t&&(n=s(n,u,"")),2&t&&(n=s(n,c,"$1")),n}};t.exports={start:l(1),end:l(2),trim:l(3)}},4495:function(t,e,n){var o=n(7388),r=n(9039),i=n(4475).String;t.exports=!!Object.getOwnPropertySymbols&&!r((function(){var t=Symbol("symbol detection");return!i(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&o&&o<41}))},8242:function(t,e,n){var o=n(9565),r=n(7751),i=n(8227),a=n(6840);t.exports=function(){var t=r("Symbol"),e=t&&t.prototype,n=e&&e.valueOf,s=i("toPrimitive");e&&!e[s]&&a(e,s,(function(t){return o(n,this)}),{arity:1})}},1296:function(t,e,n){var o=n(4495);t.exports=o&&!!Symbol.for&&!!Symbol.keyFor},1240:function(t,e,n){var o=n(9504);t.exports=o(1..valueOf)},5610:function(t,e,n){var o=n(1291),r=Math.max,i=Math.min;t.exports=function(t,e){var n=o(t);return n<0?r(n+e,0):i(n,e)}},5397:function(t,e,n){var o=n(7055),r=n(7750);t.exports=function(t){return o(r(t))}},1291:function(t,e,n){var o=n(741);t.exports=function(t){var e=+t;return e!=e||0===e?0:o(e)}},8014:function(t,e,n){var o=n(1291),r=Math.min;t.exports=function(t){var e=o(t);return e>0?r(e,9007199254740991):0}},8981:function(t,e,n){var o=n(7750),r=Object;t.exports=function(t){return r(o(t))}},2777:function(t,e,n){var o=n(9565),r=n(34),i=n(757),a=n(5966),s=n(4270),u=n(8227),c=TypeError,l=u("toPrimitive");t.exports=function(t,e){if(!r(t)||i(t))return t;var n,u=a(t,l);if(u){if(void 0===e&&(e="default"),n=o(u,t,e),!r(n)||i(n))return n;throw new c("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},6969:function(t,e,n){var o=n(2777),r=n(757);t.exports=function(t){var e=o(t,"string");return r(e)?e:e+""}},2140:function(t,e,n){var o={};o[n(8227)("toStringTag")]="z",t.exports="[object z]"===String(o)},655:function(t,e,n){var o=n(6955),r=String;t.exports=function(t){if("Symbol"===o(t))throw new TypeError("Cannot convert a Symbol value to a string");return r(t)}},6823:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},3392:function(t,e,n){var o=n(9504),r=0,i=Math.random(),a=o(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++r+i,36)}},7040:function(t,e,n){var o=n(4495);t.exports=o&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:function(t,e,n){var o=n(3724),r=n(9039);t.exports=o&&r((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8622:function(t,e,n){var o=n(4475),r=n(4901),i=o.WeakMap;t.exports=r(i)&&/native code/.test(String(i))},511:function(t,e,n){var o=n(9167),r=n(9297),i=n(1951),a=n(4913).f;t.exports=function(t){var e=o.Symbol||(o.Symbol={});r(e,t)||a(e,t,{value:i.f(t)})}},1951:function(t,e,n){var o=n(8227);e.f=o},8227:function(t,e,n){var o=n(4475),r=n(5745),i=n(9297),a=n(3392),s=n(4495),u=n(7040),c=o.Symbol,l=r("wks"),f=u?c.for||c:c&&c.withoutSetter||a;t.exports=function(t){return i(l,t)||(l[t]=s&&i(c,t)?c[t]:f("Symbol."+t)),l[t]}},7452:function(t){t.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},8706:function(t,e,n){var o=n(6518),r=n(9039),i=n(4376),a=n(34),s=n(8981),u=n(6198),c=n(6837),l=n(4659),f=n(1469),d=n(597),p=n(8227),h=n(7388),v=p("isConcatSpreadable"),y=h>=51||!r((function(){var t=[];return t[v]=!1,t.concat()[0]!==t})),g=function(t){if(!a(t))return!1;var e=t[v];return void 0!==e?!!e:i(t)};o({target:"Array",proto:!0,arity:1,forced:!y||!d("concat")},{concat:function(t){var e,n,o,r,i,a=s(this),d=f(a,0),p=0;for(e=-1,o=arguments.length;e1?arguments[1]:void 0)}})},3418:function(t,e,n){var o=n(6518),r=n(7916);o({target:"Array",stat:!0,forced:!n(4428)((function(t){Array.from(t)}))},{from:r})},4423:function(t,e,n){var o=n(6518),r=n(9617).includes,i=n(9039),a=n(6469);o({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}}),a("includes")},5276:function(t,e,n){var o=n(6518),r=n(7476),i=n(9617).indexOf,a=n(4598),s=r([].indexOf),u=!!s&&1/s([1],1,-0)<0;o({target:"Array",proto:!0,forced:u||!a("indexOf")},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return u?s(this,t,e)||0:i(this,t,e)}})},3792:function(t,e,n){var o=n(5397),r=n(6469),i=n(6269),a=n(1181),s=n(4913).f,u=n(1088),c=n(2529),l=n(6395),f=n(3724),d="Array Iterator",p=a.set,h=a.getterFor(d);t.exports=u(Array,"Array",(function(t,e){p(this,{type:d,target:o(t),index:0,kind:e})}),(function(){var t=h(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=void 0,c(void 0,!0);switch(t.kind){case"keys":return c(n,!1);case"values":return c(e[n],!1)}return c([n,e[n]],!1)}),"values");var v=i.Arguments=i.Array;if(r("keys"),r("values"),r("entries"),!l&&f&&"values"!==v.name)try{s(v,"name",{value:"values"})}catch(t){}},8598:function(t,e,n){var o=n(6518),r=n(9504),i=n(7055),a=n(5397),s=n(4598),u=r([].join);o({target:"Array",proto:!0,forced:i!==Object||!s("join",",")},{join:function(t){return u(a(this),void 0===t?",":t)}})},2062:function(t,e,n){var o=n(6518),r=n(9213).map;o({target:"Array",proto:!0,forced:!n(597)("map")},{map:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}})},2712:function(t,e,n){var o=n(6518),r=n(926).left,i=n(4598),a=n(7388);o({target:"Array",proto:!0,forced:!n(9088)&&a>79&&a<83||!i("reduce")},{reduce:function(t){var e=arguments.length;return r(this,t,e,e>1?arguments[1]:void 0)}})},4782:function(t,e,n){var o=n(6518),r=n(4376),i=n(3517),a=n(34),s=n(5610),u=n(6198),c=n(5397),l=n(4659),f=n(8227),d=n(597),p=n(7680),h=d("slice"),v=f("species"),y=Array,g=Math.max;o({target:"Array",proto:!0,forced:!h},{slice:function(t,e){var n,o,f,d=c(this),h=u(d),m=s(t,h),b=s(void 0===e?h:e,h);if(r(d)&&(n=d.constructor,(i(n)&&(n===y||r(n.prototype))||a(n)&&null===(n=n[v]))&&(n=void 0),n===y||void 0===n))return p(d,m,b);for(o=new(void 0===n?y:n)(g(b-m,0)),f=0;m3)){if(h)return!0;if(y)return y<603;var t,e,n,o,r="";for(t=65;t<76;t++){switch(e=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(o=0;o<47;o++)g.push({k:e+o,v:n})}for(g.sort((function(t,e){return e.v-t.v})),o=0;oc(n)?1:-1}}(t)),n=s(r),o=0;ox-o+n;y--)d(b,y-1)}else if(n>o)for(y=x-o;y>w;y--)m=y+n-1,(g=y+o-1)in b?b[m]=b[g]:d(b,m);for(y=0;y2)if(c=x(c),43===(e=I(c,0))||45===e){if(88===(n=I(c,2))||120===n)return NaN}else if(48===e){switch(I(c,1)){case 66:case 98:o=2,r=49;break;case 79:case 111:o=8,r=55;break;default:return+c}for(a=(i=P(c,2)).length,s=0;sr)return NaN;return parseInt(i,o)}return+c},A=c(w,!E(" 0o1")||!E("0b1")||E("+0x1")),M=function(t){var e,n=arguments.length<1?0:E(function(t){var e=h(t,"number");return"bigint"==typeof e?e:C(e)}(t));return d(S,e=this)&&v((function(){b(e)}))?f(Object(n),this,M):n};M.prototype=S,A&&!r&&(S.constructor=M),o({global:!0,constructor:!0,wrap:!0,forced:A},{Number:M});var T=function(t,e){for(var n,o=i?y(e):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),r=0;o.length>r;r++)l(e,n=o[r])&&!l(t,n)&&m(t,n,g(e,n))};r&&O&&T(s[w],O),(A||r)&&T(s[w],E)},2637:function(t,e,n){n(6518)({target:"Number",stat:!0},{isInteger:n(2087)})},9085:function(t,e,n){var o=n(6518),r=n(4213);o({target:"Object",stat:!0,arity:2,forced:Object.assign!==r},{assign:r})},7427:function(t,e,n){var o=n(6518),r=n(3724),i=n(2551),a=n(9306),s=n(8981),u=n(4913);r&&o({target:"Object",proto:!0,forced:i},{__defineGetter__:function(t,e){u.f(s(this),t,{get:a(e),enumerable:!0,configurable:!0})}})},3851:function(t,e,n){var o=n(6518),r=n(9039),i=n(5397),a=n(7347).f,s=n(3724);o({target:"Object",stat:!0,forced:!s||r((function(){a(1)})),sham:!s},{getOwnPropertyDescriptor:function(t,e){return a(i(t),e)}})},1278:function(t,e,n){var o=n(6518),r=n(3724),i=n(5031),a=n(5397),s=n(7347),u=n(4659);o({target:"Object",stat:!0,sham:!r},{getOwnPropertyDescriptors:function(t){for(var e,n,o=a(t),r=s.f,c=i(o),l={},f=0;c.length>f;)void 0!==(n=r(o,e=c[f++]))&&u(l,e,n);return l}})},1480:function(t,e,n){var o=n(6518),r=n(9039),i=n(298).f;o({target:"Object",stat:!0,forced:r((function(){return!Object.getOwnPropertyNames(1)}))},{getOwnPropertyNames:i})},9773:function(t,e,n){var o=n(6518),r=n(4495),i=n(9039),a=n(3717),s=n(8981);o({target:"Object",stat:!0,forced:!r||i((function(){a.f(1)}))},{getOwnPropertySymbols:function(t){var e=a.f;return e?e(s(t)):[]}})},9432:function(t,e,n){var o=n(6518),r=n(8981),i=n(1072);o({target:"Object",stat:!0,forced:n(9039)((function(){i(1)}))},{keys:function(t){return i(r(t))}})},6099:function(t,e,n){var o=n(2140),r=n(6840),i=n(3179);o||r(Object.prototype,"toString",i,{unsafe:!0})},4864:function(t,e,n){var o=n(3724),r=n(4475),i=n(9504),a=n(2796),s=n(3167),u=n(6699),c=n(2360),l=n(8480).f,f=n(1625),d=n(788),p=n(655),h=n(1034),v=n(8429),y=n(1056),g=n(6840),m=n(9039),b=n(9297),x=n(1181).enforce,w=n(7633),E=n(8227),O=n(3635),S=n(8814),k=E("match"),P=r.RegExp,I=P.prototype,C=r.SyntaxError,A=i(I.exec),M=i("".charAt),T=i("".replace),D=i("".indexOf),N=i("".slice),j=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,R=/a/g,L=/a/g,B=new P(R)!==R,K=v.MISSED_STICKY,F=v.UNSUPPORTED_Y,_=o&&(!B||K||O||S||m((function(){return L[k]=!1,P(R)!==R||P(L)===L||"/a/i"!==String(P(R,"i"))})));if(a("RegExp",_)){for(var H=function(t,e){var n,o,r,i,a,l,v=f(I,this),y=d(t),g=void 0===e,m=[],w=t;if(!v&&y&&g&&t.constructor===H)return t;if((y||f(I,t))&&(t=t.source,g&&(e=h(w))),t=void 0===t?"":p(t),e=void 0===e?"":p(e),w=t,O&&"dotAll"in R&&(o=!!e&&D(e,"s")>-1)&&(e=T(e,/s/g,"")),n=e,K&&"sticky"in R&&(r=!!e&&D(e,"y")>-1)&&F&&(e=T(e,/y/g,"")),S&&(i=function(t){for(var e,n=t.length,o=0,r="",i=[],a=c(null),s=!1,u=!1,l=0,f="";o<=n;o++){if("\\"===(e=M(t,o)))e+=M(t,++o);else if("]"===e)s=!1;else if(!s)switch(!0){case"["===e:s=!0;break;case"("===e:A(j,N(t,o+1))&&(o+=2,u=!0),r+=e,l++;continue;case">"===e&&u:if(""===f||b(a,f))throw new C("Invalid capture group name");a[f]=!0,i[i.length]=[f,l],u=!1,f="";continue}u?f+=e:r+=e}return[r,i]}(t),t=i[0],m=i[1]),a=s(P(t,e),v?this:I,H),(o||r||m.length)&&(l=x(a),o&&(l.dotAll=!0,l.raw=H(function(t){for(var e,n=t.length,o=0,r="",i=!1;o<=n;o++)"\\"!==(e=M(t,o))?i||"."!==e?("["===e?i=!0:"]"===e&&(i=!1),r+=e):r+="[\\s\\S]":r+=e+M(t,++o);return r}(t),n)),r&&(l.sticky=!0),m.length&&(l.groups=m)),t!==w)try{u(a,"source",""===w?"(?:)":w)}catch(t){}return a},U=l(P),$=0;U.length>$;)y(H,P,U[$++]);I.constructor=H,H.prototype=I,g(r,"RegExp",H,{constructor:!0})}w("RegExp")},7495:function(t,e,n){var o=n(6518),r=n(7323);o({target:"RegExp",proto:!0,forced:/./.exec!==r},{exec:r})},8781:function(t,e,n){var o=n(350).PROPER,r=n(6840),i=n(8551),a=n(655),s=n(9039),u=n(1034),c="toString",l=RegExp.prototype,f=l[c],d=s((function(){return"/a/b"!==f.call({source:"a",flags:"b"})})),p=o&&f.name!==c;(d||p)&&r(l,c,(function(){var t=i(this);return"/"+a(t.source)+"/"+a(u(t))}),{unsafe:!0})},1699:function(t,e,n){var o=n(6518),r=n(9504),i=n(5749),a=n(7750),s=n(655),u=n(1436),c=r("".indexOf);o({target:"String",proto:!0,forced:!u("includes")},{includes:function(t){return!!~c(s(a(this)),s(i(t)),arguments.length>1?arguments[1]:void 0)}})},7764:function(t,e,n){var o=n(8183).charAt,r=n(655),i=n(1181),a=n(1088),s=n(2529),u="String Iterator",c=i.set,l=i.getterFor(u);a(String,"String",(function(t){c(this,{type:u,string:r(t),index:0})}),(function(){var t,e=l(this),n=e.string,r=e.index;return r>=n.length?s(void 0,!0):(t=o(n,r),e.index+=t.length,s(t,!1))}))},8543:function(t,e,n){var o=n(6518),r=n(9565),i=n(7476),a=n(3994),s=n(2529),u=n(7750),c=n(8014),l=n(655),f=n(8551),d=n(4117),p=n(4576),h=n(788),v=n(1034),y=n(5966),g=n(6840),m=n(9039),b=n(8227),x=n(2293),w=n(7829),E=n(6682),O=n(1181),S=n(6395),k=b("matchAll"),P="RegExp String",I=P+" Iterator",C=O.set,A=O.getterFor(I),M=RegExp.prototype,T=TypeError,D=i("".indexOf),N=i("".matchAll),j=!!N&&!m((function(){N("a",/./)})),R=a((function(t,e,n,o){C(this,{type:I,regexp:t,string:e,global:n,unicode:o,done:!1})}),P,(function(){var t=A(this);if(t.done)return s(void 0,!0);var e=t.regexp,n=t.string,o=E(e,n);return null===o?(t.done=!0,s(void 0,!0)):t.global?(""===l(o[0])&&(e.lastIndex=w(n,c(e.lastIndex),t.unicode)),s(o,!1)):(t.done=!0,s(o,!1))})),L=function(t){var e,n,o,r=f(this),i=l(t),a=x(r,RegExp),s=l(v(r));return e=new a(a===RegExp?r.source:r,s),n=!!~D(s,"g"),o=!!~D(s,"u"),e.lastIndex=c(r.lastIndex),new R(e,i,n,o)};o({target:"String",proto:!0,forced:j},{matchAll:function(t){var e,n,o,i,a=u(this);if(d(t)){if(j)return N(a,t)}else{if(h(t)&&(e=l(u(v(t))),!~D(e,"g")))throw new T("`.matchAll` does not allow non-global regexes");if(j)return N(a,t);if(void 0===(o=y(t,k))&&S&&"RegExp"===p(t)&&(o=L),o)return r(o,t,a)}return n=l(a),i=new RegExp(t,"g"),S?r(L,i,n):i[k](n)}}),S||k in M||g(M,k,L)},1761:function(t,e,n){var o=n(9565),r=n(9228),i=n(8551),a=n(4117),s=n(8014),u=n(655),c=n(7750),l=n(5966),f=n(7829),d=n(6682);r("match",(function(t,e,n){return[function(e){var n=c(this),r=a(e)?void 0:l(e,t);return r?o(r,e,n):new RegExp(e)[t](u(n))},function(t){var o=i(this),r=u(t),a=n(e,o,r);if(a.done)return a.value;if(!o.global)return d(o,r);var c=o.unicode;o.lastIndex=0;for(var l,p=[],h=0;null!==(l=d(o,r));){var v=u(l[0]);p[h]=v,""===v&&(o.lastIndex=f(r,s(o.lastIndex),c)),h++}return 0===h?null:p}]}))},5440:function(t,e,n){var o=n(8745),r=n(9565),i=n(9504),a=n(9228),s=n(9039),u=n(8551),c=n(4901),l=n(4117),f=n(1291),d=n(8014),p=n(655),h=n(7750),v=n(7829),y=n(5966),g=n(2478),m=n(6682),b=n(8227)("replace"),x=Math.max,w=Math.min,E=i([].concat),O=i([].push),S=i("".indexOf),k=i("".slice),P="$0"==="a".replace(/./,"$0"),I=!!/./[b]&&""===/./[b]("a","$0");a("replace",(function(t,e,n){var i=I?"$":"$0";return[function(t,n){var o=h(this),i=l(t)?void 0:y(t,b);return i?r(i,t,o,n):r(e,p(o),t,n)},function(t,r){var a=u(this),s=p(t);if("string"==typeof r&&-1===S(r,i)&&-1===S(r,"$<")){var l=n(e,a,s,r);if(l.done)return l.value}var h=c(r);h||(r=p(r));var y,b=a.global;b&&(y=a.unicode,a.lastIndex=0);for(var P,I=[];null!==(P=m(a,s))&&(O(I,P),b);){""===p(P[0])&&(a.lastIndex=v(s,d(a.lastIndex),y))}for(var C,A="",M=0,T=0;T=M&&(A+=k(s,M,j)+D,M=j+N.length)}return A+k(s,M)}]}),!!s((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}))||!P||I)},744:function(t,e,n){var o=n(9565),r=n(9504),i=n(9228),a=n(8551),s=n(4117),u=n(7750),c=n(2293),l=n(7829),f=n(8014),d=n(655),p=n(5966),h=n(6682),v=n(8429),y=n(9039),g=v.UNSUPPORTED_Y,m=Math.min,b=r([].push),x=r("".slice),w=!y((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),E="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length;i("split",(function(t,e,n){var r="0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:o(e,this,t,n)}:e;return[function(e,n){var i=u(this),a=s(e)?void 0:p(e,t);return a?o(a,e,i,n):o(r,d(i),e,n)},function(t,o){var i=a(this),s=d(t);if(!E){var u=n(r,i,s,o,r!==e);if(u.done)return u.value}var p=c(i,RegExp),v=i.unicode,y=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(g?"g":"y"),w=new p(g?"^(?:"+i.source+")":i,y),O=void 0===o?4294967295:o>>>0;if(0===O)return[];if(0===s.length)return null===h(w,s)?[s]:[];for(var S=0,k=0,P=[];kt.length)&&(e=t.length);for(var n=0,o=new Array(e);n2&&void 0!==arguments[2]&&arguments[2]?Object.assign({},this.getDefaultDiplay(),e):e||this.getDefaultDiplay())[t]||t}},{key:"getUpdatedInput",value:function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=this.getOptions(),a=[n,o,r],s=e;return("{bksp}"===t||"{backspace}"===t)&&s.length>0?s=this.removeAt.apply(this,[s].concat(a)):("{delete}"===t||"{forwarddelete}"===t)&&s.length>0?s=this.removeForwardsAt.apply(this,[s].concat(a)):"{space}"===t?s=this.addStringAt.apply(this,[s," "].concat(a)):"{tab}"!==t||"boolean"==typeof i.tabCharOnTab&&!1===i.tabCharOnTab?"{enter}"!==t&&"{numpadenter}"!==t||!i.newLineOnEnter?t.includes("numpad")&&Number.isInteger(Number(t[t.length-2]))?s=this.addStringAt.apply(this,[s,t[t.length-2]].concat(a)):"{numpaddivide}"===t?s=this.addStringAt.apply(this,[s,"/"].concat(a)):"{numpadmultiply}"===t?s=this.addStringAt.apply(this,[s,"*"].concat(a)):"{numpadsubtract}"===t?s=this.addStringAt.apply(this,[s,"-"].concat(a)):"{numpadadd}"===t?s=this.addStringAt.apply(this,[s,"+"].concat(a)):"{numpaddecimal}"===t?s=this.addStringAt.apply(this,[s,"."].concat(a)):"{"===t||"}"===t?s=this.addStringAt.apply(this,[s,t].concat(a)):t.includes("{")||t.includes("}")||(s=this.addStringAt.apply(this,[s,t].concat(a))):s=this.addStringAt.apply(this,[s,"\n"].concat(a)):s=this.addStringAt.apply(this,[s,"\t"].concat(a)),i.debug&&console.log("Input will be: "+s),s}},{key:"updateCaretPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.updateCaretPosAction(t,e);this.dispatch((function(t){t.setCaretPosition(n)}))}},{key:"updateCaretPosAction",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getOptions(),o=this.getCaretPosition();return null!=o&&(e?o>0&&(o-=t):o+=t),n.debug&&console.log("Caret at:",o),o}},{key:"addStringAt",value:function(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return o||0===o?(n=[t.slice(0,o),e,t.slice(r)].join(""),this.isMaxLengthReached()||i&&this.updateCaretPos(e.length)):n=t+e,n}},{key:"removeAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0===n&&0===o)return t;if(n===o){var i=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;n&&n>=0?t.substring(n-2,n).match(i)?(e=t.substr(0,n-2)+t.substr(n),r&&this.updateCaretPos(2,!0)):(e=t.substr(0,n-1)+t.substr(n),r&&this.updateCaretPos(1,!0)):t.slice(-2).match(i)?(e=t.slice(0,-2),r&&this.updateCaretPos(2,!0)):(e=t.slice(0,-1),r&&this.updateCaretPos(1,!0))}else e=t.slice(0,n)+t.slice(o),r&&this.dispatch((function(t){t.setCaretPosition(n)}));return e}},{key:"removeForwardsAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return null!=t&&t.length&&null!==n?(n===o?e=t.substring(n,n+2).match(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g)?t.substr(0,n)+t.substr(n+2):t.substr(0,n)+t.substr(n+1):(e=t.slice(0,n)+t.slice(o),r&&this.dispatch((function(t){t.setCaretPosition(n)}))),e):t}},{key:"handleMaxLength",value:function(t,e){var n=this.getOptions(),o=n.maxLength,r=t[n.inputName||"default"],a=e.length-1>=o;if(e.length<=r.length)return!1;if(Number.isInteger(o))return n.debug&&console.log("maxLength (num) reached:",a),a?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===i(o)){var s=e.length-1>=o[n.inputName||"default"];return n.debug&&console.log("maxLength (obj) reached:",s),s?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return Boolean(this.maxLengthReached)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return!!window.PointerEvent}},{key:"camelCase",value:function(t){return t?t.toLowerCase().trim().split(/[.\-_\s]/g).reduce((function(t,e){return e.length?t+e[0].toUpperCase()+e.slice(1):t})):""}},{key:"chunkArray",value:function(e,n){return t(Array(Math.ceil(e.length/n))).map((function(t,o){return e.slice(n*o,n+n*o)}))}},{key:"escapeRegex",value:function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},{key:"getRtlOffset",value:function(t,e){var n=t,o=e.indexOf("‫");return o=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){o=o.call(t)},n:function(){var t=o.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==o.return||o.return()}finally{if(u)throw a}}}}(Object.getOwnPropertyNames(t.prototype));try{for(r.s();!(o=r.n()).done;){var i=o.value;"constructor"===i||"bindMethods"===i||(n[i]=n[i].bind(n))}}catch(t){r.e(t)}finally{r.f()}}}],o&&a(n.prototype,o),r&&a(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,r}();s(c,"noop",(function(){}));var l=c;function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function d(t,e){for(var n=0;n1?null===(e=n)||void 0===e?void 0:e.toLowerCase():n}},{key:"keyCodeToKey",value:function(t){return{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[t]||""}}])&&d(t.prototype,e),n&&d(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function g(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:r();return s(t,e)},u.appendChild(o)}));var c=i>0,l=document.createElement("div");l.classList.add("hg-candidate-box-prev"),c&&l.classList.add("hg-candidate-box-btn-active");var f=function(){c&&n.renderPage({candidateListPages:o,targetElement:r,pageIndex:i-1,nbPages:a,onItemSelected:s})};this.options.useTouchEvents?l.ontouchstart=f:l.onclick=f,this.candidateBoxElement.appendChild(l),this.candidateBoxElement.appendChild(u);var d=it.length)&&(e=t.length);for(var n=0,o=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:t;this.caretPosition=t,this.caretPositionEnd=e}},{key:"getInputCandidates",value:function(t){var e=this,n=this.options,o=n.layoutCandidates,r=n.layoutCandidatesCaseSensitiveMatch;if(!o||"object"!==S(o))return{};var i=Object.keys(o).filter((function(n){var o=t.substring(0,e.getCaretPositionEnd()||0)||t,i=new RegExp("".concat(e.utilities.escapeRegex(n),"$"),r?"g":"gi");return!!E(o.matchAll(i)).length}));if(i.length>1){var a=i.sort((function(t,e){return e.length-t.length}))[0];return{candidateKey:a,candidateValue:o[a]}}if(i.length){var s=i[0];return{candidateKey:s,candidateValue:o[s]}}return{}}},{key:"showCandidatesBox",value:function(t,e,n){var o=this;this.candidateBox&&this.candidateBox.show({candidateValue:e,targetElement:n,onSelect:function(e,n){var r=o.options,i=r.layoutCandidatesCaseSensitiveMatch,a=r.disableCandidateNormalization,s=r.enableLayoutCandidatesKeyPress,u=e;a||(u=e.normalize("NFD"));var c=o.getInput(o.options.inputName,!0),l=o.getCaretPositionEnd()||0,f=c.substring(0,l||0)||c,d=new RegExp("".concat(o.utilities.escapeRegex(t),"$"),i?"g":"gi"),p=f.replace(d,u),h=c.replace(f,p),v=p.length-f.length,y=(l||c.length)+v;y<0&&(y=0),o.setInput(h,o.options.inputName,!0),o.setCaretPosition(y),s&&"function"==typeof o.options.onKeyPress&&o.options.onKeyPress(e,n),"function"==typeof o.options.onChange&&o.options.onChange(o.getInput(o.options.inputName,!0),n),"function"==typeof o.options.onChangeAll&&o.options.onChangeAll(o.getAllInputs(),n)}})}},{key:"handleButtonClicked",value:function(t,e){var n=this.options,o=n.inputName,r=void 0===o?this.defaultName:o,i=n.debug;if("{//}"!==t){this.input[r]||(this.input[r]="");var a=this.utilities.getUpdatedInput(t,this.input[r],this.caretPosition,this.caretPositionEnd);if(this.utilities.isStandardButton(t)&&this.activeInputElement&&this.input[r]&&this.input[r]===a&&0===this.caretPosition&&this.caretPositionEnd===a.length)return this.setInput("",this.options.inputName,!0),this.setCaretPosition(0),this.activeInputElement.value="",this.activeInputElement.setSelectionRange(0,0),void this.handleButtonClicked(t,e);if("function"==typeof this.options.onKeyPress&&this.options.onKeyPress(t,e),this.input[r]!==a&&(!this.options.inputPattern||this.options.inputPattern&&this.inputPatternIsValid(a))){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,a))return;var s=this.utilities.getUpdatedInput(t,this.input[r],this.caretPosition,this.caretPositionEnd,!0);if(this.setInput(s,this.options.inputName,!0),i&&console.log("Input changed:",this.getAllInputs()),this.options.debug&&console.log("Caret at: ",this.getCaretPosition(),this.getCaretPositionEnd(),"(".concat(this.keyboardDOMClass,")"),null==e?void 0:e.type),this.options.syncInstanceInputs&&this.syncInstanceInputs(),"function"==typeof this.options.onChange&&this.options.onChange(this.getInput(this.options.inputName,!0),e),"function"==typeof this.options.onChangeAll&&this.options.onChangeAll(this.getAllInputs(),e),null!=e&&e.target&&this.options.enableLayoutCandidates){var u,c=this.getInputCandidates(a),l=c.candidateKey,f=c.candidateValue;l&&f?this.showCandidatesBox(l,f,this.keyboardDOM):null===(u=this.candidateBox)||void 0===u||u.destroy()}}this.caretPositionEnd&&this.caretPosition!==this.caretPositionEnd&&(this.setCaretPosition(this.caretPositionEnd,this.caretPositionEnd),this.activeInputElement&&this.activeInputElement.setSelectionRange(this.caretPositionEnd,this.caretPositionEnd),this.options.debug&&console.log("Caret position aligned",this.caretPosition)),i&&console.log("Key pressed:",t)}}},{key:"getMouseHold",value:function(){return this.isMouseHold}},{key:"setMouseHold",value:function(t){this.options.syncInstanceInputs?this.dispatch((function(e){e.isMouseHold=t})):this.isMouseHold=t}},{key:"handleButtonMouseDown",value:function(t,e){var n=this;e&&(this.options.preventMouseDownDefault&&e.preventDefault(),this.options.stopMouseDownPropagation&&e.stopPropagation(),e.target.classList.add(this.activeButtonClass)),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.setMouseHold(!0),this.options.disableButtonHold||(this.holdTimeout=window.setTimeout((function(){(n.getMouseHold()&&(!t.includes("{")&&!t.includes("}")||"{delete}"===t||"{backspace}"===t||"{bksp}"===t||"{space}"===t||"{tab}"===t)||"{arrowright}"===t||"{arrowleft}"===t||"{arrowup}"===t||"{arrowdown}"===t)&&(n.options.debug&&console.log("Button held:",t),n.handleButtonHold(t)),clearTimeout(n.holdTimeout)}),500))}},{key:"handleButtonMouseUp",value:function(t,e){var n=this;e&&(this.options.preventMouseUpDefault&&e.preventDefault&&e.preventDefault(),this.options.stopMouseUpPropagation&&e.stopPropagation&&e.stopPropagation(),!(e.target===this.keyboardDOM||e.target&&this.keyboardDOM.contains(e.target)||this.candidateBox&&this.candidateBox.candidateBoxElement&&(e.target===this.candidateBox.candidateBoxElement||e.target&&this.candidateBox.candidateBoxElement.contains(e.target)))&&this.candidateBox&&this.candidateBox.destroy()),this.recurseButtons((function(t){t.classList.remove(n.activeButtonClass)})),this.setMouseHold(!1),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),t&&"function"==typeof this.options.onKeyReleased&&this.options.onKeyReleased(t,e)}},{key:"handleKeyboardContainerMouseDown",value:function(t){this.options.preventMouseDownDefault&&t.preventDefault()}},{key:"handleButtonHold",value:function(t){var e=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=window.setTimeout((function(){e.getMouseHold()?(e.handleButtonClicked(t),e.handleButtonHold(t)):clearTimeout(e.holdInteractionTimeout)}),100)}},{key:"syncInstanceInputs",value:function(){var t=this;this.dispatch((function(e){e.replaceInput(t.input),e.setCaretPosition(t.caretPosition,t.caretPositionEnd)}))}},{key:"clearInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName;this.input[t]="",this.setCaretPosition(0),this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"getInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.options.syncInstanceInputs&&!e&&this.syncInstanceInputs(),this.options.rtl?"‫"+this.input[t].replace("‫","").replace("‬","")+"‬":this.input[t]}},{key:"getAllInputs",value:function(){var t=this,e={};return Object.keys(this.input).forEach((function(n){e[n]=t.getInput(n,!0)})),e}},{key:"setInput",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.inputName||this.defaultName,n=arguments.length>2?arguments[2]:void 0;this.input[e]=t,!n&&this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"replaceInput",value:function(t){this.input=t}},{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.changedOptions(t);this.options=Object.assign(this.options,t),e.length&&(this.options.debug&&console.log("changedOptions",e),this.onSetOptions(e),this.render())}},{key:"changedOptions",value:function(t){var e=this;return Object.keys(t).filter((function(n){return JSON.stringify(t[n])!==JSON.stringify(e.options[n])}))}},{key:"onSetOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.includes("layoutName")&&this.candidateBox&&this.candidateBox.destroy(),(t.includes("layoutCandidatesPageSize")||t.includes("layoutCandidates"))&&this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=new w({utilities:this.utilities,options:this.options}))}},{key:"resetRows",value:function(){this.keyboardRowsDOM&&this.keyboardRowsDOM.remove(),this.keyboardDOM.className=this.keyboardDOMClass,this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.buttonElements={}}},{key:"dispatch",value:function(t){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach((function(e){t(window.SimpleKeyboardInstances[e],e)}))}},{key:"addButtonTheme",value:function(t,e){var n=this;e&&t&&(t.split(" ").forEach((function(o){e.split(" ").forEach((function(e){n.options.buttonTheme||(n.options.buttonTheme=[]);var r=!1;n.options.buttonTheme.map((function(t){if(null!=t&&t.class.split(" ").includes(e)){r=!0;var n=t.buttons.split(" ");n.includes(o)||(r=!0,n.push(o),t.buttons=n.join(" "))}return t})),r||n.options.buttonTheme.push({class:e,buttons:t})}))})),this.render())}},{key:"removeButtonTheme",value:function(t,e){var n=this;if(!t&&!e)return this.options.buttonTheme=[],void this.render();t&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(t.split(" ").forEach((function(t){var o;null===(o=n.options)||void 0===o||null===(o=o.buttonTheme)||void 0===o||o.map((function(o,r){if(o&&e&&e.includes(o.class)||!e){var i,a,s=null===(i=o)||void 0===i?void 0:i.buttons.split(" ").filter((function(e){return e!==t}));o&&null!=s&&s.length?o.buttons=s.join(" "):(null===(a=n.options.buttonTheme)||void 0===a||a.splice(r,1),o=null)}return o}))})),this.render())}},{key:"getButtonElement",value:function(t){var e,n=this.buttonElements[t];return n&&(e=n.length>1?n:n[0]),e}},{key:"inputPatternIsValid",value:function(t){var e,n=this.options.inputPattern;if((e=n instanceof RegExp?n:n[this.options.inputName||this.defaultName])&&t){var o=e.test(t);return this.options.debug&&console.log('inputPattern ("'.concat(e,'"): ').concat(o?"passed":"did not pass!")),o}return!0}},{key:"setEventListeners",value:function(){if(this.isFirstKeyboardInstance||!this.allKeyboardInstances){this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")"));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.addEventListener("keyup",this.handleKeyUp,e),document.addEventListener("keydown",this.handleKeyDown,e),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd),document.addEventListener("selectionchange",this.handleSelectionChange),document.addEventListener("select",this.handleSelect)}}},{key:"handleKeyUp",value:function(t){this.caretEventHandler(t),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(t)}},{key:"handleKeyDown",value:function(t){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(t)}},{key:"handleMouseUp",value:function(t){this.caretEventHandler(t)}},{key:"handleTouchEnd",value:function(t){this.caretEventHandler(t)}},{key:"handleSelect",value:function(t){this.caretEventHandler(t)}},{key:"handleSelectionChange",value:function(t){navigator.userAgent.includes("Firefox")||this.caretEventHandler(t)}},{key:"caretEventHandler",value:function(t){var e,n=this;t.target.tagName&&(e=t.target.tagName.toLowerCase()),this.dispatch((function(o){var r=t.target===o.keyboardDOM||t.target&&o.keyboardDOM.contains(t.target);if(n.options.syncInstanceInputs&&Array.isArray(t.path)&&(r=t.path.some((function(t){var e;return null==t||null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-skInstance")}))),("textarea"===e||"input"===e&&["text","search","url","tel","password"].includes(t.target.type))&&!o.options.disableCaretPositioning){var i=t.target.selectionStart,a=t.target.selectionEnd;o.options.rtl&&(i=o.utilities.getRtlOffset(i,o.getInput()),a=o.utilities.getRtlOffset(a,o.getInput())),o.setCaretPosition(i,a),n.activeInputElement=t.target,o.options.debug&&console.log("Caret at: ",o.getCaretPosition(),o.getCaretPositionEnd(),t&&t.target.tagName.toLowerCase(),"(".concat(o.keyboardDOMClass,")"),null==t?void 0:t.type)}else!o.options.disableCaretPositioning&&r||"selectionchange"===(null==t?void 0:t.type)||(o.setCaretPosition(null),n.activeInputElement=null,o.options.debug&&console.log('Caret position reset due to "'.concat(null==t?void 0:t.type,'" event'),t))}))}},{key:"recurseButtons",value:function(t){var e=this;t&&Object.keys(this.buttonElements).forEach((function(n){return e.buttonElements[n].forEach(t)}))}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.removeEventListener("keyup",this.handleKeyUp,e),document.removeEventListener("keydown",this.handleKeyDown,e),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("select",this.handleSelect),document.removeEventListener("selectionchange",this.handleSelectionChange),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null,this.recurseButtons((function(t){t&&(t.onpointerdown=null,t.onpointerup=null,t.onpointercancel=null,t.ontouchstart=null,t.ontouchend=null,t.ontouchcancel=null,t.onclick=null,t.onmousedown=null,t.onmouseup=null,t.remove(),t=null)})),this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.resetRows(),this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=null),this.activeInputElement=null,this.keyboardDOM.removeAttribute("data-skInstance"),this.keyboardDOM.innerHTML="",window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(t){var e=this.options.buttonTheme,n=[];return Array.isArray(e)&&e.forEach((function(e){if(e&&e.class&&"string"==typeof e.class&&e.buttons&&"string"==typeof e.buttons){var o=e.class.split(" ");e.buttons.split(" ").includes(t)&&(n=[].concat(E(n),E(o)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',e)})),n}},{key:"setDOMButtonAttributes",value:function(t,e){var n=this.options.buttonAttributes;Array.isArray(n)&&n.forEach((function(n){n.attribute&&"string"==typeof n.attribute&&n.value&&"string"==typeof n.value&&n.buttons&&"string"==typeof n.buttons?n.buttons.split(" ").includes(t)&&e(n.attribute,n.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',n)}))}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(t){if(t.target.classList.contains("hg-button"))return t.preventDefault(),t.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),"function"==typeof this.options.onInit&&this.options.onInit(this)}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),"function"==typeof this.options.beforeFirstRender&&this.options.beforeFirstRender(this),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){"function"==typeof this.options.beforeRender&&this.options.beforeRender(this)}},{key:"onRender",value:function(){"function"==typeof this.options.onRender&&this.options.onRender(this)}},{key:"onModulesLoaded",value:function(){"function"==typeof this.options.onModulesLoaded&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var t=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach((function(e){var n=new e(t);n.init&&n.init(t)})),this.keyboardPluginClasses="modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(t,e){return!!this.modules[t]&&this.modules[t][e]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(t,e,n,o){var r=this,i=Array.from(t.children),a=0;return i.length&&n.forEach((function(n,s){var u=o[s];if(!(u&&u>n))return!1;var c=n-a,l=u-a,f=document.createElement("div");f.className+="hg-button-container";var d="".concat(r.options.layoutName,"-r").concat(e,"c").concat(s);f.setAttribute("data-skUID",d);var p=i.splice(c,l-c+1);a=l-c,p.forEach((function(t){return f.appendChild(t)})),i.splice(c,0,f),t.innerHTML="",i.forEach((function(e){return t.appendChild(e)})),r.options.debug&&console.log("rowDOMContainer",p,c,l,a+1)})),t}},{key:"render",value:function(){var t=this;this.resetRows(),this.initialized||this.beforeFirstRender(),this.beforeRender();var e="hg-layout-".concat(this.options.layoutName),n=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},o=this.options.useTouchEvents||!1,r=o?"hg-touch-events":"",i=this.options.useMouseEvents||!1,a=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,e,this.keyboardPluginClasses,r),this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.keyboardRowsDOM=document.createElement("div"),this.keyboardRowsDOM.className="hg-rows",n[this.options.layoutName||this.defaultName].forEach((function(e,n){var r=e.split(" ");t.options.excludeFromLayout&&t.options.excludeFromLayout[t.options.layoutName||t.defaultName]&&(r=r.filter((function(e){return t.options.excludeFromLayout&&!t.options.excludeFromLayout[t.options.layoutName||t.defaultName].includes(e)})));var s=document.createElement("div");s.className+="hg-row";var u=[],c=[];r.forEach((function(e,r){var l,f=!a&&"string"==typeof e&&e.length>1&&0===e.indexOf("["),d=!a&&"string"==typeof e&&e.length>1&&e.indexOf("]")===e.length-1;f&&(u.push(r),e=e.replace(/\[/g,"")),d&&(c.push(r),e=e.replace(/\]/g,""));var p=t.utilities.getButtonClass(e),h=t.utilities.getButtonDisplayName(e,t.options.display,t.options.mergeDisplay),v=t.options.useButtonTag?"button":"div",y=document.createElement(v);y.className+="hg-button ".concat(p),(l=y.classList).add.apply(l,E(t.getButtonThemeClasses(e))),t.setDOMButtonAttributes(e,(function(t,e){y.setAttribute(t,e)})),t.activeButtonClass="hg-activeButton",!t.utilities.pointerEventsSupported()||o||i?o?(y.ontouchstart=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},y.ontouchend=function(n){t.handleButtonMouseUp(e,n)},y.ontouchcancel=function(n){t.handleButtonMouseUp(e,n)}):(y.onclick=function(n){t.setMouseHold(!1),"function"!=typeof t.options.onKeyReleased&&t.handleButtonClicked(e,n)},y.onmousedown=function(n){"function"!=typeof t.options.onKeyReleased||t.isMouseHold||t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},y.onmouseup=function(n){t.handleButtonMouseUp(e,n)}):(y.onpointerdown=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},y.onpointerup=function(n){t.handleButtonMouseUp(e,n)},y.onpointercancel=function(n){t.handleButtonMouseUp(e,n)}),y.setAttribute("data-skBtn",e);var g="".concat(t.options.layoutName,"-r").concat(n,"b").concat(r);y.setAttribute("data-skBtnUID",g);var m=document.createElement("span");m.innerHTML=h,y.appendChild(m),t.buttonElements[e]||(t.buttonElements[e]=[]),t.buttonElements[e].push(y),s.appendChild(y)})),s=t.parseRowDOMContainers(s,n,u,c),t.keyboardRowsDOM.appendChild(s)})),this.keyboardDOM.appendChild(this.keyboardRowsDOM),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||o||i?o?(document.ontouchend=function(e){return t.handleButtonMouseUp(void 0,e)},document.ontouchcancel=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.ontouchstart=function(e){return t.handleKeyboardContainerMouseDown(e)}):o||(document.onmouseup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onmousedown=function(e){return t.handleKeyboardContainerMouseDown(e)}):(document.onpointerup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onpointerdown=function(e){return t.handleKeyboardContainerMouseDown(e)}),this.onInit())}}],e&&P(t.prototype,e),n&&P(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}(),M=A,T=A}(),o}()})); \ No newline at end of file diff --git a/build/index.modern.esm.js b/build/index.modern.esm.js index 5895479ab..7b379b1fc 100644 --- a/build/index.modern.esm.js +++ b/build/index.modern.esm.js @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v3.7.68 (index.modern.esm.js - Modern Browsers bundle, ESM output) + * simple-keyboard v3.7.69 (index.modern.esm.js - Modern Browsers bundle, ESM output) * https://github.com/hodgef/simple-keyboard * * NOTE: This modern browsers bundle (index.modern.esm.js) removes all polyfills @@ -12,5 +12,5 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - */var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{o:()=>D,A:()=>S});function n(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n2&&void 0!==arguments[2]&&arguments[2]?Object.assign({},this.getDefaultDiplay(),e):e||this.getDefaultDiplay())[t]||t}},{key:"getUpdatedInput",value:function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=this.getOptions(),a=[n,o,i],r=e;return("{bksp}"===t||"{backspace}"===t)&&r.length>0?r=this.removeAt.apply(this,[r].concat(a)):("{delete}"===t||"{forwarddelete}"===t)&&r.length>0?r=this.removeForwardsAt.apply(this,[r].concat(a)):"{space}"===t?r=this.addStringAt.apply(this,[r," "].concat(a)):"{tab}"!==t||"boolean"==typeof s.tabCharOnTab&&!1===s.tabCharOnTab?"{enter}"!==t&&"{numpadenter}"!==t||!s.newLineOnEnter?t.includes("numpad")&&Number.isInteger(Number(t[t.length-2]))?r=this.addStringAt.apply(this,[r,t[t.length-2]].concat(a)):"{numpaddivide}"===t?r=this.addStringAt.apply(this,[r,"/"].concat(a)):"{numpadmultiply}"===t?r=this.addStringAt.apply(this,[r,"*"].concat(a)):"{numpadsubtract}"===t?r=this.addStringAt.apply(this,[r,"-"].concat(a)):"{numpadadd}"===t?r=this.addStringAt.apply(this,[r,"+"].concat(a)):"{numpaddecimal}"===t?r=this.addStringAt.apply(this,[r,"."].concat(a)):"{"===t||"}"===t?r=this.addStringAt.apply(this,[r,t].concat(a)):t.includes("{")||t.includes("}")||(r=this.addStringAt.apply(this,[r,t].concat(a))):r=this.addStringAt.apply(this,[r,"\n"].concat(a)):r=this.addStringAt.apply(this,[r,"\t"].concat(a)),s.debug&&console.log("Input will be: "+r),r}},{key:"updateCaretPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.updateCaretPosAction(t,e);this.dispatch((function(t){t.setCaretPosition(n)}))}},{key:"updateCaretPosAction",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getOptions(),o=this.getCaretPosition();return null!=o&&(e?o>0&&(o-=t):o+=t),n.debug&&console.log("Caret at:",o),o}},{key:"addStringAt",value:function(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return o||0===o?(n=[t.slice(0,o),e,t.slice(i)].join(""),this.isMaxLengthReached()||s&&this.updateCaretPos(e.length)):n=t+e,n}},{key:"removeAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0===n&&0===o)return t;if(n===o){var s=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;n&&n>=0?t.substring(n-2,n).match(s)?(e=t.substr(0,n-2)+t.substr(n),i&&this.updateCaretPos(2,!0)):(e=t.substr(0,n-1)+t.substr(n),i&&this.updateCaretPos(1,!0)):t.slice(-2).match(s)?(e=t.slice(0,-2),i&&this.updateCaretPos(2,!0)):(e=t.slice(0,-1),i&&this.updateCaretPos(1,!0))}else e=t.slice(0,n)+t.slice(o),i&&this.dispatch((function(t){t.setCaretPosition(n)}));return e}},{key:"removeForwardsAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return null!=t&&t.length&&null!==n?(n===o?e=t.substring(n,n+2).match(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g)?t.substr(0,n)+t.substr(n+2):t.substr(0,n)+t.substr(n+1):(e=t.slice(0,n)+t.slice(o),i&&this.dispatch((function(t){t.setCaretPosition(n)}))),e):t}},{key:"handleMaxLength",value:function(t,e){var n=this.getOptions(),o=n.maxLength,i=t[n.inputName||"default"],a=e.length-1>=o;if(e.length<=i.length)return!1;if(Number.isInteger(o))return n.debug&&console.log("maxLength (num) reached:",a),a?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===s(o)){var r=e.length-1>=o[n.inputName||"default"];return n.debug&&console.log("maxLength (obj) reached:",r),r?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return Boolean(this.maxLengthReached)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return!!window.PointerEvent}},{key:"camelCase",value:function(t){return t?t.toLowerCase().trim().split(/[.\-_\s]/g).reduce((function(t,e){return e.length?t+e[0].toUpperCase()+e.slice(1):t})):""}},{key:"chunkArray",value:function(t,e){return n(Array(Math.ceil(t.length/e))).map((function(n,o){return t.slice(e*o,e+e*o)}))}},{key:"escapeRegex",value:function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},{key:"getRtlOffset",value:function(t,e){var n=t,o=e.indexOf("‫");return o=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return r=t.done,t},e:function(t){u=!0,a=t},f:function(){try{r||null==n.return||n.return()}finally{if(u)throw a}}}}(Object.getOwnPropertyNames(t.prototype));try{for(i.s();!(n=i.n()).done;){var s=n.value;"constructor"===s||"bindMethods"===s||(e[s]=e[s].bind(e))}}catch(t){i.e(t)}finally{i.f()}}}],i&&a(e.prototype,i),u&&a(e,u),Object.defineProperty(e,"prototype",{writable:!1}),t}();r(l,"noop",(function(){}));const c=l;function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function h(t,e){for(var n=0;n1?null===(e=n)||void 0===e?void 0:e.toLowerCase():n}},{key:"keyCodeToKey",value:function(t){return{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[t]||""}}])&&h(e.prototype,n),o&&h(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function g(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:i();return r(t,e)},u.appendChild(o)}));var l=s>0,c=document.createElement("div");c.classList.add("hg-candidate-box-prev"),l&&c.classList.add("hg-candidate-box-btn-active");var d=function(){l&&n.renderPage({candidateListPages:o,targetElement:i,pageIndex:s-1,nbPages:a,onItemSelected:r})};this.options.useTouchEvents?c.ontouchstart=d:c.onclick=d,this.candidateBoxElement.appendChild(c),this.candidateBoxElement.appendChild(u);var h=st.length)&&(e=t.length);for(var n=0,o=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:t;this.caretPosition=t,this.caretPositionEnd=e}},{key:"getInputCandidates",value:function(t){var e=this,n=this.options,o=n.layoutCandidates,i=n.layoutCandidatesCaseSensitiveMatch;if(!o||"object"!==C(o))return{};var s=Object.keys(o).filter((function(n){var o=t.substring(0,e.getCaretPositionEnd()||0)||t,s=new RegExp("".concat(e.utilities.escapeRegex(n),"$"),i?"g":"gi");return!!w(o.matchAll(s)).length}));if(s.length>1){var a=s.sort((function(t,e){return e.length-t.length}))[0];return{candidateKey:a,candidateValue:o[a]}}if(s.length){var r=s[0];return{candidateKey:r,candidateValue:o[r]}}return{}}},{key:"showCandidatesBox",value:function(t,e,n){var o=this;this.candidateBox&&this.candidateBox.show({candidateValue:e,targetElement:n,onSelect:function(e,n){var i=o.options,s=i.layoutCandidatesCaseSensitiveMatch,a=i.disableCandidateNormalization,r=i.enableLayoutCandidatesKeyPress,u=e;a||(u=e.normalize("NFD"));var l=o.getInput(o.options.inputName,!0),c=o.getCaretPositionEnd()||0,d=l.substring(0,c||0)||l,h=new RegExp("".concat(o.utilities.escapeRegex(t),"$"),s?"g":"gi"),p=d.replace(h,u),f=l.replace(d,p),y=p.length-d.length,v=(c||l.length)+y;v<0&&(v=0),o.setInput(f,o.options.inputName,!0),o.setCaretPosition(v),r&&"function"==typeof o.options.onKeyPress&&o.options.onKeyPress(e,n),"function"==typeof o.options.onChange&&o.options.onChange(o.getInput(o.options.inputName,!0),n),"function"==typeof o.options.onChangeAll&&o.options.onChangeAll(o.getAllInputs(),n)}})}},{key:"handleButtonClicked",value:function(t,e){var n=this.options,o=n.inputName,i=void 0===o?this.defaultName:o,s=n.debug;if("{//}"!==t){this.input[i]||(this.input[i]="");var a=this.utilities.getUpdatedInput(t,this.input[i],this.caretPosition,this.caretPositionEnd);if(this.utilities.isStandardButton(t)&&this.activeInputElement&&this.input[i]&&this.input[i]===a&&0===this.caretPosition&&this.caretPositionEnd===a.length)return this.setInput("",this.options.inputName,!0),this.setCaretPosition(0),this.activeInputElement.value="",this.activeInputElement.setSelectionRange(0,0),void this.handleButtonClicked(t,e);if("function"==typeof this.options.onKeyPress&&this.options.onKeyPress(t,e),this.input[i]!==a&&(!this.options.inputPattern||this.options.inputPattern&&this.inputPatternIsValid(a))){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,a))return;var r=this.utilities.getUpdatedInput(t,this.input[i],this.caretPosition,this.caretPositionEnd,!0);if(this.setInput(r,this.options.inputName,!0),s&&console.log("Input changed:",this.getAllInputs()),this.options.debug&&console.log("Caret at: ",this.getCaretPosition(),this.getCaretPositionEnd(),"(".concat(this.keyboardDOMClass,")"),null==e?void 0:e.type),this.options.syncInstanceInputs&&this.syncInstanceInputs(),"function"==typeof this.options.onChange&&this.options.onChange(this.getInput(this.options.inputName,!0),e),"function"==typeof this.options.onChangeAll&&this.options.onChangeAll(this.getAllInputs(),e),null!=e&&e.target&&this.options.enableLayoutCandidates){var u,l=this.getInputCandidates(a),c=l.candidateKey,d=l.candidateValue;c&&d?this.showCandidatesBox(c,d,this.keyboardDOM):null===(u=this.candidateBox)||void 0===u||u.destroy()}}this.caretPositionEnd&&this.caretPosition!==this.caretPositionEnd&&(this.setCaretPosition(this.caretPositionEnd,this.caretPositionEnd),this.activeInputElement&&this.activeInputElement.setSelectionRange(this.caretPositionEnd,this.caretPositionEnd),this.options.debug&&console.log("Caret position aligned",this.caretPosition)),s&&console.log("Key pressed:",t)}}},{key:"getMouseHold",value:function(){return this.isMouseHold}},{key:"setMouseHold",value:function(t){this.options.syncInstanceInputs?this.dispatch((function(e){e.isMouseHold=t})):this.isMouseHold=t}},{key:"handleButtonMouseDown",value:function(t,e){var n=this;e&&(this.options.preventMouseDownDefault&&e.preventDefault(),this.options.stopMouseDownPropagation&&e.stopPropagation(),e.target.classList.add(this.activeButtonClass)),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.setMouseHold(!0),this.options.disableButtonHold||(this.holdTimeout=window.setTimeout((function(){(n.getMouseHold()&&(!t.includes("{")&&!t.includes("}")||"{delete}"===t||"{backspace}"===t||"{bksp}"===t||"{space}"===t||"{tab}"===t)||"{arrowright}"===t||"{arrowleft}"===t||"{arrowup}"===t||"{arrowdown}"===t)&&(n.options.debug&&console.log("Button held:",t),n.handleButtonHold(t)),clearTimeout(n.holdTimeout)}),500))}},{key:"handleButtonMouseUp",value:function(t,e){var n=this;e&&(this.options.preventMouseUpDefault&&e.preventDefault&&e.preventDefault(),this.options.stopMouseUpPropagation&&e.stopPropagation&&e.stopPropagation(),!(e.target===this.keyboardDOM||e.target&&this.keyboardDOM.contains(e.target)||this.candidateBox&&this.candidateBox.candidateBoxElement&&(e.target===this.candidateBox.candidateBoxElement||e.target&&this.candidateBox.candidateBoxElement.contains(e.target)))&&this.candidateBox&&this.candidateBox.destroy()),this.recurseButtons((function(t){t.classList.remove(n.activeButtonClass)})),this.setMouseHold(!1),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),t&&"function"==typeof this.options.onKeyReleased&&this.options.onKeyReleased(t,e)}},{key:"handleKeyboardContainerMouseDown",value:function(t){this.options.preventMouseDownDefault&&t.preventDefault()}},{key:"handleButtonHold",value:function(t){var e=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=window.setTimeout((function(){e.getMouseHold()?(e.handleButtonClicked(t),e.handleButtonHold(t)):clearTimeout(e.holdInteractionTimeout)}),100)}},{key:"syncInstanceInputs",value:function(){var t=this;this.dispatch((function(e){e.replaceInput(t.input),e.setCaretPosition(t.caretPosition,t.caretPositionEnd)}))}},{key:"clearInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName;this.input[t]="",this.setCaretPosition(0),this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"getInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.options.syncInstanceInputs&&!e&&this.syncInstanceInputs(),this.options.rtl?"‫"+this.input[t].replace("‫","").replace("‬","")+"‬":this.input[t]}},{key:"getAllInputs",value:function(){var t=this,e={};return Object.keys(this.input).forEach((function(n){e[n]=t.getInput(n,!0)})),e}},{key:"setInput",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.inputName||this.defaultName,n=arguments.length>2?arguments[2]:void 0;this.input[e]=t,!n&&this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"replaceInput",value:function(t){this.input=t}},{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.changedOptions(t);this.options=Object.assign(this.options,t),e.length&&(this.options.debug&&console.log("changedOptions",e),this.onSetOptions(e),this.render())}},{key:"changedOptions",value:function(t){var e=this;return Object.keys(t).filter((function(n){return JSON.stringify(t[n])!==JSON.stringify(e.options[n])}))}},{key:"onSetOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.includes("layoutName")&&this.candidateBox&&this.candidateBox.destroy(),(t.includes("layoutCandidatesPageSize")||t.includes("layoutCandidates"))&&this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=new k({utilities:this.utilities,options:this.options}))}},{key:"resetRows",value:function(){this.keyboardRowsDOM&&this.keyboardRowsDOM.remove(),this.keyboardDOM.className=this.keyboardDOMClass,this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.buttonElements={}}},{key:"dispatch",value:function(t){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach((function(e){t(window.SimpleKeyboardInstances[e],e)}))}},{key:"addButtonTheme",value:function(t,e){var n=this;e&&t&&(t.split(" ").forEach((function(o){e.split(" ").forEach((function(e){n.options.buttonTheme||(n.options.buttonTheme=[]);var i=!1;n.options.buttonTheme.map((function(t){if(null!=t&&t.class.split(" ").includes(e)){i=!0;var n=t.buttons.split(" ");n.includes(o)||(i=!0,n.push(o),t.buttons=n.join(" "))}return t})),i||n.options.buttonTheme.push({class:e,buttons:t})}))})),this.render())}},{key:"removeButtonTheme",value:function(t,e){var n=this;if(!t&&!e)return this.options.buttonTheme=[],void this.render();t&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(t.split(" ").forEach((function(t){var o;null===(o=n.options)||void 0===o||null===(o=o.buttonTheme)||void 0===o||o.map((function(o,i){if(o&&e&&e.includes(o.class)||!e){var s,a,r=null===(s=o)||void 0===s?void 0:s.buttons.split(" ").filter((function(e){return e!==t}));o&&null!=r&&r.length?o.buttons=r.join(" "):(null===(a=n.options.buttonTheme)||void 0===a||a.splice(i,1),o=null)}return o}))})),this.render())}},{key:"getButtonElement",value:function(t){var e,n=this.buttonElements[t];return n&&(e=n.length>1?n:n[0]),e}},{key:"inputPatternIsValid",value:function(t){var e,n=this.options.inputPattern;if((e=n instanceof RegExp?n:n[this.options.inputName||this.defaultName])&&t){var o=e.test(t);return this.options.debug&&console.log('inputPattern ("'.concat(e,'"): ').concat(o?"passed":"did not pass!")),o}return!0}},{key:"setEventListeners",value:function(){if(this.isFirstKeyboardInstance||!this.allKeyboardInstances){this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")"));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.addEventListener("keyup",this.handleKeyUp,e),document.addEventListener("keydown",this.handleKeyDown,e),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd),document.addEventListener("selectionchange",this.handleSelectionChange),document.addEventListener("select",this.handleSelect)}}},{key:"handleKeyUp",value:function(t){this.caretEventHandler(t),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(t)}},{key:"handleKeyDown",value:function(t){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(t)}},{key:"handleMouseUp",value:function(t){this.caretEventHandler(t)}},{key:"handleTouchEnd",value:function(t){this.caretEventHandler(t)}},{key:"handleSelect",value:function(t){this.caretEventHandler(t)}},{key:"handleSelectionChange",value:function(t){navigator.userAgent.includes("Firefox")||this.caretEventHandler(t)}},{key:"caretEventHandler",value:function(t){var e,n=this;t.target.tagName&&(e=t.target.tagName.toLowerCase()),this.dispatch((function(o){var i=t.target===o.keyboardDOM||t.target&&o.keyboardDOM.contains(t.target);if(n.options.syncInstanceInputs&&Array.isArray(t.path)&&(i=t.path.some((function(t){var e;return null==t||null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-skInstance")}))),("textarea"===e||"input"===e&&["text","search","url","tel","password"].includes(t.target.type))&&!o.options.disableCaretPositioning){var s=t.target.selectionStart,a=t.target.selectionEnd;o.options.rtl&&(s=o.utilities.getRtlOffset(s,o.getInput()),a=o.utilities.getRtlOffset(a,o.getInput())),o.setCaretPosition(s,a),n.activeInputElement=t.target,o.options.debug&&console.log("Caret at: ",o.getCaretPosition(),o.getCaretPositionEnd(),t&&t.target.tagName.toLowerCase(),"(".concat(o.keyboardDOMClass,")"),null==t?void 0:t.type)}else!o.options.disableCaretPositioning&&i||"selectionchange"===(null==t?void 0:t.type)||(o.setCaretPosition(null),n.activeInputElement=null,o.options.debug&&console.log('Caret position reset due to "'.concat(null==t?void 0:t.type,'" event'),t))}))}},{key:"recurseButtons",value:function(t){var e=this;t&&Object.keys(this.buttonElements).forEach((function(n){return e.buttonElements[n].forEach(t)}))}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.removeEventListener("keyup",this.handleKeyUp,e),document.removeEventListener("keydown",this.handleKeyDown,e),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("select",this.handleSelect),document.removeEventListener("selectionchange",this.handleSelectionChange),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null,this.recurseButtons((function(t){t&&(t.onpointerdown=null,t.onpointerup=null,t.onpointercancel=null,t.ontouchstart=null,t.ontouchend=null,t.ontouchcancel=null,t.onclick=null,t.onmousedown=null,t.onmouseup=null,t.remove(),t=null)})),this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.resetRows(),this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=null),this.activeInputElement=null,this.keyboardDOM.removeAttribute("data-skInstance"),this.keyboardDOM.innerHTML="",window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(t){var e=this.options.buttonTheme,n=[];return Array.isArray(e)&&e.forEach((function(e){if(e&&e.class&&"string"==typeof e.class&&e.buttons&&"string"==typeof e.buttons){var o=e.class.split(" ");e.buttons.split(" ").includes(t)&&(n=[].concat(w(n),w(o)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',e)})),n}},{key:"setDOMButtonAttributes",value:function(t,e){var n=this.options.buttonAttributes;Array.isArray(n)&&n.forEach((function(n){n.attribute&&"string"==typeof n.attribute&&n.value&&"string"==typeof n.value&&n.buttons&&"string"==typeof n.buttons?n.buttons.split(" ").includes(t)&&e(n.attribute,n.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',n)}))}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(t){if(t.target.classList.contains("hg-button"))return t.preventDefault(),t.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),"function"==typeof this.options.onInit&&this.options.onInit(this)}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),"function"==typeof this.options.beforeFirstRender&&this.options.beforeFirstRender(this),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){"function"==typeof this.options.beforeRender&&this.options.beforeRender(this)}},{key:"onRender",value:function(){"function"==typeof this.options.onRender&&this.options.onRender(this)}},{key:"onModulesLoaded",value:function(){"function"==typeof this.options.onModulesLoaded&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var t=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach((function(e){var n=new e(t);n.init&&n.init(t)})),this.keyboardPluginClasses="modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(t,e){return!!this.modules[t]&&this.modules[t][e]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(t,e,n,o){var i=this,s=Array.from(t.children),a=0;return s.length&&n.forEach((function(n,r){var u=o[r];if(!(u&&u>n))return!1;var l=n-a,c=u-a,d=document.createElement("div");d.className+="hg-button-container";var h="".concat(i.options.layoutName,"-r").concat(e,"c").concat(r);d.setAttribute("data-skUID",h);var p=s.splice(l,c-l+1);a=c-l,p.forEach((function(t){return d.appendChild(t)})),s.splice(l,0,d),t.innerHTML="",s.forEach((function(e){return t.appendChild(e)})),i.options.debug&&console.log("rowDOMContainer",p,l,c,a+1)})),t}},{key:"render",value:function(){var t=this;this.resetRows(),this.initialized||this.beforeFirstRender(),this.beforeRender();var e="hg-layout-".concat(this.options.layoutName),n=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},o=this.options.useTouchEvents||!1,i=o?"hg-touch-events":"",s=this.options.useMouseEvents||!1,a=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,e,this.keyboardPluginClasses,i),this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.keyboardRowsDOM=document.createElement("div"),this.keyboardRowsDOM.className="hg-rows",n[this.options.layoutName||this.defaultName].forEach((function(e,n){var i=e.split(" ");t.options.excludeFromLayout&&t.options.excludeFromLayout[t.options.layoutName||t.defaultName]&&(i=i.filter((function(e){return t.options.excludeFromLayout&&!t.options.excludeFromLayout[t.options.layoutName||t.defaultName].includes(e)})));var r=document.createElement("div");r.className+="hg-row";var u=[],l=[];i.forEach((function(e,i){var c,d=!a&&"string"==typeof e&&e.length>1&&0===e.indexOf("["),h=!a&&"string"==typeof e&&e.length>1&&e.indexOf("]")===e.length-1;d&&(u.push(i),e=e.replace(/\[/g,"")),h&&(l.push(i),e=e.replace(/\]/g,""));var p=t.utilities.getButtonClass(e),f=t.utilities.getButtonDisplayName(e,t.options.display,t.options.mergeDisplay),y=t.options.useButtonTag?"button":"div",v=document.createElement(y);v.className+="hg-button ".concat(p),(c=v.classList).add.apply(c,w(t.getButtonThemeClasses(e))),t.setDOMButtonAttributes(e,(function(t,e){v.setAttribute(t,e)})),t.activeButtonClass="hg-activeButton",!t.utilities.pointerEventsSupported()||o||s?o?(v.ontouchstart=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.ontouchend=function(n){t.handleButtonMouseUp(e,n)},v.ontouchcancel=function(n){t.handleButtonMouseUp(e,n)}):(v.onclick=function(n){t.setMouseHold(!1),"function"!=typeof t.options.onKeyReleased&&t.handleButtonClicked(e,n)},v.onmousedown=function(n){"function"!=typeof t.options.onKeyReleased||t.isMouseHold||t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.onmouseup=function(n){t.handleButtonMouseUp(e,n)}):(v.onpointerdown=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.onpointerup=function(n){t.handleButtonMouseUp(e,n)},v.onpointercancel=function(n){t.handleButtonMouseUp(e,n)}),v.setAttribute("data-skBtn",e);var g="".concat(t.options.layoutName,"-r").concat(n,"b").concat(i);v.setAttribute("data-skBtnUID",g);var m=document.createElement("span");m.innerHTML=f,v.appendChild(m),t.buttonElements[e]||(t.buttonElements[e]=[]),t.buttonElements[e].push(v),r.appendChild(v)})),r=t.parseRowDOMContainers(r,n,u,l),t.keyboardRowsDOM.appendChild(r)})),this.keyboardDOM.appendChild(this.keyboardRowsDOM),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||o||s?o?(document.ontouchend=function(e){return t.handleButtonMouseUp(void 0,e)},document.ontouchcancel=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.ontouchstart=function(e){return t.handleKeyboardContainerMouseDown(e)}):o||(document.onmouseup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onmousedown=function(e){return t.handleKeyboardContainerMouseDown(e)}):(document.onpointerup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onpointerdown=function(e){return t.handleKeyboardContainerMouseDown(e)}),this.onInit())}}],n&&O(e.prototype,n),o&&O(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}(),S=D;var B=e.o,A=e.A;export{B as SimpleKeyboard,A as default}; + */var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{o:()=>D,A:()=>S});function n(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n2&&void 0!==arguments[2]&&arguments[2]?Object.assign({},this.getDefaultDiplay(),e):e||this.getDefaultDiplay())[t]||t}},{key:"getUpdatedInput",value:function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=this.getOptions(),a=[n,o,i],r=e;return("{bksp}"===t||"{backspace}"===t)&&r.length>0?r=this.removeAt.apply(this,[r].concat(a)):("{delete}"===t||"{forwarddelete}"===t)&&r.length>0?r=this.removeForwardsAt.apply(this,[r].concat(a)):"{space}"===t?r=this.addStringAt.apply(this,[r," "].concat(a)):"{tab}"!==t||"boolean"==typeof s.tabCharOnTab&&!1===s.tabCharOnTab?"{enter}"!==t&&"{numpadenter}"!==t||!s.newLineOnEnter?t.includes("numpad")&&Number.isInteger(Number(t[t.length-2]))?r=this.addStringAt.apply(this,[r,t[t.length-2]].concat(a)):"{numpaddivide}"===t?r=this.addStringAt.apply(this,[r,"/"].concat(a)):"{numpadmultiply}"===t?r=this.addStringAt.apply(this,[r,"*"].concat(a)):"{numpadsubtract}"===t?r=this.addStringAt.apply(this,[r,"-"].concat(a)):"{numpadadd}"===t?r=this.addStringAt.apply(this,[r,"+"].concat(a)):"{numpaddecimal}"===t?r=this.addStringAt.apply(this,[r,"."].concat(a)):"{"===t||"}"===t?r=this.addStringAt.apply(this,[r,t].concat(a)):t.includes("{")||t.includes("}")||(r=this.addStringAt.apply(this,[r,t].concat(a))):r=this.addStringAt.apply(this,[r,"\n"].concat(a)):r=this.addStringAt.apply(this,[r,"\t"].concat(a)),s.debug&&console.log("Input will be: "+r),r}},{key:"updateCaretPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.updateCaretPosAction(t,e);this.dispatch((function(t){t.setCaretPosition(n)}))}},{key:"updateCaretPosAction",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getOptions(),o=this.getCaretPosition();return null!=o&&(e?o>0&&(o-=t):o+=t),n.debug&&console.log("Caret at:",o),o}},{key:"addStringAt",value:function(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return o||0===o?(n=[t.slice(0,o),e,t.slice(i)].join(""),this.isMaxLengthReached()||s&&this.updateCaretPos(e.length)):n=t+e,n}},{key:"removeAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0===n&&0===o)return t;if(n===o){var s=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;n&&n>=0?t.substring(n-2,n).match(s)?(e=t.substr(0,n-2)+t.substr(n),i&&this.updateCaretPos(2,!0)):(e=t.substr(0,n-1)+t.substr(n),i&&this.updateCaretPos(1,!0)):t.slice(-2).match(s)?(e=t.slice(0,-2),i&&this.updateCaretPos(2,!0)):(e=t.slice(0,-1),i&&this.updateCaretPos(1,!0))}else e=t.slice(0,n)+t.slice(o),i&&this.dispatch((function(t){t.setCaretPosition(n)}));return e}},{key:"removeForwardsAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return null!=t&&t.length&&null!==n?(n===o?e=t.substring(n,n+2).match(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g)?t.substr(0,n)+t.substr(n+2):t.substr(0,n)+t.substr(n+1):(e=t.slice(0,n)+t.slice(o),i&&this.dispatch((function(t){t.setCaretPosition(n)}))),e):t}},{key:"handleMaxLength",value:function(t,e){var n=this.getOptions(),o=n.maxLength,i=t[n.inputName||"default"],a=e.length-1>=o;if(e.length<=i.length)return!1;if(Number.isInteger(o))return n.debug&&console.log("maxLength (num) reached:",a),a?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===s(o)){var r=e.length-1>=o[n.inputName||"default"];return n.debug&&console.log("maxLength (obj) reached:",r),r?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return Boolean(this.maxLengthReached)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return!!window.PointerEvent}},{key:"camelCase",value:function(t){return t?t.toLowerCase().trim().split(/[.\-_\s]/g).reduce((function(t,e){return e.length?t+e[0].toUpperCase()+e.slice(1):t})):""}},{key:"chunkArray",value:function(t,e){return n(Array(Math.ceil(t.length/e))).map((function(n,o){return t.slice(e*o,e+e*o)}))}},{key:"escapeRegex",value:function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},{key:"getRtlOffset",value:function(t,e){var n=t,o=e.indexOf("‫");return o=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return r=t.done,t},e:function(t){u=!0,a=t},f:function(){try{r||null==n.return||n.return()}finally{if(u)throw a}}}}(Object.getOwnPropertyNames(t.prototype));try{for(i.s();!(n=i.n()).done;){var s=n.value;"constructor"===s||"bindMethods"===s||(e[s]=e[s].bind(e))}}catch(t){i.e(t)}finally{i.f()}}}],e&&a(t.prototype,e),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();r(l,"noop",(function(){}));const c=l;function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function h(t,e){for(var n=0;n1?null===(e=n)||void 0===e?void 0:e.toLowerCase():n}},{key:"keyCodeToKey",value:function(t){return{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[t]||""}}])&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function g(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:i();return r(t,e)},u.appendChild(o)}));var l=s>0,c=document.createElement("div");c.classList.add("hg-candidate-box-prev"),l&&c.classList.add("hg-candidate-box-btn-active");var d=function(){l&&n.renderPage({candidateListPages:o,targetElement:i,pageIndex:s-1,nbPages:a,onItemSelected:r})};this.options.useTouchEvents?c.ontouchstart=d:c.onclick=d,this.candidateBoxElement.appendChild(c),this.candidateBoxElement.appendChild(u);var h=st.length)&&(e=t.length);for(var n=0,o=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:t;this.caretPosition=t,this.caretPositionEnd=e}},{key:"getInputCandidates",value:function(t){var e=this,n=this.options,o=n.layoutCandidates,i=n.layoutCandidatesCaseSensitiveMatch;if(!o||"object"!==C(o))return{};var s=Object.keys(o).filter((function(n){var o=t.substring(0,e.getCaretPositionEnd()||0)||t,s=new RegExp("".concat(e.utilities.escapeRegex(n),"$"),i?"g":"gi");return!!w(o.matchAll(s)).length}));if(s.length>1){var a=s.sort((function(t,e){return e.length-t.length}))[0];return{candidateKey:a,candidateValue:o[a]}}if(s.length){var r=s[0];return{candidateKey:r,candidateValue:o[r]}}return{}}},{key:"showCandidatesBox",value:function(t,e,n){var o=this;this.candidateBox&&this.candidateBox.show({candidateValue:e,targetElement:n,onSelect:function(e,n){var i=o.options,s=i.layoutCandidatesCaseSensitiveMatch,a=i.disableCandidateNormalization,r=i.enableLayoutCandidatesKeyPress,u=e;a||(u=e.normalize("NFD"));var l=o.getInput(o.options.inputName,!0),c=o.getCaretPositionEnd()||0,d=l.substring(0,c||0)||l,h=new RegExp("".concat(o.utilities.escapeRegex(t),"$"),s?"g":"gi"),p=d.replace(h,u),f=l.replace(d,p),y=p.length-d.length,v=(c||l.length)+y;v<0&&(v=0),o.setInput(f,o.options.inputName,!0),o.setCaretPosition(v),r&&"function"==typeof o.options.onKeyPress&&o.options.onKeyPress(e,n),"function"==typeof o.options.onChange&&o.options.onChange(o.getInput(o.options.inputName,!0),n),"function"==typeof o.options.onChangeAll&&o.options.onChangeAll(o.getAllInputs(),n)}})}},{key:"handleButtonClicked",value:function(t,e){var n=this.options,o=n.inputName,i=void 0===o?this.defaultName:o,s=n.debug;if("{//}"!==t){this.input[i]||(this.input[i]="");var a=this.utilities.getUpdatedInput(t,this.input[i],this.caretPosition,this.caretPositionEnd);if(this.utilities.isStandardButton(t)&&this.activeInputElement&&this.input[i]&&this.input[i]===a&&0===this.caretPosition&&this.caretPositionEnd===a.length)return this.setInput("",this.options.inputName,!0),this.setCaretPosition(0),this.activeInputElement.value="",this.activeInputElement.setSelectionRange(0,0),void this.handleButtonClicked(t,e);if("function"==typeof this.options.onKeyPress&&this.options.onKeyPress(t,e),this.input[i]!==a&&(!this.options.inputPattern||this.options.inputPattern&&this.inputPatternIsValid(a))){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,a))return;var r=this.utilities.getUpdatedInput(t,this.input[i],this.caretPosition,this.caretPositionEnd,!0);if(this.setInput(r,this.options.inputName,!0),s&&console.log("Input changed:",this.getAllInputs()),this.options.debug&&console.log("Caret at: ",this.getCaretPosition(),this.getCaretPositionEnd(),"(".concat(this.keyboardDOMClass,")"),null==e?void 0:e.type),this.options.syncInstanceInputs&&this.syncInstanceInputs(),"function"==typeof this.options.onChange&&this.options.onChange(this.getInput(this.options.inputName,!0),e),"function"==typeof this.options.onChangeAll&&this.options.onChangeAll(this.getAllInputs(),e),null!=e&&e.target&&this.options.enableLayoutCandidates){var u,l=this.getInputCandidates(a),c=l.candidateKey,d=l.candidateValue;c&&d?this.showCandidatesBox(c,d,this.keyboardDOM):null===(u=this.candidateBox)||void 0===u||u.destroy()}}this.caretPositionEnd&&this.caretPosition!==this.caretPositionEnd&&(this.setCaretPosition(this.caretPositionEnd,this.caretPositionEnd),this.activeInputElement&&this.activeInputElement.setSelectionRange(this.caretPositionEnd,this.caretPositionEnd),this.options.debug&&console.log("Caret position aligned",this.caretPosition)),s&&console.log("Key pressed:",t)}}},{key:"getMouseHold",value:function(){return this.isMouseHold}},{key:"setMouseHold",value:function(t){this.options.syncInstanceInputs?this.dispatch((function(e){e.isMouseHold=t})):this.isMouseHold=t}},{key:"handleButtonMouseDown",value:function(t,e){var n=this;e&&(this.options.preventMouseDownDefault&&e.preventDefault(),this.options.stopMouseDownPropagation&&e.stopPropagation(),e.target.classList.add(this.activeButtonClass)),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.setMouseHold(!0),this.options.disableButtonHold||(this.holdTimeout=window.setTimeout((function(){(n.getMouseHold()&&(!t.includes("{")&&!t.includes("}")||"{delete}"===t||"{backspace}"===t||"{bksp}"===t||"{space}"===t||"{tab}"===t)||"{arrowright}"===t||"{arrowleft}"===t||"{arrowup}"===t||"{arrowdown}"===t)&&(n.options.debug&&console.log("Button held:",t),n.handleButtonHold(t)),clearTimeout(n.holdTimeout)}),500))}},{key:"handleButtonMouseUp",value:function(t,e){var n=this;e&&(this.options.preventMouseUpDefault&&e.preventDefault&&e.preventDefault(),this.options.stopMouseUpPropagation&&e.stopPropagation&&e.stopPropagation(),!(e.target===this.keyboardDOM||e.target&&this.keyboardDOM.contains(e.target)||this.candidateBox&&this.candidateBox.candidateBoxElement&&(e.target===this.candidateBox.candidateBoxElement||e.target&&this.candidateBox.candidateBoxElement.contains(e.target)))&&this.candidateBox&&this.candidateBox.destroy()),this.recurseButtons((function(t){t.classList.remove(n.activeButtonClass)})),this.setMouseHold(!1),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),t&&"function"==typeof this.options.onKeyReleased&&this.options.onKeyReleased(t,e)}},{key:"handleKeyboardContainerMouseDown",value:function(t){this.options.preventMouseDownDefault&&t.preventDefault()}},{key:"handleButtonHold",value:function(t){var e=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=window.setTimeout((function(){e.getMouseHold()?(e.handleButtonClicked(t),e.handleButtonHold(t)):clearTimeout(e.holdInteractionTimeout)}),100)}},{key:"syncInstanceInputs",value:function(){var t=this;this.dispatch((function(e){e.replaceInput(t.input),e.setCaretPosition(t.caretPosition,t.caretPositionEnd)}))}},{key:"clearInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName;this.input[t]="",this.setCaretPosition(0),this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"getInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.options.syncInstanceInputs&&!e&&this.syncInstanceInputs(),this.options.rtl?"‫"+this.input[t].replace("‫","").replace("‬","")+"‬":this.input[t]}},{key:"getAllInputs",value:function(){var t=this,e={};return Object.keys(this.input).forEach((function(n){e[n]=t.getInput(n,!0)})),e}},{key:"setInput",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.inputName||this.defaultName,n=arguments.length>2?arguments[2]:void 0;this.input[e]=t,!n&&this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"replaceInput",value:function(t){this.input=t}},{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.changedOptions(t);this.options=Object.assign(this.options,t),e.length&&(this.options.debug&&console.log("changedOptions",e),this.onSetOptions(e),this.render())}},{key:"changedOptions",value:function(t){var e=this;return Object.keys(t).filter((function(n){return JSON.stringify(t[n])!==JSON.stringify(e.options[n])}))}},{key:"onSetOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.includes("layoutName")&&this.candidateBox&&this.candidateBox.destroy(),(t.includes("layoutCandidatesPageSize")||t.includes("layoutCandidates"))&&this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=new k({utilities:this.utilities,options:this.options}))}},{key:"resetRows",value:function(){this.keyboardRowsDOM&&this.keyboardRowsDOM.remove(),this.keyboardDOM.className=this.keyboardDOMClass,this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.buttonElements={}}},{key:"dispatch",value:function(t){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach((function(e){t(window.SimpleKeyboardInstances[e],e)}))}},{key:"addButtonTheme",value:function(t,e){var n=this;e&&t&&(t.split(" ").forEach((function(o){e.split(" ").forEach((function(e){n.options.buttonTheme||(n.options.buttonTheme=[]);var i=!1;n.options.buttonTheme.map((function(t){if(null!=t&&t.class.split(" ").includes(e)){i=!0;var n=t.buttons.split(" ");n.includes(o)||(i=!0,n.push(o),t.buttons=n.join(" "))}return t})),i||n.options.buttonTheme.push({class:e,buttons:t})}))})),this.render())}},{key:"removeButtonTheme",value:function(t,e){var n=this;if(!t&&!e)return this.options.buttonTheme=[],void this.render();t&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(t.split(" ").forEach((function(t){var o;null===(o=n.options)||void 0===o||null===(o=o.buttonTheme)||void 0===o||o.map((function(o,i){if(o&&e&&e.includes(o.class)||!e){var s,a,r=null===(s=o)||void 0===s?void 0:s.buttons.split(" ").filter((function(e){return e!==t}));o&&null!=r&&r.length?o.buttons=r.join(" "):(null===(a=n.options.buttonTheme)||void 0===a||a.splice(i,1),o=null)}return o}))})),this.render())}},{key:"getButtonElement",value:function(t){var e,n=this.buttonElements[t];return n&&(e=n.length>1?n:n[0]),e}},{key:"inputPatternIsValid",value:function(t){var e,n=this.options.inputPattern;if((e=n instanceof RegExp?n:n[this.options.inputName||this.defaultName])&&t){var o=e.test(t);return this.options.debug&&console.log('inputPattern ("'.concat(e,'"): ').concat(o?"passed":"did not pass!")),o}return!0}},{key:"setEventListeners",value:function(){if(this.isFirstKeyboardInstance||!this.allKeyboardInstances){this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")"));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.addEventListener("keyup",this.handleKeyUp,e),document.addEventListener("keydown",this.handleKeyDown,e),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd),document.addEventListener("selectionchange",this.handleSelectionChange),document.addEventListener("select",this.handleSelect)}}},{key:"handleKeyUp",value:function(t){this.caretEventHandler(t),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(t)}},{key:"handleKeyDown",value:function(t){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(t)}},{key:"handleMouseUp",value:function(t){this.caretEventHandler(t)}},{key:"handleTouchEnd",value:function(t){this.caretEventHandler(t)}},{key:"handleSelect",value:function(t){this.caretEventHandler(t)}},{key:"handleSelectionChange",value:function(t){navigator.userAgent.includes("Firefox")||this.caretEventHandler(t)}},{key:"caretEventHandler",value:function(t){var e,n=this;t.target.tagName&&(e=t.target.tagName.toLowerCase()),this.dispatch((function(o){var i=t.target===o.keyboardDOM||t.target&&o.keyboardDOM.contains(t.target);if(n.options.syncInstanceInputs&&Array.isArray(t.path)&&(i=t.path.some((function(t){var e;return null==t||null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-skInstance")}))),("textarea"===e||"input"===e&&["text","search","url","tel","password"].includes(t.target.type))&&!o.options.disableCaretPositioning){var s=t.target.selectionStart,a=t.target.selectionEnd;o.options.rtl&&(s=o.utilities.getRtlOffset(s,o.getInput()),a=o.utilities.getRtlOffset(a,o.getInput())),o.setCaretPosition(s,a),n.activeInputElement=t.target,o.options.debug&&console.log("Caret at: ",o.getCaretPosition(),o.getCaretPositionEnd(),t&&t.target.tagName.toLowerCase(),"(".concat(o.keyboardDOMClass,")"),null==t?void 0:t.type)}else!o.options.disableCaretPositioning&&i||"selectionchange"===(null==t?void 0:t.type)||(o.setCaretPosition(null),n.activeInputElement=null,o.options.debug&&console.log('Caret position reset due to "'.concat(null==t?void 0:t.type,'" event'),t))}))}},{key:"recurseButtons",value:function(t){var e=this;t&&Object.keys(this.buttonElements).forEach((function(n){return e.buttonElements[n].forEach(t)}))}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.removeEventListener("keyup",this.handleKeyUp,e),document.removeEventListener("keydown",this.handleKeyDown,e),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("select",this.handleSelect),document.removeEventListener("selectionchange",this.handleSelectionChange),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null,this.recurseButtons((function(t){t&&(t.onpointerdown=null,t.onpointerup=null,t.onpointercancel=null,t.ontouchstart=null,t.ontouchend=null,t.ontouchcancel=null,t.onclick=null,t.onmousedown=null,t.onmouseup=null,t.remove(),t=null)})),this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.resetRows(),this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=null),this.activeInputElement=null,this.keyboardDOM.removeAttribute("data-skInstance"),this.keyboardDOM.innerHTML="",window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(t){var e=this.options.buttonTheme,n=[];return Array.isArray(e)&&e.forEach((function(e){if(e&&e.class&&"string"==typeof e.class&&e.buttons&&"string"==typeof e.buttons){var o=e.class.split(" ");e.buttons.split(" ").includes(t)&&(n=[].concat(w(n),w(o)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',e)})),n}},{key:"setDOMButtonAttributes",value:function(t,e){var n=this.options.buttonAttributes;Array.isArray(n)&&n.forEach((function(n){n.attribute&&"string"==typeof n.attribute&&n.value&&"string"==typeof n.value&&n.buttons&&"string"==typeof n.buttons?n.buttons.split(" ").includes(t)&&e(n.attribute,n.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',n)}))}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(t){if(t.target.classList.contains("hg-button"))return t.preventDefault(),t.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),"function"==typeof this.options.onInit&&this.options.onInit(this)}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),"function"==typeof this.options.beforeFirstRender&&this.options.beforeFirstRender(this),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){"function"==typeof this.options.beforeRender&&this.options.beforeRender(this)}},{key:"onRender",value:function(){"function"==typeof this.options.onRender&&this.options.onRender(this)}},{key:"onModulesLoaded",value:function(){"function"==typeof this.options.onModulesLoaded&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var t=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach((function(e){var n=new e(t);n.init&&n.init(t)})),this.keyboardPluginClasses="modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(t,e){return!!this.modules[t]&&this.modules[t][e]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(t,e,n,o){var i=this,s=Array.from(t.children),a=0;return s.length&&n.forEach((function(n,r){var u=o[r];if(!(u&&u>n))return!1;var l=n-a,c=u-a,d=document.createElement("div");d.className+="hg-button-container";var h="".concat(i.options.layoutName,"-r").concat(e,"c").concat(r);d.setAttribute("data-skUID",h);var p=s.splice(l,c-l+1);a=c-l,p.forEach((function(t){return d.appendChild(t)})),s.splice(l,0,d),t.innerHTML="",s.forEach((function(e){return t.appendChild(e)})),i.options.debug&&console.log("rowDOMContainer",p,l,c,a+1)})),t}},{key:"render",value:function(){var t=this;this.resetRows(),this.initialized||this.beforeFirstRender(),this.beforeRender();var e="hg-layout-".concat(this.options.layoutName),n=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},o=this.options.useTouchEvents||!1,i=o?"hg-touch-events":"",s=this.options.useMouseEvents||!1,a=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,e,this.keyboardPluginClasses,i),this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.keyboardRowsDOM=document.createElement("div"),this.keyboardRowsDOM.className="hg-rows",n[this.options.layoutName||this.defaultName].forEach((function(e,n){var i=e.split(" ");t.options.excludeFromLayout&&t.options.excludeFromLayout[t.options.layoutName||t.defaultName]&&(i=i.filter((function(e){return t.options.excludeFromLayout&&!t.options.excludeFromLayout[t.options.layoutName||t.defaultName].includes(e)})));var r=document.createElement("div");r.className+="hg-row";var u=[],l=[];i.forEach((function(e,i){var c,d=!a&&"string"==typeof e&&e.length>1&&0===e.indexOf("["),h=!a&&"string"==typeof e&&e.length>1&&e.indexOf("]")===e.length-1;d&&(u.push(i),e=e.replace(/\[/g,"")),h&&(l.push(i),e=e.replace(/\]/g,""));var p=t.utilities.getButtonClass(e),f=t.utilities.getButtonDisplayName(e,t.options.display,t.options.mergeDisplay),y=t.options.useButtonTag?"button":"div",v=document.createElement(y);v.className+="hg-button ".concat(p),(c=v.classList).add.apply(c,w(t.getButtonThemeClasses(e))),t.setDOMButtonAttributes(e,(function(t,e){v.setAttribute(t,e)})),t.activeButtonClass="hg-activeButton",!t.utilities.pointerEventsSupported()||o||s?o?(v.ontouchstart=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.ontouchend=function(n){t.handleButtonMouseUp(e,n)},v.ontouchcancel=function(n){t.handleButtonMouseUp(e,n)}):(v.onclick=function(n){t.setMouseHold(!1),"function"!=typeof t.options.onKeyReleased&&t.handleButtonClicked(e,n)},v.onmousedown=function(n){"function"!=typeof t.options.onKeyReleased||t.isMouseHold||t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.onmouseup=function(n){t.handleButtonMouseUp(e,n)}):(v.onpointerdown=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.onpointerup=function(n){t.handleButtonMouseUp(e,n)},v.onpointercancel=function(n){t.handleButtonMouseUp(e,n)}),v.setAttribute("data-skBtn",e);var g="".concat(t.options.layoutName,"-r").concat(n,"b").concat(i);v.setAttribute("data-skBtnUID",g);var m=document.createElement("span");m.innerHTML=f,v.appendChild(m),t.buttonElements[e]||(t.buttonElements[e]=[]),t.buttonElements[e].push(v),r.appendChild(v)})),r=t.parseRowDOMContainers(r,n,u,l),t.keyboardRowsDOM.appendChild(r)})),this.keyboardDOM.appendChild(this.keyboardRowsDOM),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||o||s?o?(document.ontouchend=function(e){return t.handleButtonMouseUp(void 0,e)},document.ontouchcancel=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.ontouchstart=function(e){return t.handleKeyboardContainerMouseDown(e)}):o||(document.onmouseup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onmousedown=function(e){return t.handleKeyboardContainerMouseDown(e)}):(document.onpointerup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onpointerdown=function(e){return t.handleKeyboardContainerMouseDown(e)}),this.onInit())}}],e&&O(t.prototype,e),n&&O(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}(),S=D;var B=e.o,A=e.A;export{B as SimpleKeyboard,A as default}; //# sourceMappingURL=index.modern.esm.js.map \ No newline at end of file diff --git a/build/index.modern.esm.js.map b/build/index.modern.esm.js.map index 736729723..ecab507cf 100644 --- a/build/index.modern.esm.js.map +++ b/build/index.modern.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"index.modern.esm.js","mappings":";;;;;;;;;;;;;;GACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,ylDCGlF,IAGMI,EAAS,WAUb,SAAAA,EAAAC,GAKoB,IAJlBC,EAAUD,EAAVC,WACAC,EAAgBF,EAAhBE,iBACAC,EAAmBH,EAAnBG,oBACAC,EAAQJ,EAARI,U,4FAAQC,CAAA,KAAAN,GAAAO,EAAA,0BAAAA,EAAA,gCAAAA,EAAA,mCAAAA,EAAA,wBAAAA,EAAA,gCA6RVA,EAAA,yBAGmB,SAACC,GAAc,OAChCA,KAA0B,MAAdA,EAAO,IAA4C,MAA9BA,EAAOA,EAAOC,OAAS,GAAW,IA/RnEC,KAAKR,WAAaA,EAClBQ,KAAKP,iBAAmBA,EACxBO,KAAKN,oBAAsBA,EAC3BM,KAAKL,SAAWA,EAKhBL,EAAUW,YAAYX,EAAWU,KACnC,C,UA+dC,O,EA7dDV,E,EAAA,EAAAX,IAAA,gBAAAuB,MAMA,SAAcJ,GACZ,OAAOA,EAAOK,SAAS,MAAQL,EAAOK,SAAS,MAAmB,SAAXL,EACnD,cACA,aACN,GAEA,CAAAnB,IAAA,iBAAAuB,MAMA,SAAeJ,GACb,IAAMM,EAAkBJ,KAAKK,cAAcP,GACrCQ,EAAsBR,EAAOS,QAAQ,IAAK,IAAIA,QAAQ,IAAK,IAC7DC,EAAmB,GAKvB,MAHwB,gBAApBJ,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["webpack://simple-keyboard/webpack/bootstrap","webpack://simple-keyboard/webpack/runtime/define property getters","webpack://simple-keyboard/webpack/runtime/hasOwnProperty shorthand","webpack://simple-keyboard/./src/lib/services/Utilities.ts","webpack://simple-keyboard/./src/lib/services/PhysicalKeyboard.ts","webpack://simple-keyboard/./src/lib/components/CandidateBox.ts","webpack://simple-keyboard/./src/lib/components/Keyboard.ts","webpack://simple-keyboard/./src/lib/services/KeyboardLayout.ts","webpack://simple-keyboard/./src/lib/index.modern.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import { KeyboardInput } from \"./../interfaces\";\nimport { KeyboardOptions, UtilitiesParams } from \"../interfaces\";\n\n/**\n * Utility Service\n */\nclass Utilities {\n getOptions: () => KeyboardOptions;\n getCaretPosition: () => number | null;\n getCaretPositionEnd: () => number | null;\n dispatch: any;\n maxLengthReached!: boolean;\n\n /**\n * Creates an instance of the Utility service\n */\n constructor({\n getOptions,\n getCaretPosition,\n getCaretPositionEnd,\n dispatch,\n }: UtilitiesParams) {\n this.getOptions = getOptions;\n this.getCaretPosition = getCaretPosition;\n this.getCaretPositionEnd = getCaretPositionEnd;\n this.dispatch = dispatch;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(Utilities, this);\n }\n\n /**\n * Retrieve button type\n *\n * @param {string} button The button's layout name\n * @return {string} The button type\n */\n getButtonType(button: string): string {\n return button.includes(\"{\") && button.includes(\"}\") && button !== \"{//}\"\n ? \"functionBtn\"\n : \"standardBtn\";\n }\n\n /**\n * Adds default classes to a given button\n *\n * @param {string} button The button's layout name\n * @return {string} The classes to be added to the button\n */\n getButtonClass(button: string): string {\n const buttonTypeClass = this.getButtonType(button);\n const buttonWithoutBraces = button.replace(\"{\", \"\").replace(\"}\", \"\");\n let buttonNormalized = \"\";\n\n if (buttonTypeClass !== \"standardBtn\")\n buttonNormalized = ` hg-button-${buttonWithoutBraces}`;\n\n return `hg-${buttonTypeClass}${buttonNormalized}`;\n }\n\n /**\n * Default button display labels\n */\n getDefaultDiplay() {\n return {\n \"{bksp}\": \"backspace\",\n \"{backspace}\": \"backspace\",\n \"{enter}\": \"< enter\",\n \"{shift}\": \"shift\",\n \"{shiftleft}\": \"shift\",\n \"{shiftright}\": \"shift\",\n \"{alt}\": \"alt\",\n \"{s}\": \"shift\",\n \"{tab}\": \"tab\",\n \"{lock}\": \"caps\",\n \"{capslock}\": \"caps\",\n \"{accept}\": \"Submit\",\n \"{space}\": \" \",\n \"{//}\": \" \",\n \"{esc}\": \"esc\",\n \"{escape}\": \"esc\",\n \"{f1}\": \"f1\",\n \"{f2}\": \"f2\",\n \"{f3}\": \"f3\",\n \"{f4}\": \"f4\",\n \"{f5}\": \"f5\",\n \"{f6}\": \"f6\",\n \"{f7}\": \"f7\",\n \"{f8}\": \"f8\",\n \"{f9}\": \"f9\",\n \"{f10}\": \"f10\",\n \"{f11}\": \"f11\",\n \"{f12}\": \"f12\",\n \"{numpaddivide}\": \"/\",\n \"{numlock}\": \"lock\",\n \"{arrowup}\": \"↑\",\n \"{arrowleft}\": \"←\",\n \"{arrowdown}\": \"↓\",\n \"{arrowright}\": \"→\",\n \"{prtscr}\": \"print\",\n \"{scrolllock}\": \"scroll\",\n \"{pause}\": \"pause\",\n \"{insert}\": \"ins\",\n \"{home}\": \"home\",\n \"{pageup}\": \"up\",\n \"{delete}\": \"del\",\n \"{forwarddelete}\": \"del\",\n \"{end}\": \"end\",\n \"{pagedown}\": \"down\",\n \"{numpadmultiply}\": \"*\",\n \"{numpadsubtract}\": \"-\",\n \"{numpadadd}\": \"+\",\n \"{numpadenter}\": \"enter\",\n \"{period}\": \".\",\n \"{numpaddecimal}\": \".\",\n \"{numpad0}\": \"0\",\n \"{numpad1}\": \"1\",\n \"{numpad2}\": \"2\",\n \"{numpad3}\": \"3\",\n \"{numpad4}\": \"4\",\n \"{numpad5}\": \"5\",\n \"{numpad6}\": \"6\",\n \"{numpad7}\": \"7\",\n \"{numpad8}\": \"8\",\n \"{numpad9}\": \"9\",\n };\n }\n /**\n * Returns the display (label) name for a given button\n *\n * @param {string} button The button's layout name\n * @param {object} display The provided display option\n * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.\n */\n getButtonDisplayName(\n button: string,\n display: KeyboardOptions[\"display\"],\n mergeDisplay = false\n ) {\n if (mergeDisplay) {\n display = Object.assign({}, this.getDefaultDiplay(), display);\n } else {\n display = display || this.getDefaultDiplay();\n }\n\n return display[button] || button;\n }\n\n /**\n * Returns the updated input resulting from clicking a given button\n *\n * @param {string} button The button's layout name\n * @param {string} input The input string\n * @param {number} caretPos The cursor's current position\n * @param {number} caretPosEnd The cursor's current end position\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n getUpdatedInput(\n button: string,\n input: string,\n caretPos: any,\n caretPosEnd = caretPos,\n moveCaret = false\n ) {\n const options = this.getOptions();\n const commonParams: [number | undefined, number | undefined, boolean] = [\n caretPos,\n caretPosEnd,\n moveCaret,\n ];\n\n let output = input;\n\n if (\n (button === \"{bksp}\" || button === \"{backspace}\") &&\n output.length > 0\n ) {\n output = this.removeAt(output, ...commonParams);\n } else if (\n (button === \"{delete}\" || button === \"{forwarddelete}\") &&\n output.length > 0\n ) {\n output = this.removeForwardsAt(output, ...commonParams);\n } else if (button === \"{space}\")\n output = this.addStringAt(output, \" \", ...commonParams);\n else if (\n button === \"{tab}\" &&\n !(\n typeof options.tabCharOnTab === \"boolean\" &&\n options.tabCharOnTab === false\n )\n ) {\n output = this.addStringAt(output, \"\\t\", ...commonParams);\n } else if (\n (button === \"{enter}\" || button === \"{numpadenter}\") &&\n options.newLineOnEnter\n )\n output = this.addStringAt(output, \"\\n\", ...commonParams);\n else if (\n button.includes(\"numpad\") &&\n Number.isInteger(Number(button[button.length - 2]))\n ) {\n output = this.addStringAt(\n output,\n button[button.length - 2],\n ...commonParams\n );\n } else if (button === \"{numpaddivide}\")\n output = this.addStringAt(output, \"/\", ...commonParams);\n else if (button === \"{numpadmultiply}\")\n output = this.addStringAt(output, \"*\", ...commonParams);\n else if (button === \"{numpadsubtract}\")\n output = this.addStringAt(output, \"-\", ...commonParams);\n else if (button === \"{numpadadd}\")\n output = this.addStringAt(output, \"+\", ...commonParams);\n else if (button === \"{numpaddecimal}\")\n output = this.addStringAt(output, \".\", ...commonParams);\n else if (button === \"{\" || button === \"}\")\n output = this.addStringAt(output, button, ...commonParams);\n else if (!button.includes(\"{\") && !button.includes(\"}\"))\n output = this.addStringAt(output, button, ...commonParams);\n\n if(options.debug){\n console.log(\"Input will be: \"+ output);\n }\n\n return output;\n }\n\n /**\n * Moves the cursor position by a given amount\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPos(length: number, minus = false) {\n const newCaretPos = this.updateCaretPosAction(length, minus);\n\n this.dispatch((instance: any) => {\n instance.setCaretPosition(newCaretPos);\n });\n }\n\n /**\n * Action method of updateCaretPos\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPosAction(length: number, minus = false) {\n const options = this.getOptions();\n let caretPosition = this.getCaretPosition();\n\n if (caretPosition != null) {\n if (minus) {\n if (caretPosition > 0) caretPosition = caretPosition - length;\n } else {\n caretPosition = caretPosition + length;\n }\n }\n\n if (options.debug) {\n console.log(\"Caret at:\", caretPosition);\n }\n\n return caretPosition;\n }\n\n /**\n * Adds a string to the input at a given position\n *\n * @param {string} source The source input\n * @param {string} str The string to add\n * @param {number} position The (cursor) position where the string should be added\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n addStringAt(\n source: string,\n str: string,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n let output;\n\n if (!position && position !== 0) {\n output = source + str;\n } else {\n output = [source.slice(0, position), str, source.slice(positionEnd)].join(\n \"\"\n );\n\n /**\n * Avoid caret position change when maxLength is set\n */\n if (!this.isMaxLengthReached()) {\n if (moveCaret) this.updateCaretPos(str.length);\n }\n }\n\n return output;\n }\n\n /**\n * Check whether the button is a standard button\n */\n isStandardButton = (button: string) =>\n button && !(button[0] === \"{\" && button[button.length - 1] === \"}\");\n\n /**\n * Removes an amount of characters before a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n removeAt(\n source: string,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n if (position === 0 && positionEnd === 0) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n let prevTwoChars;\n let emojiMatched;\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n if (position && position >= 0) {\n prevTwoChars = source.substring(position - 2, position);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position - 2) + source.substr(position);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.substr(0, position - 1) + source.substr(position);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n } else {\n prevTwoChars = source.slice(-2);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.slice(0, -2);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.slice(0, -1);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch((instance: any) => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n\n /**\n * Removes an amount of characters after a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n */\n removeForwardsAt(\n source: string,\n position: number = source.length,\n positionEnd: number = source.length,\n moveCaret = false\n ) {\n if (!source?.length || position === null) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n const nextTwoChars = source.substring(position, position + 2);\n const emojiMatched = nextTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position) + source.substr(position + 2);\n } else {\n output = source.substr(0, position) + source.substr(position + 1);\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch((instance: any) => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n\n /**\n * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.\n *\n * @param {object} inputObj\n * @param {string} updatedInput\n */\n handleMaxLength(inputObj: KeyboardInput, updatedInput: string) {\n const options = this.getOptions();\n const maxLength = options.maxLength;\n const currentInput = inputObj[options.inputName || \"default\"];\n const condition = updatedInput.length - 1 >= maxLength;\n\n if (\n /**\n * If pressing this button won't add more characters\n * We exit out of this limiter function\n */\n updatedInput.length <= currentInput.length\n ) {\n return false;\n }\n\n if (Number.isInteger(maxLength)) {\n if (options.debug) {\n console.log(\"maxLength (num) reached:\", condition);\n }\n\n if (condition) {\n /**\n * @type {boolean} Boolean value that shows whether maxLength has been reached\n */\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n\n if (typeof maxLength === \"object\") {\n const condition =\n updatedInput.length - 1 >= maxLength[options.inputName || \"default\"];\n\n if (options.debug) {\n console.log(\"maxLength (obj) reached:\", condition);\n }\n\n if (condition) {\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n }\n\n /**\n * Gets the current value of maxLengthReached\n */\n isMaxLengthReached() {\n return Boolean(this.maxLengthReached);\n }\n\n /**\n * Determines whether a touch device is being used\n */\n isTouchDevice() {\n return \"ontouchstart\" in window || navigator.maxTouchPoints;\n }\n\n /**\n * Determines whether pointer events are supported\n */\n pointerEventsSupported() {\n return !!window.PointerEvent;\n }\n\n /**\n * Bind all methods in a given class\n */\n\n static bindMethods(myClass: any, instance: any) {\n // eslint-disable-next-line no-unused-vars\n for (const myMethod of Object.getOwnPropertyNames(myClass.prototype)) {\n const excludeMethod =\n myMethod === \"constructor\" || myMethod === \"bindMethods\";\n if (!excludeMethod) {\n instance[myMethod] = instance[myMethod].bind(instance);\n }\n }\n }\n\n /**\n * Transforms an arbitrary string to camelCase\n *\n * @param {string} str The string to transform.\n */\n camelCase(str: string): string {\n if (!str) return \"\";\n\n return str\n .toLowerCase()\n .trim()\n .split(/[.\\-_\\s]/g)\n .reduce((str, word) =>\n word.length ? str + word[0].toUpperCase() + word.slice(1) : str\n );\n }\n\n /**\n * Split array into chunks\n */\n chunkArray(arr: T[], size: number): T[][] {\n return [...Array(Math.ceil(arr.length / size))].map((_, i) =>\n arr.slice(size * i, size + size * i)\n );\n }\n\n /**\n * Escape regex input\n */\n escapeRegex(str: string) {\n return str.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n }\n\n /**\n * Calculate caret position offset when using rtl option\n */\n getRtlOffset(index: number, input: string) {\n let newIndex = index;\n const startMarkerIndex = input.indexOf(\"\\u202B\");\n const endMarkerIndex = input.indexOf(\"\\u202C\");\n\n if(startMarkerIndex < index && startMarkerIndex != -1){ newIndex--; }\n if(endMarkerIndex < index && startMarkerIndex != -1){ newIndex--; }\n\n return newIndex < 0 ? 0 : newIndex;\n }\n\n /**\n * Reusable empty function\n */\n static noop = () => {};\n}\n\nexport default Utilities;\n","import { KeyboardOptions, PhysicalKeyboardParams } from \"../interfaces\";\nimport Utilities from \"../services/Utilities\";\n\n/**\n * Physical Keyboard Service\n */\nclass PhysicalKeyboard {\n getOptions: () => KeyboardOptions;\n dispatch: any;\n\n /**\n * Creates an instance of the PhysicalKeyboard service\n */\n constructor({ dispatch, getOptions }: PhysicalKeyboardParams) {\n /**\n * @type {object} A simple-keyboard instance\n */\n this.dispatch = dispatch;\n this.getOptions = getOptions;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(PhysicalKeyboard, this);\n }\n\n handleHighlightKeyDown(e: KeyboardEvent) {\n const options = this.getOptions();\n\n if(options.physicalKeyboardHighlightPreventDefault && this.isModifierKey(e)){\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n const buttonPressed = this.getSimpleKeyboardLayoutKey(e);\n\n this.dispatch((instance: any) => {\n const standardButtonPressed = instance.getButtonElement(buttonPressed);\n const functionButtonPressed = instance.getButtonElement(\n `{${buttonPressed}}`\n );\n let buttonDOM;\n let buttonName: string;\n\n if (standardButtonPressed) {\n buttonDOM = standardButtonPressed;\n buttonName = buttonPressed;\n } else if (functionButtonPressed) {\n buttonDOM = functionButtonPressed;\n buttonName = `{${buttonPressed}}`;\n } else {\n return;\n }\n\n const applyButtonStyle = (buttonElement: HTMLElement) => {\n buttonElement.style.background =\n options.physicalKeyboardHighlightBgColor || \"#dadce4\";\n buttonElement.style.color =\n options.physicalKeyboardHighlightTextColor || \"black\";\n }\n\n if (buttonDOM) {\n if(Array.isArray(buttonDOM)){\n buttonDOM.forEach(buttonElement => applyButtonStyle(buttonElement));\n\n // Even though we have an array of buttons, we just want to press one of them\n if (options.physicalKeyboardHighlightPress) {\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM[0]?.onpointerdown?.(e);\n } else if (options.physicalKeyboardHighlightPressUseClick) {\n buttonDOM[0]?.click();\n } else {\n instance.handleButtonClicked(buttonName, e);\n }\n }\n } else {\n applyButtonStyle(buttonDOM);\n\n if (options.physicalKeyboardHighlightPress) {\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM?.onpointerdown?.(e);\n } else if (options.physicalKeyboardHighlightPressUseClick) {\n buttonDOM.click();\n } else {\n instance.handleButtonClicked(buttonName, e);\n }\n }\n }\n }\n });\n }\n\n handleHighlightKeyUp(e: KeyboardEvent) {\n const options = this.getOptions();\n\n if(options.physicalKeyboardHighlightPreventDefault && this.isModifierKey(e)){\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n \n const buttonPressed = this.getSimpleKeyboardLayoutKey(e);\n\n this.dispatch((instance: any) => {\n const buttonDOM =\n instance.getButtonElement(buttonPressed) ||\n instance.getButtonElement(`{${buttonPressed}}`);\n\n const applyButtonStyle = (buttonElement: HTMLElement) => {\n if(buttonElement.removeAttribute){\n buttonElement.removeAttribute(\"style\");\n }\n };\n\n if (buttonDOM) {\n if(Array.isArray(buttonDOM)){\n buttonDOM.forEach(buttonElement => applyButtonStyle(buttonElement));\n\n // Even though we have an array of buttons, we just want to press one of them\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM[0]?.onpointerup?.(e);\n }\n } else {\n applyButtonStyle(buttonDOM);\n\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM?.onpointerup?.(e);\n }\n }\n }\n });\n }\n\n /**\n * Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format\n * @param {object} e The KeyboardEvent\n */\n getSimpleKeyboardLayoutKey(e: KeyboardEvent) {\n let output = \"\";\n const keyId = e.code || e.key || this.keyCodeToKey(e?.keyCode);\n\n if (\n keyId?.includes(\"Numpad\") ||\n keyId?.includes(\"Shift\") ||\n keyId?.includes(\"Space\") ||\n keyId?.includes(\"Backspace\") ||\n keyId?.includes(\"Control\") ||\n keyId?.includes(\"Alt\") ||\n keyId?.includes(\"Meta\")\n ) {\n output = e.code || \"\";\n } else {\n output = e.key || this.keyCodeToKey(e?.keyCode) || \"\";\n }\n\n return output.length > 1 ? output?.toLowerCase() : output;\n }\n\n /**\n * Retrieve key from keyCode\n */\n keyCodeToKey(keyCode: number): string {\n return {\n 8: \"Backspace\",\n 9: \"Tab\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Ctrl\",\n 18: \"Alt\",\n 19: \"Pause\",\n 20: \"CapsLock\",\n 27: \"Esc\",\n 32: \"Space\",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 45: \"Insert\",\n 46: \"Delete\",\n 48: \"0\",\n 49: \"1\",\n 50: \"2\",\n 51: \"3\",\n 52: \"4\",\n 53: \"5\",\n 54: \"6\",\n 55: \"7\",\n 56: \"8\",\n 57: \"9\",\n 65: \"A\",\n 66: \"B\",\n 67: \"C\",\n 68: \"D\",\n 69: \"E\",\n 70: \"F\",\n 71: \"G\",\n 72: \"H\",\n 73: \"I\",\n 74: \"J\",\n 75: \"K\",\n 76: \"L\",\n 77: \"M\",\n 78: \"N\",\n 79: \"O\",\n 80: \"P\",\n 81: \"Q\",\n 82: \"R\",\n 83: \"S\",\n 84: \"T\",\n 85: \"U\",\n 86: \"V\",\n 87: \"W\",\n 88: \"X\",\n 89: \"Y\",\n 90: \"Z\",\n 91: \"Meta\",\n 96: \"Numpad0\",\n 97: \"Numpad1\",\n 98: \"Numpad2\",\n 99: \"Numpad3\",\n 100: \"Numpad4\",\n 101: \"Numpad5\",\n 102: \"Numpad6\",\n 103: \"Numpad7\",\n 104: \"Numpad8\",\n 105: \"Numpad9\",\n 106: \"NumpadMultiply\",\n 107: \"NumpadAdd\",\n 109: \"NumpadSubtract\",\n 110: \"NumpadDecimal\",\n 111: \"NumpadDivide\",\n 112: \"F1\",\n 113: \"F2\",\n 114: \"F3\",\n 115: \"F4\",\n 116: \"F5\",\n 117: \"F6\",\n 118: \"F7\",\n 119: \"F8\",\n 120: \"F9\",\n 121: \"F10\",\n 122: \"F11\",\n 123: \"F12\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\",\n }[keyCode] || \"\";\n }\n\n isModifierKey = (e: KeyboardEvent): boolean => {\n return (\n e.altKey\n || e.ctrlKey\n || e.shiftKey\n || [\"Tab\", \"CapsLock\", \"Esc\", \"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"].includes(\n e.code || e.key || this.keyCodeToKey(e?.keyCode)\n )\n )\n }\n}\n\nexport default PhysicalKeyboard;\n","import \"./css/CandidateBox.css\";\n\nimport Utilities from \"../services/Utilities\";\nimport {\n CandidateBoxParams,\n CandidateBoxRenderParams,\n CandidateBoxShowParams,\n KeyboardOptions,\n} from \"./../interfaces\";\n\nclass CandidateBox {\n utilities: Utilities;\n options: KeyboardOptions;\n candidateBoxElement!: HTMLDivElement;\n pageIndex = 0;\n pageSize: number;\n\n constructor({ utilities, options }: CandidateBoxParams) {\n this.utilities = utilities;\n this.options = options;\n Utilities.bindMethods(CandidateBox, this);\n this.pageSize = this.utilities.getOptions().layoutCandidatesPageSize || 5;\n }\n\n destroy() {\n if (this.candidateBoxElement) {\n this.candidateBoxElement.remove();\n this.pageIndex = 0;\n }\n }\n\n show({\n candidateValue,\n targetElement,\n onSelect,\n }: CandidateBoxShowParams): void {\n if (!candidateValue || !candidateValue.length) {\n return;\n }\n\n const candidateListPages = this.utilities.chunkArray(\n candidateValue.split(\" \"),\n this.pageSize\n );\n\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: this.pageIndex,\n nbPages: candidateListPages.length,\n onItemSelected: (selectedCandidate: string, e: MouseEvent) => {\n onSelect(selectedCandidate, e);\n this.destroy();\n },\n });\n }\n\n renderPage({\n candidateListPages,\n targetElement,\n pageIndex,\n nbPages,\n onItemSelected,\n }: CandidateBoxRenderParams) {\n // Remove current candidate box, if any\n this.candidateBoxElement?.remove();\n\n // Create candidate box element\n this.candidateBoxElement = document.createElement(\"div\");\n this.candidateBoxElement.className = \"hg-candidate-box\";\n\n // Candidate box list\n const candidateListULElement = document.createElement(\"ul\");\n candidateListULElement.className = \"hg-candidate-box-list\";\n\n // Create Candidate box list items\n candidateListPages[pageIndex].forEach((candidateListItem) => {\n const candidateListLIElement = document.createElement(\"li\");\n const getMouseEvent = () => {\n const mouseEvent = new (this.options.useTouchEvents ? TouchEvent : MouseEvent)(\"click\");\n Object.defineProperty(mouseEvent, \"target\", {\n value: candidateListLIElement,\n });\n return mouseEvent;\n };\n\n candidateListLIElement.className = \"hg-candidate-box-list-item\";\n candidateListLIElement.innerHTML = this.options.display?.[candidateListItem] || candidateListItem;\n\n if(this.options.useTouchEvents) {\n candidateListLIElement.ontouchstart = (e: any) =>\n onItemSelected(candidateListItem, e || getMouseEvent());\n } else {\n candidateListLIElement.onclick = (e = getMouseEvent() as MouseEvent) =>\n onItemSelected(candidateListItem, e);\n }\n\n // Append list item to ul\n candidateListULElement.appendChild(candidateListLIElement);\n });\n\n // Add previous button\n const isPrevBtnElementActive = pageIndex > 0;\n const prevBtnElement = document.createElement(\"div\");\n prevBtnElement.classList.add(\"hg-candidate-box-prev\");\n isPrevBtnElementActive &&\n prevBtnElement.classList.add(\"hg-candidate-box-btn-active\");\n\n const prevBtnElementClickAction = () => {\n if (!isPrevBtnElementActive) return;\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: pageIndex - 1,\n nbPages,\n onItemSelected,\n });\n };\n\n if(this.options.useTouchEvents) {\n prevBtnElement.ontouchstart = prevBtnElementClickAction;\n } else {\n prevBtnElement.onclick = prevBtnElementClickAction;\n }\n \n this.candidateBoxElement.appendChild(prevBtnElement);\n\n // Add elements to container\n this.candidateBoxElement.appendChild(candidateListULElement);\n\n // Add next button\n const isNextBtnElementActive = pageIndex < nbPages - 1;\n const nextBtnElement = document.createElement(\"div\");\n nextBtnElement.classList.add(\"hg-candidate-box-next\");\n isNextBtnElementActive &&\n nextBtnElement.classList.add(\"hg-candidate-box-btn-active\");\n\n const nextBtnElementClickAction = () => {\n if (!isNextBtnElementActive) return;\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: pageIndex + 1,\n nbPages,\n onItemSelected,\n });\n };\n\n if(this.options.useTouchEvents) {\n nextBtnElement.ontouchstart = nextBtnElementClickAction;\n } else {\n nextBtnElement.onclick = nextBtnElementClickAction;\n }\n\n this.candidateBoxElement.appendChild(nextBtnElement);\n\n // Append candidate box to target element\n targetElement.prepend(this.candidateBoxElement);\n }\n}\n\nexport default CandidateBox;\n","import \"./css/Keyboard.css\";\n\n// Services\nimport { getDefaultLayout } from \"../services/KeyboardLayout\";\nimport PhysicalKeyboard from \"../services/PhysicalKeyboard\";\nimport Utilities from \"../services/Utilities\";\nimport {\n KeyboardOptions,\n KeyboardInput,\n KeyboardButtonElements,\n KeyboardHandlerEvent,\n KeyboardElement,\n} from \"../interfaces\";\nimport CandidateBox from \"./CandidateBox\";\n\n/**\n * Root class for simple-keyboard.\n * This class:\n * - Parses the options\n * - Renders the rows and buttons\n * - Handles button functionality\n */\nclass SimpleKeyboard {\n input!: KeyboardInput;\n options!: KeyboardOptions;\n utilities!: Utilities;\n caretPosition!: number | null;\n caretPositionEnd!: number | null;\n keyboardDOM!: KeyboardElement;\n keyboardPluginClasses!: string;\n keyboardDOMClass!: string;\n buttonElements!: KeyboardButtonElements;\n currentInstanceName!: string;\n allKeyboardInstances!: { [key: string]: SimpleKeyboard };\n keyboardInstanceNames!: string[];\n isFirstKeyboardInstance!: boolean;\n physicalKeyboard!: PhysicalKeyboard;\n modules!: { [key: string]: any };\n activeButtonClass!: string;\n holdInteractionTimeout!: number;\n holdTimeout!: number;\n isMouseHold!: boolean;\n initialized!: boolean;\n candidateBox!: CandidateBox | null;\n keyboardRowsDOM!: KeyboardElement;\n defaultName = \"default\";\n activeInputElement: HTMLInputElement | HTMLTextAreaElement | null = null;\n\n /**\n * Creates an instance of SimpleKeyboard\n * @param {Array} params If first parameter is a string, it is considered the container class. The second parameter is then considered the options object. If first parameter is an object, it is considered the options object.\n */\n constructor(\n selectorOrOptions?: string | HTMLDivElement | KeyboardOptions,\n keyboardOptions?: KeyboardOptions\n ) {\n if (typeof window === \"undefined\") return;\n\n const {\n keyboardDOMClass,\n keyboardDOM,\n options = {},\n } = this.handleParams(selectorOrOptions, keyboardOptions);\n\n /**\n * Initializing Utilities\n */\n this.utilities = new Utilities({\n getOptions: this.getOptions,\n getCaretPosition: this.getCaretPosition,\n getCaretPositionEnd: this.getCaretPositionEnd,\n dispatch: this.dispatch,\n });\n\n /**\n * Caret position\n */\n this.caretPosition = null;\n\n /**\n * Caret position end\n */\n this.caretPositionEnd = null;\n\n /**\n * Processing options\n */\n this.keyboardDOM = keyboardDOM;\n\n /**\n * @type {object}\n * @property {object} layout Modify the keyboard layout.\n * @property {string} layoutName Specifies which layout should be used.\n * @property {object} display Replaces variable buttons (such as {bksp}) with a human-friendly name (e.g.: “backspace”).\n * @property {boolean} mergeDisplay By default, when you set the display property, you replace the default one. This setting merges them instead.\n * @property {string} theme A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space.\n * @property {array} buttonTheme A prop to add your own css classes to one or several buttons.\n * @property {array} buttonAttributes A prop to add your own attributes to one or several buttons.\n * @property {boolean} debug Runs a console.log every time a key is pressed. Displays the buttons pressed and the current input.\n * @property {boolean} newLineOnEnter Specifies whether clicking the “ENTER” button will input a newline (\\n) or not.\n * @property {boolean} tabCharOnTab Specifies whether clicking the “TAB” button will input a tab character (\\t) or not.\n * @property {string} inputName Allows you to use a single simple-keyboard instance for several inputs.\n * @property {number} maxLength Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {object} maxLength Restrains simple-keyboard’s individual inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {boolean} syncInstanceInputs When set to true, this option synchronizes the internal input of every simple-keyboard instance.\n * @property {boolean} physicalKeyboardHighlight Enable highlighting of keys pressed on physical keyboard.\n * @property {boolean} physicalKeyboardHighlightPress Presses keys highlighted by physicalKeyboardHighlight\n * @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.\n * @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have.\n * @property {boolean} physicalKeyboardHighlightPressUseClick Whether physicalKeyboardHighlightPress should use clicks to trigger buttons.\n * @property {boolean} physicalKeyboardHighlightPressUsePointerEvents Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.\n * @property {boolean} physicalKeyboardHighlightPreventDefault Whether physicalKeyboardHighlight should use preventDefault to disable default browser actions.\n * @property {boolean} preventMouseDownDefault Calling preventDefault for the mousedown events keeps the focus on the input.\n * @property {boolean} preventMouseUpDefault Calling preventDefault for the mouseup events.\n * @property {boolean} stopMouseDownPropagation Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.\n * @property {boolean} stopMouseUpPropagation Stops pointer up events on simple-keyboard buttons from bubbling to parent elements.\n * @property {function(button: string):string} onKeyPress Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”).\n * @property {function(input: string):string} onChange Executes the callback function on input change. Returns the current input’s string.\n * @property {function} onRender Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n * @property {function} onInit Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n * @property {function(inputs: object):object} onChangeAll Executes the callback function on input change. Returns the input object with all defined inputs.\n * @property {boolean} useButtonTag Render buttons as a button element instead of a div element.\n * @property {boolean} disableCaretPositioning A prop to ensure characters are always be added/removed at the end of the string.\n * @property {object} inputPattern Restrains input(s) change to the defined regular expression pattern.\n * @property {boolean} useTouchEvents Instructs simple-keyboard to use touch events instead of click events.\n * @property {boolean} autoUseTouchEvents Enable useTouchEvents automatically when touch device is detected.\n * @property {boolean} useMouseEvents Opt out of PointerEvents handling, falling back to the prior mouse event logic.\n * @property {function} destroy Clears keyboard listeners and DOM elements.\n * @property {boolean} disableButtonHold Disable button hold action.\n * @property {boolean} rtl Adds unicode right-to-left control characters to input return values.\n * @property {function} onKeyReleased Executes the callback function on key release.\n * @property {array} modules Module classes to be loaded by simple-keyboard.\n * @property {boolean} enableLayoutCandidates Enable input method editor candidate list support.\n * @property {object} excludeFromLayout Buttons to exclude from layout\n * @property {number} layoutCandidatesPageSize Determines size of layout candidate list\n * @property {boolean} layoutCandidatesCaseSensitiveMatch Determines whether layout candidate match should be case sensitive.\n * @property {boolean} disableCandidateNormalization Disables the automatic normalization for selected layout candidates\n * @property {boolean} enableLayoutCandidatesKeyPress Enables onKeyPress triggering for layoutCandidate items\n */\n this.options = {\n layoutName: \"default\",\n theme: \"hg-theme-default\",\n inputName: \"default\",\n preventMouseDownDefault: false,\n enableLayoutCandidates: true,\n excludeFromLayout: {},\n ...options,\n };\n\n /**\n * @type {object} Classes identifying loaded plugins\n */\n this.keyboardPluginClasses = \"\";\n\n /**\n * Bindings\n */\n Utilities.bindMethods(SimpleKeyboard, this);\n\n /**\n * simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).\n * This removes any dependency to input DOM elements. You can type and directly display the value in a div element, for example.\n * @example\n * // To get entered input\n * const input = keyboard.getInput();\n *\n * // To clear entered input.\n * keyboard.clearInput();\n *\n * @type {object}\n * @property {object} default Default SimpleKeyboard internal input.\n * @property {object} myInputName Example input that can be set through `options.inputName:\"myInputName\"`.\n */\n const { inputName = this.defaultName } = this.options;\n this.input = {};\n this.input[inputName] = \"\";\n\n /**\n * @type {string} DOM class of the keyboard wrapper, normally \"simple-keyboard\" by default.\n */\n this.keyboardDOMClass = keyboardDOMClass;\n\n /**\n * @type {object} Contains the DOM elements of every rendered button, the key being the button's layout name (e.g.: \"{enter}\").\n */\n this.buttonElements = {};\n\n /**\n * Simple-keyboard Instances\n * This enables multiple simple-keyboard support with easier management\n */\n if (!window[\"SimpleKeyboardInstances\"])\n window[\"SimpleKeyboardInstances\"] = {};\n\n this.currentInstanceName = this.utilities.camelCase(this.keyboardDOMClass);\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = this;\n\n /**\n * Instance vars\n */\n this.allKeyboardInstances = window[\"SimpleKeyboardInstances\"];\n this.keyboardInstanceNames = Object.keys(window[\"SimpleKeyboardInstances\"]);\n this.isFirstKeyboardInstance =\n this.keyboardInstanceNames[0] === this.currentInstanceName;\n\n /**\n * Physical Keyboard support\n */\n this.physicalKeyboard = new PhysicalKeyboard({\n dispatch: this.dispatch,\n getOptions: this.getOptions,\n });\n\n /**\n * Initializing CandidateBox\n */\n this.candidateBox = this.options.enableLayoutCandidates\n ? new CandidateBox({\n utilities: this.utilities,\n options: this.options,\n })\n : null;\n\n /**\n * Rendering keyboard\n */\n if (this.keyboardDOM) this.render();\n else {\n console.warn(`\".${keyboardDOMClass}\" was not found in the DOM.`);\n throw new Error(\"KEYBOARD_DOM_ERROR\");\n }\n\n /**\n * Modules\n */\n this.modules = {};\n this.loadModules();\n }\n\n /**\n * parseParams\n */\n handleParams = (\n selectorOrOptions?: string | HTMLDivElement | KeyboardOptions,\n keyboardOptions?: KeyboardOptions\n ): {\n keyboardDOMClass: string;\n keyboardDOM: KeyboardElement;\n options: Partial;\n } => {\n let keyboardDOMClass;\n let keyboardDOM;\n let options;\n\n /**\n * If first parameter is a string:\n * Consider it as an element's class\n */\n if (typeof selectorOrOptions === \"string\") {\n keyboardDOMClass = selectorOrOptions.split(\".\").join(\"\");\n keyboardDOM = document.querySelector(\n `.${keyboardDOMClass}`\n ) as KeyboardElement;\n options = keyboardOptions;\n\n /**\n * If first parameter is an KeyboardElement\n * Consider it as the keyboard DOM element\n */\n } else if (selectorOrOptions instanceof HTMLDivElement) {\n /**\n * This element must have a class, otherwise throw\n */\n if (!selectorOrOptions.className) {\n console.warn(\"Any DOM element passed as parameter must have a class.\");\n throw new Error(\"KEYBOARD_DOM_CLASS_ERROR\");\n }\n\n keyboardDOMClass = selectorOrOptions.className.split(\" \")[0];\n keyboardDOM = selectorOrOptions;\n options = keyboardOptions;\n\n /**\n * Otherwise, search for .simple-keyboard DOM element\n */\n } else {\n keyboardDOMClass = \"simple-keyboard\";\n keyboardDOM = document.querySelector(\n `.${keyboardDOMClass}`\n ) as KeyboardElement;\n options = selectorOrOptions;\n }\n\n return {\n keyboardDOMClass,\n keyboardDOM,\n options,\n };\n };\n\n /**\n * Getters\n */\n getOptions = (): KeyboardOptions => this.options;\n getCaretPosition = (): number | null => this.caretPosition;\n getCaretPositionEnd = (): number | null => this.caretPositionEnd;\n\n /**\n * Changes the internal caret position\n * @param {number} position The caret's start position\n * @param {number} positionEnd The caret's end position\n */\n setCaretPosition(position: number | null, endPosition = position): void {\n this.caretPosition = position;\n this.caretPositionEnd = endPosition;\n }\n\n /**\n * Retrieve the candidates for a given input\n * @param input The input string to check\n */\n getInputCandidates(\n input: string\n ): { candidateKey: string; candidateValue: string } | Record {\n const {\n layoutCandidates: layoutCandidatesObj,\n layoutCandidatesCaseSensitiveMatch,\n } = this.options;\n\n if (!layoutCandidatesObj || typeof layoutCandidatesObj !== \"object\") {\n return {};\n }\n\n const layoutCandidates = Object.keys(layoutCandidatesObj).filter(\n (layoutCandidate: string) => {\n const inputSubstr =\n input.substring(0, this.getCaretPositionEnd() || 0) || input;\n const regexp = new RegExp(\n `${this.utilities.escapeRegex(layoutCandidate)}$`,\n layoutCandidatesCaseSensitiveMatch ? \"g\" : \"gi\"\n );\n const matches = [...inputSubstr.matchAll(regexp)];\n return !!matches.length;\n }\n );\n\n if (layoutCandidates.length > 1) {\n const candidateKey = layoutCandidates.sort(\n (a, b) => b.length - a.length\n )[0];\n return {\n candidateKey,\n candidateValue: layoutCandidatesObj[candidateKey],\n };\n } else if (layoutCandidates.length) {\n const candidateKey = layoutCandidates[0];\n return {\n candidateKey,\n candidateValue: layoutCandidatesObj[candidateKey],\n };\n } else {\n return {};\n }\n }\n\n /**\n * Shows a suggestion box with a list of candidate words\n * @param candidates The chosen candidates string as defined in the layoutCandidates option\n * @param targetElement The element next to which the candidates box will be shown\n */\n showCandidatesBox(\n candidateKey: string,\n candidateValue: string,\n targetElement: KeyboardElement\n ): void {\n if (this.candidateBox) {\n this.candidateBox.show({\n candidateValue,\n targetElement,\n onSelect: (selectedCandidate: string, e: MouseEvent) => {\n const {\n layoutCandidatesCaseSensitiveMatch,\n disableCandidateNormalization,\n enableLayoutCandidatesKeyPress\n } = this.options;\n\n let candidateStr = selectedCandidate;\n\n if(!disableCandidateNormalization) {\n /**\n * Making sure that our suggestions are not composed characters\n */\n candidateStr = selectedCandidate.normalize(\"NFD\");\n }\n\n const currentInput = this.getInput(this.options.inputName, true);\n const initialCaretPosition = this.getCaretPositionEnd() || 0;\n const inputSubstr =\n currentInput.substring(0, initialCaretPosition || 0) ||\n currentInput;\n\n const regexp = new RegExp(\n `${this.utilities.escapeRegex(candidateKey)}$`,\n layoutCandidatesCaseSensitiveMatch ? \"g\" : \"gi\"\n );\n const newInputSubstr = inputSubstr.replace(\n regexp,\n candidateStr\n );\n const newInput = currentInput.replace(inputSubstr, newInputSubstr);\n\n const caretPositionDiff = newInputSubstr.length - inputSubstr.length;\n let newCaretPosition =\n (initialCaretPosition || currentInput.length) + caretPositionDiff;\n\n if (newCaretPosition < 0) newCaretPosition = 0;\n\n this.setInput(newInput, this.options.inputName, true);\n this.setCaretPosition(newCaretPosition);\n\n /**\n * Calling onKeyPress\n * We pass in the composed candidate instead of the decomposed one\n * To prevent confusion for users\n */\n if (enableLayoutCandidatesKeyPress && typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(selectedCandidate, e);\n\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(\n this.getInput(this.options.inputName, true),\n e\n );\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.getAllInputs(), e);\n },\n });\n }\n }\n\n /**\n * Handles clicks made to keyboard buttons\n * @param {string} button The button's layout name.\n */\n handleButtonClicked(button: string, e?: KeyboardHandlerEvent): void {\n const { inputName = this.defaultName, debug } = this.options;\n /**\n * Ignoring placeholder buttons\n */\n if (button === \"{//}\") return;\n\n /**\n * Creating inputName if it doesn't exist\n */\n if (!this.input[inputName]) this.input[inputName] = \"\";\n\n /**\n * Calculating new input\n */\n const updatedInput = this.utilities.getUpdatedInput(\n button,\n this.input[inputName],\n this.caretPosition,\n this.caretPositionEnd\n );\n\n /**\n * EDGE CASE: Check for whole input selection changes that will yield same updatedInput\n */\n if (this.utilities.isStandardButton(button) && this.activeInputElement) {\n const isEntireInputSelection =\n this.input[inputName] &&\n this.input[inputName] === updatedInput &&\n this.caretPosition === 0 &&\n this.caretPositionEnd === updatedInput.length;\n\n if (isEntireInputSelection) {\n this.setInput(\"\", this.options.inputName, true);\n this.setCaretPosition(0);\n this.activeInputElement.value = \"\";\n this.activeInputElement.setSelectionRange(0, 0);\n this.handleButtonClicked(button, e);\n return;\n }\n }\n\n /**\n * Calling onKeyPress\n */\n if (typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(button, e);\n\n if (\n // If input will change as a result of this button press\n this.input[inputName] !== updatedInput &&\n // This pertains to the \"inputPattern\" option:\n // If inputPattern isn't set\n (!this.options.inputPattern ||\n // Or, if it is set and if the pattern is valid - we proceed.\n (this.options.inputPattern && this.inputPatternIsValid(updatedInput)))\n ) {\n /**\n * If maxLength and handleMaxLength yield true, halting\n */\n if (\n this.options.maxLength &&\n this.utilities.handleMaxLength(this.input, updatedInput)\n ) {\n return;\n }\n\n /**\n * Updating input\n */\n const newInputValue = this.utilities.getUpdatedInput(\n button,\n this.input[inputName],\n this.caretPosition,\n this.caretPositionEnd,\n true\n );\n\n this.setInput(newInputValue, this.options.inputName, true);\n\n if (debug) console.log(\"Input changed:\", this.getAllInputs());\n\n if (this.options.debug) {\n console.log(\n \"Caret at: \",\n this.getCaretPosition(),\n this.getCaretPositionEnd(),\n `(${this.keyboardDOMClass})`,\n e?.type\n );\n }\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n\n /**\n * Calling onChange\n */\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(this.getInput(this.options.inputName, true), e);\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.getAllInputs(), e);\n\n /**\n * Check if this new input has candidates (suggested words)\n */\n if (e?.target && this.options.enableLayoutCandidates) {\n const { candidateKey, candidateValue } =\n this.getInputCandidates(updatedInput);\n\n if (candidateKey && candidateValue) {\n this.showCandidatesBox(\n candidateKey,\n candidateValue,\n this.keyboardDOM\n );\n } else {\n this.candidateBox?.destroy();\n }\n }\n }\n\n /**\n * After a button is clicked the selection (if any) will disappear\n * we should reflect this in our state, as applicable\n */\n if(this.caretPositionEnd && this.caretPosition !== this.caretPositionEnd){\n this.setCaretPosition(this.caretPositionEnd, this.caretPositionEnd);\n\n if(this.activeInputElement){\n this.activeInputElement.setSelectionRange(this.caretPositionEnd, this.caretPositionEnd);\n }\n \n if(this.options.debug){\n console.log(\"Caret position aligned\", this.caretPosition);\n }\n }\n\n if (debug) {\n console.log(\"Key pressed:\", button);\n }\n }\n\n /**\n * Get mouse hold state\n */\n getMouseHold() {\n return this.isMouseHold;\n }\n\n /**\n * Mark mouse hold state as set\n */\n setMouseHold(value: boolean) {\n if (this.options.syncInstanceInputs) {\n this.dispatch((instance: SimpleKeyboard) => {\n instance.isMouseHold = value;\n });\n } else {\n this.isMouseHold = value;\n }\n }\n\n /**\n * Handles button mousedown\n */\n /* istanbul ignore next */\n handleButtonMouseDown(button: string, e: KeyboardHandlerEvent): void {\n if (e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n if (this.options.stopMouseDownPropagation) e.stopPropagation();\n\n /**\n * Add active class\n */\n e.target.classList.add(this.activeButtonClass);\n }\n\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n if (this.holdTimeout) clearTimeout(this.holdTimeout);\n\n /**\n * @type {boolean} Whether the mouse is being held onKeyPress\n */\n this.setMouseHold(true);\n\n /**\n * @type {object} Time to wait until a key hold is detected\n */\n if (!this.options.disableButtonHold) {\n this.holdTimeout = window.setTimeout(() => {\n if (\n (this.getMouseHold() &&\n // TODO: This needs to be configurable through options\n ((!button.includes(\"{\") && !button.includes(\"}\")) ||\n button === \"{delete}\" ||\n button === \"{backspace}\" ||\n button === \"{bksp}\" ||\n button === \"{space}\" ||\n button === \"{tab}\")) ||\n button === \"{arrowright}\" ||\n button === \"{arrowleft}\" ||\n button === \"{arrowup}\" ||\n button === \"{arrowdown}\"\n ) {\n if (this.options.debug) console.log(\"Button held:\", button);\n\n this.handleButtonHold(button);\n }\n clearTimeout(this.holdTimeout);\n }, 500);\n }\n }\n\n /**\n * Handles button mouseup\n */\n handleButtonMouseUp(button?: string, e?: KeyboardHandlerEvent): void {\n if (e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseUpDefault && e.preventDefault)\n e.preventDefault();\n if (this.options.stopMouseUpPropagation && e.stopPropagation)\n e.stopPropagation();\n\n /* istanbul ignore next */\n const isKeyboard =\n e.target === this.keyboardDOM ||\n (e.target && this.keyboardDOM.contains(e.target)) ||\n (this.candidateBox &&\n this.candidateBox.candidateBoxElement &&\n (e.target === this.candidateBox.candidateBoxElement ||\n (e.target &&\n this.candidateBox.candidateBoxElement.contains(e.target))));\n\n /**\n * On click outside, remove candidateBox\n */\n if (!isKeyboard && this.candidateBox) {\n this.candidateBox.destroy();\n }\n }\n\n /**\n * Remove active class\n */\n this.recurseButtons((buttonElement: Element) => {\n buttonElement.classList.remove(this.activeButtonClass);\n });\n\n this.setMouseHold(false);\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * Calling onKeyReleased\n */\n if (button && typeof this.options.onKeyReleased === \"function\")\n this.options.onKeyReleased(button, e);\n }\n\n /**\n * Handles container mousedown\n */\n handleKeyboardContainerMouseDown(e: KeyboardHandlerEvent): void {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n }\n\n /**\n * Handles button hold\n */\n /* istanbul ignore next */\n handleButtonHold(button: string): void {\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * @type {object} Timeout dictating the speed of key hold iterations\n */\n this.holdInteractionTimeout = window.setTimeout(() => {\n if (this.getMouseHold()) {\n this.handleButtonClicked(button);\n this.handleButtonHold(button);\n } else {\n clearTimeout(this.holdInteractionTimeout);\n }\n }, 100);\n }\n\n /**\n * Send a command to all simple-keyboard instances (if you have several instances).\n */\n syncInstanceInputs(): void {\n this.dispatch((instance: SimpleKeyboard) => {\n instance.replaceInput(this.input);\n instance.setCaretPosition(this.caretPosition, this.caretPositionEnd);\n });\n }\n\n /**\n * Clear the keyboard’s input.\n * @param {string} [inputName] optional - the internal input to select\n */\n clearInput(\n inputName: string = this.options.inputName || this.defaultName\n ): void {\n this.input[inputName] = \"\";\n\n /**\n * Reset caretPosition\n */\n this.setCaretPosition(0);\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Get the keyboard’s input (You can also get it from the onChange prop).\n * @param {string} [inputName] optional - the internal input to select\n */\n getInput(\n inputName: string = this.options.inputName || this.defaultName,\n skipSync = false\n ): string {\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs && !skipSync) this.syncInstanceInputs();\n\n if (this.options.rtl) {\n // Remove existing control chars\n const inputWithoutRTLControl = this.input[inputName]\n .replace(\"\\u202B\", \"\")\n .replace(\"\\u202C\", \"\");\n\n return \"\\u202B\" + inputWithoutRTLControl + \"\\u202C\";\n } else {\n return this.input[inputName];\n }\n }\n\n /**\n * Get all simple-keyboard inputs\n */\n getAllInputs(): KeyboardInput {\n const output = {};\n const inputNames = Object.keys(this.input);\n\n inputNames.forEach((inputName) => {\n output[inputName] = this.getInput(inputName, true);\n });\n\n return output;\n }\n\n /**\n * Set the keyboard’s input.\n * @param {string} input the input value\n * @param {string} inputName optional - the internal input to select\n */\n setInput(\n input: string,\n inputName: string = this.options.inputName || this.defaultName,\n skipSync?: boolean\n ): void {\n this.input[inputName] = input;\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (!skipSync && this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Replace the input object (`keyboard.input`)\n * @param {object} inputObj The input object\n */\n replaceInput(inputObj: KeyboardInput): void {\n this.input = inputObj;\n }\n\n /**\n * Set new option or modify existing ones after initialization.\n * @param {object} options The options to set\n */\n setOptions(options = {}): void {\n const changedOptions = this.changedOptions(options);\n this.options = Object.assign(this.options, options);\n\n if (changedOptions.length) {\n if (this.options.debug) {\n console.log(\"changedOptions\", changedOptions);\n }\n\n /**\n * Some option changes require adjustments before re-render\n */\n this.onSetOptions(changedOptions);\n\n /**\n * Rendering\n */\n this.render();\n }\n }\n\n /**\n * Detecting changes to non-function options\n * This allows us to ascertain whether a button re-render is needed\n */\n changedOptions(newOptions: Partial): string[] {\n return Object.keys(newOptions).filter(\n (optionName) =>\n JSON.stringify(newOptions[optionName]) !==\n JSON.stringify(this.options[optionName])\n );\n }\n\n /**\n * Executing actions depending on changed options\n * @param {object} options The options to set\n */\n onSetOptions(changedOptions: string[] = []): void {\n /**\n * Changed: layoutName\n */\n if (changedOptions.includes(\"layoutName\")) {\n /**\n * Reset candidateBox\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n }\n }\n\n /**\n * Changed: layoutCandidatesPageSize, layoutCandidates\n */\n if (\n changedOptions.includes(\"layoutCandidatesPageSize\") ||\n changedOptions.includes(\"layoutCandidates\")\n ) {\n /**\n * Reset and recreate candidateBox\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n this.candidateBox = new CandidateBox({\n utilities: this.utilities,\n options: this.options,\n });\n }\n }\n }\n\n /**\n * Remove all keyboard rows and reset keyboard values.\n * Used internally between re-renders.\n */\n resetRows(): void {\n if (this.keyboardRowsDOM) {\n this.keyboardRowsDOM.remove();\n }\n\n this.keyboardDOM.className = this.keyboardDOMClass;\n this.keyboardDOM.setAttribute(\"data-skInstance\", this.currentInstanceName);\n this.buttonElements = {};\n }\n\n /**\n * Send a command to all simple-keyboard instances at once (if you have multiple instances).\n * @param {function(instance: object, key: string)} callback Function to run on every instance\n */\n // eslint-disable-next-line no-unused-vars\n dispatch(callback: (instance: SimpleKeyboard, key?: string) => void): void {\n if (!window[\"SimpleKeyboardInstances\"]) {\n console.warn(\n `SimpleKeyboardInstances is not defined. Dispatch cannot be called.`\n );\n throw new Error(\"INSTANCES_VAR_ERROR\");\n }\n\n return Object.keys(window[\"SimpleKeyboardInstances\"]).forEach((key) => {\n callback(window[\"SimpleKeyboardInstances\"][key], key);\n });\n }\n\n /**\n * Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n addButtonTheme(buttons: string, className: string): void {\n if (!className || !buttons) return;\n\n buttons.split(\" \").forEach((button) => {\n className.split(\" \").forEach((classNameItem) => {\n if (!this.options.buttonTheme) this.options.buttonTheme = [];\n\n let classNameFound = false;\n\n /**\n * If class is already defined, we add button to class definition\n */\n this.options.buttonTheme.map((buttonTheme) => {\n if (buttonTheme?.class.split(\" \").includes(classNameItem)) {\n classNameFound = true;\n\n const buttonThemeArray = buttonTheme.buttons.split(\" \");\n if (!buttonThemeArray.includes(button)) {\n classNameFound = true;\n buttonThemeArray.push(button);\n buttonTheme.buttons = buttonThemeArray.join(\" \");\n }\n }\n return buttonTheme;\n });\n\n /**\n * If class is not defined, we create a new entry\n */\n if (!classNameFound) {\n this.options.buttonTheme.push({\n class: classNameItem,\n buttons: buttons,\n });\n }\n });\n });\n\n this.render();\n }\n\n /**\n * Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n removeButtonTheme(buttons: string, className: string): void {\n /**\n * When called with empty parameters, remove all button themes\n */\n if (!buttons && !className) {\n this.options.buttonTheme = [];\n this.render();\n return;\n }\n\n /**\n * If buttons are passed and buttonTheme has items\n */\n if (\n buttons &&\n Array.isArray(this.options.buttonTheme) &&\n this.options.buttonTheme.length\n ) {\n const buttonArray = buttons.split(\" \");\n buttonArray.forEach((button) => {\n this.options?.buttonTheme?.map((buttonTheme, index) => {\n /**\n * If className is set, we affect the buttons only for that class\n * Otherwise, we afect all classes\n */\n if (\n (buttonTheme &&\n className &&\n className.includes(buttonTheme.class)) ||\n !className\n ) {\n const filteredButtonArray = buttonTheme?.buttons\n .split(\" \")\n .filter((item) => item !== button);\n\n /**\n * If buttons left, return them, otherwise, remove button Theme\n */\n if (buttonTheme && filteredButtonArray?.length) {\n buttonTheme.buttons = filteredButtonArray.join(\" \");\n } else {\n this.options.buttonTheme?.splice(index, 1);\n buttonTheme = null;\n }\n }\n\n return buttonTheme;\n });\n });\n\n this.render();\n }\n }\n\n /**\n * Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned.\n * @param {string} button The button layout name to select\n */\n getButtonElement(\n button: string\n ): KeyboardElement | KeyboardElement[] | undefined {\n let output;\n\n const buttonArr = this.buttonElements[button];\n if (buttonArr) {\n if (buttonArr.length > 1) {\n output = buttonArr;\n } else {\n output = buttonArr[0];\n }\n }\n\n return output;\n }\n\n /**\n * This handles the \"inputPattern\" option\n * by checking if the provided inputPattern passes\n */\n inputPatternIsValid(inputVal: string): boolean {\n const inputPatternRaw = this.options.inputPattern;\n let inputPattern;\n\n /**\n * Check if input pattern is global or targeted to individual inputs\n */\n if (inputPatternRaw instanceof RegExp) {\n inputPattern = inputPatternRaw;\n } else {\n inputPattern =\n inputPatternRaw[this.options.inputName || this.defaultName];\n }\n\n if (inputPattern && inputVal) {\n const didInputMatch = inputPattern.test(inputVal);\n\n if (this.options.debug) {\n console.log(\n `inputPattern (\"${inputPattern}\"): ${\n didInputMatch ? \"passed\" : \"did not pass!\"\n }`\n );\n }\n\n return didInputMatch;\n } else {\n /**\n * inputPattern doesn't seem to be set for the current input, or input is empty. Pass.\n */\n return true;\n }\n }\n\n /**\n * Handles simple-keyboard event listeners\n */\n setEventListeners(): void {\n /**\n * Only first instance should set the event listeners\n */\n if (this.isFirstKeyboardInstance || !this.allKeyboardInstances) {\n if (this.options.debug) {\n console.log(`Caret handling started (${this.keyboardDOMClass})`);\n }\n\n const { physicalKeyboardHighlightPreventDefault = false } = this.options;\n\n /**\n * Event Listeners\n */\n document.addEventListener(\"keyup\", this.handleKeyUp, physicalKeyboardHighlightPreventDefault);\n document.addEventListener(\"keydown\", this.handleKeyDown, physicalKeyboardHighlightPreventDefault);\n document.addEventListener(\"mouseup\", this.handleMouseUp);\n document.addEventListener(\"touchend\", this.handleTouchEnd);\n document.addEventListener(\"selectionchange\", this.handleSelectionChange);\n document.addEventListener(\"select\", this.handleSelect);\n }\n }\n\n /**\n * Event Handler: KeyUp\n */\n handleKeyUp(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyUp(event);\n }\n }\n\n /**\n * Event Handler: KeyDown\n */\n handleKeyDown(event: KeyboardHandlerEvent): void {\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyDown(event);\n }\n }\n\n /**\n * Event Handler: MouseUp\n */\n handleMouseUp(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: TouchEnd\n */\n /* istanbul ignore next */\n handleTouchEnd(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: Select\n */\n /* istanbul ignore next */\n handleSelect(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: SelectionChange\n */\n /* istanbul ignore next */\n handleSelectionChange(event: KeyboardHandlerEvent): void {\n /**\n * Firefox is not reporting the correct caret position through this event\n * https://github.com/hodgef/simple-keyboard/issues/1839\n */\n if(navigator.userAgent.includes('Firefox')){\n return;\n }\n this.caretEventHandler(event);\n }\n\n /**\n * Called by {@link setEventListeners} when an event that warrants a cursor position update is triggered\n */\n caretEventHandler(event: KeyboardHandlerEvent): void {\n let targetTagName: string;\n if (event.target.tagName) {\n targetTagName = event.target.tagName.toLowerCase();\n }\n\n this.dispatch((instance) => {\n let isKeyboard =\n event.target === instance.keyboardDOM ||\n (event.target && instance.keyboardDOM.contains(event.target));\n\n /**\n * If syncInstanceInputs option is enabled, make isKeyboard match any instance\n * not just the current one\n */\n if (this.options.syncInstanceInputs && Array.isArray(event.path)) {\n isKeyboard = event.path.some((item: HTMLElement) =>\n item?.hasAttribute?.(\"data-skInstance\")\n );\n }\n\n if (\n (targetTagName === \"textarea\" ||\n (targetTagName === \"input\" &&\n [\"text\", \"search\", \"url\", \"tel\", \"password\"].includes(\n event.target.type\n ))) &&\n !instance.options.disableCaretPositioning\n ) {\n /**\n * Tracks current cursor position\n * As keys are pressed, text will be added/removed at that position within the input.\n */\n let selectionStart = event.target.selectionStart;\n let selectionEnd = event.target.selectionEnd;\n\n if(instance.options.rtl){\n selectionStart = instance.utilities.getRtlOffset(selectionStart, instance.getInput());\n selectionEnd = instance.utilities.getRtlOffset(selectionEnd, instance.getInput());\n }\n\n instance.setCaretPosition(selectionStart, selectionEnd);\n\n /**\n * Tracking current input in order to handle caret positioning edge cases\n */\n this.activeInputElement = event.target;\n\n if (instance.options.debug) {\n console.log(\n \"Caret at: \",\n instance.getCaretPosition(),\n instance.getCaretPositionEnd(),\n event && event.target.tagName.toLowerCase(),\n `(${instance.keyboardDOMClass})`,\n event?.type\n );\n }\n } else if (\n (instance.options.disableCaretPositioning || !isKeyboard) &&\n event?.type !== \"selectionchange\"\n ) {\n /**\n * If we toggled off disableCaretPositioning, we must ensure caretPosition doesn't persist once reactivated.\n */\n instance.setCaretPosition(null);\n\n /**\n * Resetting activeInputElement\n */\n this.activeInputElement = null;\n\n if (instance.options.debug) {\n console.log(\n `Caret position reset due to \"${event?.type}\" event`,\n event\n );\n }\n }\n });\n }\n\n /**\n * Execute an operation on each button\n */\n recurseButtons(fn: any): void {\n if (!fn) return;\n\n Object.keys(this.buttonElements).forEach((buttonName) =>\n this.buttonElements[buttonName].forEach(fn)\n );\n }\n\n /**\n * Destroy keyboard listeners and DOM elements\n */\n destroy(): void {\n if (this.options.debug)\n console.log(\n `Destroying simple-keyboard instance: ${this.currentInstanceName}`\n );\n\n const { physicalKeyboardHighlightPreventDefault = false } = this.options;\n\n /**\n * Remove document listeners\n */\n document.removeEventListener(\"keyup\", this.handleKeyUp, physicalKeyboardHighlightPreventDefault);\n document.removeEventListener(\"keydown\", this.handleKeyDown, physicalKeyboardHighlightPreventDefault);\n document.removeEventListener(\"mouseup\", this.handleMouseUp);\n document.removeEventListener(\"touchend\", this.handleTouchEnd);\n document.removeEventListener(\"select\", this.handleSelect);\n document.removeEventListener(\"selectionchange\", this.handleSelectionChange);\n document.onpointerup = null;\n document.ontouchend = null;\n document.ontouchcancel = null;\n document.onmouseup = null;\n\n /**\n * Remove buttons\n */\n const deleteButton = (buttonElement: KeyboardElement | null) => {\n if (buttonElement) {\n buttonElement.onpointerdown = null;\n buttonElement.onpointerup = null;\n buttonElement.onpointercancel = null;\n buttonElement.ontouchstart = null;\n buttonElement.ontouchend = null;\n buttonElement.ontouchcancel = null;\n buttonElement.onclick = null;\n buttonElement.onmousedown = null;\n buttonElement.onmouseup = null;\n\n buttonElement.remove();\n buttonElement = null;\n }\n };\n\n this.recurseButtons(deleteButton);\n\n /**\n * Remove wrapper events\n */\n this.keyboardDOM.onpointerdown = null;\n this.keyboardDOM.ontouchstart = null;\n this.keyboardDOM.onmousedown = null;\n\n /**\n * Clearing keyboard rows\n */\n this.resetRows();\n\n /**\n * Candidate box\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n this.candidateBox = null;\n }\n\n /**\n * Clearing activeInputElement\n */\n this.activeInputElement = null;\n\n /**\n * Removing instance attribute\n */\n this.keyboardDOM.removeAttribute(\"data-skInstance\");\n\n /**\n * Clearing keyboardDOM\n */\n this.keyboardDOM.innerHTML = \"\";\n\n /**\n * Remove instance\n */\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = null;\n delete window[\"SimpleKeyboardInstances\"][this.currentInstanceName];\n\n /**\n * Reset initialized flag\n */\n this.initialized = false;\n }\n\n /**\n * Process buttonTheme option\n */\n getButtonThemeClasses(button: string): string[] {\n const buttonTheme = this.options.buttonTheme;\n let buttonClasses: string[] = [];\n\n if (Array.isArray(buttonTheme)) {\n buttonTheme.forEach((themeObj) => {\n if (\n themeObj &&\n themeObj.class &&\n typeof themeObj.class === \"string\" &&\n themeObj.buttons &&\n typeof themeObj.buttons === \"string\"\n ) {\n const themeObjClasses = themeObj.class.split(\" \");\n const themeObjButtons = themeObj.buttons.split(\" \");\n\n if (themeObjButtons.includes(button)) {\n buttonClasses = [...buttonClasses, ...themeObjClasses];\n }\n } else {\n console.warn(\n `Incorrect \"buttonTheme\". Please check the documentation.`,\n themeObj\n );\n }\n });\n }\n\n return buttonClasses;\n }\n\n /**\n * Process buttonAttributes option\n */\n setDOMButtonAttributes(button: string, callback: any): void {\n const buttonAttributes = this.options.buttonAttributes;\n\n if (Array.isArray(buttonAttributes)) {\n buttonAttributes.forEach((attrObj) => {\n if (\n attrObj.attribute &&\n typeof attrObj.attribute === \"string\" &&\n attrObj.value &&\n typeof attrObj.value === \"string\" &&\n attrObj.buttons &&\n typeof attrObj.buttons === \"string\"\n ) {\n const attrObjButtons = attrObj.buttons.split(\" \");\n\n if (attrObjButtons.includes(button)) {\n callback(attrObj.attribute, attrObj.value);\n }\n } else {\n console.warn(\n `Incorrect \"buttonAttributes\". Please check the documentation.`,\n attrObj\n );\n }\n });\n }\n }\n\n onTouchDeviceDetected() {\n /**\n * Processing autoTouchEvents\n */\n this.processAutoTouchEvents();\n\n /**\n * Disabling contextual window on touch devices\n */\n this.disableContextualWindow();\n }\n\n /**\n * Disabling contextual window for hg-button\n */\n /* istanbul ignore next */\n disableContextualWindow() {\n window.oncontextmenu = (event: KeyboardHandlerEvent) => {\n if (event.target.classList.contains(\"hg-button\")) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n };\n }\n\n /**\n * Process autoTouchEvents option\n */\n processAutoTouchEvents() {\n if (this.options.autoUseTouchEvents) {\n this.options.useTouchEvents = true;\n\n if (this.options.debug) {\n console.log(\n `autoUseTouchEvents: Touch device detected, useTouchEvents enabled.`\n );\n }\n }\n }\n\n /**\n * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n */\n onInit() {\n if (this.options.debug) {\n console.log(`${this.keyboardDOMClass} Initialized`);\n }\n\n /**\n * setEventListeners\n */\n this.setEventListeners();\n\n if (typeof this.options.onInit === \"function\") this.options.onInit(this);\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeFirstRender() {\n /**\n * Performing actions when touch device detected\n */\n if (this.utilities.isTouchDevice()) {\n this.onTouchDeviceDetected();\n }\n\n if (typeof this.options.beforeFirstRender === \"function\")\n this.options.beforeFirstRender(this);\n\n /**\n * Notify about PointerEvents usage\n */\n if (\n this.isFirstKeyboardInstance &&\n this.utilities.pointerEventsSupported() &&\n !this.options.useTouchEvents &&\n !this.options.useMouseEvents\n ) {\n if (this.options.debug) {\n console.log(\"Using PointerEvents as it is supported by this browser\");\n }\n }\n\n /**\n * Notify about touch events usage\n */\n if (this.options.useTouchEvents) {\n if (this.options.debug) {\n console.log(\n \"useTouchEvents has been enabled. Only touch events will be used.\"\n );\n }\n }\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeRender() {\n if (typeof this.options.beforeRender === \"function\")\n this.options.beforeRender(this);\n }\n\n /**\n * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n */\n onRender() {\n if (typeof this.options.onRender === \"function\")\n this.options.onRender(this);\n }\n\n /**\n * Executes the callback function once all modules have been loaded\n */\n onModulesLoaded() {\n if (typeof this.options.onModulesLoaded === \"function\")\n this.options.onModulesLoaded(this);\n }\n\n /**\n * Register module\n */\n registerModule = (name: string, initCallback: any) => {\n if (!this.modules[name]) this.modules[name] = {};\n\n initCallback(this.modules[name]);\n };\n\n /**\n * Load modules\n */\n loadModules() {\n if (Array.isArray(this.options.modules)) {\n this.options.modules.forEach((KeyboardModule) => {\n const keyboardModule = new KeyboardModule(this);\n keyboardModule.init && keyboardModule.init(this);\n });\n\n this.keyboardPluginClasses = \"modules-loaded\";\n\n this.render();\n this.onModulesLoaded();\n }\n }\n\n /**\n * Get module prop\n */\n getModuleProp(name: string, prop: string) {\n if (!this.modules[name]) return false;\n\n return this.modules[name][prop];\n }\n\n /**\n * getModulesList\n */\n getModulesList() {\n return Object.keys(this.modules);\n }\n\n /**\n * Parse Row DOM containers\n */\n parseRowDOMContainers(\n rowDOM: HTMLDivElement,\n rowIndex: number,\n containerStartIndexes: number[],\n containerEndIndexes: number[]\n ) {\n const rowDOMArray = Array.from(rowDOM.children);\n let removedElements = 0;\n\n if (rowDOMArray.length) {\n containerStartIndexes.forEach((startIndex, arrIndex) => {\n const endIndex = containerEndIndexes[arrIndex];\n\n /**\n * If there exists a respective end index\n * if end index comes after start index\n */\n if (!endIndex || !(endIndex > startIndex)) {\n return false;\n }\n\n /**\n * Updated startIndex, endIndex\n * This is since the removal of buttons to place a single button container\n * results in a modified array size\n */\n const updated_startIndex = startIndex - removedElements;\n const updated_endIndex = endIndex - removedElements;\n\n /**\n * Create button container\n */\n const containerDOM = document.createElement(\"div\");\n containerDOM.className += \"hg-button-container\";\n const containerUID = `${this.options.layoutName}-r${rowIndex}c${arrIndex}`;\n containerDOM.setAttribute(\"data-skUID\", containerUID);\n\n /**\n * Taking elements due to be inserted into container\n */\n const containedElements = rowDOMArray.splice(\n updated_startIndex,\n updated_endIndex - updated_startIndex + 1\n );\n removedElements = updated_endIndex - updated_startIndex;\n\n /**\n * Inserting elements to container\n */\n containedElements.forEach((element) =>\n containerDOM.appendChild(element)\n );\n\n /**\n * Adding container at correct position within rowDOMArray\n */\n rowDOMArray.splice(updated_startIndex, 0, containerDOM);\n\n /**\n * Clearing old rowDOM children structure\n */\n rowDOM.innerHTML = \"\";\n\n /**\n * Appending rowDOM new children list\n */\n rowDOMArray.forEach((element) => rowDOM.appendChild(element));\n\n if (this.options.debug) {\n console.log(\n \"rowDOMContainer\",\n containedElements,\n updated_startIndex,\n updated_endIndex,\n removedElements + 1\n );\n }\n });\n }\n\n return rowDOM;\n }\n\n /**\n * getKeyboardClassString\n */\n getKeyboardClassString = (...baseDOMClasses: any[]) => {\n const keyboardClasses = [this.keyboardDOMClass, ...baseDOMClasses].filter(\n (DOMClass) => !!DOMClass\n );\n\n return keyboardClasses.join(\" \");\n };\n\n /**\n * Renders rows and buttons as per options\n */\n render() {\n /**\n * Clear keyboard\n */\n this.resetRows();\n\n /**\n * Calling beforeFirstRender\n */\n if (!this.initialized) {\n this.beforeFirstRender();\n }\n\n /**\n * Calling beforeRender\n */\n this.beforeRender();\n\n const layoutClass = `hg-layout-${this.options.layoutName}`;\n const layout = this.options.layout || getDefaultLayout();\n const useTouchEvents = this.options.useTouchEvents || false;\n const useTouchEventsClass = useTouchEvents ? \"hg-touch-events\" : \"\";\n const useMouseEvents = this.options.useMouseEvents || false;\n const disableRowButtonContainers = this.options.disableRowButtonContainers;\n\n /**\n * Adding themeClass, layoutClass to keyboardDOM\n */\n this.keyboardDOM.className = this.getKeyboardClassString(\n this.options.theme,\n layoutClass,\n this.keyboardPluginClasses,\n useTouchEventsClass\n );\n\n /**\n * Adding keyboard identifier\n */\n this.keyboardDOM.setAttribute(\"data-skInstance\", this.currentInstanceName);\n\n /**\n * Create row wrapper\n */\n this.keyboardRowsDOM = document.createElement(\"div\");\n this.keyboardRowsDOM.className = \"hg-rows\";\n\n /**\n * Iterating through each row\n */\n layout[this.options.layoutName || this.defaultName].forEach(\n (row: string, rIndex: number) => {\n let rowArray = row.split(\" \");\n\n /**\n * Enforce excludeFromLayout\n */\n if (\n this.options.excludeFromLayout &&\n this.options.excludeFromLayout[\n this.options.layoutName || this.defaultName\n ]\n ) {\n rowArray = rowArray.filter(\n (buttonName) =>\n this.options.excludeFromLayout &&\n !this.options.excludeFromLayout[\n this.options.layoutName || this.defaultName\n ].includes(buttonName)\n );\n }\n\n /**\n * Creating empty row\n */\n let rowDOM = document.createElement(\"div\");\n rowDOM.className += \"hg-row\";\n\n /**\n * Tracking container indicators in rows\n */\n const containerStartIndexes: number[] = [];\n const containerEndIndexes: number[] = [];\n\n /**\n * Iterating through each button in row\n */\n rowArray.forEach((button, bIndex) => {\n /**\n * Check if button has a container indicator\n */\n const buttonHasContainerStart =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"[\") === 0;\n\n const buttonHasContainerEnd =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"]\") === button.length - 1;\n\n /**\n * Save container start index, if applicable\n */\n if (buttonHasContainerStart) {\n containerStartIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\[/g, \"\");\n }\n\n if (buttonHasContainerEnd) {\n containerEndIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\]/g, \"\");\n }\n\n /**\n * Processing button options\n */\n const fctBtnClass = this.utilities.getButtonClass(button);\n const buttonDisplayName = this.utilities.getButtonDisplayName(\n button,\n this.options.display,\n this.options.mergeDisplay\n );\n\n /**\n * Creating button\n */\n const buttonType = this.options.useButtonTag ? \"button\" : \"div\";\n const buttonDOM = document.createElement(buttonType);\n buttonDOM.className += `hg-button ${fctBtnClass}`;\n\n /**\n * Adding buttonTheme\n */\n buttonDOM.classList.add(...this.getButtonThemeClasses(button));\n\n /**\n * Adding buttonAttributes\n */\n this.setDOMButtonAttributes(\n button,\n (attribute: string, value: string) => {\n buttonDOM.setAttribute(attribute, value);\n }\n );\n\n this.activeButtonClass = \"hg-activeButton\";\n\n /**\n * Handle button click event\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n /**\n * Handle PointerEvents\n */\n buttonDOM.onpointerdown = (e: KeyboardHandlerEvent) => {\n this.handleButtonClicked(button, e);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onpointerup = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n buttonDOM.onpointercancel = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n } else {\n /**\n * Fallback for browsers not supporting PointerEvents\n */\n if (useTouchEvents) {\n /**\n * Handle touch events\n */\n buttonDOM.ontouchstart = (e: KeyboardHandlerEvent) => {\n this.handleButtonClicked(button, e);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.ontouchend = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n buttonDOM.ontouchcancel = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n } else {\n /**\n * Handle mouse events\n */\n buttonDOM.onclick = (e: KeyboardHandlerEvent) => {\n this.setMouseHold(false);\n /**\n * Fire button handler in onclick for compatibility reasons\n * This fires handler before onKeyReleased, therefore when that option is set we will fire the handler\n * in onmousedown instead\n */\n if (typeof this.options.onKeyReleased !== \"function\") {\n this.handleButtonClicked(button, e);\n }\n };\n buttonDOM.onmousedown = (e: KeyboardHandlerEvent) => {\n /**\n * Fire button handler for onKeyReleased use-case\n */\n if (\n typeof this.options.onKeyReleased === \"function\" &&\n !this.isMouseHold\n ) {\n this.handleButtonClicked(button, e);\n }\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onmouseup = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n }\n }\n\n /**\n * Adding identifier\n */\n buttonDOM.setAttribute(\"data-skBtn\", button);\n\n /**\n * Adding unique id\n * Since there's no limit on spawning same buttons, the unique id ensures you can style every button\n */\n const buttonUID = `${this.options.layoutName}-r${rIndex}b${bIndex}`;\n buttonDOM.setAttribute(\"data-skBtnUID\", buttonUID);\n\n /**\n * Adding button label to button\n */\n const buttonSpanDOM = document.createElement(\"span\");\n buttonSpanDOM.innerHTML = buttonDisplayName;\n buttonDOM.appendChild(buttonSpanDOM);\n\n /**\n * Adding to buttonElements\n */\n if (!this.buttonElements[button]) this.buttonElements[button] = [];\n\n this.buttonElements[button].push(buttonDOM);\n\n /**\n * Appending button to row\n */\n rowDOM.appendChild(buttonDOM);\n });\n\n /**\n * Parse containers in row\n */\n rowDOM = this.parseRowDOMContainers(\n rowDOM,\n rIndex,\n containerStartIndexes,\n containerEndIndexes\n );\n\n /**\n * Appending row to hg-rows\n */\n this.keyboardRowsDOM.appendChild(rowDOM);\n }\n );\n\n /**\n * Appending row to keyboard\n */\n this.keyboardDOM.appendChild(this.keyboardRowsDOM);\n\n /**\n * Calling onRender\n */\n this.onRender();\n\n if (!this.initialized) {\n /**\n * Ensures that onInit and beforeFirstRender are only called once per instantiation\n */\n this.initialized = true;\n\n /**\n * Handling parent events\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n document.onpointerup = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n this.keyboardDOM.onpointerdown = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n } else if (useTouchEvents) {\n /**\n * Handling ontouchend, ontouchcancel\n */\n document.ontouchend = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n document.ontouchcancel = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n\n this.keyboardDOM.ontouchstart = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n } else if (!useTouchEvents) {\n /**\n * Handling mouseup\n */\n document.onmouseup = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n this.keyboardDOM.onmousedown = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n }\n\n /**\n * Calling onInit\n */\n this.onInit();\n }\n }\n}\n\nexport default SimpleKeyboard;\n","export const getDefaultLayout = () => {\n return {\n default: [\n \"` 1 2 3 4 5 6 7 8 9 0 - = {bksp}\",\n \"{tab} q w e r t y u i o p [ ] \\\\\",\n \"{lock} a s d f g h j k l ; ' {enter}\",\n \"{shift} z x c v b n m , . / {shift}\",\n \".com @ {space}\",\n ],\n shift: [\n \"~ ! @ # $ % ^ & * ( ) _ + {bksp}\",\n \"{tab} Q W E R T Y U I O P { } |\",\n '{lock} A S D F G H J K L : \" {enter}',\n \"{shift} Z X C V B N M < > ? {shift}\",\n \".com @ {space}\",\n ],\n };\n};\n","import SimpleKeyboard from \"./components/Keyboard\";\nexport { SimpleKeyboard };\nexport default SimpleKeyboard;\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Utilities","_ref","getOptions","getCaretPosition","getCaretPositionEnd","dispatch","_classCallCheck","_defineProperty","button","length","this","bindMethods","value","includes","buttonTypeClass","getButtonType","buttonWithoutBraces","replace","buttonNormalized","concat","display","arguments","undefined","assign","getDefaultDiplay","input","caretPos","caretPosEnd","moveCaret","options","commonParams","output","removeAt","apply","removeForwardsAt","addStringAt","tabCharOnTab","newLineOnEnter","Number","isInteger","debug","console","log","minus","newCaretPos","updateCaretPosAction","instance","setCaretPosition","caretPosition","source","str","position","positionEnd","slice","join","isMaxLengthReached","updateCaretPos","emojiMatchedReg","substring","match","substr","inputObj","updatedInput","maxLength","currentInput","inputName","condition","maxLengthReached","_typeof","Boolean","window","navigator","maxTouchPoints","PointerEvent","toLowerCase","trim","split","reduce","word","toUpperCase","arr","size","_toConsumableArray","Array","Math","ceil","map","_","i","index","newIndex","startMarkerIndex","indexOf","myClass","_step","_iterator","_createForOfIteratorHelper","getOwnPropertyNames","s","n","done","myMethod","bind","err","e","f","PhysicalKeyboard","_this","altKey","ctrlKey","shiftKey","code","keyCodeToKey","keyCode","physicalKeyboardHighlightPreventDefault","isModifierKey","preventDefault","stopImmediatePropagation","buttonPressed","getSimpleKeyboardLayoutKey","buttonDOM","buttonName","standardButtonPressed","getButtonElement","functionButtonPressed","_buttonDOM$","_buttonDOM$$onpointer","_buttonDOM","_buttonDOM$onpointerd","applyButtonStyle","buttonElement","style","background","physicalKeyboardHighlightBgColor","color","physicalKeyboardHighlightTextColor","isArray","forEach","physicalKeyboardHighlightPress","physicalKeyboardHighlightPressUsePointerEvents","onpointerdown","physicalKeyboardHighlightPressUseClick","_buttonDOM$2","click","handleButtonClicked","_buttonDOM$3","_buttonDOM$3$onpointe","_buttonDOM$onpointeru","removeAttribute","onpointerup","_output","keyId","CandidateBox","utilities","pageSize","layoutCandidatesPageSize","candidateBoxElement","remove","pageIndex","_ref2","candidateValue","targetElement","onSelect","candidateListPages","chunkArray","renderPage","nbPages","onItemSelected","selectedCandidate","destroy","_ref3","_this$candidateBoxEle","_this2","document","createElement","className","candidateListULElement","candidateListItem","_this2$options$displa","candidateListLIElement","getMouseEvent","mouseEvent","useTouchEvents","TouchEvent","MouseEvent","innerHTML","ontouchstart","onclick","appendChild","isPrevBtnElementActive","prevBtnElement","classList","add","prevBtnElementClickAction","isNextBtnElementActive","nextBtnElement","nextBtnElementClickAction","prepend","SimpleKeyboard","selectorOrOptions","keyboardOptions","keyboardDOMClass","keyboardDOM","querySelector","HTMLDivElement","warn","Error","caretPositionEnd","name","initCallback","modules","_len","baseDOMClasses","_key","filter","DOMClass","_this$handleParams","handleParams","_this$handleParams$op","_objectSpread","layoutName","theme","preventMouseDownDefault","enableLayoutCandidates","excludeFromLayout","keyboardPluginClasses","_this$options$inputNa","defaultName","buttonElements","currentInstanceName","camelCase","allKeyboardInstances","keyboardInstanceNames","keys","isFirstKeyboardInstance","physicalKeyboard","candidateBox","render","loadModules","endPosition","_this$options","layoutCandidatesObj","layoutCandidates","layoutCandidatesCaseSensitiveMatch","layoutCandidate","inputSubstr","regexp","RegExp","escapeRegex","matchAll","candidateKey","sort","a","b","_this3","show","_this3$options","disableCandidateNormalization","enableLayoutCandidatesKeyPress","candidateStr","normalize","getInput","initialCaretPosition","newInputSubstr","newInput","caretPositionDiff","newCaretPosition","setInput","onKeyPress","onChange","onChangeAll","getAllInputs","_this$options2","_this$options2$inputN","getUpdatedInput","isStandardButton","activeInputElement","setSelectionRange","inputPattern","inputPatternIsValid","handleMaxLength","newInputValue","type","syncInstanceInputs","target","_this$candidateBox","_this$getInputCandida","getInputCandidates","showCandidatesBox","isMouseHold","_this4","stopMouseDownPropagation","stopPropagation","activeButtonClass","holdInteractionTimeout","clearTimeout","holdTimeout","setMouseHold","disableButtonHold","setTimeout","getMouseHold","handleButtonHold","_this5","preventMouseUpDefault","stopMouseUpPropagation","contains","recurseButtons","onKeyReleased","_this6","_this7","replaceInput","skipSync","rtl","_this8","changedOptions","onSetOptions","newOptions","_this9","optionName","JSON","stringify","keyboardRowsDOM","setAttribute","callback","buttons","_this10","classNameItem","buttonTheme","classNameFound","buttonThemeArray","push","class","_this11","_this11$options","_buttonTheme","_this11$options$butto","filteredButtonArray","item","splice","buttonArr","inputVal","inputPatternRaw","didInputMatch","test","_this$options$physica","addEventListener","handleKeyUp","handleKeyDown","handleMouseUp","handleTouchEnd","handleSelectionChange","handleSelect","event","caretEventHandler","physicalKeyboardHighlight","handleHighlightKeyUp","handleHighlightKeyDown","userAgent","targetTagName","_this12","tagName","isKeyboard","path","some","_item$hasAttribute","hasAttribute","disableCaretPositioning","selectionStart","selectionEnd","getRtlOffset","fn","_this13","_this$options$physica2","removeEventListener","ontouchend","ontouchcancel","onmouseup","onpointercancel","onmousedown","resetRows","initialized","buttonClasses","themeObj","themeObjClasses","buttonAttributes","attrObj","attribute","processAutoTouchEvents","disableContextualWindow","oncontextmenu","autoUseTouchEvents","setEventListeners","onInit","isTouchDevice","onTouchDeviceDetected","beforeFirstRender","pointerEventsSupported","useMouseEvents","beforeRender","onRender","onModulesLoaded","_this14","KeyboardModule","keyboardModule","init","rowDOM","rowIndex","containerStartIndexes","containerEndIndexes","_this15","rowDOMArray","from","children","removedElements","startIndex","arrIndex","endIndex","updated_startIndex","updated_endIndex","containerDOM","containerUID","containedElements","element","_this16","layoutClass","layout","default","shift","useTouchEventsClass","disableRowButtonContainers","getKeyboardClassString","row","rIndex","rowArray","bIndex","_buttonDOM$classList","buttonHasContainerStart","buttonHasContainerEnd","fctBtnClass","getButtonClass","buttonDisplayName","getButtonDisplayName","mergeDisplay","buttonType","useButtonTag","getButtonThemeClasses","setDOMButtonAttributes","handleButtonMouseDown","handleButtonMouseUp","buttonUID","buttonSpanDOM","parseRowDOMContainers","handleKeyboardContainerMouseDown"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.modern.esm.js","mappings":";;;;;;;;;;;;;;GACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,olDCGlF,IAGMI,EAAS,WA2Bb,O,EAjBA,SAAAA,EAAAC,GAKoB,IAJlBC,EAAUD,EAAVC,WACAC,EAAgBF,EAAhBE,iBACAC,EAAmBH,EAAnBG,oBACAC,EAAQJ,EAARI,U,4FAAQC,CAAA,KAAAN,GAAAO,EAAA,0BAAAA,EAAA,gCAAAA,EAAA,mCAAAA,EAAA,wBAAAA,EAAA,gCA6RVA,EAAA,yBAGmB,SAACC,GAAc,OAChCA,KAA0B,MAAdA,EAAO,IAA4C,MAA9BA,EAAOA,EAAOC,OAAS,GAAW,IA/RnEC,KAAKR,WAAaA,EAClBQ,KAAKP,iBAAmBA,EACxBO,KAA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,EAAE,EACxC9F,KAAKgM,YAAYgL,YAAc,SAAClR,GAAuB,OACrD+T,EAAK6B,iCAAiC5V,EAAE,IAtB1CqE,SAASxB,YAAc,SAAC7C,GAAuB,OAC7C+T,EAAKyB,yBAAoB1a,EAAWkF,EAAE,EACxC9F,KAAKgM,YAAY9D,cAAgB,SAACpC,GAAuB,OACvD+T,EAAK6B,iCAAiC5V,EAAE,GAyB5C9F,KAAK8X,SAET,I,4FAAC,CA5+DiB,GEpBpB,I","sources":["webpack://simple-keyboard/webpack/bootstrap","webpack://simple-keyboard/webpack/runtime/define property getters","webpack://simple-keyboard/webpack/runtime/hasOwnProperty shorthand","webpack://simple-keyboard/./src/lib/services/Utilities.ts","webpack://simple-keyboard/./src/lib/services/PhysicalKeyboard.ts","webpack://simple-keyboard/./src/lib/components/CandidateBox.ts","webpack://simple-keyboard/./src/lib/components/Keyboard.ts","webpack://simple-keyboard/./src/lib/services/KeyboardLayout.ts","webpack://simple-keyboard/./src/lib/index.modern.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import { KeyboardInput } from \"./../interfaces\";\nimport { KeyboardOptions, UtilitiesParams } from \"../interfaces\";\n\n/**\n * Utility Service\n */\nclass Utilities {\n getOptions: () => KeyboardOptions;\n getCaretPosition: () => number | null;\n getCaretPositionEnd: () => number | null;\n dispatch: any;\n maxLengthReached!: boolean;\n\n /**\n * Creates an instance of the Utility service\n */\n constructor({\n getOptions,\n getCaretPosition,\n getCaretPositionEnd,\n dispatch,\n }: UtilitiesParams) {\n this.getOptions = getOptions;\n this.getCaretPosition = getCaretPosition;\n this.getCaretPositionEnd = getCaretPositionEnd;\n this.dispatch = dispatch;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(Utilities, this);\n }\n\n /**\n * Retrieve button type\n *\n * @param {string} button The button's layout name\n * @return {string} The button type\n */\n getButtonType(button: string): string {\n return button.includes(\"{\") && button.includes(\"}\") && button !== \"{//}\"\n ? \"functionBtn\"\n : \"standardBtn\";\n }\n\n /**\n * Adds default classes to a given button\n *\n * @param {string} button The button's layout name\n * @return {string} The classes to be added to the button\n */\n getButtonClass(button: string): string {\n const buttonTypeClass = this.getButtonType(button);\n const buttonWithoutBraces = button.replace(\"{\", \"\").replace(\"}\", \"\");\n let buttonNormalized = \"\";\n\n if (buttonTypeClass !== \"standardBtn\")\n buttonNormalized = ` hg-button-${buttonWithoutBraces}`;\n\n return `hg-${buttonTypeClass}${buttonNormalized}`;\n }\n\n /**\n * Default button display labels\n */\n getDefaultDiplay() {\n return {\n \"{bksp}\": \"backspace\",\n \"{backspace}\": \"backspace\",\n \"{enter}\": \"< enter\",\n \"{shift}\": \"shift\",\n \"{shiftleft}\": \"shift\",\n \"{shiftright}\": \"shift\",\n \"{alt}\": \"alt\",\n \"{s}\": \"shift\",\n \"{tab}\": \"tab\",\n \"{lock}\": \"caps\",\n \"{capslock}\": \"caps\",\n \"{accept}\": \"Submit\",\n \"{space}\": \" \",\n \"{//}\": \" \",\n \"{esc}\": \"esc\",\n \"{escape}\": \"esc\",\n \"{f1}\": \"f1\",\n \"{f2}\": \"f2\",\n \"{f3}\": \"f3\",\n \"{f4}\": \"f4\",\n \"{f5}\": \"f5\",\n \"{f6}\": \"f6\",\n \"{f7}\": \"f7\",\n \"{f8}\": \"f8\",\n \"{f9}\": \"f9\",\n \"{f10}\": \"f10\",\n \"{f11}\": \"f11\",\n \"{f12}\": \"f12\",\n \"{numpaddivide}\": \"/\",\n \"{numlock}\": \"lock\",\n \"{arrowup}\": \"↑\",\n \"{arrowleft}\": \"←\",\n \"{arrowdown}\": \"↓\",\n \"{arrowright}\": \"→\",\n \"{prtscr}\": \"print\",\n \"{scrolllock}\": \"scroll\",\n \"{pause}\": \"pause\",\n \"{insert}\": \"ins\",\n \"{home}\": \"home\",\n \"{pageup}\": \"up\",\n \"{delete}\": \"del\",\n \"{forwarddelete}\": \"del\",\n \"{end}\": \"end\",\n \"{pagedown}\": \"down\",\n \"{numpadmultiply}\": \"*\",\n \"{numpadsubtract}\": \"-\",\n \"{numpadadd}\": \"+\",\n \"{numpadenter}\": \"enter\",\n \"{period}\": \".\",\n \"{numpaddecimal}\": \".\",\n \"{numpad0}\": \"0\",\n \"{numpad1}\": \"1\",\n \"{numpad2}\": \"2\",\n \"{numpad3}\": \"3\",\n \"{numpad4}\": \"4\",\n \"{numpad5}\": \"5\",\n \"{numpad6}\": \"6\",\n \"{numpad7}\": \"7\",\n \"{numpad8}\": \"8\",\n \"{numpad9}\": \"9\",\n };\n }\n /**\n * Returns the display (label) name for a given button\n *\n * @param {string} button The button's layout name\n * @param {object} display The provided display option\n * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.\n */\n getButtonDisplayName(\n button: string,\n display: KeyboardOptions[\"display\"],\n mergeDisplay = false\n ) {\n if (mergeDisplay) {\n display = Object.assign({}, this.getDefaultDiplay(), display);\n } else {\n display = display || this.getDefaultDiplay();\n }\n\n return display[button] || button;\n }\n\n /**\n * Returns the updated input resulting from clicking a given button\n *\n * @param {string} button The button's layout name\n * @param {string} input The input string\n * @param {number} caretPos The cursor's current position\n * @param {number} caretPosEnd The cursor's current end position\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n getUpdatedInput(\n button: string,\n input: string,\n caretPos: any,\n caretPosEnd = caretPos,\n moveCaret = false\n ) {\n const options = this.getOptions();\n const commonParams: [number | undefined, number | undefined, boolean] = [\n caretPos,\n caretPosEnd,\n moveCaret,\n ];\n\n let output = input;\n\n if (\n (button === \"{bksp}\" || button === \"{backspace}\") &&\n output.length > 0\n ) {\n output = this.removeAt(output, ...commonParams);\n } else if (\n (button === \"{delete}\" || button === \"{forwarddelete}\") &&\n output.length > 0\n ) {\n output = this.removeForwardsAt(output, ...commonParams);\n } else if (button === \"{space}\")\n output = this.addStringAt(output, \" \", ...commonParams);\n else if (\n button === \"{tab}\" &&\n !(\n typeof options.tabCharOnTab === \"boolean\" &&\n options.tabCharOnTab === false\n )\n ) {\n output = this.addStringAt(output, \"\\t\", ...commonParams);\n } else if (\n (button === \"{enter}\" || button === \"{numpadenter}\") &&\n options.newLineOnEnter\n )\n output = this.addStringAt(output, \"\\n\", ...commonParams);\n else if (\n button.includes(\"numpad\") &&\n Number.isInteger(Number(button[button.length - 2]))\n ) {\n output = this.addStringAt(\n output,\n button[button.length - 2],\n ...commonParams\n );\n } else if (button === \"{numpaddivide}\")\n output = this.addStringAt(output, \"/\", ...commonParams);\n else if (button === \"{numpadmultiply}\")\n output = this.addStringAt(output, \"*\", ...commonParams);\n else if (button === \"{numpadsubtract}\")\n output = this.addStringAt(output, \"-\", ...commonParams);\n else if (button === \"{numpadadd}\")\n output = this.addStringAt(output, \"+\", ...commonParams);\n else if (button === \"{numpaddecimal}\")\n output = this.addStringAt(output, \".\", ...commonParams);\n else if (button === \"{\" || button === \"}\")\n output = this.addStringAt(output, button, ...commonParams);\n else if (!button.includes(\"{\") && !button.includes(\"}\"))\n output = this.addStringAt(output, button, ...commonParams);\n\n if(options.debug){\n console.log(\"Input will be: \"+ output);\n }\n\n return output;\n }\n\n /**\n * Moves the cursor position by a given amount\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPos(length: number, minus = false) {\n const newCaretPos = this.updateCaretPosAction(length, minus);\n\n this.dispatch((instance: any) => {\n instance.setCaretPosition(newCaretPos);\n });\n }\n\n /**\n * Action method of updateCaretPos\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPosAction(length: number, minus = false) {\n const options = this.getOptions();\n let caretPosition = this.getCaretPosition();\n\n if (caretPosition != null) {\n if (minus) {\n if (caretPosition > 0) caretPosition = caretPosition - length;\n } else {\n caretPosition = caretPosition + length;\n }\n }\n\n if (options.debug) {\n console.log(\"Caret at:\", caretPosition);\n }\n\n return caretPosition;\n }\n\n /**\n * Adds a string to the input at a given position\n *\n * @param {string} source The source input\n * @param {string} str The string to add\n * @param {number} position The (cursor) position where the string should be added\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n addStringAt(\n source: string,\n str: string,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n let output;\n\n if (!position && position !== 0) {\n output = source + str;\n } else {\n output = [source.slice(0, position), str, source.slice(positionEnd)].join(\n \"\"\n );\n\n /**\n * Avoid caret position change when maxLength is set\n */\n if (!this.isMaxLengthReached()) {\n if (moveCaret) this.updateCaretPos(str.length);\n }\n }\n\n return output;\n }\n\n /**\n * Check whether the button is a standard button\n */\n isStandardButton = (button: string) =>\n button && !(button[0] === \"{\" && button[button.length - 1] === \"}\");\n\n /**\n * Removes an amount of characters before a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n removeAt(\n source: string,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n if (position === 0 && positionEnd === 0) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n let prevTwoChars;\n let emojiMatched;\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n if (position && position >= 0) {\n prevTwoChars = source.substring(position - 2, position);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position - 2) + source.substr(position);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.substr(0, position - 1) + source.substr(position);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n } else {\n prevTwoChars = source.slice(-2);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.slice(0, -2);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.slice(0, -1);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch((instance: any) => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n\n /**\n * Removes an amount of characters after a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n */\n removeForwardsAt(\n source: string,\n position: number = source.length,\n positionEnd: number = source.length,\n moveCaret = false\n ) {\n if (!source?.length || position === null) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n const nextTwoChars = source.substring(position, position + 2);\n const emojiMatched = nextTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position) + source.substr(position + 2);\n } else {\n output = source.substr(0, position) + source.substr(position + 1);\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch((instance: any) => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n\n /**\n * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.\n *\n * @param {object} inputObj\n * @param {string} updatedInput\n */\n handleMaxLength(inputObj: KeyboardInput, updatedInput: string) {\n const options = this.getOptions();\n const maxLength = options.maxLength;\n const currentInput = inputObj[options.inputName || \"default\"];\n const condition = updatedInput.length - 1 >= maxLength;\n\n if (\n /**\n * If pressing this button won't add more characters\n * We exit out of this limiter function\n */\n updatedInput.length <= currentInput.length\n ) {\n return false;\n }\n\n if (Number.isInteger(maxLength)) {\n if (options.debug) {\n console.log(\"maxLength (num) reached:\", condition);\n }\n\n if (condition) {\n /**\n * @type {boolean} Boolean value that shows whether maxLength has been reached\n */\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n\n if (typeof maxLength === \"object\") {\n const condition =\n updatedInput.length - 1 >= maxLength[options.inputName || \"default\"];\n\n if (options.debug) {\n console.log(\"maxLength (obj) reached:\", condition);\n }\n\n if (condition) {\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n }\n\n /**\n * Gets the current value of maxLengthReached\n */\n isMaxLengthReached() {\n return Boolean(this.maxLengthReached);\n }\n\n /**\n * Determines whether a touch device is being used\n */\n isTouchDevice() {\n return \"ontouchstart\" in window || navigator.maxTouchPoints;\n }\n\n /**\n * Determines whether pointer events are supported\n */\n pointerEventsSupported() {\n return !!window.PointerEvent;\n }\n\n /**\n * Bind all methods in a given class\n */\n\n static bindMethods(myClass: any, instance: any) {\n // eslint-disable-next-line no-unused-vars\n for (const myMethod of Object.getOwnPropertyNames(myClass.prototype)) {\n const excludeMethod =\n myMethod === \"constructor\" || myMethod === \"bindMethods\";\n if (!excludeMethod) {\n instance[myMethod] = instance[myMethod].bind(instance);\n }\n }\n }\n\n /**\n * Transforms an arbitrary string to camelCase\n *\n * @param {string} str The string to transform.\n */\n camelCase(str: string): string {\n if (!str) return \"\";\n\n return str\n .toLowerCase()\n .trim()\n .split(/[.\\-_\\s]/g)\n .reduce((str, word) =>\n word.length ? str + word[0].toUpperCase() + word.slice(1) : str\n );\n }\n\n /**\n * Split array into chunks\n */\n chunkArray(arr: T[], size: number): T[][] {\n return [...Array(Math.ceil(arr.length / size))].map((_, i) =>\n arr.slice(size * i, size + size * i)\n );\n }\n\n /**\n * Escape regex input\n */\n escapeRegex(str: string) {\n return str.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n }\n\n /**\n * Calculate caret position offset when using rtl option\n */\n getRtlOffset(index: number, input: string) {\n let newIndex = index;\n const startMarkerIndex = input.indexOf(\"\\u202B\");\n const endMarkerIndex = input.indexOf(\"\\u202C\");\n\n if(startMarkerIndex < index && startMarkerIndex != -1){ newIndex--; }\n if(endMarkerIndex < index && startMarkerIndex != -1){ newIndex--; }\n\n return newIndex < 0 ? 0 : newIndex;\n }\n\n /**\n * Reusable empty function\n */\n static noop = () => {};\n}\n\nexport default Utilities;\n","import { KeyboardOptions, PhysicalKeyboardParams } from \"../interfaces\";\nimport Utilities from \"../services/Utilities\";\n\n/**\n * Physical Keyboard Service\n */\nclass PhysicalKeyboard {\n getOptions: () => KeyboardOptions;\n dispatch: any;\n\n /**\n * Creates an instance of the PhysicalKeyboard service\n */\n constructor({ dispatch, getOptions }: PhysicalKeyboardParams) {\n /**\n * @type {object} A simple-keyboard instance\n */\n this.dispatch = dispatch;\n this.getOptions = getOptions;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(PhysicalKeyboard, this);\n }\n\n handleHighlightKeyDown(e: KeyboardEvent) {\n const options = this.getOptions();\n\n if(options.physicalKeyboardHighlightPreventDefault && this.isModifierKey(e)){\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n const buttonPressed = this.getSimpleKeyboardLayoutKey(e);\n\n this.dispatch((instance: any) => {\n const standardButtonPressed = instance.getButtonElement(buttonPressed);\n const functionButtonPressed = instance.getButtonElement(\n `{${buttonPressed}}`\n );\n let buttonDOM;\n let buttonName: string;\n\n if (standardButtonPressed) {\n buttonDOM = standardButtonPressed;\n buttonName = buttonPressed;\n } else if (functionButtonPressed) {\n buttonDOM = functionButtonPressed;\n buttonName = `{${buttonPressed}}`;\n } else {\n return;\n }\n\n const applyButtonStyle = (buttonElement: HTMLElement) => {\n buttonElement.style.background =\n options.physicalKeyboardHighlightBgColor || \"#dadce4\";\n buttonElement.style.color =\n options.physicalKeyboardHighlightTextColor || \"black\";\n }\n\n if (buttonDOM) {\n if(Array.isArray(buttonDOM)){\n buttonDOM.forEach(buttonElement => applyButtonStyle(buttonElement));\n\n // Even though we have an array of buttons, we just want to press one of them\n if (options.physicalKeyboardHighlightPress) {\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM[0]?.onpointerdown?.(e);\n } else if (options.physicalKeyboardHighlightPressUseClick) {\n buttonDOM[0]?.click();\n } else {\n instance.handleButtonClicked(buttonName, e);\n }\n }\n } else {\n applyButtonStyle(buttonDOM);\n\n if (options.physicalKeyboardHighlightPress) {\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM?.onpointerdown?.(e);\n } else if (options.physicalKeyboardHighlightPressUseClick) {\n buttonDOM.click();\n } else {\n instance.handleButtonClicked(buttonName, e);\n }\n }\n }\n }\n });\n }\n\n handleHighlightKeyUp(e: KeyboardEvent) {\n const options = this.getOptions();\n\n if(options.physicalKeyboardHighlightPreventDefault && this.isModifierKey(e)){\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n \n const buttonPressed = this.getSimpleKeyboardLayoutKey(e);\n\n this.dispatch((instance: any) => {\n const buttonDOM =\n instance.getButtonElement(buttonPressed) ||\n instance.getButtonElement(`{${buttonPressed}}`);\n\n const applyButtonStyle = (buttonElement: HTMLElement) => {\n if(buttonElement.removeAttribute){\n buttonElement.removeAttribute(\"style\");\n }\n };\n\n if (buttonDOM) {\n if(Array.isArray(buttonDOM)){\n buttonDOM.forEach(buttonElement => applyButtonStyle(buttonElement));\n\n // Even though we have an array of buttons, we just want to press one of them\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM[0]?.onpointerup?.(e);\n }\n } else {\n applyButtonStyle(buttonDOM);\n\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM?.onpointerup?.(e);\n }\n }\n }\n });\n }\n\n /**\n * Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format\n * @param {object} e The KeyboardEvent\n */\n getSimpleKeyboardLayoutKey(e: KeyboardEvent) {\n let output = \"\";\n const keyId = e.code || e.key || this.keyCodeToKey(e?.keyCode);\n\n if (\n keyId?.includes(\"Numpad\") ||\n keyId?.includes(\"Shift\") ||\n keyId?.includes(\"Space\") ||\n keyId?.includes(\"Backspace\") ||\n keyId?.includes(\"Control\") ||\n keyId?.includes(\"Alt\") ||\n keyId?.includes(\"Meta\")\n ) {\n output = e.code || \"\";\n } else {\n output = e.key || this.keyCodeToKey(e?.keyCode) || \"\";\n }\n\n return output.length > 1 ? output?.toLowerCase() : output;\n }\n\n /**\n * Retrieve key from keyCode\n */\n keyCodeToKey(keyCode: number): string {\n return {\n 8: \"Backspace\",\n 9: \"Tab\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Ctrl\",\n 18: \"Alt\",\n 19: \"Pause\",\n 20: \"CapsLock\",\n 27: \"Esc\",\n 32: \"Space\",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 45: \"Insert\",\n 46: \"Delete\",\n 48: \"0\",\n 49: \"1\",\n 50: \"2\",\n 51: \"3\",\n 52: \"4\",\n 53: \"5\",\n 54: \"6\",\n 55: \"7\",\n 56: \"8\",\n 57: \"9\",\n 65: \"A\",\n 66: \"B\",\n 67: \"C\",\n 68: \"D\",\n 69: \"E\",\n 70: \"F\",\n 71: \"G\",\n 72: \"H\",\n 73: \"I\",\n 74: \"J\",\n 75: \"K\",\n 76: \"L\",\n 77: \"M\",\n 78: \"N\",\n 79: \"O\",\n 80: \"P\",\n 81: \"Q\",\n 82: \"R\",\n 83: \"S\",\n 84: \"T\",\n 85: \"U\",\n 86: \"V\",\n 87: \"W\",\n 88: \"X\",\n 89: \"Y\",\n 90: \"Z\",\n 91: \"Meta\",\n 96: \"Numpad0\",\n 97: \"Numpad1\",\n 98: \"Numpad2\",\n 99: \"Numpad3\",\n 100: \"Numpad4\",\n 101: \"Numpad5\",\n 102: \"Numpad6\",\n 103: \"Numpad7\",\n 104: \"Numpad8\",\n 105: \"Numpad9\",\n 106: \"NumpadMultiply\",\n 107: \"NumpadAdd\",\n 109: \"NumpadSubtract\",\n 110: \"NumpadDecimal\",\n 111: \"NumpadDivide\",\n 112: \"F1\",\n 113: \"F2\",\n 114: \"F3\",\n 115: \"F4\",\n 116: \"F5\",\n 117: \"F6\",\n 118: \"F7\",\n 119: \"F8\",\n 120: \"F9\",\n 121: \"F10\",\n 122: \"F11\",\n 123: \"F12\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\",\n }[keyCode] || \"\";\n }\n\n isModifierKey = (e: KeyboardEvent): boolean => {\n return (\n e.altKey\n || e.ctrlKey\n || e.shiftKey\n || [\"Tab\", \"CapsLock\", \"Esc\", \"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"].includes(\n e.code || e.key || this.keyCodeToKey(e?.keyCode)\n )\n )\n }\n}\n\nexport default PhysicalKeyboard;\n","import \"./css/CandidateBox.css\";\n\nimport Utilities from \"../services/Utilities\";\nimport {\n CandidateBoxParams,\n CandidateBoxRenderParams,\n CandidateBoxShowParams,\n KeyboardOptions,\n} from \"./../interfaces\";\n\nclass CandidateBox {\n utilities: Utilities;\n options: KeyboardOptions;\n candidateBoxElement!: HTMLDivElement;\n pageIndex = 0;\n pageSize: number;\n\n constructor({ utilities, options }: CandidateBoxParams) {\n this.utilities = utilities;\n this.options = options;\n Utilities.bindMethods(CandidateBox, this);\n this.pageSize = this.utilities.getOptions().layoutCandidatesPageSize || 5;\n }\n\n destroy() {\n if (this.candidateBoxElement) {\n this.candidateBoxElement.remove();\n this.pageIndex = 0;\n }\n }\n\n show({\n candidateValue,\n targetElement,\n onSelect,\n }: CandidateBoxShowParams): void {\n if (!candidateValue || !candidateValue.length) {\n return;\n }\n\n const candidateListPages = this.utilities.chunkArray(\n candidateValue.split(\" \"),\n this.pageSize\n );\n\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: this.pageIndex,\n nbPages: candidateListPages.length,\n onItemSelected: (selectedCandidate: string, e: MouseEvent) => {\n onSelect(selectedCandidate, e);\n this.destroy();\n },\n });\n }\n\n renderPage({\n candidateListPages,\n targetElement,\n pageIndex,\n nbPages,\n onItemSelected,\n }: CandidateBoxRenderParams) {\n // Remove current candidate box, if any\n this.candidateBoxElement?.remove();\n\n // Create candidate box element\n this.candidateBoxElement = document.createElement(\"div\");\n this.candidateBoxElement.className = \"hg-candidate-box\";\n\n // Candidate box list\n const candidateListULElement = document.createElement(\"ul\");\n candidateListULElement.className = \"hg-candidate-box-list\";\n\n // Create Candidate box list items\n candidateListPages[pageIndex].forEach((candidateListItem) => {\n const candidateListLIElement = document.createElement(\"li\");\n const getMouseEvent = () => {\n const mouseEvent = new (this.options.useTouchEvents ? TouchEvent : MouseEvent)(\"click\");\n Object.defineProperty(mouseEvent, \"target\", {\n value: candidateListLIElement,\n });\n return mouseEvent;\n };\n\n candidateListLIElement.className = \"hg-candidate-box-list-item\";\n candidateListLIElement.innerHTML = this.options.display?.[candidateListItem] || candidateListItem;\n\n if(this.options.useTouchEvents) {\n candidateListLIElement.ontouchstart = (e: any) =>\n onItemSelected(candidateListItem, e || getMouseEvent());\n } else {\n candidateListLIElement.onclick = (e = getMouseEvent() as MouseEvent) =>\n onItemSelected(candidateListItem, e);\n }\n\n // Append list item to ul\n candidateListULElement.appendChild(candidateListLIElement);\n });\n\n // Add previous button\n const isPrevBtnElementActive = pageIndex > 0;\n const prevBtnElement = document.createElement(\"div\");\n prevBtnElement.classList.add(\"hg-candidate-box-prev\");\n isPrevBtnElementActive &&\n prevBtnElement.classList.add(\"hg-candidate-box-btn-active\");\n\n const prevBtnElementClickAction = () => {\n if (!isPrevBtnElementActive) return;\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: pageIndex - 1,\n nbPages,\n onItemSelected,\n });\n };\n\n if(this.options.useTouchEvents) {\n prevBtnElement.ontouchstart = prevBtnElementClickAction;\n } else {\n prevBtnElement.onclick = prevBtnElementClickAction;\n }\n \n this.candidateBoxElement.appendChild(prevBtnElement);\n\n // Add elements to container\n this.candidateBoxElement.appendChild(candidateListULElement);\n\n // Add next button\n const isNextBtnElementActive = pageIndex < nbPages - 1;\n const nextBtnElement = document.createElement(\"div\");\n nextBtnElement.classList.add(\"hg-candidate-box-next\");\n isNextBtnElementActive &&\n nextBtnElement.classList.add(\"hg-candidate-box-btn-active\");\n\n const nextBtnElementClickAction = () => {\n if (!isNextBtnElementActive) return;\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: pageIndex + 1,\n nbPages,\n onItemSelected,\n });\n };\n\n if(this.options.useTouchEvents) {\n nextBtnElement.ontouchstart = nextBtnElementClickAction;\n } else {\n nextBtnElement.onclick = nextBtnElementClickAction;\n }\n\n this.candidateBoxElement.appendChild(nextBtnElement);\n\n // Append candidate box to target element\n targetElement.prepend(this.candidateBoxElement);\n }\n}\n\nexport default CandidateBox;\n","import \"./css/Keyboard.css\";\n\n// Services\nimport { getDefaultLayout } from \"../services/KeyboardLayout\";\nimport PhysicalKeyboard from \"../services/PhysicalKeyboard\";\nimport Utilities from \"../services/Utilities\";\nimport {\n KeyboardOptions,\n KeyboardInput,\n KeyboardButtonElements,\n KeyboardHandlerEvent,\n KeyboardElement,\n} from \"../interfaces\";\nimport CandidateBox from \"./CandidateBox\";\n\n/**\n * Root class for simple-keyboard.\n * This class:\n * - Parses the options\n * - Renders the rows and buttons\n * - Handles button functionality\n */\nclass SimpleKeyboard {\n input!: KeyboardInput;\n options!: KeyboardOptions;\n utilities!: Utilities;\n caretPosition!: number | null;\n caretPositionEnd!: number | null;\n keyboardDOM!: KeyboardElement;\n keyboardPluginClasses!: string;\n keyboardDOMClass!: string;\n buttonElements!: KeyboardButtonElements;\n currentInstanceName!: string;\n allKeyboardInstances!: { [key: string]: SimpleKeyboard };\n keyboardInstanceNames!: string[];\n isFirstKeyboardInstance!: boolean;\n physicalKeyboard!: PhysicalKeyboard;\n modules!: { [key: string]: any };\n activeButtonClass!: string;\n holdInteractionTimeout!: number;\n holdTimeout!: number;\n isMouseHold!: boolean;\n initialized!: boolean;\n candidateBox!: CandidateBox | null;\n keyboardRowsDOM!: KeyboardElement;\n defaultName = \"default\";\n activeInputElement: HTMLInputElement | HTMLTextAreaElement | null = null;\n\n /**\n * Creates an instance of SimpleKeyboard\n * @param {Array} params If first parameter is a string, it is considered the container class. The second parameter is then considered the options object. If first parameter is an object, it is considered the options object.\n */\n constructor(\n selectorOrOptions?: string | HTMLDivElement | KeyboardOptions,\n keyboardOptions?: KeyboardOptions\n ) {\n if (typeof window === \"undefined\") return;\n\n const {\n keyboardDOMClass,\n keyboardDOM,\n options = {},\n } = this.handleParams(selectorOrOptions, keyboardOptions);\n\n /**\n * Initializing Utilities\n */\n this.utilities = new Utilities({\n getOptions: this.getOptions,\n getCaretPosition: this.getCaretPosition,\n getCaretPositionEnd: this.getCaretPositionEnd,\n dispatch: this.dispatch,\n });\n\n /**\n * Caret position\n */\n this.caretPosition = null;\n\n /**\n * Caret position end\n */\n this.caretPositionEnd = null;\n\n /**\n * Processing options\n */\n this.keyboardDOM = keyboardDOM;\n\n /**\n * @type {object}\n * @property {object} layout Modify the keyboard layout.\n * @property {string} layoutName Specifies which layout should be used.\n * @property {object} display Replaces variable buttons (such as {bksp}) with a human-friendly name (e.g.: “backspace”).\n * @property {boolean} mergeDisplay By default, when you set the display property, you replace the default one. This setting merges them instead.\n * @property {string} theme A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space.\n * @property {array} buttonTheme A prop to add your own css classes to one or several buttons.\n * @property {array} buttonAttributes A prop to add your own attributes to one or several buttons.\n * @property {boolean} debug Runs a console.log every time a key is pressed. Displays the buttons pressed and the current input.\n * @property {boolean} newLineOnEnter Specifies whether clicking the “ENTER” button will input a newline (\\n) or not.\n * @property {boolean} tabCharOnTab Specifies whether clicking the “TAB” button will input a tab character (\\t) or not.\n * @property {string} inputName Allows you to use a single simple-keyboard instance for several inputs.\n * @property {number} maxLength Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {object} maxLength Restrains simple-keyboard’s individual inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {boolean} syncInstanceInputs When set to true, this option synchronizes the internal input of every simple-keyboard instance.\n * @property {boolean} physicalKeyboardHighlight Enable highlighting of keys pressed on physical keyboard.\n * @property {boolean} physicalKeyboardHighlightPress Presses keys highlighted by physicalKeyboardHighlight\n * @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.\n * @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have.\n * @property {boolean} physicalKeyboardHighlightPressUseClick Whether physicalKeyboardHighlightPress should use clicks to trigger buttons.\n * @property {boolean} physicalKeyboardHighlightPressUsePointerEvents Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.\n * @property {boolean} physicalKeyboardHighlightPreventDefault Whether physicalKeyboardHighlight should use preventDefault to disable default browser actions.\n * @property {boolean} preventMouseDownDefault Calling preventDefault for the mousedown events keeps the focus on the input.\n * @property {boolean} preventMouseUpDefault Calling preventDefault for the mouseup events.\n * @property {boolean} stopMouseDownPropagation Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.\n * @property {boolean} stopMouseUpPropagation Stops pointer up events on simple-keyboard buttons from bubbling to parent elements.\n * @property {function(button: string):string} onKeyPress Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”).\n * @property {function(input: string):string} onChange Executes the callback function on input change. Returns the current input’s string.\n * @property {function} onRender Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n * @property {function} onInit Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n * @property {function(inputs: object):object} onChangeAll Executes the callback function on input change. Returns the input object with all defined inputs.\n * @property {boolean} useButtonTag Render buttons as a button element instead of a div element.\n * @property {boolean} disableCaretPositioning A prop to ensure characters are always be added/removed at the end of the string.\n * @property {object} inputPattern Restrains input(s) change to the defined regular expression pattern.\n * @property {boolean} useTouchEvents Instructs simple-keyboard to use touch events instead of click events.\n * @property {boolean} autoUseTouchEvents Enable useTouchEvents automatically when touch device is detected.\n * @property {boolean} useMouseEvents Opt out of PointerEvents handling, falling back to the prior mouse event logic.\n * @property {function} destroy Clears keyboard listeners and DOM elements.\n * @property {boolean} disableButtonHold Disable button hold action.\n * @property {boolean} rtl Adds unicode right-to-left control characters to input return values.\n * @property {function} onKeyReleased Executes the callback function on key release.\n * @property {array} modules Module classes to be loaded by simple-keyboard.\n * @property {boolean} enableLayoutCandidates Enable input method editor candidate list support.\n * @property {object} excludeFromLayout Buttons to exclude from layout\n * @property {number} layoutCandidatesPageSize Determines size of layout candidate list\n * @property {boolean} layoutCandidatesCaseSensitiveMatch Determines whether layout candidate match should be case sensitive.\n * @property {boolean} disableCandidateNormalization Disables the automatic normalization for selected layout candidates\n * @property {boolean} enableLayoutCandidatesKeyPress Enables onKeyPress triggering for layoutCandidate items\n */\n this.options = {\n layoutName: \"default\",\n theme: \"hg-theme-default\",\n inputName: \"default\",\n preventMouseDownDefault: false,\n enableLayoutCandidates: true,\n excludeFromLayout: {},\n ...options,\n };\n\n /**\n * @type {object} Classes identifying loaded plugins\n */\n this.keyboardPluginClasses = \"\";\n\n /**\n * Bindings\n */\n Utilities.bindMethods(SimpleKeyboard, this);\n\n /**\n * simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).\n * This removes any dependency to input DOM elements. You can type and directly display the value in a div element, for example.\n * @example\n * // To get entered input\n * const input = keyboard.getInput();\n *\n * // To clear entered input.\n * keyboard.clearInput();\n *\n * @type {object}\n * @property {object} default Default SimpleKeyboard internal input.\n * @property {object} myInputName Example input that can be set through `options.inputName:\"myInputName\"`.\n */\n const { inputName = this.defaultName } = this.options;\n this.input = {};\n this.input[inputName] = \"\";\n\n /**\n * @type {string} DOM class of the keyboard wrapper, normally \"simple-keyboard\" by default.\n */\n this.keyboardDOMClass = keyboardDOMClass;\n\n /**\n * @type {object} Contains the DOM elements of every rendered button, the key being the button's layout name (e.g.: \"{enter}\").\n */\n this.buttonElements = {};\n\n /**\n * Simple-keyboard Instances\n * This enables multiple simple-keyboard support with easier management\n */\n if (!window[\"SimpleKeyboardInstances\"])\n window[\"SimpleKeyboardInstances\"] = {};\n\n this.currentInstanceName = this.utilities.camelCase(this.keyboardDOMClass);\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = this;\n\n /**\n * Instance vars\n */\n this.allKeyboardInstances = window[\"SimpleKeyboardInstances\"];\n this.keyboardInstanceNames = Object.keys(window[\"SimpleKeyboardInstances\"]);\n this.isFirstKeyboardInstance =\n this.keyboardInstanceNames[0] === this.currentInstanceName;\n\n /**\n * Physical Keyboard support\n */\n this.physicalKeyboard = new PhysicalKeyboard({\n dispatch: this.dispatch,\n getOptions: this.getOptions,\n });\n\n /**\n * Initializing CandidateBox\n */\n this.candidateBox = this.options.enableLayoutCandidates\n ? new CandidateBox({\n utilities: this.utilities,\n options: this.options,\n })\n : null;\n\n /**\n * Rendering keyboard\n */\n if (this.keyboardDOM) this.render();\n else {\n console.warn(`\".${keyboardDOMClass}\" was not found in the DOM.`);\n throw new Error(\"KEYBOARD_DOM_ERROR\");\n }\n\n /**\n * Modules\n */\n this.modules = {};\n this.loadModules();\n }\n\n /**\n * parseParams\n */\n handleParams = (\n selectorOrOptions?: string | HTMLDivElement | KeyboardOptions,\n keyboardOptions?: KeyboardOptions\n ): {\n keyboardDOMClass: string;\n keyboardDOM: KeyboardElement;\n options: Partial;\n } => {\n let keyboardDOMClass;\n let keyboardDOM;\n let options;\n\n /**\n * If first parameter is a string:\n * Consider it as an element's class\n */\n if (typeof selectorOrOptions === \"string\") {\n keyboardDOMClass = selectorOrOptions.split(\".\").join(\"\");\n keyboardDOM = document.querySelector(\n `.${keyboardDOMClass}`\n ) as KeyboardElement;\n options = keyboardOptions;\n\n /**\n * If first parameter is an KeyboardElement\n * Consider it as the keyboard DOM element\n */\n } else if (selectorOrOptions instanceof HTMLDivElement) {\n /**\n * This element must have a class, otherwise throw\n */\n if (!selectorOrOptions.className) {\n console.warn(\"Any DOM element passed as parameter must have a class.\");\n throw new Error(\"KEYBOARD_DOM_CLASS_ERROR\");\n }\n\n keyboardDOMClass = selectorOrOptions.className.split(\" \")[0];\n keyboardDOM = selectorOrOptions;\n options = keyboardOptions;\n\n /**\n * Otherwise, search for .simple-keyboard DOM element\n */\n } else {\n keyboardDOMClass = \"simple-keyboard\";\n keyboardDOM = document.querySelector(\n `.${keyboardDOMClass}`\n ) as KeyboardElement;\n options = selectorOrOptions;\n }\n\n return {\n keyboardDOMClass,\n keyboardDOM,\n options,\n };\n };\n\n /**\n * Getters\n */\n getOptions = (): KeyboardOptions => this.options;\n getCaretPosition = (): number | null => this.caretPosition;\n getCaretPositionEnd = (): number | null => this.caretPositionEnd;\n\n /**\n * Changes the internal caret position\n * @param {number} position The caret's start position\n * @param {number} positionEnd The caret's end position\n */\n setCaretPosition(position: number | null, endPosition = position): void {\n this.caretPosition = position;\n this.caretPositionEnd = endPosition;\n }\n\n /**\n * Retrieve the candidates for a given input\n * @param input The input string to check\n */\n getInputCandidates(\n input: string\n ): { candidateKey: string; candidateValue: string } | Record {\n const {\n layoutCandidates: layoutCandidatesObj,\n layoutCandidatesCaseSensitiveMatch,\n } = this.options;\n\n if (!layoutCandidatesObj || typeof layoutCandidatesObj !== \"object\") {\n return {};\n }\n\n const layoutCandidates = Object.keys(layoutCandidatesObj).filter(\n (layoutCandidate: string) => {\n const inputSubstr =\n input.substring(0, this.getCaretPositionEnd() || 0) || input;\n const regexp = new RegExp(\n `${this.utilities.escapeRegex(layoutCandidate)}$`,\n layoutCandidatesCaseSensitiveMatch ? \"g\" : \"gi\"\n );\n const matches = [...inputSubstr.matchAll(regexp)];\n return !!matches.length;\n }\n );\n\n if (layoutCandidates.length > 1) {\n const candidateKey = layoutCandidates.sort(\n (a, b) => b.length - a.length\n )[0];\n return {\n candidateKey,\n candidateValue: layoutCandidatesObj[candidateKey],\n };\n } else if (layoutCandidates.length) {\n const candidateKey = layoutCandidates[0];\n return {\n candidateKey,\n candidateValue: layoutCandidatesObj[candidateKey],\n };\n } else {\n return {};\n }\n }\n\n /**\n * Shows a suggestion box with a list of candidate words\n * @param candidates The chosen candidates string as defined in the layoutCandidates option\n * @param targetElement The element next to which the candidates box will be shown\n */\n showCandidatesBox(\n candidateKey: string,\n candidateValue: string,\n targetElement: KeyboardElement\n ): void {\n if (this.candidateBox) {\n this.candidateBox.show({\n candidateValue,\n targetElement,\n onSelect: (selectedCandidate: string, e: MouseEvent) => {\n const {\n layoutCandidatesCaseSensitiveMatch,\n disableCandidateNormalization,\n enableLayoutCandidatesKeyPress\n } = this.options;\n\n let candidateStr = selectedCandidate;\n\n if(!disableCandidateNormalization) {\n /**\n * Making sure that our suggestions are not composed characters\n */\n candidateStr = selectedCandidate.normalize(\"NFD\");\n }\n\n const currentInput = this.getInput(this.options.inputName, true);\n const initialCaretPosition = this.getCaretPositionEnd() || 0;\n const inputSubstr =\n currentInput.substring(0, initialCaretPosition || 0) ||\n currentInput;\n\n const regexp = new RegExp(\n `${this.utilities.escapeRegex(candidateKey)}$`,\n layoutCandidatesCaseSensitiveMatch ? \"g\" : \"gi\"\n );\n const newInputSubstr = inputSubstr.replace(\n regexp,\n candidateStr\n );\n const newInput = currentInput.replace(inputSubstr, newInputSubstr);\n\n const caretPositionDiff = newInputSubstr.length - inputSubstr.length;\n let newCaretPosition =\n (initialCaretPosition || currentInput.length) + caretPositionDiff;\n\n if (newCaretPosition < 0) newCaretPosition = 0;\n\n this.setInput(newInput, this.options.inputName, true);\n this.setCaretPosition(newCaretPosition);\n\n /**\n * Calling onKeyPress\n * We pass in the composed candidate instead of the decomposed one\n * To prevent confusion for users\n */\n if (enableLayoutCandidatesKeyPress && typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(selectedCandidate, e);\n\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(\n this.getInput(this.options.inputName, true),\n e\n );\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.getAllInputs(), e);\n },\n });\n }\n }\n\n /**\n * Handles clicks made to keyboard buttons\n * @param {string} button The button's layout name.\n */\n handleButtonClicked(button: string, e?: KeyboardHandlerEvent): void {\n const { inputName = this.defaultName, debug } = this.options;\n /**\n * Ignoring placeholder buttons\n */\n if (button === \"{//}\") return;\n\n /**\n * Creating inputName if it doesn't exist\n */\n if (!this.input[inputName]) this.input[inputName] = \"\";\n\n /**\n * Calculating new input\n */\n const updatedInput = this.utilities.getUpdatedInput(\n button,\n this.input[inputName],\n this.caretPosition,\n this.caretPositionEnd\n );\n\n /**\n * EDGE CASE: Check for whole input selection changes that will yield same updatedInput\n */\n if (this.utilities.isStandardButton(button) && this.activeInputElement) {\n const isEntireInputSelection =\n this.input[inputName] &&\n this.input[inputName] === updatedInput &&\n this.caretPosition === 0 &&\n this.caretPositionEnd === updatedInput.length;\n\n if (isEntireInputSelection) {\n this.setInput(\"\", this.options.inputName, true);\n this.setCaretPosition(0);\n this.activeInputElement.value = \"\";\n this.activeInputElement.setSelectionRange(0, 0);\n this.handleButtonClicked(button, e);\n return;\n }\n }\n\n /**\n * Calling onKeyPress\n */\n if (typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(button, e);\n\n if (\n // If input will change as a result of this button press\n this.input[inputName] !== updatedInput &&\n // This pertains to the \"inputPattern\" option:\n // If inputPattern isn't set\n (!this.options.inputPattern ||\n // Or, if it is set and if the pattern is valid - we proceed.\n (this.options.inputPattern && this.inputPatternIsValid(updatedInput)))\n ) {\n /**\n * If maxLength and handleMaxLength yield true, halting\n */\n if (\n this.options.maxLength &&\n this.utilities.handleMaxLength(this.input, updatedInput)\n ) {\n return;\n }\n\n /**\n * Updating input\n */\n const newInputValue = this.utilities.getUpdatedInput(\n button,\n this.input[inputName],\n this.caretPosition,\n this.caretPositionEnd,\n true\n );\n\n this.setInput(newInputValue, this.options.inputName, true);\n\n if (debug) console.log(\"Input changed:\", this.getAllInputs());\n\n if (this.options.debug) {\n console.log(\n \"Caret at: \",\n this.getCaretPosition(),\n this.getCaretPositionEnd(),\n `(${this.keyboardDOMClass})`,\n e?.type\n );\n }\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n\n /**\n * Calling onChange\n */\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(this.getInput(this.options.inputName, true), e);\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.getAllInputs(), e);\n\n /**\n * Check if this new input has candidates (suggested words)\n */\n if (e?.target && this.options.enableLayoutCandidates) {\n const { candidateKey, candidateValue } =\n this.getInputCandidates(updatedInput);\n\n if (candidateKey && candidateValue) {\n this.showCandidatesBox(\n candidateKey,\n candidateValue,\n this.keyboardDOM\n );\n } else {\n this.candidateBox?.destroy();\n }\n }\n }\n\n /**\n * After a button is clicked the selection (if any) will disappear\n * we should reflect this in our state, as applicable\n */\n if(this.caretPositionEnd && this.caretPosition !== this.caretPositionEnd){\n this.setCaretPosition(this.caretPositionEnd, this.caretPositionEnd);\n\n if(this.activeInputElement){\n this.activeInputElement.setSelectionRange(this.caretPositionEnd, this.caretPositionEnd);\n }\n \n if(this.options.debug){\n console.log(\"Caret position aligned\", this.caretPosition);\n }\n }\n\n if (debug) {\n console.log(\"Key pressed:\", button);\n }\n }\n\n /**\n * Get mouse hold state\n */\n getMouseHold() {\n return this.isMouseHold;\n }\n\n /**\n * Mark mouse hold state as set\n */\n setMouseHold(value: boolean) {\n if (this.options.syncInstanceInputs) {\n this.dispatch((instance: SimpleKeyboard) => {\n instance.isMouseHold = value;\n });\n } else {\n this.isMouseHold = value;\n }\n }\n\n /**\n * Handles button mousedown\n */\n /* istanbul ignore next */\n handleButtonMouseDown(button: string, e: KeyboardHandlerEvent): void {\n if (e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n if (this.options.stopMouseDownPropagation) e.stopPropagation();\n\n /**\n * Add active class\n */\n e.target.classList.add(this.activeButtonClass);\n }\n\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n if (this.holdTimeout) clearTimeout(this.holdTimeout);\n\n /**\n * @type {boolean} Whether the mouse is being held onKeyPress\n */\n this.setMouseHold(true);\n\n /**\n * @type {object} Time to wait until a key hold is detected\n */\n if (!this.options.disableButtonHold) {\n this.holdTimeout = window.setTimeout(() => {\n if (\n (this.getMouseHold() &&\n // TODO: This needs to be configurable through options\n ((!button.includes(\"{\") && !button.includes(\"}\")) ||\n button === \"{delete}\" ||\n button === \"{backspace}\" ||\n button === \"{bksp}\" ||\n button === \"{space}\" ||\n button === \"{tab}\")) ||\n button === \"{arrowright}\" ||\n button === \"{arrowleft}\" ||\n button === \"{arrowup}\" ||\n button === \"{arrowdown}\"\n ) {\n if (this.options.debug) console.log(\"Button held:\", button);\n\n this.handleButtonHold(button);\n }\n clearTimeout(this.holdTimeout);\n }, 500);\n }\n }\n\n /**\n * Handles button mouseup\n */\n handleButtonMouseUp(button?: string, e?: KeyboardHandlerEvent): void {\n if (e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseUpDefault && e.preventDefault)\n e.preventDefault();\n if (this.options.stopMouseUpPropagation && e.stopPropagation)\n e.stopPropagation();\n\n /* istanbul ignore next */\n const isKeyboard =\n e.target === this.keyboardDOM ||\n (e.target && this.keyboardDOM.contains(e.target)) ||\n (this.candidateBox &&\n this.candidateBox.candidateBoxElement &&\n (e.target === this.candidateBox.candidateBoxElement ||\n (e.target &&\n this.candidateBox.candidateBoxElement.contains(e.target))));\n\n /**\n * On click outside, remove candidateBox\n */\n if (!isKeyboard && this.candidateBox) {\n this.candidateBox.destroy();\n }\n }\n\n /**\n * Remove active class\n */\n this.recurseButtons((buttonElement: Element) => {\n buttonElement.classList.remove(this.activeButtonClass);\n });\n\n this.setMouseHold(false);\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * Calling onKeyReleased\n */\n if (button && typeof this.options.onKeyReleased === \"function\")\n this.options.onKeyReleased(button, e);\n }\n\n /**\n * Handles container mousedown\n */\n handleKeyboardContainerMouseDown(e: KeyboardHandlerEvent): void {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n }\n\n /**\n * Handles button hold\n */\n /* istanbul ignore next */\n handleButtonHold(button: string): void {\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * @type {object} Timeout dictating the speed of key hold iterations\n */\n this.holdInteractionTimeout = window.setTimeout(() => {\n if (this.getMouseHold()) {\n this.handleButtonClicked(button);\n this.handleButtonHold(button);\n } else {\n clearTimeout(this.holdInteractionTimeout);\n }\n }, 100);\n }\n\n /**\n * Send a command to all simple-keyboard instances (if you have several instances).\n */\n syncInstanceInputs(): void {\n this.dispatch((instance: SimpleKeyboard) => {\n instance.replaceInput(this.input);\n instance.setCaretPosition(this.caretPosition, this.caretPositionEnd);\n });\n }\n\n /**\n * Clear the keyboard’s input.\n * @param {string} [inputName] optional - the internal input to select\n */\n clearInput(\n inputName: string = this.options.inputName || this.defaultName\n ): void {\n this.input[inputName] = \"\";\n\n /**\n * Reset caretPosition\n */\n this.setCaretPosition(0);\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Get the keyboard’s input (You can also get it from the onChange prop).\n * @param {string} [inputName] optional - the internal input to select\n */\n getInput(\n inputName: string = this.options.inputName || this.defaultName,\n skipSync = false\n ): string {\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs && !skipSync) this.syncInstanceInputs();\n\n if (this.options.rtl) {\n // Remove existing control chars\n const inputWithoutRTLControl = this.input[inputName]\n .replace(\"\\u202B\", \"\")\n .replace(\"\\u202C\", \"\");\n\n return \"\\u202B\" + inputWithoutRTLControl + \"\\u202C\";\n } else {\n return this.input[inputName];\n }\n }\n\n /**\n * Get all simple-keyboard inputs\n */\n getAllInputs(): KeyboardInput {\n const output = {};\n const inputNames = Object.keys(this.input);\n\n inputNames.forEach((inputName) => {\n output[inputName] = this.getInput(inputName, true);\n });\n\n return output;\n }\n\n /**\n * Set the keyboard’s input.\n * @param {string} input the input value\n * @param {string} inputName optional - the internal input to select\n */\n setInput(\n input: string,\n inputName: string = this.options.inputName || this.defaultName,\n skipSync?: boolean\n ): void {\n this.input[inputName] = input;\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (!skipSync && this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Replace the input object (`keyboard.input`)\n * @param {object} inputObj The input object\n */\n replaceInput(inputObj: KeyboardInput): void {\n this.input = inputObj;\n }\n\n /**\n * Set new option or modify existing ones after initialization.\n * @param {object} options The options to set\n */\n setOptions(options = {}): void {\n const changedOptions = this.changedOptions(options);\n this.options = Object.assign(this.options, options);\n\n if (changedOptions.length) {\n if (this.options.debug) {\n console.log(\"changedOptions\", changedOptions);\n }\n\n /**\n * Some option changes require adjustments before re-render\n */\n this.onSetOptions(changedOptions);\n\n /**\n * Rendering\n */\n this.render();\n }\n }\n\n /**\n * Detecting changes to non-function options\n * This allows us to ascertain whether a button re-render is needed\n */\n changedOptions(newOptions: Partial): string[] {\n return Object.keys(newOptions).filter(\n (optionName) =>\n JSON.stringify(newOptions[optionName]) !==\n JSON.stringify(this.options[optionName])\n );\n }\n\n /**\n * Executing actions depending on changed options\n * @param {object} options The options to set\n */\n onSetOptions(changedOptions: string[] = []): void {\n /**\n * Changed: layoutName\n */\n if (changedOptions.includes(\"layoutName\")) {\n /**\n * Reset candidateBox\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n }\n }\n\n /**\n * Changed: layoutCandidatesPageSize, layoutCandidates\n */\n if (\n changedOptions.includes(\"layoutCandidatesPageSize\") ||\n changedOptions.includes(\"layoutCandidates\")\n ) {\n /**\n * Reset and recreate candidateBox\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n this.candidateBox = new CandidateBox({\n utilities: this.utilities,\n options: this.options,\n });\n }\n }\n }\n\n /**\n * Remove all keyboard rows and reset keyboard values.\n * Used internally between re-renders.\n */\n resetRows(): void {\n if (this.keyboardRowsDOM) {\n this.keyboardRowsDOM.remove();\n }\n\n this.keyboardDOM.className = this.keyboardDOMClass;\n this.keyboardDOM.setAttribute(\"data-skInstance\", this.currentInstanceName);\n this.buttonElements = {};\n }\n\n /**\n * Send a command to all simple-keyboard instances at once (if you have multiple instances).\n * @param {function(instance: object, key: string)} callback Function to run on every instance\n */\n // eslint-disable-next-line no-unused-vars\n dispatch(callback: (instance: SimpleKeyboard, key?: string) => void): void {\n if (!window[\"SimpleKeyboardInstances\"]) {\n console.warn(\n `SimpleKeyboardInstances is not defined. Dispatch cannot be called.`\n );\n throw new Error(\"INSTANCES_VAR_ERROR\");\n }\n\n return Object.keys(window[\"SimpleKeyboardInstances\"]).forEach((key) => {\n callback(window[\"SimpleKeyboardInstances\"][key], key);\n });\n }\n\n /**\n * Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n addButtonTheme(buttons: string, className: string): void {\n if (!className || !buttons) return;\n\n buttons.split(\" \").forEach((button) => {\n className.split(\" \").forEach((classNameItem) => {\n if (!this.options.buttonTheme) this.options.buttonTheme = [];\n\n let classNameFound = false;\n\n /**\n * If class is already defined, we add button to class definition\n */\n this.options.buttonTheme.map((buttonTheme) => {\n if (buttonTheme?.class.split(\" \").includes(classNameItem)) {\n classNameFound = true;\n\n const buttonThemeArray = buttonTheme.buttons.split(\" \");\n if (!buttonThemeArray.includes(button)) {\n classNameFound = true;\n buttonThemeArray.push(button);\n buttonTheme.buttons = buttonThemeArray.join(\" \");\n }\n }\n return buttonTheme;\n });\n\n /**\n * If class is not defined, we create a new entry\n */\n if (!classNameFound) {\n this.options.buttonTheme.push({\n class: classNameItem,\n buttons: buttons,\n });\n }\n });\n });\n\n this.render();\n }\n\n /**\n * Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n removeButtonTheme(buttons: string, className: string): void {\n /**\n * When called with empty parameters, remove all button themes\n */\n if (!buttons && !className) {\n this.options.buttonTheme = [];\n this.render();\n return;\n }\n\n /**\n * If buttons are passed and buttonTheme has items\n */\n if (\n buttons &&\n Array.isArray(this.options.buttonTheme) &&\n this.options.buttonTheme.length\n ) {\n const buttonArray = buttons.split(\" \");\n buttonArray.forEach((button) => {\n this.options?.buttonTheme?.map((buttonTheme, index) => {\n /**\n * If className is set, we affect the buttons only for that class\n * Otherwise, we afect all classes\n */\n if (\n (buttonTheme &&\n className &&\n className.includes(buttonTheme.class)) ||\n !className\n ) {\n const filteredButtonArray = buttonTheme?.buttons\n .split(\" \")\n .filter((item) => item !== button);\n\n /**\n * If buttons left, return them, otherwise, remove button Theme\n */\n if (buttonTheme && filteredButtonArray?.length) {\n buttonTheme.buttons = filteredButtonArray.join(\" \");\n } else {\n this.options.buttonTheme?.splice(index, 1);\n buttonTheme = null;\n }\n }\n\n return buttonTheme;\n });\n });\n\n this.render();\n }\n }\n\n /**\n * Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned.\n * @param {string} button The button layout name to select\n */\n getButtonElement(\n button: string\n ): KeyboardElement | KeyboardElement[] | undefined {\n let output;\n\n const buttonArr = this.buttonElements[button];\n if (buttonArr) {\n if (buttonArr.length > 1) {\n output = buttonArr;\n } else {\n output = buttonArr[0];\n }\n }\n\n return output;\n }\n\n /**\n * This handles the \"inputPattern\" option\n * by checking if the provided inputPattern passes\n */\n inputPatternIsValid(inputVal: string): boolean {\n const inputPatternRaw = this.options.inputPattern;\n let inputPattern;\n\n /**\n * Check if input pattern is global or targeted to individual inputs\n */\n if (inputPatternRaw instanceof RegExp) {\n inputPattern = inputPatternRaw;\n } else {\n inputPattern =\n inputPatternRaw[this.options.inputName || this.defaultName];\n }\n\n if (inputPattern && inputVal) {\n const didInputMatch = inputPattern.test(inputVal);\n\n if (this.options.debug) {\n console.log(\n `inputPattern (\"${inputPattern}\"): ${\n didInputMatch ? \"passed\" : \"did not pass!\"\n }`\n );\n }\n\n return didInputMatch;\n } else {\n /**\n * inputPattern doesn't seem to be set for the current input, or input is empty. Pass.\n */\n return true;\n }\n }\n\n /**\n * Handles simple-keyboard event listeners\n */\n setEventListeners(): void {\n /**\n * Only first instance should set the event listeners\n */\n if (this.isFirstKeyboardInstance || !this.allKeyboardInstances) {\n if (this.options.debug) {\n console.log(`Caret handling started (${this.keyboardDOMClass})`);\n }\n\n const { physicalKeyboardHighlightPreventDefault = false } = this.options;\n\n /**\n * Event Listeners\n */\n document.addEventListener(\"keyup\", this.handleKeyUp, physicalKeyboardHighlightPreventDefault);\n document.addEventListener(\"keydown\", this.handleKeyDown, physicalKeyboardHighlightPreventDefault);\n document.addEventListener(\"mouseup\", this.handleMouseUp);\n document.addEventListener(\"touchend\", this.handleTouchEnd);\n document.addEventListener(\"selectionchange\", this.handleSelectionChange);\n document.addEventListener(\"select\", this.handleSelect);\n }\n }\n\n /**\n * Event Handler: KeyUp\n */\n handleKeyUp(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyUp(event);\n }\n }\n\n /**\n * Event Handler: KeyDown\n */\n handleKeyDown(event: KeyboardHandlerEvent): void {\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyDown(event);\n }\n }\n\n /**\n * Event Handler: MouseUp\n */\n handleMouseUp(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: TouchEnd\n */\n /* istanbul ignore next */\n handleTouchEnd(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: Select\n */\n /* istanbul ignore next */\n handleSelect(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: SelectionChange\n */\n /* istanbul ignore next */\n handleSelectionChange(event: KeyboardHandlerEvent): void {\n /**\n * Firefox is not reporting the correct caret position through this event\n * https://github.com/hodgef/simple-keyboard/issues/1839\n */\n if(navigator.userAgent.includes('Firefox')){\n return;\n }\n this.caretEventHandler(event);\n }\n\n /**\n * Called by {@link setEventListeners} when an event that warrants a cursor position update is triggered\n */\n caretEventHandler(event: KeyboardHandlerEvent): void {\n let targetTagName: string;\n if (event.target.tagName) {\n targetTagName = event.target.tagName.toLowerCase();\n }\n\n this.dispatch((instance) => {\n let isKeyboard =\n event.target === instance.keyboardDOM ||\n (event.target && instance.keyboardDOM.contains(event.target));\n\n /**\n * If syncInstanceInputs option is enabled, make isKeyboard match any instance\n * not just the current one\n */\n if (this.options.syncInstanceInputs && Array.isArray(event.path)) {\n isKeyboard = event.path.some((item: HTMLElement) =>\n item?.hasAttribute?.(\"data-skInstance\")\n );\n }\n\n if (\n (targetTagName === \"textarea\" ||\n (targetTagName === \"input\" &&\n [\"text\", \"search\", \"url\", \"tel\", \"password\"].includes(\n event.target.type\n ))) &&\n !instance.options.disableCaretPositioning\n ) {\n /**\n * Tracks current cursor position\n * As keys are pressed, text will be added/removed at that position within the input.\n */\n let selectionStart = event.target.selectionStart;\n let selectionEnd = event.target.selectionEnd;\n\n if(instance.options.rtl){\n selectionStart = instance.utilities.getRtlOffset(selectionStart, instance.getInput());\n selectionEnd = instance.utilities.getRtlOffset(selectionEnd, instance.getInput());\n }\n\n instance.setCaretPosition(selectionStart, selectionEnd);\n\n /**\n * Tracking current input in order to handle caret positioning edge cases\n */\n this.activeInputElement = event.target;\n\n if (instance.options.debug) {\n console.log(\n \"Caret at: \",\n instance.getCaretPosition(),\n instance.getCaretPositionEnd(),\n event && event.target.tagName.toLowerCase(),\n `(${instance.keyboardDOMClass})`,\n event?.type\n );\n }\n } else if (\n (instance.options.disableCaretPositioning || !isKeyboard) &&\n event?.type !== \"selectionchange\"\n ) {\n /**\n * If we toggled off disableCaretPositioning, we must ensure caretPosition doesn't persist once reactivated.\n */\n instance.setCaretPosition(null);\n\n /**\n * Resetting activeInputElement\n */\n this.activeInputElement = null;\n\n if (instance.options.debug) {\n console.log(\n `Caret position reset due to \"${event?.type}\" event`,\n event\n );\n }\n }\n });\n }\n\n /**\n * Execute an operation on each button\n */\n recurseButtons(fn: any): void {\n if (!fn) return;\n\n Object.keys(this.buttonElements).forEach((buttonName) =>\n this.buttonElements[buttonName].forEach(fn)\n );\n }\n\n /**\n * Destroy keyboard listeners and DOM elements\n */\n destroy(): void {\n if (this.options.debug)\n console.log(\n `Destroying simple-keyboard instance: ${this.currentInstanceName}`\n );\n\n const { physicalKeyboardHighlightPreventDefault = false } = this.options;\n\n /**\n * Remove document listeners\n */\n document.removeEventListener(\"keyup\", this.handleKeyUp, physicalKeyboardHighlightPreventDefault);\n document.removeEventListener(\"keydown\", this.handleKeyDown, physicalKeyboardHighlightPreventDefault);\n document.removeEventListener(\"mouseup\", this.handleMouseUp);\n document.removeEventListener(\"touchend\", this.handleTouchEnd);\n document.removeEventListener(\"select\", this.handleSelect);\n document.removeEventListener(\"selectionchange\", this.handleSelectionChange);\n document.onpointerup = null;\n document.ontouchend = null;\n document.ontouchcancel = null;\n document.onmouseup = null;\n\n /**\n * Remove buttons\n */\n const deleteButton = (buttonElement: KeyboardElement | null) => {\n if (buttonElement) {\n buttonElement.onpointerdown = null;\n buttonElement.onpointerup = null;\n buttonElement.onpointercancel = null;\n buttonElement.ontouchstart = null;\n buttonElement.ontouchend = null;\n buttonElement.ontouchcancel = null;\n buttonElement.onclick = null;\n buttonElement.onmousedown = null;\n buttonElement.onmouseup = null;\n\n buttonElement.remove();\n buttonElement = null;\n }\n };\n\n this.recurseButtons(deleteButton);\n\n /**\n * Remove wrapper events\n */\n this.keyboardDOM.onpointerdown = null;\n this.keyboardDOM.ontouchstart = null;\n this.keyboardDOM.onmousedown = null;\n\n /**\n * Clearing keyboard rows\n */\n this.resetRows();\n\n /**\n * Candidate box\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n this.candidateBox = null;\n }\n\n /**\n * Clearing activeInputElement\n */\n this.activeInputElement = null;\n\n /**\n * Removing instance attribute\n */\n this.keyboardDOM.removeAttribute(\"data-skInstance\");\n\n /**\n * Clearing keyboardDOM\n */\n this.keyboardDOM.innerHTML = \"\";\n\n /**\n * Remove instance\n */\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = null;\n delete window[\"SimpleKeyboardInstances\"][this.currentInstanceName];\n\n /**\n * Reset initialized flag\n */\n this.initialized = false;\n }\n\n /**\n * Process buttonTheme option\n */\n getButtonThemeClasses(button: string): string[] {\n const buttonTheme = this.options.buttonTheme;\n let buttonClasses: string[] = [];\n\n if (Array.isArray(buttonTheme)) {\n buttonTheme.forEach((themeObj) => {\n if (\n themeObj &&\n themeObj.class &&\n typeof themeObj.class === \"string\" &&\n themeObj.buttons &&\n typeof themeObj.buttons === \"string\"\n ) {\n const themeObjClasses = themeObj.class.split(\" \");\n const themeObjButtons = themeObj.buttons.split(\" \");\n\n if (themeObjButtons.includes(button)) {\n buttonClasses = [...buttonClasses, ...themeObjClasses];\n }\n } else {\n console.warn(\n `Incorrect \"buttonTheme\". Please check the documentation.`,\n themeObj\n );\n }\n });\n }\n\n return buttonClasses;\n }\n\n /**\n * Process buttonAttributes option\n */\n setDOMButtonAttributes(button: string, callback: any): void {\n const buttonAttributes = this.options.buttonAttributes;\n\n if (Array.isArray(buttonAttributes)) {\n buttonAttributes.forEach((attrObj) => {\n if (\n attrObj.attribute &&\n typeof attrObj.attribute === \"string\" &&\n attrObj.value &&\n typeof attrObj.value === \"string\" &&\n attrObj.buttons &&\n typeof attrObj.buttons === \"string\"\n ) {\n const attrObjButtons = attrObj.buttons.split(\" \");\n\n if (attrObjButtons.includes(button)) {\n callback(attrObj.attribute, attrObj.value);\n }\n } else {\n console.warn(\n `Incorrect \"buttonAttributes\". Please check the documentation.`,\n attrObj\n );\n }\n });\n }\n }\n\n onTouchDeviceDetected() {\n /**\n * Processing autoTouchEvents\n */\n this.processAutoTouchEvents();\n\n /**\n * Disabling contextual window on touch devices\n */\n this.disableContextualWindow();\n }\n\n /**\n * Disabling contextual window for hg-button\n */\n /* istanbul ignore next */\n disableContextualWindow() {\n window.oncontextmenu = (event: KeyboardHandlerEvent) => {\n if (event.target.classList.contains(\"hg-button\")) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n };\n }\n\n /**\n * Process autoTouchEvents option\n */\n processAutoTouchEvents() {\n if (this.options.autoUseTouchEvents) {\n this.options.useTouchEvents = true;\n\n if (this.options.debug) {\n console.log(\n `autoUseTouchEvents: Touch device detected, useTouchEvents enabled.`\n );\n }\n }\n }\n\n /**\n * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n */\n onInit() {\n if (this.options.debug) {\n console.log(`${this.keyboardDOMClass} Initialized`);\n }\n\n /**\n * setEventListeners\n */\n this.setEventListeners();\n\n if (typeof this.options.onInit === \"function\") this.options.onInit(this);\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeFirstRender() {\n /**\n * Performing actions when touch device detected\n */\n if (this.utilities.isTouchDevice()) {\n this.onTouchDeviceDetected();\n }\n\n if (typeof this.options.beforeFirstRender === \"function\")\n this.options.beforeFirstRender(this);\n\n /**\n * Notify about PointerEvents usage\n */\n if (\n this.isFirstKeyboardInstance &&\n this.utilities.pointerEventsSupported() &&\n !this.options.useTouchEvents &&\n !this.options.useMouseEvents\n ) {\n if (this.options.debug) {\n console.log(\"Using PointerEvents as it is supported by this browser\");\n }\n }\n\n /**\n * Notify about touch events usage\n */\n if (this.options.useTouchEvents) {\n if (this.options.debug) {\n console.log(\n \"useTouchEvents has been enabled. Only touch events will be used.\"\n );\n }\n }\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeRender() {\n if (typeof this.options.beforeRender === \"function\")\n this.options.beforeRender(this);\n }\n\n /**\n * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n */\n onRender() {\n if (typeof this.options.onRender === \"function\")\n this.options.onRender(this);\n }\n\n /**\n * Executes the callback function once all modules have been loaded\n */\n onModulesLoaded() {\n if (typeof this.options.onModulesLoaded === \"function\")\n this.options.onModulesLoaded(this);\n }\n\n /**\n * Register module\n */\n registerModule = (name: string, initCallback: any) => {\n if (!this.modules[name]) this.modules[name] = {};\n\n initCallback(this.modules[name]);\n };\n\n /**\n * Load modules\n */\n loadModules() {\n if (Array.isArray(this.options.modules)) {\n this.options.modules.forEach((KeyboardModule) => {\n const keyboardModule = new KeyboardModule(this);\n keyboardModule.init && keyboardModule.init(this);\n });\n\n this.keyboardPluginClasses = \"modules-loaded\";\n\n this.render();\n this.onModulesLoaded();\n }\n }\n\n /**\n * Get module prop\n */\n getModuleProp(name: string, prop: string) {\n if (!this.modules[name]) return false;\n\n return this.modules[name][prop];\n }\n\n /**\n * getModulesList\n */\n getModulesList() {\n return Object.keys(this.modules);\n }\n\n /**\n * Parse Row DOM containers\n */\n parseRowDOMContainers(\n rowDOM: HTMLDivElement,\n rowIndex: number,\n containerStartIndexes: number[],\n containerEndIndexes: number[]\n ) {\n const rowDOMArray = Array.from(rowDOM.children);\n let removedElements = 0;\n\n if (rowDOMArray.length) {\n containerStartIndexes.forEach((startIndex, arrIndex) => {\n const endIndex = containerEndIndexes[arrIndex];\n\n /**\n * If there exists a respective end index\n * if end index comes after start index\n */\n if (!endIndex || !(endIndex > startIndex)) {\n return false;\n }\n\n /**\n * Updated startIndex, endIndex\n * This is since the removal of buttons to place a single button container\n * results in a modified array size\n */\n const updated_startIndex = startIndex - removedElements;\n const updated_endIndex = endIndex - removedElements;\n\n /**\n * Create button container\n */\n const containerDOM = document.createElement(\"div\");\n containerDOM.className += \"hg-button-container\";\n const containerUID = `${this.options.layoutName}-r${rowIndex}c${arrIndex}`;\n containerDOM.setAttribute(\"data-skUID\", containerUID);\n\n /**\n * Taking elements due to be inserted into container\n */\n const containedElements = rowDOMArray.splice(\n updated_startIndex,\n updated_endIndex - updated_startIndex + 1\n );\n removedElements = updated_endIndex - updated_startIndex;\n\n /**\n * Inserting elements to container\n */\n containedElements.forEach((element) =>\n containerDOM.appendChild(element)\n );\n\n /**\n * Adding container at correct position within rowDOMArray\n */\n rowDOMArray.splice(updated_startIndex, 0, containerDOM);\n\n /**\n * Clearing old rowDOM children structure\n */\n rowDOM.innerHTML = \"\";\n\n /**\n * Appending rowDOM new children list\n */\n rowDOMArray.forEach((element) => rowDOM.appendChild(element));\n\n if (this.options.debug) {\n console.log(\n \"rowDOMContainer\",\n containedElements,\n updated_startIndex,\n updated_endIndex,\n removedElements + 1\n );\n }\n });\n }\n\n return rowDOM;\n }\n\n /**\n * getKeyboardClassString\n */\n getKeyboardClassString = (...baseDOMClasses: any[]) => {\n const keyboardClasses = [this.keyboardDOMClass, ...baseDOMClasses].filter(\n (DOMClass) => !!DOMClass\n );\n\n return keyboardClasses.join(\" \");\n };\n\n /**\n * Renders rows and buttons as per options\n */\n render() {\n /**\n * Clear keyboard\n */\n this.resetRows();\n\n /**\n * Calling beforeFirstRender\n */\n if (!this.initialized) {\n this.beforeFirstRender();\n }\n\n /**\n * Calling beforeRender\n */\n this.beforeRender();\n\n const layoutClass = `hg-layout-${this.options.layoutName}`;\n const layout = this.options.layout || getDefaultLayout();\n const useTouchEvents = this.options.useTouchEvents || false;\n const useTouchEventsClass = useTouchEvents ? \"hg-touch-events\" : \"\";\n const useMouseEvents = this.options.useMouseEvents || false;\n const disableRowButtonContainers = this.options.disableRowButtonContainers;\n\n /**\n * Adding themeClass, layoutClass to keyboardDOM\n */\n this.keyboardDOM.className = this.getKeyboardClassString(\n this.options.theme,\n layoutClass,\n this.keyboardPluginClasses,\n useTouchEventsClass\n );\n\n /**\n * Adding keyboard identifier\n */\n this.keyboardDOM.setAttribute(\"data-skInstance\", this.currentInstanceName);\n\n /**\n * Create row wrapper\n */\n this.keyboardRowsDOM = document.createElement(\"div\");\n this.keyboardRowsDOM.className = \"hg-rows\";\n\n /**\n * Iterating through each row\n */\n layout[this.options.layoutName || this.defaultName].forEach(\n (row: string, rIndex: number) => {\n let rowArray = row.split(\" \");\n\n /**\n * Enforce excludeFromLayout\n */\n if (\n this.options.excludeFromLayout &&\n this.options.excludeFromLayout[\n this.options.layoutName || this.defaultName\n ]\n ) {\n rowArray = rowArray.filter(\n (buttonName) =>\n this.options.excludeFromLayout &&\n !this.options.excludeFromLayout[\n this.options.layoutName || this.defaultName\n ].includes(buttonName)\n );\n }\n\n /**\n * Creating empty row\n */\n let rowDOM = document.createElement(\"div\");\n rowDOM.className += \"hg-row\";\n\n /**\n * Tracking container indicators in rows\n */\n const containerStartIndexes: number[] = [];\n const containerEndIndexes: number[] = [];\n\n /**\n * Iterating through each button in row\n */\n rowArray.forEach((button, bIndex) => {\n /**\n * Check if button has a container indicator\n */\n const buttonHasContainerStart =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"[\") === 0;\n\n const buttonHasContainerEnd =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"]\") === button.length - 1;\n\n /**\n * Save container start index, if applicable\n */\n if (buttonHasContainerStart) {\n containerStartIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\[/g, \"\");\n }\n\n if (buttonHasContainerEnd) {\n containerEndIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\]/g, \"\");\n }\n\n /**\n * Processing button options\n */\n const fctBtnClass = this.utilities.getButtonClass(button);\n const buttonDisplayName = this.utilities.getButtonDisplayName(\n button,\n this.options.display,\n this.options.mergeDisplay\n );\n\n /**\n * Creating button\n */\n const buttonType = this.options.useButtonTag ? \"button\" : \"div\";\n const buttonDOM = document.createElement(buttonType);\n buttonDOM.className += `hg-button ${fctBtnClass}`;\n\n /**\n * Adding buttonTheme\n */\n buttonDOM.classList.add(...this.getButtonThemeClasses(button));\n\n /**\n * Adding buttonAttributes\n */\n this.setDOMButtonAttributes(\n button,\n (attribute: string, value: string) => {\n buttonDOM.setAttribute(attribute, value);\n }\n );\n\n this.activeButtonClass = \"hg-activeButton\";\n\n /**\n * Handle button click event\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n /**\n * Handle PointerEvents\n */\n buttonDOM.onpointerdown = (e: KeyboardHandlerEvent) => {\n this.handleButtonClicked(button, e);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onpointerup = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n buttonDOM.onpointercancel = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n } else {\n /**\n * Fallback for browsers not supporting PointerEvents\n */\n if (useTouchEvents) {\n /**\n * Handle touch events\n */\n buttonDOM.ontouchstart = (e: KeyboardHandlerEvent) => {\n this.handleButtonClicked(button, e);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.ontouchend = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n buttonDOM.ontouchcancel = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n } else {\n /**\n * Handle mouse events\n */\n buttonDOM.onclick = (e: KeyboardHandlerEvent) => {\n this.setMouseHold(false);\n /**\n * Fire button handler in onclick for compatibility reasons\n * This fires handler before onKeyReleased, therefore when that option is set we will fire the handler\n * in onmousedown instead\n */\n if (typeof this.options.onKeyReleased !== \"function\") {\n this.handleButtonClicked(button, e);\n }\n };\n buttonDOM.onmousedown = (e: KeyboardHandlerEvent) => {\n /**\n * Fire button handler for onKeyReleased use-case\n */\n if (\n typeof this.options.onKeyReleased === \"function\" &&\n !this.isMouseHold\n ) {\n this.handleButtonClicked(button, e);\n }\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onmouseup = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n }\n }\n\n /**\n * Adding identifier\n */\n buttonDOM.setAttribute(\"data-skBtn\", button);\n\n /**\n * Adding unique id\n * Since there's no limit on spawning same buttons, the unique id ensures you can style every button\n */\n const buttonUID = `${this.options.layoutName}-r${rIndex}b${bIndex}`;\n buttonDOM.setAttribute(\"data-skBtnUID\", buttonUID);\n\n /**\n * Adding button label to button\n */\n const buttonSpanDOM = document.createElement(\"span\");\n buttonSpanDOM.innerHTML = buttonDisplayName;\n buttonDOM.appendChild(buttonSpanDOM);\n\n /**\n * Adding to buttonElements\n */\n if (!this.buttonElements[button]) this.buttonElements[button] = [];\n\n this.buttonElements[button].push(buttonDOM);\n\n /**\n * Appending button to row\n */\n rowDOM.appendChild(buttonDOM);\n });\n\n /**\n * Parse containers in row\n */\n rowDOM = this.parseRowDOMContainers(\n rowDOM,\n rIndex,\n containerStartIndexes,\n containerEndIndexes\n );\n\n /**\n * Appending row to hg-rows\n */\n this.keyboardRowsDOM.appendChild(rowDOM);\n }\n );\n\n /**\n * Appending row to keyboard\n */\n this.keyboardDOM.appendChild(this.keyboardRowsDOM);\n\n /**\n * Calling onRender\n */\n this.onRender();\n\n if (!this.initialized) {\n /**\n * Ensures that onInit and beforeFirstRender are only called once per instantiation\n */\n this.initialized = true;\n\n /**\n * Handling parent events\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n document.onpointerup = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n this.keyboardDOM.onpointerdown = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n } else if (useTouchEvents) {\n /**\n * Handling ontouchend, ontouchcancel\n */\n document.ontouchend = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n document.ontouchcancel = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n\n this.keyboardDOM.ontouchstart = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n } else if (!useTouchEvents) {\n /**\n * Handling mouseup\n */\n document.onmouseup = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n this.keyboardDOM.onmousedown = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n }\n\n /**\n * Calling onInit\n */\n this.onInit();\n }\n }\n}\n\nexport default SimpleKeyboard;\n","export const getDefaultLayout = () => {\n return {\n default: [\n \"` 1 2 3 4 5 6 7 8 9 0 - = {bksp}\",\n \"{tab} q w e r t y u i o p [ ] \\\\\",\n \"{lock} a s d f g h j k l ; ' {enter}\",\n \"{shift} z x c v b n m , . / {shift}\",\n \".com @ {space}\",\n ],\n shift: [\n \"~ ! @ # $ % ^ & * ( ) _ + {bksp}\",\n \"{tab} Q W E R T Y U I O P { } |\",\n '{lock} A S D F G H J K L : \" {enter}',\n \"{shift} Z X C V B N M < > ? {shift}\",\n \".com @ {space}\",\n ],\n };\n};\n","import SimpleKeyboard from \"./components/Keyboard\";\nexport { SimpleKeyboard };\nexport default SimpleKeyboard;\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Utilities","_ref","getOptions","getCaretPosition","getCaretPositionEnd","dispatch","_classCallCheck","_defineProperty","button","length","this","bindMethods","value","includes","buttonTypeClass","getButtonType","buttonWithoutBraces","replace","buttonNormalized","concat","display","arguments","undefined","assign","getDefaultDiplay","input","caretPos","caretPosEnd","moveCaret","options","commonParams","output","removeAt","apply","removeForwardsAt","addStringAt","tabCharOnTab","newLineOnEnter","Number","isInteger","debug","console","log","minus","newCaretPos","updateCaretPosAction","instance","setCaretPosition","caretPosition","source","str","position","positionEnd","slice","join","isMaxLengthReached","updateCaretPos","emojiMatchedReg","substring","match","substr","inputObj","updatedInput","maxLength","currentInput","inputName","condition","maxLengthReached","_typeof","Boolean","window","navigator","maxTouchPoints","PointerEvent","toLowerCase","trim","split","reduce","word","toUpperCase","arr","size","_toConsumableArray","Array","Math","ceil","map","_","i","index","newIndex","startMarkerIndex","indexOf","myClass","_step","_iterator","_createForOfIteratorHelper","getOwnPropertyNames","s","n","done","myMethod","bind","err","e","f","PhysicalKeyboard","_this","altKey","ctrlKey","shiftKey","code","keyCodeToKey","keyCode","physicalKeyboardHighlightPreventDefault","isModifierKey","preventDefault","stopImmediatePropagation","buttonPressed","getSimpleKeyboardLayoutKey","buttonDOM","buttonName","standardButtonPressed","getButtonElement","functionButtonPressed","_buttonDOM$","_buttonDOM$$onpointer","_buttonDOM","_buttonDOM$onpointerd","applyButtonStyle","buttonElement","style","background","physicalKeyboardHighlightBgColor","color","physicalKeyboardHighlightTextColor","isArray","forEach","physicalKeyboardHighlightPress","physicalKeyboardHighlightPressUsePointerEvents","onpointerdown","physicalKeyboardHighlightPressUseClick","_buttonDOM$2","click","handleButtonClicked","_buttonDOM$3","_buttonDOM$3$onpointe","_buttonDOM$onpointeru","removeAttribute","onpointerup","_output","keyId","CandidateBox","utilities","pageSize","layoutCandidatesPageSize","candidateBoxElement","remove","pageIndex","_ref2","candidateValue","targetElement","onSelect","candidateListPages","chunkArray","renderPage","nbPages","onItemSelected","selectedCandidate","destroy","_ref3","_this$candidateBoxEle","_this2","document","createElement","className","candidateListULElement","candidateListItem","_this2$options$displa","candidateListLIElement","getMouseEvent","mouseEvent","useTouchEvents","TouchEvent","MouseEvent","innerHTML","ontouchstart","onclick","appendChild","isPrevBtnElementActive","prevBtnElement","classList","add","prevBtnElementClickAction","isNextBtnElementActive","nextBtnElement","nextBtnElementClickAction","prepend","SimpleKeyboard","selectorOrOptions","keyboardOptions","keyboardDOMClass","keyboardDOM","querySelector","HTMLDivElement","warn","Error","caretPositionEnd","name","initCallback","modules","_len","baseDOMClasses","_key","filter","DOMClass","_this$handleParams","handleParams","_this$handleParams$op","_objectSpread","layoutName","theme","preventMouseDownDefault","enableLayoutCandidates","excludeFromLayout","keyboardPluginClasses","_this$options$inputNa","defaultName","buttonElements","currentInstanceName","camelCase","allKeyboardInstances","keyboardInstanceNames","keys","isFirstKeyboardInstance","physicalKeyboard","candidateBox","render","loadModules","endPosition","_this$options","layoutCandidatesObj","layoutCandidates","layoutCandidatesCaseSensitiveMatch","layoutCandidate","inputSubstr","regexp","RegExp","escapeRegex","matchAll","candidateKey","sort","a","b","_this3","show","_this3$options","disableCandidateNormalization","enableLayoutCandidatesKeyPress","candidateStr","normalize","getInput","initialCaretPosition","newInputSubstr","newInput","caretPositionDiff","newCaretPosition","setInput","onKeyPress","onChange","onChangeAll","getAllInputs","_this$options2","_this$options2$inputN","getUpdatedInput","isStandardButton","activeInputElement","setSelectionRange","inputPattern","inputPatternIsValid","handleMaxLength","newInputValue","type","syncInstanceInputs","target","_this$candidateBox","_this$getInputCandida","getInputCandidates","showCandidatesBox","isMouseHold","_this4","stopMouseDownPropagation","stopPropagation","activeButtonClass","holdInteractionTimeout","clearTimeout","holdTimeout","setMouseHold","disableButtonHold","setTimeout","getMouseHold","handleButtonHold","_this5","preventMouseUpDefault","stopMouseUpPropagation","contains","recurseButtons","onKeyReleased","_this6","_this7","replaceInput","skipSync","rtl","_this8","changedOptions","onSetOptions","newOptions","_this9","optionName","JSON","stringify","keyboardRowsDOM","setAttribute","callback","buttons","_this10","classNameItem","buttonTheme","classNameFound","buttonThemeArray","push","class","_this11","_this11$options","_buttonTheme","_this11$options$butto","filteredButtonArray","item","splice","buttonArr","inputVal","inputPatternRaw","didInputMatch","test","_this$options$physica","addEventListener","handleKeyUp","handleKeyDown","handleMouseUp","handleTouchEnd","handleSelectionChange","handleSelect","event","caretEventHandler","physicalKeyboardHighlight","handleHighlightKeyUp","handleHighlightKeyDown","userAgent","targetTagName","_this12","tagName","isKeyboard","path","some","_item$hasAttribute","hasAttribute","disableCaretPositioning","selectionStart","selectionEnd","getRtlOffset","fn","_this13","_this$options$physica2","removeEventListener","ontouchend","ontouchcancel","onmouseup","onpointercancel","onmousedown","resetRows","initialized","buttonClasses","themeObj","themeObjClasses","buttonAttributes","attrObj","attribute","processAutoTouchEvents","disableContextualWindow","oncontextmenu","autoUseTouchEvents","setEventListeners","onInit","isTouchDevice","onTouchDeviceDetected","beforeFirstRender","pointerEventsSupported","useMouseEvents","beforeRender","onRender","onModulesLoaded","_this14","KeyboardModule","keyboardModule","init","rowDOM","rowIndex","containerStartIndexes","containerEndIndexes","_this15","rowDOMArray","from","children","removedElements","startIndex","arrIndex","endIndex","updated_startIndex","updated_endIndex","containerDOM","containerUID","containedElements","element","_this16","layoutClass","layout","default","shift","useTouchEventsClass","disableRowButtonContainers","getKeyboardClassString","row","rIndex","rowArray","bIndex","_buttonDOM$classList","buttonHasContainerStart","buttonHasContainerEnd","fctBtnClass","getButtonClass","buttonDisplayName","getButtonDisplayName","mergeDisplay","buttonType","useButtonTag","getButtonThemeClasses","setDOMButtonAttributes","handleButtonMouseDown","handleButtonMouseUp","buttonUID","buttonSpanDOM","parseRowDOMContainers","handleKeyboardContainerMouseDown"],"sourceRoot":""} \ No newline at end of file diff --git a/build/index.modern.js b/build/index.modern.js index 4e47ed6e6..06519299d 100644 --- a/build/index.modern.js +++ b/build/index.modern.js @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v3.7.68 (index.modern.js - Modern Browsers bundle) + * simple-keyboard v3.7.69 (index.modern.js - Modern Browsers bundle) * https://github.com/hodgef/simple-keyboard * * NOTE: This modern browsers bundle (index.modern.js) removes all polyfills @@ -13,5 +13,5 @@ * LICENSE file in the root directory of this source tree. * */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SimpleKeyboard=e():t.SimpleKeyboard=e()}(this,(function(){return function(){"use strict";var t={d:function(e,n){for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{SimpleKeyboard:function(){return B},default:function(){return A}});function n(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n2&&void 0!==arguments[2]&&arguments[2]?Object.assign({},this.getDefaultDiplay(),e):e||this.getDefaultDiplay())[t]||t}},{key:"getUpdatedInput",value:function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=this.getOptions(),a=[n,o,i],r=e;return("{bksp}"===t||"{backspace}"===t)&&r.length>0?r=this.removeAt.apply(this,[r].concat(a)):("{delete}"===t||"{forwarddelete}"===t)&&r.length>0?r=this.removeForwardsAt.apply(this,[r].concat(a)):"{space}"===t?r=this.addStringAt.apply(this,[r," "].concat(a)):"{tab}"!==t||"boolean"==typeof s.tabCharOnTab&&!1===s.tabCharOnTab?"{enter}"!==t&&"{numpadenter}"!==t||!s.newLineOnEnter?t.includes("numpad")&&Number.isInteger(Number(t[t.length-2]))?r=this.addStringAt.apply(this,[r,t[t.length-2]].concat(a)):"{numpaddivide}"===t?r=this.addStringAt.apply(this,[r,"/"].concat(a)):"{numpadmultiply}"===t?r=this.addStringAt.apply(this,[r,"*"].concat(a)):"{numpadsubtract}"===t?r=this.addStringAt.apply(this,[r,"-"].concat(a)):"{numpadadd}"===t?r=this.addStringAt.apply(this,[r,"+"].concat(a)):"{numpaddecimal}"===t?r=this.addStringAt.apply(this,[r,"."].concat(a)):"{"===t||"}"===t?r=this.addStringAt.apply(this,[r,t].concat(a)):t.includes("{")||t.includes("}")||(r=this.addStringAt.apply(this,[r,t].concat(a))):r=this.addStringAt.apply(this,[r,"\n"].concat(a)):r=this.addStringAt.apply(this,[r,"\t"].concat(a)),s.debug&&console.log("Input will be: "+r),r}},{key:"updateCaretPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.updateCaretPosAction(t,e);this.dispatch((function(t){t.setCaretPosition(n)}))}},{key:"updateCaretPosAction",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getOptions(),o=this.getCaretPosition();return null!=o&&(e?o>0&&(o-=t):o+=t),n.debug&&console.log("Caret at:",o),o}},{key:"addStringAt",value:function(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return o||0===o?(n=[t.slice(0,o),e,t.slice(i)].join(""),this.isMaxLengthReached()||s&&this.updateCaretPos(e.length)):n=t+e,n}},{key:"removeAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0===n&&0===o)return t;if(n===o){var s=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;n&&n>=0?t.substring(n-2,n).match(s)?(e=t.substr(0,n-2)+t.substr(n),i&&this.updateCaretPos(2,!0)):(e=t.substr(0,n-1)+t.substr(n),i&&this.updateCaretPos(1,!0)):t.slice(-2).match(s)?(e=t.slice(0,-2),i&&this.updateCaretPos(2,!0)):(e=t.slice(0,-1),i&&this.updateCaretPos(1,!0))}else e=t.slice(0,n)+t.slice(o),i&&this.dispatch((function(t){t.setCaretPosition(n)}));return e}},{key:"removeForwardsAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return null!=t&&t.length&&null!==n?(n===o?e=t.substring(n,n+2).match(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g)?t.substr(0,n)+t.substr(n+2):t.substr(0,n)+t.substr(n+1):(e=t.slice(0,n)+t.slice(o),i&&this.dispatch((function(t){t.setCaretPosition(n)}))),e):t}},{key:"handleMaxLength",value:function(t,e){var n=this.getOptions(),o=n.maxLength,i=t[n.inputName||"default"],a=e.length-1>=o;if(e.length<=i.length)return!1;if(Number.isInteger(o))return n.debug&&console.log("maxLength (num) reached:",a),a?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===s(o)){var r=e.length-1>=o[n.inputName||"default"];return n.debug&&console.log("maxLength (obj) reached:",r),r?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return Boolean(this.maxLengthReached)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return!!window.PointerEvent}},{key:"camelCase",value:function(t){return t?t.toLowerCase().trim().split(/[.\-_\s]/g).reduce((function(t,e){return e.length?t+e[0].toUpperCase()+e.slice(1):t})):""}},{key:"chunkArray",value:function(t,e){return n(Array(Math.ceil(t.length/e))).map((function(n,o){return t.slice(e*o,e+e*o)}))}},{key:"escapeRegex",value:function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},{key:"getRtlOffset",value:function(t,e){var n=t,o=e.indexOf("‫");return o=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return r=t.done,t},e:function(t){u=!0,a=t},f:function(){try{r||null==n.return||n.return()}finally{if(u)throw a}}}}(Object.getOwnPropertyNames(t.prototype));try{for(i.s();!(n=i.n()).done;){var s=n.value;"constructor"===s||"bindMethods"===s||(e[s]=e[s].bind(e))}}catch(t){i.e(t)}finally{i.f()}}}],i&&a(e.prototype,i),u&&a(e,u),Object.defineProperty(e,"prototype",{writable:!1}),t}();r(l,"noop",(function(){}));var c=l;function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function h(t,e){for(var n=0;n1?null===(e=n)||void 0===e?void 0:e.toLowerCase():n}},{key:"keyCodeToKey",value:function(t){return{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[t]||""}}])&&h(e.prototype,n),o&&h(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function g(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:i();return r(t,e)},u.appendChild(o)}));var l=s>0,c=document.createElement("div");c.classList.add("hg-candidate-box-prev"),l&&c.classList.add("hg-candidate-box-btn-active");var d=function(){l&&n.renderPage({candidateListPages:o,targetElement:i,pageIndex:s-1,nbPages:a,onItemSelected:r})};this.options.useTouchEvents?c.ontouchstart=d:c.onclick=d,this.candidateBoxElement.appendChild(c),this.candidateBoxElement.appendChild(u);var h=st.length)&&(e=t.length);for(var n=0,o=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:t;this.caretPosition=t,this.caretPositionEnd=e}},{key:"getInputCandidates",value:function(t){var e=this,n=this.options,o=n.layoutCandidates,i=n.layoutCandidatesCaseSensitiveMatch;if(!o||"object"!==P(o))return{};var s=Object.keys(o).filter((function(n){var o=t.substring(0,e.getCaretPositionEnd()||0)||t,s=new RegExp("".concat(e.utilities.escapeRegex(n),"$"),i?"g":"gi");return!!E(o.matchAll(s)).length}));if(s.length>1){var a=s.sort((function(t,e){return e.length-t.length}))[0];return{candidateKey:a,candidateValue:o[a]}}if(s.length){var r=s[0];return{candidateKey:r,candidateValue:o[r]}}return{}}},{key:"showCandidatesBox",value:function(t,e,n){var o=this;this.candidateBox&&this.candidateBox.show({candidateValue:e,targetElement:n,onSelect:function(e,n){var i=o.options,s=i.layoutCandidatesCaseSensitiveMatch,a=i.disableCandidateNormalization,r=i.enableLayoutCandidatesKeyPress,u=e;a||(u=e.normalize("NFD"));var l=o.getInput(o.options.inputName,!0),c=o.getCaretPositionEnd()||0,d=l.substring(0,c||0)||l,h=new RegExp("".concat(o.utilities.escapeRegex(t),"$"),s?"g":"gi"),p=d.replace(h,u),f=l.replace(d,p),y=p.length-d.length,v=(c||l.length)+y;v<0&&(v=0),o.setInput(f,o.options.inputName,!0),o.setCaretPosition(v),r&&"function"==typeof o.options.onKeyPress&&o.options.onKeyPress(e,n),"function"==typeof o.options.onChange&&o.options.onChange(o.getInput(o.options.inputName,!0),n),"function"==typeof o.options.onChangeAll&&o.options.onChangeAll(o.getAllInputs(),n)}})}},{key:"handleButtonClicked",value:function(t,e){var n=this.options,o=n.inputName,i=void 0===o?this.defaultName:o,s=n.debug;if("{//}"!==t){this.input[i]||(this.input[i]="");var a=this.utilities.getUpdatedInput(t,this.input[i],this.caretPosition,this.caretPositionEnd);if(this.utilities.isStandardButton(t)&&this.activeInputElement&&this.input[i]&&this.input[i]===a&&0===this.caretPosition&&this.caretPositionEnd===a.length)return this.setInput("",this.options.inputName,!0),this.setCaretPosition(0),this.activeInputElement.value="",this.activeInputElement.setSelectionRange(0,0),void this.handleButtonClicked(t,e);if("function"==typeof this.options.onKeyPress&&this.options.onKeyPress(t,e),this.input[i]!==a&&(!this.options.inputPattern||this.options.inputPattern&&this.inputPatternIsValid(a))){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,a))return;var r=this.utilities.getUpdatedInput(t,this.input[i],this.caretPosition,this.caretPositionEnd,!0);if(this.setInput(r,this.options.inputName,!0),s&&console.log("Input changed:",this.getAllInputs()),this.options.debug&&console.log("Caret at: ",this.getCaretPosition(),this.getCaretPositionEnd(),"(".concat(this.keyboardDOMClass,")"),null==e?void 0:e.type),this.options.syncInstanceInputs&&this.syncInstanceInputs(),"function"==typeof this.options.onChange&&this.options.onChange(this.getInput(this.options.inputName,!0),e),"function"==typeof this.options.onChangeAll&&this.options.onChangeAll(this.getAllInputs(),e),null!=e&&e.target&&this.options.enableLayoutCandidates){var u,l=this.getInputCandidates(a),c=l.candidateKey,d=l.candidateValue;c&&d?this.showCandidatesBox(c,d,this.keyboardDOM):null===(u=this.candidateBox)||void 0===u||u.destroy()}}this.caretPositionEnd&&this.caretPosition!==this.caretPositionEnd&&(this.setCaretPosition(this.caretPositionEnd,this.caretPositionEnd),this.activeInputElement&&this.activeInputElement.setSelectionRange(this.caretPositionEnd,this.caretPositionEnd),this.options.debug&&console.log("Caret position aligned",this.caretPosition)),s&&console.log("Key pressed:",t)}}},{key:"getMouseHold",value:function(){return this.isMouseHold}},{key:"setMouseHold",value:function(t){this.options.syncInstanceInputs?this.dispatch((function(e){e.isMouseHold=t})):this.isMouseHold=t}},{key:"handleButtonMouseDown",value:function(t,e){var n=this;e&&(this.options.preventMouseDownDefault&&e.preventDefault(),this.options.stopMouseDownPropagation&&e.stopPropagation(),e.target.classList.add(this.activeButtonClass)),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.setMouseHold(!0),this.options.disableButtonHold||(this.holdTimeout=window.setTimeout((function(){(n.getMouseHold()&&(!t.includes("{")&&!t.includes("}")||"{delete}"===t||"{backspace}"===t||"{bksp}"===t||"{space}"===t||"{tab}"===t)||"{arrowright}"===t||"{arrowleft}"===t||"{arrowup}"===t||"{arrowdown}"===t)&&(n.options.debug&&console.log("Button held:",t),n.handleButtonHold(t)),clearTimeout(n.holdTimeout)}),500))}},{key:"handleButtonMouseUp",value:function(t,e){var n=this;e&&(this.options.preventMouseUpDefault&&e.preventDefault&&e.preventDefault(),this.options.stopMouseUpPropagation&&e.stopPropagation&&e.stopPropagation(),!(e.target===this.keyboardDOM||e.target&&this.keyboardDOM.contains(e.target)||this.candidateBox&&this.candidateBox.candidateBoxElement&&(e.target===this.candidateBox.candidateBoxElement||e.target&&this.candidateBox.candidateBoxElement.contains(e.target)))&&this.candidateBox&&this.candidateBox.destroy()),this.recurseButtons((function(t){t.classList.remove(n.activeButtonClass)})),this.setMouseHold(!1),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),t&&"function"==typeof this.options.onKeyReleased&&this.options.onKeyReleased(t,e)}},{key:"handleKeyboardContainerMouseDown",value:function(t){this.options.preventMouseDownDefault&&t.preventDefault()}},{key:"handleButtonHold",value:function(t){var e=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=window.setTimeout((function(){e.getMouseHold()?(e.handleButtonClicked(t),e.handleButtonHold(t)):clearTimeout(e.holdInteractionTimeout)}),100)}},{key:"syncInstanceInputs",value:function(){var t=this;this.dispatch((function(e){e.replaceInput(t.input),e.setCaretPosition(t.caretPosition,t.caretPositionEnd)}))}},{key:"clearInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName;this.input[t]="",this.setCaretPosition(0),this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"getInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.options.syncInstanceInputs&&!e&&this.syncInstanceInputs(),this.options.rtl?"‫"+this.input[t].replace("‫","").replace("‬","")+"‬":this.input[t]}},{key:"getAllInputs",value:function(){var t=this,e={};return Object.keys(this.input).forEach((function(n){e[n]=t.getInput(n,!0)})),e}},{key:"setInput",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.inputName||this.defaultName,n=arguments.length>2?arguments[2]:void 0;this.input[e]=t,!n&&this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"replaceInput",value:function(t){this.input=t}},{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.changedOptions(t);this.options=Object.assign(this.options,t),e.length&&(this.options.debug&&console.log("changedOptions",e),this.onSetOptions(e),this.render())}},{key:"changedOptions",value:function(t){var e=this;return Object.keys(t).filter((function(n){return JSON.stringify(t[n])!==JSON.stringify(e.options[n])}))}},{key:"onSetOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.includes("layoutName")&&this.candidateBox&&this.candidateBox.destroy(),(t.includes("layoutCandidatesPageSize")||t.includes("layoutCandidates"))&&this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=new w({utilities:this.utilities,options:this.options}))}},{key:"resetRows",value:function(){this.keyboardRowsDOM&&this.keyboardRowsDOM.remove(),this.keyboardDOM.className=this.keyboardDOMClass,this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.buttonElements={}}},{key:"dispatch",value:function(t){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach((function(e){t(window.SimpleKeyboardInstances[e],e)}))}},{key:"addButtonTheme",value:function(t,e){var n=this;e&&t&&(t.split(" ").forEach((function(o){e.split(" ").forEach((function(e){n.options.buttonTheme||(n.options.buttonTheme=[]);var i=!1;n.options.buttonTheme.map((function(t){if(null!=t&&t.class.split(" ").includes(e)){i=!0;var n=t.buttons.split(" ");n.includes(o)||(i=!0,n.push(o),t.buttons=n.join(" "))}return t})),i||n.options.buttonTheme.push({class:e,buttons:t})}))})),this.render())}},{key:"removeButtonTheme",value:function(t,e){var n=this;if(!t&&!e)return this.options.buttonTheme=[],void this.render();t&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(t.split(" ").forEach((function(t){var o;null===(o=n.options)||void 0===o||null===(o=o.buttonTheme)||void 0===o||o.map((function(o,i){if(o&&e&&e.includes(o.class)||!e){var s,a,r=null===(s=o)||void 0===s?void 0:s.buttons.split(" ").filter((function(e){return e!==t}));o&&null!=r&&r.length?o.buttons=r.join(" "):(null===(a=n.options.buttonTheme)||void 0===a||a.splice(i,1),o=null)}return o}))})),this.render())}},{key:"getButtonElement",value:function(t){var e,n=this.buttonElements[t];return n&&(e=n.length>1?n:n[0]),e}},{key:"inputPatternIsValid",value:function(t){var e,n=this.options.inputPattern;if((e=n instanceof RegExp?n:n[this.options.inputName||this.defaultName])&&t){var o=e.test(t);return this.options.debug&&console.log('inputPattern ("'.concat(e,'"): ').concat(o?"passed":"did not pass!")),o}return!0}},{key:"setEventListeners",value:function(){if(this.isFirstKeyboardInstance||!this.allKeyboardInstances){this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")"));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.addEventListener("keyup",this.handleKeyUp,e),document.addEventListener("keydown",this.handleKeyDown,e),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd),document.addEventListener("selectionchange",this.handleSelectionChange),document.addEventListener("select",this.handleSelect)}}},{key:"handleKeyUp",value:function(t){this.caretEventHandler(t),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(t)}},{key:"handleKeyDown",value:function(t){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(t)}},{key:"handleMouseUp",value:function(t){this.caretEventHandler(t)}},{key:"handleTouchEnd",value:function(t){this.caretEventHandler(t)}},{key:"handleSelect",value:function(t){this.caretEventHandler(t)}},{key:"handleSelectionChange",value:function(t){navigator.userAgent.includes("Firefox")||this.caretEventHandler(t)}},{key:"caretEventHandler",value:function(t){var e,n=this;t.target.tagName&&(e=t.target.tagName.toLowerCase()),this.dispatch((function(o){var i=t.target===o.keyboardDOM||t.target&&o.keyboardDOM.contains(t.target);if(n.options.syncInstanceInputs&&Array.isArray(t.path)&&(i=t.path.some((function(t){var e;return null==t||null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-skInstance")}))),("textarea"===e||"input"===e&&["text","search","url","tel","password"].includes(t.target.type))&&!o.options.disableCaretPositioning){var s=t.target.selectionStart,a=t.target.selectionEnd;o.options.rtl&&(s=o.utilities.getRtlOffset(s,o.getInput()),a=o.utilities.getRtlOffset(a,o.getInput())),o.setCaretPosition(s,a),n.activeInputElement=t.target,o.options.debug&&console.log("Caret at: ",o.getCaretPosition(),o.getCaretPositionEnd(),t&&t.target.tagName.toLowerCase(),"(".concat(o.keyboardDOMClass,")"),null==t?void 0:t.type)}else!o.options.disableCaretPositioning&&i||"selectionchange"===(null==t?void 0:t.type)||(o.setCaretPosition(null),n.activeInputElement=null,o.options.debug&&console.log('Caret position reset due to "'.concat(null==t?void 0:t.type,'" event'),t))}))}},{key:"recurseButtons",value:function(t){var e=this;t&&Object.keys(this.buttonElements).forEach((function(n){return e.buttonElements[n].forEach(t)}))}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.removeEventListener("keyup",this.handleKeyUp,e),document.removeEventListener("keydown",this.handleKeyDown,e),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("select",this.handleSelect),document.removeEventListener("selectionchange",this.handleSelectionChange),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null,this.recurseButtons((function(t){t&&(t.onpointerdown=null,t.onpointerup=null,t.onpointercancel=null,t.ontouchstart=null,t.ontouchend=null,t.ontouchcancel=null,t.onclick=null,t.onmousedown=null,t.onmouseup=null,t.remove(),t=null)})),this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.resetRows(),this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=null),this.activeInputElement=null,this.keyboardDOM.removeAttribute("data-skInstance"),this.keyboardDOM.innerHTML="",window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(t){var e=this.options.buttonTheme,n=[];return Array.isArray(e)&&e.forEach((function(e){if(e&&e.class&&"string"==typeof e.class&&e.buttons&&"string"==typeof e.buttons){var o=e.class.split(" ");e.buttons.split(" ").includes(t)&&(n=[].concat(E(n),E(o)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',e)})),n}},{key:"setDOMButtonAttributes",value:function(t,e){var n=this.options.buttonAttributes;Array.isArray(n)&&n.forEach((function(n){n.attribute&&"string"==typeof n.attribute&&n.value&&"string"==typeof n.value&&n.buttons&&"string"==typeof n.buttons?n.buttons.split(" ").includes(t)&&e(n.attribute,n.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',n)}))}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(t){if(t.target.classList.contains("hg-button"))return t.preventDefault(),t.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),"function"==typeof this.options.onInit&&this.options.onInit(this)}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),"function"==typeof this.options.beforeFirstRender&&this.options.beforeFirstRender(this),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){"function"==typeof this.options.beforeRender&&this.options.beforeRender(this)}},{key:"onRender",value:function(){"function"==typeof this.options.onRender&&this.options.onRender(this)}},{key:"onModulesLoaded",value:function(){"function"==typeof this.options.onModulesLoaded&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var t=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach((function(e){var n=new e(t);n.init&&n.init(t)})),this.keyboardPluginClasses="modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(t,e){return!!this.modules[t]&&this.modules[t][e]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(t,e,n,o){var i=this,s=Array.from(t.children),a=0;return s.length&&n.forEach((function(n,r){var u=o[r];if(!(u&&u>n))return!1;var l=n-a,c=u-a,d=document.createElement("div");d.className+="hg-button-container";var h="".concat(i.options.layoutName,"-r").concat(e,"c").concat(r);d.setAttribute("data-skUID",h);var p=s.splice(l,c-l+1);a=c-l,p.forEach((function(t){return d.appendChild(t)})),s.splice(l,0,d),t.innerHTML="",s.forEach((function(e){return t.appendChild(e)})),i.options.debug&&console.log("rowDOMContainer",p,l,c,a+1)})),t}},{key:"render",value:function(){var t=this;this.resetRows(),this.initialized||this.beforeFirstRender(),this.beforeRender();var e="hg-layout-".concat(this.options.layoutName),n=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},o=this.options.useTouchEvents||!1,i=o?"hg-touch-events":"",s=this.options.useMouseEvents||!1,a=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,e,this.keyboardPluginClasses,i),this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.keyboardRowsDOM=document.createElement("div"),this.keyboardRowsDOM.className="hg-rows",n[this.options.layoutName||this.defaultName].forEach((function(e,n){var i=e.split(" ");t.options.excludeFromLayout&&t.options.excludeFromLayout[t.options.layoutName||t.defaultName]&&(i=i.filter((function(e){return t.options.excludeFromLayout&&!t.options.excludeFromLayout[t.options.layoutName||t.defaultName].includes(e)})));var r=document.createElement("div");r.className+="hg-row";var u=[],l=[];i.forEach((function(e,i){var c,d=!a&&"string"==typeof e&&e.length>1&&0===e.indexOf("["),h=!a&&"string"==typeof e&&e.length>1&&e.indexOf("]")===e.length-1;d&&(u.push(i),e=e.replace(/\[/g,"")),h&&(l.push(i),e=e.replace(/\]/g,""));var p=t.utilities.getButtonClass(e),f=t.utilities.getButtonDisplayName(e,t.options.display,t.options.mergeDisplay),y=t.options.useButtonTag?"button":"div",v=document.createElement(y);v.className+="hg-button ".concat(p),(c=v.classList).add.apply(c,E(t.getButtonThemeClasses(e))),t.setDOMButtonAttributes(e,(function(t,e){v.setAttribute(t,e)})),t.activeButtonClass="hg-activeButton",!t.utilities.pointerEventsSupported()||o||s?o?(v.ontouchstart=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.ontouchend=function(n){t.handleButtonMouseUp(e,n)},v.ontouchcancel=function(n){t.handleButtonMouseUp(e,n)}):(v.onclick=function(n){t.setMouseHold(!1),"function"!=typeof t.options.onKeyReleased&&t.handleButtonClicked(e,n)},v.onmousedown=function(n){"function"!=typeof t.options.onKeyReleased||t.isMouseHold||t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.onmouseup=function(n){t.handleButtonMouseUp(e,n)}):(v.onpointerdown=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.onpointerup=function(n){t.handleButtonMouseUp(e,n)},v.onpointercancel=function(n){t.handleButtonMouseUp(e,n)}),v.setAttribute("data-skBtn",e);var g="".concat(t.options.layoutName,"-r").concat(n,"b").concat(i);v.setAttribute("data-skBtnUID",g);var m=document.createElement("span");m.innerHTML=f,v.appendChild(m),t.buttonElements[e]||(t.buttonElements[e]=[]),t.buttonElements[e].push(v),r.appendChild(v)})),r=t.parseRowDOMContainers(r,n,u,l),t.keyboardRowsDOM.appendChild(r)})),this.keyboardDOM.appendChild(this.keyboardRowsDOM),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||o||s?o?(document.ontouchend=function(e){return t.handleButtonMouseUp(void 0,e)},document.ontouchcancel=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.ontouchstart=function(e){return t.handleKeyboardContainerMouseDown(e)}):o||(document.onmouseup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onmousedown=function(e){return t.handleKeyboardContainerMouseDown(e)}):(document.onpointerup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onpointerdown=function(e){return t.handleKeyboardContainerMouseDown(e)}),this.onInit())}}],n&&I(e.prototype,n),o&&I(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}(),B=D,A=B;return e}()})); +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SimpleKeyboard=e():t.SimpleKeyboard=e()}(this,(function(){return function(){"use strict";var t={d:function(e,n){for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{SimpleKeyboard:function(){return B},default:function(){return A}});function n(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n2&&void 0!==arguments[2]&&arguments[2]?Object.assign({},this.getDefaultDiplay(),e):e||this.getDefaultDiplay())[t]||t}},{key:"getUpdatedInput",value:function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=this.getOptions(),a=[n,o,i],r=e;return("{bksp}"===t||"{backspace}"===t)&&r.length>0?r=this.removeAt.apply(this,[r].concat(a)):("{delete}"===t||"{forwarddelete}"===t)&&r.length>0?r=this.removeForwardsAt.apply(this,[r].concat(a)):"{space}"===t?r=this.addStringAt.apply(this,[r," "].concat(a)):"{tab}"!==t||"boolean"==typeof s.tabCharOnTab&&!1===s.tabCharOnTab?"{enter}"!==t&&"{numpadenter}"!==t||!s.newLineOnEnter?t.includes("numpad")&&Number.isInteger(Number(t[t.length-2]))?r=this.addStringAt.apply(this,[r,t[t.length-2]].concat(a)):"{numpaddivide}"===t?r=this.addStringAt.apply(this,[r,"/"].concat(a)):"{numpadmultiply}"===t?r=this.addStringAt.apply(this,[r,"*"].concat(a)):"{numpadsubtract}"===t?r=this.addStringAt.apply(this,[r,"-"].concat(a)):"{numpadadd}"===t?r=this.addStringAt.apply(this,[r,"+"].concat(a)):"{numpaddecimal}"===t?r=this.addStringAt.apply(this,[r,"."].concat(a)):"{"===t||"}"===t?r=this.addStringAt.apply(this,[r,t].concat(a)):t.includes("{")||t.includes("}")||(r=this.addStringAt.apply(this,[r,t].concat(a))):r=this.addStringAt.apply(this,[r,"\n"].concat(a)):r=this.addStringAt.apply(this,[r,"\t"].concat(a)),s.debug&&console.log("Input will be: "+r),r}},{key:"updateCaretPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.updateCaretPosAction(t,e);this.dispatch((function(t){t.setCaretPosition(n)}))}},{key:"updateCaretPosAction",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getOptions(),o=this.getCaretPosition();return null!=o&&(e?o>0&&(o-=t):o+=t),n.debug&&console.log("Caret at:",o),o}},{key:"addStringAt",value:function(t,e){var n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return o||0===o?(n=[t.slice(0,o),e,t.slice(i)].join(""),this.isMaxLengthReached()||s&&this.updateCaretPos(e.length)):n=t+e,n}},{key:"removeAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0===n&&0===o)return t;if(n===o){var s=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;n&&n>=0?t.substring(n-2,n).match(s)?(e=t.substr(0,n-2)+t.substr(n),i&&this.updateCaretPos(2,!0)):(e=t.substr(0,n-1)+t.substr(n),i&&this.updateCaretPos(1,!0)):t.slice(-2).match(s)?(e=t.slice(0,-2),i&&this.updateCaretPos(2,!0)):(e=t.slice(0,-1),i&&this.updateCaretPos(1,!0))}else e=t.slice(0,n)+t.slice(o),i&&this.dispatch((function(t){t.setCaretPosition(n)}));return e}},{key:"removeForwardsAt",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return null!=t&&t.length&&null!==n?(n===o?e=t.substring(n,n+2).match(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g)?t.substr(0,n)+t.substr(n+2):t.substr(0,n)+t.substr(n+1):(e=t.slice(0,n)+t.slice(o),i&&this.dispatch((function(t){t.setCaretPosition(n)}))),e):t}},{key:"handleMaxLength",value:function(t,e){var n=this.getOptions(),o=n.maxLength,i=t[n.inputName||"default"],a=e.length-1>=o;if(e.length<=i.length)return!1;if(Number.isInteger(o))return n.debug&&console.log("maxLength (num) reached:",a),a?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===s(o)){var r=e.length-1>=o[n.inputName||"default"];return n.debug&&console.log("maxLength (obj) reached:",r),r?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return Boolean(this.maxLengthReached)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return!!window.PointerEvent}},{key:"camelCase",value:function(t){return t?t.toLowerCase().trim().split(/[.\-_\s]/g).reduce((function(t,e){return e.length?t+e[0].toUpperCase()+e.slice(1):t})):""}},{key:"chunkArray",value:function(t,e){return n(Array(Math.ceil(t.length/e))).map((function(n,o){return t.slice(e*o,e+e*o)}))}},{key:"escapeRegex",value:function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},{key:"getRtlOffset",value:function(t,e){var n=t,o=e.indexOf("‫");return o=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return r=t.done,t},e:function(t){u=!0,a=t},f:function(){try{r||null==n.return||n.return()}finally{if(u)throw a}}}}(Object.getOwnPropertyNames(t.prototype));try{for(i.s();!(n=i.n()).done;){var s=n.value;"constructor"===s||"bindMethods"===s||(e[s]=e[s].bind(e))}}catch(t){i.e(t)}finally{i.f()}}}],e&&a(t.prototype,e),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();r(l,"noop",(function(){}));var c=l;function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function h(t,e){for(var n=0;n1?null===(e=n)||void 0===e?void 0:e.toLowerCase():n}},{key:"keyCodeToKey",value:function(t){return{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[t]||""}}])&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function g(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:i();return r(t,e)},u.appendChild(o)}));var l=s>0,c=document.createElement("div");c.classList.add("hg-candidate-box-prev"),l&&c.classList.add("hg-candidate-box-btn-active");var d=function(){l&&n.renderPage({candidateListPages:o,targetElement:i,pageIndex:s-1,nbPages:a,onItemSelected:r})};this.options.useTouchEvents?c.ontouchstart=d:c.onclick=d,this.candidateBoxElement.appendChild(c),this.candidateBoxElement.appendChild(u);var h=st.length)&&(e=t.length);for(var n=0,o=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:t;this.caretPosition=t,this.caretPositionEnd=e}},{key:"getInputCandidates",value:function(t){var e=this,n=this.options,o=n.layoutCandidates,i=n.layoutCandidatesCaseSensitiveMatch;if(!o||"object"!==P(o))return{};var s=Object.keys(o).filter((function(n){var o=t.substring(0,e.getCaretPositionEnd()||0)||t,s=new RegExp("".concat(e.utilities.escapeRegex(n),"$"),i?"g":"gi");return!!E(o.matchAll(s)).length}));if(s.length>1){var a=s.sort((function(t,e){return e.length-t.length}))[0];return{candidateKey:a,candidateValue:o[a]}}if(s.length){var r=s[0];return{candidateKey:r,candidateValue:o[r]}}return{}}},{key:"showCandidatesBox",value:function(t,e,n){var o=this;this.candidateBox&&this.candidateBox.show({candidateValue:e,targetElement:n,onSelect:function(e,n){var i=o.options,s=i.layoutCandidatesCaseSensitiveMatch,a=i.disableCandidateNormalization,r=i.enableLayoutCandidatesKeyPress,u=e;a||(u=e.normalize("NFD"));var l=o.getInput(o.options.inputName,!0),c=o.getCaretPositionEnd()||0,d=l.substring(0,c||0)||l,h=new RegExp("".concat(o.utilities.escapeRegex(t),"$"),s?"g":"gi"),p=d.replace(h,u),f=l.replace(d,p),y=p.length-d.length,v=(c||l.length)+y;v<0&&(v=0),o.setInput(f,o.options.inputName,!0),o.setCaretPosition(v),r&&"function"==typeof o.options.onKeyPress&&o.options.onKeyPress(e,n),"function"==typeof o.options.onChange&&o.options.onChange(o.getInput(o.options.inputName,!0),n),"function"==typeof o.options.onChangeAll&&o.options.onChangeAll(o.getAllInputs(),n)}})}},{key:"handleButtonClicked",value:function(t,e){var n=this.options,o=n.inputName,i=void 0===o?this.defaultName:o,s=n.debug;if("{//}"!==t){this.input[i]||(this.input[i]="");var a=this.utilities.getUpdatedInput(t,this.input[i],this.caretPosition,this.caretPositionEnd);if(this.utilities.isStandardButton(t)&&this.activeInputElement&&this.input[i]&&this.input[i]===a&&0===this.caretPosition&&this.caretPositionEnd===a.length)return this.setInput("",this.options.inputName,!0),this.setCaretPosition(0),this.activeInputElement.value="",this.activeInputElement.setSelectionRange(0,0),void this.handleButtonClicked(t,e);if("function"==typeof this.options.onKeyPress&&this.options.onKeyPress(t,e),this.input[i]!==a&&(!this.options.inputPattern||this.options.inputPattern&&this.inputPatternIsValid(a))){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,a))return;var r=this.utilities.getUpdatedInput(t,this.input[i],this.caretPosition,this.caretPositionEnd,!0);if(this.setInput(r,this.options.inputName,!0),s&&console.log("Input changed:",this.getAllInputs()),this.options.debug&&console.log("Caret at: ",this.getCaretPosition(),this.getCaretPositionEnd(),"(".concat(this.keyboardDOMClass,")"),null==e?void 0:e.type),this.options.syncInstanceInputs&&this.syncInstanceInputs(),"function"==typeof this.options.onChange&&this.options.onChange(this.getInput(this.options.inputName,!0),e),"function"==typeof this.options.onChangeAll&&this.options.onChangeAll(this.getAllInputs(),e),null!=e&&e.target&&this.options.enableLayoutCandidates){var u,l=this.getInputCandidates(a),c=l.candidateKey,d=l.candidateValue;c&&d?this.showCandidatesBox(c,d,this.keyboardDOM):null===(u=this.candidateBox)||void 0===u||u.destroy()}}this.caretPositionEnd&&this.caretPosition!==this.caretPositionEnd&&(this.setCaretPosition(this.caretPositionEnd,this.caretPositionEnd),this.activeInputElement&&this.activeInputElement.setSelectionRange(this.caretPositionEnd,this.caretPositionEnd),this.options.debug&&console.log("Caret position aligned",this.caretPosition)),s&&console.log("Key pressed:",t)}}},{key:"getMouseHold",value:function(){return this.isMouseHold}},{key:"setMouseHold",value:function(t){this.options.syncInstanceInputs?this.dispatch((function(e){e.isMouseHold=t})):this.isMouseHold=t}},{key:"handleButtonMouseDown",value:function(t,e){var n=this;e&&(this.options.preventMouseDownDefault&&e.preventDefault(),this.options.stopMouseDownPropagation&&e.stopPropagation(),e.target.classList.add(this.activeButtonClass)),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.setMouseHold(!0),this.options.disableButtonHold||(this.holdTimeout=window.setTimeout((function(){(n.getMouseHold()&&(!t.includes("{")&&!t.includes("}")||"{delete}"===t||"{backspace}"===t||"{bksp}"===t||"{space}"===t||"{tab}"===t)||"{arrowright}"===t||"{arrowleft}"===t||"{arrowup}"===t||"{arrowdown}"===t)&&(n.options.debug&&console.log("Button held:",t),n.handleButtonHold(t)),clearTimeout(n.holdTimeout)}),500))}},{key:"handleButtonMouseUp",value:function(t,e){var n=this;e&&(this.options.preventMouseUpDefault&&e.preventDefault&&e.preventDefault(),this.options.stopMouseUpPropagation&&e.stopPropagation&&e.stopPropagation(),!(e.target===this.keyboardDOM||e.target&&this.keyboardDOM.contains(e.target)||this.candidateBox&&this.candidateBox.candidateBoxElement&&(e.target===this.candidateBox.candidateBoxElement||e.target&&this.candidateBox.candidateBoxElement.contains(e.target)))&&this.candidateBox&&this.candidateBox.destroy()),this.recurseButtons((function(t){t.classList.remove(n.activeButtonClass)})),this.setMouseHold(!1),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),t&&"function"==typeof this.options.onKeyReleased&&this.options.onKeyReleased(t,e)}},{key:"handleKeyboardContainerMouseDown",value:function(t){this.options.preventMouseDownDefault&&t.preventDefault()}},{key:"handleButtonHold",value:function(t){var e=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=window.setTimeout((function(){e.getMouseHold()?(e.handleButtonClicked(t),e.handleButtonHold(t)):clearTimeout(e.holdInteractionTimeout)}),100)}},{key:"syncInstanceInputs",value:function(){var t=this;this.dispatch((function(e){e.replaceInput(t.input),e.setCaretPosition(t.caretPosition,t.caretPositionEnd)}))}},{key:"clearInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName;this.input[t]="",this.setCaretPosition(0),this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"getInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.inputName||this.defaultName,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.options.syncInstanceInputs&&!e&&this.syncInstanceInputs(),this.options.rtl?"‫"+this.input[t].replace("‫","").replace("‬","")+"‬":this.input[t]}},{key:"getAllInputs",value:function(){var t=this,e={};return Object.keys(this.input).forEach((function(n){e[n]=t.getInput(n,!0)})),e}},{key:"setInput",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.inputName||this.defaultName,n=arguments.length>2?arguments[2]:void 0;this.input[e]=t,!n&&this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"replaceInput",value:function(t){this.input=t}},{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.changedOptions(t);this.options=Object.assign(this.options,t),e.length&&(this.options.debug&&console.log("changedOptions",e),this.onSetOptions(e),this.render())}},{key:"changedOptions",value:function(t){var e=this;return Object.keys(t).filter((function(n){return JSON.stringify(t[n])!==JSON.stringify(e.options[n])}))}},{key:"onSetOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.includes("layoutName")&&this.candidateBox&&this.candidateBox.destroy(),(t.includes("layoutCandidatesPageSize")||t.includes("layoutCandidates"))&&this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=new w({utilities:this.utilities,options:this.options}))}},{key:"resetRows",value:function(){this.keyboardRowsDOM&&this.keyboardRowsDOM.remove(),this.keyboardDOM.className=this.keyboardDOMClass,this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.buttonElements={}}},{key:"dispatch",value:function(t){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach((function(e){t(window.SimpleKeyboardInstances[e],e)}))}},{key:"addButtonTheme",value:function(t,e){var n=this;e&&t&&(t.split(" ").forEach((function(o){e.split(" ").forEach((function(e){n.options.buttonTheme||(n.options.buttonTheme=[]);var i=!1;n.options.buttonTheme.map((function(t){if(null!=t&&t.class.split(" ").includes(e)){i=!0;var n=t.buttons.split(" ");n.includes(o)||(i=!0,n.push(o),t.buttons=n.join(" "))}return t})),i||n.options.buttonTheme.push({class:e,buttons:t})}))})),this.render())}},{key:"removeButtonTheme",value:function(t,e){var n=this;if(!t&&!e)return this.options.buttonTheme=[],void this.render();t&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(t.split(" ").forEach((function(t){var o;null===(o=n.options)||void 0===o||null===(o=o.buttonTheme)||void 0===o||o.map((function(o,i){if(o&&e&&e.includes(o.class)||!e){var s,a,r=null===(s=o)||void 0===s?void 0:s.buttons.split(" ").filter((function(e){return e!==t}));o&&null!=r&&r.length?o.buttons=r.join(" "):(null===(a=n.options.buttonTheme)||void 0===a||a.splice(i,1),o=null)}return o}))})),this.render())}},{key:"getButtonElement",value:function(t){var e,n=this.buttonElements[t];return n&&(e=n.length>1?n:n[0]),e}},{key:"inputPatternIsValid",value:function(t){var e,n=this.options.inputPattern;if((e=n instanceof RegExp?n:n[this.options.inputName||this.defaultName])&&t){var o=e.test(t);return this.options.debug&&console.log('inputPattern ("'.concat(e,'"): ').concat(o?"passed":"did not pass!")),o}return!0}},{key:"setEventListeners",value:function(){if(this.isFirstKeyboardInstance||!this.allKeyboardInstances){this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")"));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.addEventListener("keyup",this.handleKeyUp,e),document.addEventListener("keydown",this.handleKeyDown,e),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd),document.addEventListener("selectionchange",this.handleSelectionChange),document.addEventListener("select",this.handleSelect)}}},{key:"handleKeyUp",value:function(t){this.caretEventHandler(t),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(t)}},{key:"handleKeyDown",value:function(t){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(t)}},{key:"handleMouseUp",value:function(t){this.caretEventHandler(t)}},{key:"handleTouchEnd",value:function(t){this.caretEventHandler(t)}},{key:"handleSelect",value:function(t){this.caretEventHandler(t)}},{key:"handleSelectionChange",value:function(t){navigator.userAgent.includes("Firefox")||this.caretEventHandler(t)}},{key:"caretEventHandler",value:function(t){var e,n=this;t.target.tagName&&(e=t.target.tagName.toLowerCase()),this.dispatch((function(o){var i=t.target===o.keyboardDOM||t.target&&o.keyboardDOM.contains(t.target);if(n.options.syncInstanceInputs&&Array.isArray(t.path)&&(i=t.path.some((function(t){var e;return null==t||null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-skInstance")}))),("textarea"===e||"input"===e&&["text","search","url","tel","password"].includes(t.target.type))&&!o.options.disableCaretPositioning){var s=t.target.selectionStart,a=t.target.selectionEnd;o.options.rtl&&(s=o.utilities.getRtlOffset(s,o.getInput()),a=o.utilities.getRtlOffset(a,o.getInput())),o.setCaretPosition(s,a),n.activeInputElement=t.target,o.options.debug&&console.log("Caret at: ",o.getCaretPosition(),o.getCaretPositionEnd(),t&&t.target.tagName.toLowerCase(),"(".concat(o.keyboardDOMClass,")"),null==t?void 0:t.type)}else!o.options.disableCaretPositioning&&i||"selectionchange"===(null==t?void 0:t.type)||(o.setCaretPosition(null),n.activeInputElement=null,o.options.debug&&console.log('Caret position reset due to "'.concat(null==t?void 0:t.type,'" event'),t))}))}},{key:"recurseButtons",value:function(t){var e=this;t&&Object.keys(this.buttonElements).forEach((function(n){return e.buttonElements[n].forEach(t)}))}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var t=this.options.physicalKeyboardHighlightPreventDefault,e=void 0!==t&&t;document.removeEventListener("keyup",this.handleKeyUp,e),document.removeEventListener("keydown",this.handleKeyDown,e),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("select",this.handleSelect),document.removeEventListener("selectionchange",this.handleSelectionChange),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null,this.recurseButtons((function(t){t&&(t.onpointerdown=null,t.onpointerup=null,t.onpointercancel=null,t.ontouchstart=null,t.ontouchend=null,t.ontouchcancel=null,t.onclick=null,t.onmousedown=null,t.onmouseup=null,t.remove(),t=null)})),this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.resetRows(),this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=null),this.activeInputElement=null,this.keyboardDOM.removeAttribute("data-skInstance"),this.keyboardDOM.innerHTML="",window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(t){var e=this.options.buttonTheme,n=[];return Array.isArray(e)&&e.forEach((function(e){if(e&&e.class&&"string"==typeof e.class&&e.buttons&&"string"==typeof e.buttons){var o=e.class.split(" ");e.buttons.split(" ").includes(t)&&(n=[].concat(E(n),E(o)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',e)})),n}},{key:"setDOMButtonAttributes",value:function(t,e){var n=this.options.buttonAttributes;Array.isArray(n)&&n.forEach((function(n){n.attribute&&"string"==typeof n.attribute&&n.value&&"string"==typeof n.value&&n.buttons&&"string"==typeof n.buttons?n.buttons.split(" ").includes(t)&&e(n.attribute,n.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',n)}))}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(t){if(t.target.classList.contains("hg-button"))return t.preventDefault(),t.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),"function"==typeof this.options.onInit&&this.options.onInit(this)}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),"function"==typeof this.options.beforeFirstRender&&this.options.beforeFirstRender(this),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){"function"==typeof this.options.beforeRender&&this.options.beforeRender(this)}},{key:"onRender",value:function(){"function"==typeof this.options.onRender&&this.options.onRender(this)}},{key:"onModulesLoaded",value:function(){"function"==typeof this.options.onModulesLoaded&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var t=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach((function(e){var n=new e(t);n.init&&n.init(t)})),this.keyboardPluginClasses="modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(t,e){return!!this.modules[t]&&this.modules[t][e]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(t,e,n,o){var i=this,s=Array.from(t.children),a=0;return s.length&&n.forEach((function(n,r){var u=o[r];if(!(u&&u>n))return!1;var l=n-a,c=u-a,d=document.createElement("div");d.className+="hg-button-container";var h="".concat(i.options.layoutName,"-r").concat(e,"c").concat(r);d.setAttribute("data-skUID",h);var p=s.splice(l,c-l+1);a=c-l,p.forEach((function(t){return d.appendChild(t)})),s.splice(l,0,d),t.innerHTML="",s.forEach((function(e){return t.appendChild(e)})),i.options.debug&&console.log("rowDOMContainer",p,l,c,a+1)})),t}},{key:"render",value:function(){var t=this;this.resetRows(),this.initialized||this.beforeFirstRender(),this.beforeRender();var e="hg-layout-".concat(this.options.layoutName),n=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},o=this.options.useTouchEvents||!1,i=o?"hg-touch-events":"",s=this.options.useMouseEvents||!1,a=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,e,this.keyboardPluginClasses,i),this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.keyboardRowsDOM=document.createElement("div"),this.keyboardRowsDOM.className="hg-rows",n[this.options.layoutName||this.defaultName].forEach((function(e,n){var i=e.split(" ");t.options.excludeFromLayout&&t.options.excludeFromLayout[t.options.layoutName||t.defaultName]&&(i=i.filter((function(e){return t.options.excludeFromLayout&&!t.options.excludeFromLayout[t.options.layoutName||t.defaultName].includes(e)})));var r=document.createElement("div");r.className+="hg-row";var u=[],l=[];i.forEach((function(e,i){var c,d=!a&&"string"==typeof e&&e.length>1&&0===e.indexOf("["),h=!a&&"string"==typeof e&&e.length>1&&e.indexOf("]")===e.length-1;d&&(u.push(i),e=e.replace(/\[/g,"")),h&&(l.push(i),e=e.replace(/\]/g,""));var p=t.utilities.getButtonClass(e),f=t.utilities.getButtonDisplayName(e,t.options.display,t.options.mergeDisplay),y=t.options.useButtonTag?"button":"div",v=document.createElement(y);v.className+="hg-button ".concat(p),(c=v.classList).add.apply(c,E(t.getButtonThemeClasses(e))),t.setDOMButtonAttributes(e,(function(t,e){v.setAttribute(t,e)})),t.activeButtonClass="hg-activeButton",!t.utilities.pointerEventsSupported()||o||s?o?(v.ontouchstart=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.ontouchend=function(n){t.handleButtonMouseUp(e,n)},v.ontouchcancel=function(n){t.handleButtonMouseUp(e,n)}):(v.onclick=function(n){t.setMouseHold(!1),"function"!=typeof t.options.onKeyReleased&&t.handleButtonClicked(e,n)},v.onmousedown=function(n){"function"!=typeof t.options.onKeyReleased||t.isMouseHold||t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.onmouseup=function(n){t.handleButtonMouseUp(e,n)}):(v.onpointerdown=function(n){t.handleButtonClicked(e,n),t.handleButtonMouseDown(e,n)},v.onpointerup=function(n){t.handleButtonMouseUp(e,n)},v.onpointercancel=function(n){t.handleButtonMouseUp(e,n)}),v.setAttribute("data-skBtn",e);var g="".concat(t.options.layoutName,"-r").concat(n,"b").concat(i);v.setAttribute("data-skBtnUID",g);var m=document.createElement("span");m.innerHTML=f,v.appendChild(m),t.buttonElements[e]||(t.buttonElements[e]=[]),t.buttonElements[e].push(v),r.appendChild(v)})),r=t.parseRowDOMContainers(r,n,u,l),t.keyboardRowsDOM.appendChild(r)})),this.keyboardDOM.appendChild(this.keyboardRowsDOM),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||o||s?o?(document.ontouchend=function(e){return t.handleButtonMouseUp(void 0,e)},document.ontouchcancel=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.ontouchstart=function(e){return t.handleKeyboardContainerMouseDown(e)}):o||(document.onmouseup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onmousedown=function(e){return t.handleKeyboardContainerMouseDown(e)}):(document.onpointerup=function(e){return t.handleButtonMouseUp(void 0,e)},this.keyboardDOM.onpointerdown=function(e){return t.handleKeyboardContainerMouseDown(e)}),this.onInit())}}],e&&I(t.prototype,e),n&&I(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}(),B=D,A=B;return e}()})); //# sourceMappingURL=index.modern.js.map \ No newline at end of file diff --git a/build/index.modern.js.map b/build/index.modern.js.map index 58a90f136..871202c55 100644 --- a/build/index.modern.js.map +++ b/build/index.modern.js.map @@ -1 +1 @@ -{"version":3,"file":"index.modern.js","mappings":";;;;;;;;;;;;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAwB,eAAID,IAE5BD,EAAqB,eAAIC,GAC1B,CATD,CASGK,MAAM,WACT,kB,aCTA,IAAIC,EAAsB,CCA1BA,EAAwB,SAASL,EAASM,GACzC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAG3E,ECPAF,EAAwB,SAASQ,EAAKC,GAAQ,OAAOL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,EAAO,ECCtGT,EAAwB,SAASL,GACX,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GACvD,G,ipDCHA,IAGMC,EAAS,WAUb,SAAAA,EAAAC,GAKoB,IAJlBC,EAAUD,EAAVC,WACAC,EAAgBF,EAAhBE,iBACAC,EAAmBH,EAAnBG,oBACAC,EAAQJ,EAARI,U,4FAAQC,CAAA,KAAAN,GAAAO,EAAA,0BAAAA,EAAA,gCAAAA,EAAA,mCAAAA,EAAA,wBAAAA,EAAA,gCA6RVA,EAAA,yBAGmB,SAACC,GAAc,OAChCA,KAA0B,MAAdA,EAAO,IAA4C,MAA9BA,EAAOA,EAAOC,O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,SAAClF,GAAuB,OACtD+T,EAAK6B,iCAAiC5V,EAAE,GAChC8E,IAIVT,SAAS2M,UAAY,SAAChR,GAAuB,OAC3C+T,EAAKyB,yBAAoB1a,EAAWkF,EAAE,EACxCvH,KAAKyN,YAAYgL,YAAc,SAAClR,GAAuB,OACrD+T,EAAK6B,iCAAiC5V,EAAE,IAtB1CqE,SAASxB,YAAc,SAAC7C,GAAuB,OAC7C+T,EAAKyB,yBAAoB1a,EAAWkF,EAAE,EACxCvH,KAAKyN,YAAY9D,cAAgB,SAACpC,GAAuB,OACvD+T,EAAK6B,iCAAiC5V,EAAE,GAyB5CvH,KAAKuZ,SAET,I,iFAAClM,CAAA,CA5+DiB,GA++DpB,IEngEA,I,SVQA,E","sources":["webpack://SimpleKeyboard/webpack/universalModuleDefinition","webpack://SimpleKeyboard/webpack/bootstrap","webpack://SimpleKeyboard/webpack/runtime/define property getters","webpack://SimpleKeyboard/webpack/runtime/hasOwnProperty shorthand","webpack://SimpleKeyboard/webpack/runtime/make namespace object","webpack://SimpleKeyboard/./src/lib/services/Utilities.ts","webpack://SimpleKeyboard/./src/lib/services/PhysicalKeyboard.ts","webpack://SimpleKeyboard/./src/lib/components/CandidateBox.ts","webpack://SimpleKeyboard/./src/lib/components/Keyboard.ts","webpack://SimpleKeyboard/./src/lib/services/KeyboardLayout.ts","webpack://SimpleKeyboard/./src/lib/index.modern.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SimpleKeyboard\"] = factory();\n\telse\n\t\troot[\"SimpleKeyboard\"] = factory();\n})(this, function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { KeyboardInput } from \"./../interfaces\";\nimport { KeyboardOptions, UtilitiesParams } from \"../interfaces\";\n\n/**\n * Utility Service\n */\nclass Utilities {\n getOptions: () => KeyboardOptions;\n getCaretPosition: () => number | null;\n getCaretPositionEnd: () => number | null;\n dispatch: any;\n maxLengthReached!: boolean;\n\n /**\n * Creates an instance of the Utility service\n */\n constructor({\n getOptions,\n getCaretPosition,\n getCaretPositionEnd,\n dispatch,\n }: UtilitiesParams) {\n this.getOptions = getOptions;\n this.getCaretPosition = getCaretPosition;\n this.getCaretPositionEnd = getCaretPositionEnd;\n this.dispatch = dispatch;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(Utilities, this);\n }\n\n /**\n * Retrieve button type\n *\n * @param {string} button The button's layout name\n * @return {string} The button type\n */\n getButtonType(button: string): string {\n return button.includes(\"{\") && button.includes(\"}\") && button !== \"{//}\"\n ? \"functionBtn\"\n : \"standardBtn\";\n }\n\n /**\n * Adds default classes to a given button\n *\n * @param {string} button The button's layout name\n * @return {string} The classes to be added to the button\n */\n getButtonClass(button: string): string {\n const buttonTypeClass = this.getButtonType(button);\n const buttonWithoutBraces = button.replace(\"{\", \"\").replace(\"}\", \"\");\n let buttonNormalized = \"\";\n\n if (buttonTypeClass !== \"standardBtn\")\n buttonNormalized = ` hg-button-${buttonWithoutBraces}`;\n\n return `hg-${buttonTypeClass}${buttonNormalized}`;\n }\n\n /**\n * Default button display labels\n */\n getDefaultDiplay() {\n return {\n \"{bksp}\": \"backspace\",\n \"{backspace}\": \"backspace\",\n \"{enter}\": \"< enter\",\n \"{shift}\": \"shift\",\n \"{shiftleft}\": \"shift\",\n \"{shiftright}\": \"shift\",\n \"{alt}\": \"alt\",\n \"{s}\": \"shift\",\n \"{tab}\": \"tab\",\n \"{lock}\": \"caps\",\n \"{capslock}\": \"caps\",\n \"{accept}\": \"Submit\",\n \"{space}\": \" \",\n \"{//}\": \" \",\n \"{esc}\": \"esc\",\n \"{escape}\": \"esc\",\n \"{f1}\": \"f1\",\n \"{f2}\": \"f2\",\n \"{f3}\": \"f3\",\n \"{f4}\": \"f4\",\n \"{f5}\": \"f5\",\n \"{f6}\": \"f6\",\n \"{f7}\": \"f7\",\n \"{f8}\": \"f8\",\n \"{f9}\": \"f9\",\n \"{f10}\": \"f10\",\n \"{f11}\": \"f11\",\n \"{f12}\": \"f12\",\n \"{numpaddivide}\": \"/\",\n \"{numlock}\": \"lock\",\n \"{arrowup}\": \"↑\",\n \"{arrowleft}\": \"←\",\n \"{arrowdown}\": \"↓\",\n \"{arrowright}\": \"→\",\n \"{prtscr}\": \"print\",\n \"{scrolllock}\": \"scroll\",\n \"{pause}\": \"pause\",\n \"{insert}\": \"ins\",\n \"{home}\": \"home\",\n \"{pageup}\": \"up\",\n \"{delete}\": \"del\",\n \"{forwarddelete}\": \"del\",\n \"{end}\": \"end\",\n \"{pagedown}\": \"down\",\n \"{numpadmultiply}\": \"*\",\n \"{numpadsubtract}\": \"-\",\n \"{numpadadd}\": \"+\",\n \"{numpadenter}\": \"enter\",\n \"{period}\": \".\",\n \"{numpaddecimal}\": \".\",\n \"{numpad0}\": \"0\",\n \"{numpad1}\": \"1\",\n \"{numpad2}\": \"2\",\n \"{numpad3}\": \"3\",\n \"{numpad4}\": \"4\",\n \"{numpad5}\": \"5\",\n \"{numpad6}\": \"6\",\n \"{numpad7}\": \"7\",\n \"{numpad8}\": \"8\",\n \"{numpad9}\": \"9\",\n };\n }\n /**\n * Returns the display (label) name for a given button\n *\n * @param {string} button The button's layout name\n * @param {object} display The provided display option\n * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.\n */\n getButtonDisplayName(\n button: string,\n display: KeyboardOptions[\"display\"],\n mergeDisplay = false\n ) {\n if (mergeDisplay) {\n display = Object.assign({}, this.getDefaultDiplay(), display);\n } else {\n display = display || this.getDefaultDiplay();\n }\n\n return display[button] || button;\n }\n\n /**\n * Returns the updated input resulting from clicking a given button\n *\n * @param {string} button The button's layout name\n * @param {string} input The input string\n * @param {number} caretPos The cursor's current position\n * @param {number} caretPosEnd The cursor's current end position\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n getUpdatedInput(\n button: string,\n input: string,\n caretPos: any,\n caretPosEnd = caretPos,\n moveCaret = false\n ) {\n const options = this.getOptions();\n const commonParams: [number | undefined, number | undefined, boolean] = [\n caretPos,\n caretPosEnd,\n moveCaret,\n ];\n\n let output = input;\n\n if (\n (button === \"{bksp}\" || button === \"{backspace}\") &&\n output.length > 0\n ) {\n output = this.removeAt(output, ...commonParams);\n } else if (\n (button === \"{delete}\" || button === \"{forwarddelete}\") &&\n output.length > 0\n ) {\n output = this.removeForwardsAt(output, ...commonParams);\n } else if (button === \"{space}\")\n output = this.addStringAt(output, \" \", ...commonParams);\n else if (\n button === \"{tab}\" &&\n !(\n typeof options.tabCharOnTab === \"boolean\" &&\n options.tabCharOnTab === false\n )\n ) {\n output = this.addStringAt(output, \"\\t\", ...commonParams);\n } else if (\n (button === \"{enter}\" || button === \"{numpadenter}\") &&\n options.newLineOnEnter\n )\n output = this.addStringAt(output, \"\\n\", ...commonParams);\n else if (\n button.includes(\"numpad\") &&\n Number.isInteger(Number(button[button.length - 2]))\n ) {\n output = this.addStringAt(\n output,\n button[button.length - 2],\n ...commonParams\n );\n } else if (button === \"{numpaddivide}\")\n output = this.addStringAt(output, \"/\", ...commonParams);\n else if (button === \"{numpadmultiply}\")\n output = this.addStringAt(output, \"*\", ...commonParams);\n else if (button === \"{numpadsubtract}\")\n output = this.addStringAt(output, \"-\", ...commonParams);\n else if (button === \"{numpadadd}\")\n output = this.addStringAt(output, \"+\", ...commonParams);\n else if (button === \"{numpaddecimal}\")\n output = this.addStringAt(output, \".\", ...commonParams);\n else if (button === \"{\" || button === \"}\")\n output = this.addStringAt(output, button, ...commonParams);\n else if (!button.includes(\"{\") && !button.includes(\"}\"))\n output = this.addStringAt(output, button, ...commonParams);\n\n if(options.debug){\n console.log(\"Input will be: \"+ output);\n }\n\n return output;\n }\n\n /**\n * Moves the cursor position by a given amount\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPos(length: number, minus = false) {\n const newCaretPos = this.updateCaretPosAction(length, minus);\n\n this.dispatch((instance: any) => {\n instance.setCaretPosition(newCaretPos);\n });\n }\n\n /**\n * Action method of updateCaretPos\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPosAction(length: number, minus = false) {\n const options = this.getOptions();\n let caretPosition = this.getCaretPosition();\n\n if (caretPosition != null) {\n if (minus) {\n if (caretPosition > 0) caretPosition = caretPosition - length;\n } else {\n caretPosition = caretPosition + length;\n }\n }\n\n if (options.debug) {\n console.log(\"Caret at:\", caretPosition);\n }\n\n return caretPosition;\n }\n\n /**\n * Adds a string to the input at a given position\n *\n * @param {string} source The source input\n * @param {string} str The string to add\n * @param {number} position The (cursor) position where the string should be added\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n addStringAt(\n source: string,\n str: string,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n let output;\n\n if (!position && position !== 0) {\n output = source + str;\n } else {\n output = [source.slice(0, position), str, source.slice(positionEnd)].join(\n \"\"\n );\n\n /**\n * Avoid caret position change when maxLength is set\n */\n if (!this.isMaxLengthReached()) {\n if (moveCaret) this.updateCaretPos(str.length);\n }\n }\n\n return output;\n }\n\n /**\n * Check whether the button is a standard button\n */\n isStandardButton = (button: string) =>\n button && !(button[0] === \"{\" && button[button.length - 1] === \"}\");\n\n /**\n * Removes an amount of characters before a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n removeAt(\n source: string,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n if (position === 0 && positionEnd === 0) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n let prevTwoChars;\n let emojiMatched;\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n if (position && position >= 0) {\n prevTwoChars = source.substring(position - 2, position);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position - 2) + source.substr(position);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.substr(0, position - 1) + source.substr(position);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n } else {\n prevTwoChars = source.slice(-2);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.slice(0, -2);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.slice(0, -1);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch((instance: any) => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n\n /**\n * Removes an amount of characters after a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n */\n removeForwardsAt(\n source: string,\n position: number = source.length,\n positionEnd: number = source.length,\n moveCaret = false\n ) {\n if (!source?.length || position === null) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n const nextTwoChars = source.substring(position, position + 2);\n const emojiMatched = nextTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position) + source.substr(position + 2);\n } else {\n output = source.substr(0, position) + source.substr(position + 1);\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch((instance: any) => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n\n /**\n * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.\n *\n * @param {object} inputObj\n * @param {string} updatedInput\n */\n handleMaxLength(inputObj: KeyboardInput, updatedInput: string) {\n const options = this.getOptions();\n const maxLength = options.maxLength;\n const currentInput = inputObj[options.inputName || \"default\"];\n const condition = updatedInput.length - 1 >= maxLength;\n\n if (\n /**\n * If pressing this button won't add more characters\n * We exit out of this limiter function\n */\n updatedInput.length <= currentInput.length\n ) {\n return false;\n }\n\n if (Number.isInteger(maxLength)) {\n if (options.debug) {\n console.log(\"maxLength (num) reached:\", condition);\n }\n\n if (condition) {\n /**\n * @type {boolean} Boolean value that shows whether maxLength has been reached\n */\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n\n if (typeof maxLength === \"object\") {\n const condition =\n updatedInput.length - 1 >= maxLength[options.inputName || \"default\"];\n\n if (options.debug) {\n console.log(\"maxLength (obj) reached:\", condition);\n }\n\n if (condition) {\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n }\n\n /**\n * Gets the current value of maxLengthReached\n */\n isMaxLengthReached() {\n return Boolean(this.maxLengthReached);\n }\n\n /**\n * Determines whether a touch device is being used\n */\n isTouchDevice() {\n return \"ontouchstart\" in window || navigator.maxTouchPoints;\n }\n\n /**\n * Determines whether pointer events are supported\n */\n pointerEventsSupported() {\n return !!window.PointerEvent;\n }\n\n /**\n * Bind all methods in a given class\n */\n\n static bindMethods(myClass: any, instance: any) {\n // eslint-disable-next-line no-unused-vars\n for (const myMethod of Object.getOwnPropertyNames(myClass.prototype)) {\n const excludeMethod =\n myMethod === \"constructor\" || myMethod === \"bindMethods\";\n if (!excludeMethod) {\n instance[myMethod] = instance[myMethod].bind(instance);\n }\n }\n }\n\n /**\n * Transforms an arbitrary string to camelCase\n *\n * @param {string} str The string to transform.\n */\n camelCase(str: string): string {\n if (!str) return \"\";\n\n return str\n .toLowerCase()\n .trim()\n .split(/[.\\-_\\s]/g)\n .reduce((str, word) =>\n word.length ? str + word[0].toUpperCase() + word.slice(1) : str\n );\n }\n\n /**\n * Split array into chunks\n */\n chunkArray(arr: T[], size: number): T[][] {\n return [...Array(Math.ceil(arr.length / size))].map((_, i) =>\n arr.slice(size * i, size + size * i)\n );\n }\n\n /**\n * Escape regex input\n */\n escapeRegex(str: string) {\n return str.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n }\n\n /**\n * Calculate caret position offset when using rtl option\n */\n getRtlOffset(index: number, input: string) {\n let newIndex = index;\n const startMarkerIndex = input.indexOf(\"\\u202B\");\n const endMarkerIndex = input.indexOf(\"\\u202C\");\n\n if(startMarkerIndex < index && startMarkerIndex != -1){ newIndex--; }\n if(endMarkerIndex < index && startMarkerIndex != -1){ newIndex--; }\n\n return newIndex < 0 ? 0 : newIndex;\n }\n\n /**\n * Reusable empty function\n */\n static noop = () => {};\n}\n\nexport default Utilities;\n","import { KeyboardOptions, PhysicalKeyboardParams } from \"../interfaces\";\nimport Utilities from \"../services/Utilities\";\n\n/**\n * Physical Keyboard Service\n */\nclass PhysicalKeyboard {\n getOptions: () => KeyboardOptions;\n dispatch: any;\n\n /**\n * Creates an instance of the PhysicalKeyboard service\n */\n constructor({ dispatch, getOptions }: PhysicalKeyboardParams) {\n /**\n * @type {object} A simple-keyboard instance\n */\n this.dispatch = dispatch;\n this.getOptions = getOptions;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(PhysicalKeyboard, this);\n }\n\n handleHighlightKeyDown(e: KeyboardEvent) {\n const options = this.getOptions();\n\n if(options.physicalKeyboardHighlightPreventDefault && this.isModifierKey(e)){\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n const buttonPressed = this.getSimpleKeyboardLayoutKey(e);\n\n this.dispatch((instance: any) => {\n const standardButtonPressed = instance.getButtonElement(buttonPressed);\n const functionButtonPressed = instance.getButtonElement(\n `{${buttonPressed}}`\n );\n let buttonDOM;\n let buttonName: string;\n\n if (standardButtonPressed) {\n buttonDOM = standardButtonPressed;\n buttonName = buttonPressed;\n } else if (functionButtonPressed) {\n buttonDOM = functionButtonPressed;\n buttonName = `{${buttonPressed}}`;\n } else {\n return;\n }\n\n const applyButtonStyle = (buttonElement: HTMLElement) => {\n buttonElement.style.background =\n options.physicalKeyboardHighlightBgColor || \"#dadce4\";\n buttonElement.style.color =\n options.physicalKeyboardHighlightTextColor || \"black\";\n }\n\n if (buttonDOM) {\n if(Array.isArray(buttonDOM)){\n buttonDOM.forEach(buttonElement => applyButtonStyle(buttonElement));\n\n // Even though we have an array of buttons, we just want to press one of them\n if (options.physicalKeyboardHighlightPress) {\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM[0]?.onpointerdown?.(e);\n } else if (options.physicalKeyboardHighlightPressUseClick) {\n buttonDOM[0]?.click();\n } else {\n instance.handleButtonClicked(buttonName, e);\n }\n }\n } else {\n applyButtonStyle(buttonDOM);\n\n if (options.physicalKeyboardHighlightPress) {\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM?.onpointerdown?.(e);\n } else if (options.physicalKeyboardHighlightPressUseClick) {\n buttonDOM.click();\n } else {\n instance.handleButtonClicked(buttonName, e);\n }\n }\n }\n }\n });\n }\n\n handleHighlightKeyUp(e: KeyboardEvent) {\n const options = this.getOptions();\n\n if(options.physicalKeyboardHighlightPreventDefault && this.isModifierKey(e)){\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n \n const buttonPressed = this.getSimpleKeyboardLayoutKey(e);\n\n this.dispatch((instance: any) => {\n const buttonDOM =\n instance.getButtonElement(buttonPressed) ||\n instance.getButtonElement(`{${buttonPressed}}`);\n\n const applyButtonStyle = (buttonElement: HTMLElement) => {\n if(buttonElement.removeAttribute){\n buttonElement.removeAttribute(\"style\");\n }\n };\n\n if (buttonDOM) {\n if(Array.isArray(buttonDOM)){\n buttonDOM.forEach(buttonElement => applyButtonStyle(buttonElement));\n\n // Even though we have an array of buttons, we just want to press one of them\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM[0]?.onpointerup?.(e);\n }\n } else {\n applyButtonStyle(buttonDOM);\n\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM?.onpointerup?.(e);\n }\n }\n }\n });\n }\n\n /**\n * Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format\n * @param {object} e The KeyboardEvent\n */\n getSimpleKeyboardLayoutKey(e: KeyboardEvent) {\n let output = \"\";\n const keyId = e.code || e.key || this.keyCodeToKey(e?.keyCode);\n\n if (\n keyId?.includes(\"Numpad\") ||\n keyId?.includes(\"Shift\") ||\n keyId?.includes(\"Space\") ||\n keyId?.includes(\"Backspace\") ||\n keyId?.includes(\"Control\") ||\n keyId?.includes(\"Alt\") ||\n keyId?.includes(\"Meta\")\n ) {\n output = e.code || \"\";\n } else {\n output = e.key || this.keyCodeToKey(e?.keyCode) || \"\";\n }\n\n return output.length > 1 ? output?.toLowerCase() : output;\n }\n\n /**\n * Retrieve key from keyCode\n */\n keyCodeToKey(keyCode: number): string {\n return {\n 8: \"Backspace\",\n 9: \"Tab\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Ctrl\",\n 18: \"Alt\",\n 19: \"Pause\",\n 20: \"CapsLock\",\n 27: \"Esc\",\n 32: \"Space\",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 45: \"Insert\",\n 46: \"Delete\",\n 48: \"0\",\n 49: \"1\",\n 50: \"2\",\n 51: \"3\",\n 52: \"4\",\n 53: \"5\",\n 54: \"6\",\n 55: \"7\",\n 56: \"8\",\n 57: \"9\",\n 65: \"A\",\n 66: \"B\",\n 67: \"C\",\n 68: \"D\",\n 69: \"E\",\n 70: \"F\",\n 71: \"G\",\n 72: \"H\",\n 73: \"I\",\n 74: \"J\",\n 75: \"K\",\n 76: \"L\",\n 77: \"M\",\n 78: \"N\",\n 79: \"O\",\n 80: \"P\",\n 81: \"Q\",\n 82: \"R\",\n 83: \"S\",\n 84: \"T\",\n 85: \"U\",\n 86: \"V\",\n 87: \"W\",\n 88: \"X\",\n 89: \"Y\",\n 90: \"Z\",\n 91: \"Meta\",\n 96: \"Numpad0\",\n 97: \"Numpad1\",\n 98: \"Numpad2\",\n 99: \"Numpad3\",\n 100: \"Numpad4\",\n 101: \"Numpad5\",\n 102: \"Numpad6\",\n 103: \"Numpad7\",\n 104: \"Numpad8\",\n 105: \"Numpad9\",\n 106: \"NumpadMultiply\",\n 107: \"NumpadAdd\",\n 109: \"NumpadSubtract\",\n 110: \"NumpadDecimal\",\n 111: \"NumpadDivide\",\n 112: \"F1\",\n 113: \"F2\",\n 114: \"F3\",\n 115: \"F4\",\n 116: \"F5\",\n 117: \"F6\",\n 118: \"F7\",\n 119: \"F8\",\n 120: \"F9\",\n 121: \"F10\",\n 122: \"F11\",\n 123: \"F12\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\",\n }[keyCode] || \"\";\n }\n\n isModifierKey = (e: KeyboardEvent): boolean => {\n return (\n e.altKey\n || e.ctrlKey\n || e.shiftKey\n || [\"Tab\", \"CapsLock\", \"Esc\", \"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"].includes(\n e.code || e.key || this.keyCodeToKey(e?.keyCode)\n )\n )\n }\n}\n\nexport default PhysicalKeyboard;\n","import \"./css/CandidateBox.css\";\n\nimport Utilities from \"../services/Utilities\";\nimport {\n CandidateBoxParams,\n CandidateBoxRenderParams,\n CandidateBoxShowParams,\n KeyboardOptions,\n} from \"./../interfaces\";\n\nclass CandidateBox {\n utilities: Utilities;\n options: KeyboardOptions;\n candidateBoxElement!: HTMLDivElement;\n pageIndex = 0;\n pageSize: number;\n\n constructor({ utilities, options }: CandidateBoxParams) {\n this.utilities = utilities;\n this.options = options;\n Utilities.bindMethods(CandidateBox, this);\n this.pageSize = this.utilities.getOptions().layoutCandidatesPageSize || 5;\n }\n\n destroy() {\n if (this.candidateBoxElement) {\n this.candidateBoxElement.remove();\n this.pageIndex = 0;\n }\n }\n\n show({\n candidateValue,\n targetElement,\n onSelect,\n }: CandidateBoxShowParams): void {\n if (!candidateValue || !candidateValue.length) {\n return;\n }\n\n const candidateListPages = this.utilities.chunkArray(\n candidateValue.split(\" \"),\n this.pageSize\n );\n\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: this.pageIndex,\n nbPages: candidateListPages.length,\n onItemSelected: (selectedCandidate: string, e: MouseEvent) => {\n onSelect(selectedCandidate, e);\n this.destroy();\n },\n });\n }\n\n renderPage({\n candidateListPages,\n targetElement,\n pageIndex,\n nbPages,\n onItemSelected,\n }: CandidateBoxRenderParams) {\n // Remove current candidate box, if any\n this.candidateBoxElement?.remove();\n\n // Create candidate box element\n this.candidateBoxElement = document.createElement(\"div\");\n this.candidateBoxElement.className = \"hg-candidate-box\";\n\n // Candidate box list\n const candidateListULElement = document.createElement(\"ul\");\n candidateListULElement.className = \"hg-candidate-box-list\";\n\n // Create Candidate box list items\n candidateListPages[pageIndex].forEach((candidateListItem) => {\n const candidateListLIElement = document.createElement(\"li\");\n const getMouseEvent = () => {\n const mouseEvent = new (this.options.useTouchEvents ? TouchEvent : MouseEvent)(\"click\");\n Object.defineProperty(mouseEvent, \"target\", {\n value: candidateListLIElement,\n });\n return mouseEvent;\n };\n\n candidateListLIElement.className = \"hg-candidate-box-list-item\";\n candidateListLIElement.innerHTML = this.options.display?.[candidateListItem] || candidateListItem;\n\n if(this.options.useTouchEvents) {\n candidateListLIElement.ontouchstart = (e: any) =>\n onItemSelected(candidateListItem, e || getMouseEvent());\n } else {\n candidateListLIElement.onclick = (e = getMouseEvent() as MouseEvent) =>\n onItemSelected(candidateListItem, e);\n }\n\n // Append list item to ul\n candidateListULElement.appendChild(candidateListLIElement);\n });\n\n // Add previous button\n const isPrevBtnElementActive = pageIndex > 0;\n const prevBtnElement = document.createElement(\"div\");\n prevBtnElement.classList.add(\"hg-candidate-box-prev\");\n isPrevBtnElementActive &&\n prevBtnElement.classList.add(\"hg-candidate-box-btn-active\");\n\n const prevBtnElementClickAction = () => {\n if (!isPrevBtnElementActive) return;\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: pageIndex - 1,\n nbPages,\n onItemSelected,\n });\n };\n\n if(this.options.useTouchEvents) {\n prevBtnElement.ontouchstart = prevBtnElementClickAction;\n } else {\n prevBtnElement.onclick = prevBtnElementClickAction;\n }\n \n this.candidateBoxElement.appendChild(prevBtnElement);\n\n // Add elements to container\n this.candidateBoxElement.appendChild(candidateListULElement);\n\n // Add next button\n const isNextBtnElementActive = pageIndex < nbPages - 1;\n const nextBtnElement = document.createElement(\"div\");\n nextBtnElement.classList.add(\"hg-candidate-box-next\");\n isNextBtnElementActive &&\n nextBtnElement.classList.add(\"hg-candidate-box-btn-active\");\n\n const nextBtnElementClickAction = () => {\n if (!isNextBtnElementActive) return;\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: pageIndex + 1,\n nbPages,\n onItemSelected,\n });\n };\n\n if(this.options.useTouchEvents) {\n nextBtnElement.ontouchstart = nextBtnElementClickAction;\n } else {\n nextBtnElement.onclick = nextBtnElementClickAction;\n }\n\n this.candidateBoxElement.appendChild(nextBtnElement);\n\n // Append candidate box to target element\n targetElement.prepend(this.candidateBoxElement);\n }\n}\n\nexport default CandidateBox;\n","import \"./css/Keyboard.css\";\n\n// Services\nimport { getDefaultLayout } from \"../services/KeyboardLayout\";\nimport PhysicalKeyboard from \"../services/PhysicalKeyboard\";\nimport Utilities from \"../services/Utilities\";\nimport {\n KeyboardOptions,\n KeyboardInput,\n KeyboardButtonElements,\n KeyboardHandlerEvent,\n KeyboardElement,\n} from \"../interfaces\";\nimport CandidateBox from \"./CandidateBox\";\n\n/**\n * Root class for simple-keyboard.\n * This class:\n * - Parses the options\n * - Renders the rows and buttons\n * - Handles button functionality\n */\nclass SimpleKeyboard {\n input!: KeyboardInput;\n options!: KeyboardOptions;\n utilities!: Utilities;\n caretPosition!: number | null;\n caretPositionEnd!: number | null;\n keyboardDOM!: KeyboardElement;\n keyboardPluginClasses!: string;\n keyboardDOMClass!: string;\n buttonElements!: KeyboardButtonElements;\n currentInstanceName!: string;\n allKeyboardInstances!: { [key: string]: SimpleKeyboard };\n keyboardInstanceNames!: string[];\n isFirstKeyboardInstance!: boolean;\n physicalKeyboard!: PhysicalKeyboard;\n modules!: { [key: string]: any };\n activeButtonClass!: string;\n holdInteractionTimeout!: number;\n holdTimeout!: number;\n isMouseHold!: boolean;\n initialized!: boolean;\n candidateBox!: CandidateBox | null;\n keyboardRowsDOM!: KeyboardElement;\n defaultName = \"default\";\n activeInputElement: HTMLInputElement | HTMLTextAreaElement | null = null;\n\n /**\n * Creates an instance of SimpleKeyboard\n * @param {Array} params If first parameter is a string, it is considered the container class. The second parameter is then considered the options object. If first parameter is an object, it is considered the options object.\n */\n constructor(\n selectorOrOptions?: string | HTMLDivElement | KeyboardOptions,\n keyboardOptions?: KeyboardOptions\n ) {\n if (typeof window === \"undefined\") return;\n\n const {\n keyboardDOMClass,\n keyboardDOM,\n options = {},\n } = this.handleParams(selectorOrOptions, keyboardOptions);\n\n /**\n * Initializing Utilities\n */\n this.utilities = new Utilities({\n getOptions: this.getOptions,\n getCaretPosition: this.getCaretPosition,\n getCaretPositionEnd: this.getCaretPositionEnd,\n dispatch: this.dispatch,\n });\n\n /**\n * Caret position\n */\n this.caretPosition = null;\n\n /**\n * Caret position end\n */\n this.caretPositionEnd = null;\n\n /**\n * Processing options\n */\n this.keyboardDOM = keyboardDOM;\n\n /**\n * @type {object}\n * @property {object} layout Modify the keyboard layout.\n * @property {string} layoutName Specifies which layout should be used.\n * @property {object} display Replaces variable buttons (such as {bksp}) with a human-friendly name (e.g.: “backspace”).\n * @property {boolean} mergeDisplay By default, when you set the display property, you replace the default one. This setting merges them instead.\n * @property {string} theme A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space.\n * @property {array} buttonTheme A prop to add your own css classes to one or several buttons.\n * @property {array} buttonAttributes A prop to add your own attributes to one or several buttons.\n * @property {boolean} debug Runs a console.log every time a key is pressed. Displays the buttons pressed and the current input.\n * @property {boolean} newLineOnEnter Specifies whether clicking the “ENTER” button will input a newline (\\n) or not.\n * @property {boolean} tabCharOnTab Specifies whether clicking the “TAB” button will input a tab character (\\t) or not.\n * @property {string} inputName Allows you to use a single simple-keyboard instance for several inputs.\n * @property {number} maxLength Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {object} maxLength Restrains simple-keyboard’s individual inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {boolean} syncInstanceInputs When set to true, this option synchronizes the internal input of every simple-keyboard instance.\n * @property {boolean} physicalKeyboardHighlight Enable highlighting of keys pressed on physical keyboard.\n * @property {boolean} physicalKeyboardHighlightPress Presses keys highlighted by physicalKeyboardHighlight\n * @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.\n * @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have.\n * @property {boolean} physicalKeyboardHighlightPressUseClick Whether physicalKeyboardHighlightPress should use clicks to trigger buttons.\n * @property {boolean} physicalKeyboardHighlightPressUsePointerEvents Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.\n * @property {boolean} physicalKeyboardHighlightPreventDefault Whether physicalKeyboardHighlight should use preventDefault to disable default browser actions.\n * @property {boolean} preventMouseDownDefault Calling preventDefault for the mousedown events keeps the focus on the input.\n * @property {boolean} preventMouseUpDefault Calling preventDefault for the mouseup events.\n * @property {boolean} stopMouseDownPropagation Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.\n * @property {boolean} stopMouseUpPropagation Stops pointer up events on simple-keyboard buttons from bubbling to parent elements.\n * @property {function(button: string):string} onKeyPress Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”).\n * @property {function(input: string):string} onChange Executes the callback function on input change. Returns the current input’s string.\n * @property {function} onRender Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n * @property {function} onInit Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n * @property {function(inputs: object):object} onChangeAll Executes the callback function on input change. Returns the input object with all defined inputs.\n * @property {boolean} useButtonTag Render buttons as a button element instead of a div element.\n * @property {boolean} disableCaretPositioning A prop to ensure characters are always be added/removed at the end of the string.\n * @property {object} inputPattern Restrains input(s) change to the defined regular expression pattern.\n * @property {boolean} useTouchEvents Instructs simple-keyboard to use touch events instead of click events.\n * @property {boolean} autoUseTouchEvents Enable useTouchEvents automatically when touch device is detected.\n * @property {boolean} useMouseEvents Opt out of PointerEvents handling, falling back to the prior mouse event logic.\n * @property {function} destroy Clears keyboard listeners and DOM elements.\n * @property {boolean} disableButtonHold Disable button hold action.\n * @property {boolean} rtl Adds unicode right-to-left control characters to input return values.\n * @property {function} onKeyReleased Executes the callback function on key release.\n * @property {array} modules Module classes to be loaded by simple-keyboard.\n * @property {boolean} enableLayoutCandidates Enable input method editor candidate list support.\n * @property {object} excludeFromLayout Buttons to exclude from layout\n * @property {number} layoutCandidatesPageSize Determines size of layout candidate list\n * @property {boolean} layoutCandidatesCaseSensitiveMatch Determines whether layout candidate match should be case sensitive.\n * @property {boolean} disableCandidateNormalization Disables the automatic normalization for selected layout candidates\n * @property {boolean} enableLayoutCandidatesKeyPress Enables onKeyPress triggering for layoutCandidate items\n */\n this.options = {\n layoutName: \"default\",\n theme: \"hg-theme-default\",\n inputName: \"default\",\n preventMouseDownDefault: false,\n enableLayoutCandidates: true,\n excludeFromLayout: {},\n ...options,\n };\n\n /**\n * @type {object} Classes identifying loaded plugins\n */\n this.keyboardPluginClasses = \"\";\n\n /**\n * Bindings\n */\n Utilities.bindMethods(SimpleKeyboard, this);\n\n /**\n * simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).\n * This removes any dependency to input DOM elements. You can type and directly display the value in a div element, for example.\n * @example\n * // To get entered input\n * const input = keyboard.getInput();\n *\n * // To clear entered input.\n * keyboard.clearInput();\n *\n * @type {object}\n * @property {object} default Default SimpleKeyboard internal input.\n * @property {object} myInputName Example input that can be set through `options.inputName:\"myInputName\"`.\n */\n const { inputName = this.defaultName } = this.options;\n this.input = {};\n this.input[inputName] = \"\";\n\n /**\n * @type {string} DOM class of the keyboard wrapper, normally \"simple-keyboard\" by default.\n */\n this.keyboardDOMClass = keyboardDOMClass;\n\n /**\n * @type {object} Contains the DOM elements of every rendered button, the key being the button's layout name (e.g.: \"{enter}\").\n */\n this.buttonElements = {};\n\n /**\n * Simple-keyboard Instances\n * This enables multiple simple-keyboard support with easier management\n */\n if (!window[\"SimpleKeyboardInstances\"])\n window[\"SimpleKeyboardInstances\"] = {};\n\n this.currentInstanceName = this.utilities.camelCase(this.keyboardDOMClass);\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = this;\n\n /**\n * Instance vars\n */\n this.allKeyboardInstances = window[\"SimpleKeyboardInstances\"];\n this.keyboardInstanceNames = Object.keys(window[\"SimpleKeyboardInstances\"]);\n this.isFirstKeyboardInstance =\n this.keyboardInstanceNames[0] === this.currentInstanceName;\n\n /**\n * Physical Keyboard support\n */\n this.physicalKeyboard = new PhysicalKeyboard({\n dispatch: this.dispatch,\n getOptions: this.getOptions,\n });\n\n /**\n * Initializing CandidateBox\n */\n this.candidateBox = this.options.enableLayoutCandidates\n ? new CandidateBox({\n utilities: this.utilities,\n options: this.options,\n })\n : null;\n\n /**\n * Rendering keyboard\n */\n if (this.keyboardDOM) this.render();\n else {\n console.warn(`\".${keyboardDOMClass}\" was not found in the DOM.`);\n throw new Error(\"KEYBOARD_DOM_ERROR\");\n }\n\n /**\n * Modules\n */\n this.modules = {};\n this.loadModules();\n }\n\n /**\n * parseParams\n */\n handleParams = (\n selectorOrOptions?: string | HTMLDivElement | KeyboardOptions,\n keyboardOptions?: KeyboardOptions\n ): {\n keyboardDOMClass: string;\n keyboardDOM: KeyboardElement;\n options: Partial;\n } => {\n let keyboardDOMClass;\n let keyboardDOM;\n let options;\n\n /**\n * If first parameter is a string:\n * Consider it as an element's class\n */\n if (typeof selectorOrOptions === \"string\") {\n keyboardDOMClass = selectorOrOptions.split(\".\").join(\"\");\n keyboardDOM = document.querySelector(\n `.${keyboardDOMClass}`\n ) as KeyboardElement;\n options = keyboardOptions;\n\n /**\n * If first parameter is an KeyboardElement\n * Consider it as the keyboard DOM element\n */\n } else if (selectorOrOptions instanceof HTMLDivElement) {\n /**\n * This element must have a class, otherwise throw\n */\n if (!selectorOrOptions.className) {\n console.warn(\"Any DOM element passed as parameter must have a class.\");\n throw new Error(\"KEYBOARD_DOM_CLASS_ERROR\");\n }\n\n keyboardDOMClass = selectorOrOptions.className.split(\" \")[0];\n keyboardDOM = selectorOrOptions;\n options = keyboardOptions;\n\n /**\n * Otherwise, search for .simple-keyboard DOM element\n */\n } else {\n keyboardDOMClass = \"simple-keyboard\";\n keyboardDOM = document.querySelector(\n `.${keyboardDOMClass}`\n ) as KeyboardElement;\n options = selectorOrOptions;\n }\n\n return {\n keyboardDOMClass,\n keyboardDOM,\n options,\n };\n };\n\n /**\n * Getters\n */\n getOptions = (): KeyboardOptions => this.options;\n getCaretPosition = (): number | null => this.caretPosition;\n getCaretPositionEnd = (): number | null => this.caretPositionEnd;\n\n /**\n * Changes the internal caret position\n * @param {number} position The caret's start position\n * @param {number} positionEnd The caret's end position\n */\n setCaretPosition(position: number | null, endPosition = position): void {\n this.caretPosition = position;\n this.caretPositionEnd = endPosition;\n }\n\n /**\n * Retrieve the candidates for a given input\n * @param input The input string to check\n */\n getInputCandidates(\n input: string\n ): { candidateKey: string; candidateValue: string } | Record {\n const {\n layoutCandidates: layoutCandidatesObj,\n layoutCandidatesCaseSensitiveMatch,\n } = this.options;\n\n if (!layoutCandidatesObj || typeof layoutCandidatesObj !== \"object\") {\n return {};\n }\n\n const layoutCandidates = Object.keys(layoutCandidatesObj).filter(\n (layoutCandidate: string) => {\n const inputSubstr =\n input.substring(0, this.getCaretPositionEnd() || 0) || input;\n const regexp = new RegExp(\n `${this.utilities.escapeRegex(layoutCandidate)}$`,\n layoutCandidatesCaseSensitiveMatch ? \"g\" : \"gi\"\n );\n const matches = [...inputSubstr.matchAll(regexp)];\n return !!matches.length;\n }\n );\n\n if (layoutCandidates.length > 1) {\n const candidateKey = layoutCandidates.sort(\n (a, b) => b.length - a.length\n )[0];\n return {\n candidateKey,\n candidateValue: layoutCandidatesObj[candidateKey],\n };\n } else if (layoutCandidates.length) {\n const candidateKey = layoutCandidates[0];\n return {\n candidateKey,\n candidateValue: layoutCandidatesObj[candidateKey],\n };\n } else {\n return {};\n }\n }\n\n /**\n * Shows a suggestion box with a list of candidate words\n * @param candidates The chosen candidates string as defined in the layoutCandidates option\n * @param targetElement The element next to which the candidates box will be shown\n */\n showCandidatesBox(\n candidateKey: string,\n candidateValue: string,\n targetElement: KeyboardElement\n ): void {\n if (this.candidateBox) {\n this.candidateBox.show({\n candidateValue,\n targetElement,\n onSelect: (selectedCandidate: string, e: MouseEvent) => {\n const {\n layoutCandidatesCaseSensitiveMatch,\n disableCandidateNormalization,\n enableLayoutCandidatesKeyPress\n } = this.options;\n\n let candidateStr = selectedCandidate;\n\n if(!disableCandidateNormalization) {\n /**\n * Making sure that our suggestions are not composed characters\n */\n candidateStr = selectedCandidate.normalize(\"NFD\");\n }\n\n const currentInput = this.getInput(this.options.inputName, true);\n const initialCaretPosition = this.getCaretPositionEnd() || 0;\n const inputSubstr =\n currentInput.substring(0, initialCaretPosition || 0) ||\n currentInput;\n\n const regexp = new RegExp(\n `${this.utilities.escapeRegex(candidateKey)}$`,\n layoutCandidatesCaseSensitiveMatch ? \"g\" : \"gi\"\n );\n const newInputSubstr = inputSubstr.replace(\n regexp,\n candidateStr\n );\n const newInput = currentInput.replace(inputSubstr, newInputSubstr);\n\n const caretPositionDiff = newInputSubstr.length - inputSubstr.length;\n let newCaretPosition =\n (initialCaretPosition || currentInput.length) + caretPositionDiff;\n\n if (newCaretPosition < 0) newCaretPosition = 0;\n\n this.setInput(newInput, this.options.inputName, true);\n this.setCaretPosition(newCaretPosition);\n\n /**\n * Calling onKeyPress\n * We pass in the composed candidate instead of the decomposed one\n * To prevent confusion for users\n */\n if (enableLayoutCandidatesKeyPress && typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(selectedCandidate, e);\n\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(\n this.getInput(this.options.inputName, true),\n e\n );\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.getAllInputs(), e);\n },\n });\n }\n }\n\n /**\n * Handles clicks made to keyboard buttons\n * @param {string} button The button's layout name.\n */\n handleButtonClicked(button: string, e?: KeyboardHandlerEvent): void {\n const { inputName = this.defaultName, debug } = this.options;\n /**\n * Ignoring placeholder buttons\n */\n if (button === \"{//}\") return;\n\n /**\n * Creating inputName if it doesn't exist\n */\n if (!this.input[inputName]) this.input[inputName] = \"\";\n\n /**\n * Calculating new input\n */\n const updatedInput = this.utilities.getUpdatedInput(\n button,\n this.input[inputName],\n this.caretPosition,\n this.caretPositionEnd\n );\n\n /**\n * EDGE CASE: Check for whole input selection changes that will yield same updatedInput\n */\n if (this.utilities.isStandardButton(button) && this.activeInputElement) {\n const isEntireInputSelection =\n this.input[inputName] &&\n this.input[inputName] === updatedInput &&\n this.caretPosition === 0 &&\n this.caretPositionEnd === updatedInput.length;\n\n if (isEntireInputSelection) {\n this.setInput(\"\", this.options.inputName, true);\n this.setCaretPosition(0);\n this.activeInputElement.value = \"\";\n this.activeInputElement.setSelectionRange(0, 0);\n this.handleButtonClicked(button, e);\n return;\n }\n }\n\n /**\n * Calling onKeyPress\n */\n if (typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(button, e);\n\n if (\n // If input will change as a result of this button press\n this.input[inputName] !== updatedInput &&\n // This pertains to the \"inputPattern\" option:\n // If inputPattern isn't set\n (!this.options.inputPattern ||\n // Or, if it is set and if the pattern is valid - we proceed.\n (this.options.inputPattern && this.inputPatternIsValid(updatedInput)))\n ) {\n /**\n * If maxLength and handleMaxLength yield true, halting\n */\n if (\n this.options.maxLength &&\n this.utilities.handleMaxLength(this.input, updatedInput)\n ) {\n return;\n }\n\n /**\n * Updating input\n */\n const newInputValue = this.utilities.getUpdatedInput(\n button,\n this.input[inputName],\n this.caretPosition,\n this.caretPositionEnd,\n true\n );\n\n this.setInput(newInputValue, this.options.inputName, true);\n\n if (debug) console.log(\"Input changed:\", this.getAllInputs());\n\n if (this.options.debug) {\n console.log(\n \"Caret at: \",\n this.getCaretPosition(),\n this.getCaretPositionEnd(),\n `(${this.keyboardDOMClass})`,\n e?.type\n );\n }\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n\n /**\n * Calling onChange\n */\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(this.getInput(this.options.inputName, true), e);\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.getAllInputs(), e);\n\n /**\n * Check if this new input has candidates (suggested words)\n */\n if (e?.target && this.options.enableLayoutCandidates) {\n const { candidateKey, candidateValue } =\n this.getInputCandidates(updatedInput);\n\n if (candidateKey && candidateValue) {\n this.showCandidatesBox(\n candidateKey,\n candidateValue,\n this.keyboardDOM\n );\n } else {\n this.candidateBox?.destroy();\n }\n }\n }\n\n /**\n * After a button is clicked the selection (if any) will disappear\n * we should reflect this in our state, as applicable\n */\n if(this.caretPositionEnd && this.caretPosition !== this.caretPositionEnd){\n this.setCaretPosition(this.caretPositionEnd, this.caretPositionEnd);\n\n if(this.activeInputElement){\n this.activeInputElement.setSelectionRange(this.caretPositionEnd, this.caretPositionEnd);\n }\n \n if(this.options.debug){\n console.log(\"Caret position aligned\", this.caretPosition);\n }\n }\n\n if (debug) {\n console.log(\"Key pressed:\", button);\n }\n }\n\n /**\n * Get mouse hold state\n */\n getMouseHold() {\n return this.isMouseHold;\n }\n\n /**\n * Mark mouse hold state as set\n */\n setMouseHold(value: boolean) {\n if (this.options.syncInstanceInputs) {\n this.dispatch((instance: SimpleKeyboard) => {\n instance.isMouseHold = value;\n });\n } else {\n this.isMouseHold = value;\n }\n }\n\n /**\n * Handles button mousedown\n */\n /* istanbul ignore next */\n handleButtonMouseDown(button: string, e: KeyboardHandlerEvent): void {\n if (e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n if (this.options.stopMouseDownPropagation) e.stopPropagation();\n\n /**\n * Add active class\n */\n e.target.classList.add(this.activeButtonClass);\n }\n\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n if (this.holdTimeout) clearTimeout(this.holdTimeout);\n\n /**\n * @type {boolean} Whether the mouse is being held onKeyPress\n */\n this.setMouseHold(true);\n\n /**\n * @type {object} Time to wait until a key hold is detected\n */\n if (!this.options.disableButtonHold) {\n this.holdTimeout = window.setTimeout(() => {\n if (\n (this.getMouseHold() &&\n // TODO: This needs to be configurable through options\n ((!button.includes(\"{\") && !button.includes(\"}\")) ||\n button === \"{delete}\" ||\n button === \"{backspace}\" ||\n button === \"{bksp}\" ||\n button === \"{space}\" ||\n button === \"{tab}\")) ||\n button === \"{arrowright}\" ||\n button === \"{arrowleft}\" ||\n button === \"{arrowup}\" ||\n button === \"{arrowdown}\"\n ) {\n if (this.options.debug) console.log(\"Button held:\", button);\n\n this.handleButtonHold(button);\n }\n clearTimeout(this.holdTimeout);\n }, 500);\n }\n }\n\n /**\n * Handles button mouseup\n */\n handleButtonMouseUp(button?: string, e?: KeyboardHandlerEvent): void {\n if (e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseUpDefault && e.preventDefault)\n e.preventDefault();\n if (this.options.stopMouseUpPropagation && e.stopPropagation)\n e.stopPropagation();\n\n /* istanbul ignore next */\n const isKeyboard =\n e.target === this.keyboardDOM ||\n (e.target && this.keyboardDOM.contains(e.target)) ||\n (this.candidateBox &&\n this.candidateBox.candidateBoxElement &&\n (e.target === this.candidateBox.candidateBoxElement ||\n (e.target &&\n this.candidateBox.candidateBoxElement.contains(e.target))));\n\n /**\n * On click outside, remove candidateBox\n */\n if (!isKeyboard && this.candidateBox) {\n this.candidateBox.destroy();\n }\n }\n\n /**\n * Remove active class\n */\n this.recurseButtons((buttonElement: Element) => {\n buttonElement.classList.remove(this.activeButtonClass);\n });\n\n this.setMouseHold(false);\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * Calling onKeyReleased\n */\n if (button && typeof this.options.onKeyReleased === \"function\")\n this.options.onKeyReleased(button, e);\n }\n\n /**\n * Handles container mousedown\n */\n handleKeyboardContainerMouseDown(e: KeyboardHandlerEvent): void {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n }\n\n /**\n * Handles button hold\n */\n /* istanbul ignore next */\n handleButtonHold(button: string): void {\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * @type {object} Timeout dictating the speed of key hold iterations\n */\n this.holdInteractionTimeout = window.setTimeout(() => {\n if (this.getMouseHold()) {\n this.handleButtonClicked(button);\n this.handleButtonHold(button);\n } else {\n clearTimeout(this.holdInteractionTimeout);\n }\n }, 100);\n }\n\n /**\n * Send a command to all simple-keyboard instances (if you have several instances).\n */\n syncInstanceInputs(): void {\n this.dispatch((instance: SimpleKeyboard) => {\n instance.replaceInput(this.input);\n instance.setCaretPosition(this.caretPosition, this.caretPositionEnd);\n });\n }\n\n /**\n * Clear the keyboard’s input.\n * @param {string} [inputName] optional - the internal input to select\n */\n clearInput(\n inputName: string = this.options.inputName || this.defaultName\n ): void {\n this.input[inputName] = \"\";\n\n /**\n * Reset caretPosition\n */\n this.setCaretPosition(0);\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Get the keyboard’s input (You can also get it from the onChange prop).\n * @param {string} [inputName] optional - the internal input to select\n */\n getInput(\n inputName: string = this.options.inputName || this.defaultName,\n skipSync = false\n ): string {\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs && !skipSync) this.syncInstanceInputs();\n\n if (this.options.rtl) {\n // Remove existing control chars\n const inputWithoutRTLControl = this.input[inputName]\n .replace(\"\\u202B\", \"\")\n .replace(\"\\u202C\", \"\");\n\n return \"\\u202B\" + inputWithoutRTLControl + \"\\u202C\";\n } else {\n return this.input[inputName];\n }\n }\n\n /**\n * Get all simple-keyboard inputs\n */\n getAllInputs(): KeyboardInput {\n const output = {};\n const inputNames = Object.keys(this.input);\n\n inputNames.forEach((inputName) => {\n output[inputName] = this.getInput(inputName, true);\n });\n\n return output;\n }\n\n /**\n * Set the keyboard’s input.\n * @param {string} input the input value\n * @param {string} inputName optional - the internal input to select\n */\n setInput(\n input: string,\n inputName: string = this.options.inputName || this.defaultName,\n skipSync?: boolean\n ): void {\n this.input[inputName] = input;\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (!skipSync && this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Replace the input object (`keyboard.input`)\n * @param {object} inputObj The input object\n */\n replaceInput(inputObj: KeyboardInput): void {\n this.input = inputObj;\n }\n\n /**\n * Set new option or modify existing ones after initialization.\n * @param {object} options The options to set\n */\n setOptions(options = {}): void {\n const changedOptions = this.changedOptions(options);\n this.options = Object.assign(this.options, options);\n\n if (changedOptions.length) {\n if (this.options.debug) {\n console.log(\"changedOptions\", changedOptions);\n }\n\n /**\n * Some option changes require adjustments before re-render\n */\n this.onSetOptions(changedOptions);\n\n /**\n * Rendering\n */\n this.render();\n }\n }\n\n /**\n * Detecting changes to non-function options\n * This allows us to ascertain whether a button re-render is needed\n */\n changedOptions(newOptions: Partial): string[] {\n return Object.keys(newOptions).filter(\n (optionName) =>\n JSON.stringify(newOptions[optionName]) !==\n JSON.stringify(this.options[optionName])\n );\n }\n\n /**\n * Executing actions depending on changed options\n * @param {object} options The options to set\n */\n onSetOptions(changedOptions: string[] = []): void {\n /**\n * Changed: layoutName\n */\n if (changedOptions.includes(\"layoutName\")) {\n /**\n * Reset candidateBox\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n }\n }\n\n /**\n * Changed: layoutCandidatesPageSize, layoutCandidates\n */\n if (\n changedOptions.includes(\"layoutCandidatesPageSize\") ||\n changedOptions.includes(\"layoutCandidates\")\n ) {\n /**\n * Reset and recreate candidateBox\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n this.candidateBox = new CandidateBox({\n utilities: this.utilities,\n options: this.options,\n });\n }\n }\n }\n\n /**\n * Remove all keyboard rows and reset keyboard values.\n * Used internally between re-renders.\n */\n resetRows(): void {\n if (this.keyboardRowsDOM) {\n this.keyboardRowsDOM.remove();\n }\n\n this.keyboardDOM.className = this.keyboardDOMClass;\n this.keyboardDOM.setAttribute(\"data-skInstance\", this.currentInstanceName);\n this.buttonElements = {};\n }\n\n /**\n * Send a command to all simple-keyboard instances at once (if you have multiple instances).\n * @param {function(instance: object, key: string)} callback Function to run on every instance\n */\n // eslint-disable-next-line no-unused-vars\n dispatch(callback: (instance: SimpleKeyboard, key?: string) => void): void {\n if (!window[\"SimpleKeyboardInstances\"]) {\n console.warn(\n `SimpleKeyboardInstances is not defined. Dispatch cannot be called.`\n );\n throw new Error(\"INSTANCES_VAR_ERROR\");\n }\n\n return Object.keys(window[\"SimpleKeyboardInstances\"]).forEach((key) => {\n callback(window[\"SimpleKeyboardInstances\"][key], key);\n });\n }\n\n /**\n * Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n addButtonTheme(buttons: string, className: string): void {\n if (!className || !buttons) return;\n\n buttons.split(\" \").forEach((button) => {\n className.split(\" \").forEach((classNameItem) => {\n if (!this.options.buttonTheme) this.options.buttonTheme = [];\n\n let classNameFound = false;\n\n /**\n * If class is already defined, we add button to class definition\n */\n this.options.buttonTheme.map((buttonTheme) => {\n if (buttonTheme?.class.split(\" \").includes(classNameItem)) {\n classNameFound = true;\n\n const buttonThemeArray = buttonTheme.buttons.split(\" \");\n if (!buttonThemeArray.includes(button)) {\n classNameFound = true;\n buttonThemeArray.push(button);\n buttonTheme.buttons = buttonThemeArray.join(\" \");\n }\n }\n return buttonTheme;\n });\n\n /**\n * If class is not defined, we create a new entry\n */\n if (!classNameFound) {\n this.options.buttonTheme.push({\n class: classNameItem,\n buttons: buttons,\n });\n }\n });\n });\n\n this.render();\n }\n\n /**\n * Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n removeButtonTheme(buttons: string, className: string): void {\n /**\n * When called with empty parameters, remove all button themes\n */\n if (!buttons && !className) {\n this.options.buttonTheme = [];\n this.render();\n return;\n }\n\n /**\n * If buttons are passed and buttonTheme has items\n */\n if (\n buttons &&\n Array.isArray(this.options.buttonTheme) &&\n this.options.buttonTheme.length\n ) {\n const buttonArray = buttons.split(\" \");\n buttonArray.forEach((button) => {\n this.options?.buttonTheme?.map((buttonTheme, index) => {\n /**\n * If className is set, we affect the buttons only for that class\n * Otherwise, we afect all classes\n */\n if (\n (buttonTheme &&\n className &&\n className.includes(buttonTheme.class)) ||\n !className\n ) {\n const filteredButtonArray = buttonTheme?.buttons\n .split(\" \")\n .filter((item) => item !== button);\n\n /**\n * If buttons left, return them, otherwise, remove button Theme\n */\n if (buttonTheme && filteredButtonArray?.length) {\n buttonTheme.buttons = filteredButtonArray.join(\" \");\n } else {\n this.options.buttonTheme?.splice(index, 1);\n buttonTheme = null;\n }\n }\n\n return buttonTheme;\n });\n });\n\n this.render();\n }\n }\n\n /**\n * Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned.\n * @param {string} button The button layout name to select\n */\n getButtonElement(\n button: string\n ): KeyboardElement | KeyboardElement[] | undefined {\n let output;\n\n const buttonArr = this.buttonElements[button];\n if (buttonArr) {\n if (buttonArr.length > 1) {\n output = buttonArr;\n } else {\n output = buttonArr[0];\n }\n }\n\n return output;\n }\n\n /**\n * This handles the \"inputPattern\" option\n * by checking if the provided inputPattern passes\n */\n inputPatternIsValid(inputVal: string): boolean {\n const inputPatternRaw = this.options.inputPattern;\n let inputPattern;\n\n /**\n * Check if input pattern is global or targeted to individual inputs\n */\n if (inputPatternRaw instanceof RegExp) {\n inputPattern = inputPatternRaw;\n } else {\n inputPattern =\n inputPatternRaw[this.options.inputName || this.defaultName];\n }\n\n if (inputPattern && inputVal) {\n const didInputMatch = inputPattern.test(inputVal);\n\n if (this.options.debug) {\n console.log(\n `inputPattern (\"${inputPattern}\"): ${\n didInputMatch ? \"passed\" : \"did not pass!\"\n }`\n );\n }\n\n return didInputMatch;\n } else {\n /**\n * inputPattern doesn't seem to be set for the current input, or input is empty. Pass.\n */\n return true;\n }\n }\n\n /**\n * Handles simple-keyboard event listeners\n */\n setEventListeners(): void {\n /**\n * Only first instance should set the event listeners\n */\n if (this.isFirstKeyboardInstance || !this.allKeyboardInstances) {\n if (this.options.debug) {\n console.log(`Caret handling started (${this.keyboardDOMClass})`);\n }\n\n const { physicalKeyboardHighlightPreventDefault = false } = this.options;\n\n /**\n * Event Listeners\n */\n document.addEventListener(\"keyup\", this.handleKeyUp, physicalKeyboardHighlightPreventDefault);\n document.addEventListener(\"keydown\", this.handleKeyDown, physicalKeyboardHighlightPreventDefault);\n document.addEventListener(\"mouseup\", this.handleMouseUp);\n document.addEventListener(\"touchend\", this.handleTouchEnd);\n document.addEventListener(\"selectionchange\", this.handleSelectionChange);\n document.addEventListener(\"select\", this.handleSelect);\n }\n }\n\n /**\n * Event Handler: KeyUp\n */\n handleKeyUp(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyUp(event);\n }\n }\n\n /**\n * Event Handler: KeyDown\n */\n handleKeyDown(event: KeyboardHandlerEvent): void {\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyDown(event);\n }\n }\n\n /**\n * Event Handler: MouseUp\n */\n handleMouseUp(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: TouchEnd\n */\n /* istanbul ignore next */\n handleTouchEnd(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: Select\n */\n /* istanbul ignore next */\n handleSelect(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: SelectionChange\n */\n /* istanbul ignore next */\n handleSelectionChange(event: KeyboardHandlerEvent): void {\n /**\n * Firefox is not reporting the correct caret position through this event\n * https://github.com/hodgef/simple-keyboard/issues/1839\n */\n if(navigator.userAgent.includes('Firefox')){\n return;\n }\n this.caretEventHandler(event);\n }\n\n /**\n * Called by {@link setEventListeners} when an event that warrants a cursor position update is triggered\n */\n caretEventHandler(event: KeyboardHandlerEvent): void {\n let targetTagName: string;\n if (event.target.tagName) {\n targetTagName = event.target.tagName.toLowerCase();\n }\n\n this.dispatch((instance) => {\n let isKeyboard =\n event.target === instance.keyboardDOM ||\n (event.target && instance.keyboardDOM.contains(event.target));\n\n /**\n * If syncInstanceInputs option is enabled, make isKeyboard match any instance\n * not just the current one\n */\n if (this.options.syncInstanceInputs && Array.isArray(event.path)) {\n isKeyboard = event.path.some((item: HTMLElement) =>\n item?.hasAttribute?.(\"data-skInstance\")\n );\n }\n\n if (\n (targetTagName === \"textarea\" ||\n (targetTagName === \"input\" &&\n [\"text\", \"search\", \"url\", \"tel\", \"password\"].includes(\n event.target.type\n ))) &&\n !instance.options.disableCaretPositioning\n ) {\n /**\n * Tracks current cursor position\n * As keys are pressed, text will be added/removed at that position within the input.\n */\n let selectionStart = event.target.selectionStart;\n let selectionEnd = event.target.selectionEnd;\n\n if(instance.options.rtl){\n selectionStart = instance.utilities.getRtlOffset(selectionStart, instance.getInput());\n selectionEnd = instance.utilities.getRtlOffset(selectionEnd, instance.getInput());\n }\n\n instance.setCaretPosition(selectionStart, selectionEnd);\n\n /**\n * Tracking current input in order to handle caret positioning edge cases\n */\n this.activeInputElement = event.target;\n\n if (instance.options.debug) {\n console.log(\n \"Caret at: \",\n instance.getCaretPosition(),\n instance.getCaretPositionEnd(),\n event && event.target.tagName.toLowerCase(),\n `(${instance.keyboardDOMClass})`,\n event?.type\n );\n }\n } else if (\n (instance.options.disableCaretPositioning || !isKeyboard) &&\n event?.type !== \"selectionchange\"\n ) {\n /**\n * If we toggled off disableCaretPositioning, we must ensure caretPosition doesn't persist once reactivated.\n */\n instance.setCaretPosition(null);\n\n /**\n * Resetting activeInputElement\n */\n this.activeInputElement = null;\n\n if (instance.options.debug) {\n console.log(\n `Caret position reset due to \"${event?.type}\" event`,\n event\n );\n }\n }\n });\n }\n\n /**\n * Execute an operation on each button\n */\n recurseButtons(fn: any): void {\n if (!fn) return;\n\n Object.keys(this.buttonElements).forEach((buttonName) =>\n this.buttonElements[buttonName].forEach(fn)\n );\n }\n\n /**\n * Destroy keyboard listeners and DOM elements\n */\n destroy(): void {\n if (this.options.debug)\n console.log(\n `Destroying simple-keyboard instance: ${this.currentInstanceName}`\n );\n\n const { physicalKeyboardHighlightPreventDefault = false } = this.options;\n\n /**\n * Remove document listeners\n */\n document.removeEventListener(\"keyup\", this.handleKeyUp, physicalKeyboardHighlightPreventDefault);\n document.removeEventListener(\"keydown\", this.handleKeyDown, physicalKeyboardHighlightPreventDefault);\n document.removeEventListener(\"mouseup\", this.handleMouseUp);\n document.removeEventListener(\"touchend\", this.handleTouchEnd);\n document.removeEventListener(\"select\", this.handleSelect);\n document.removeEventListener(\"selectionchange\", this.handleSelectionChange);\n document.onpointerup = null;\n document.ontouchend = null;\n document.ontouchcancel = null;\n document.onmouseup = null;\n\n /**\n * Remove buttons\n */\n const deleteButton = (buttonElement: KeyboardElement | null) => {\n if (buttonElement) {\n buttonElement.onpointerdown = null;\n buttonElement.onpointerup = null;\n buttonElement.onpointercancel = null;\n buttonElement.ontouchstart = null;\n buttonElement.ontouchend = null;\n buttonElement.ontouchcancel = null;\n buttonElement.onclick = null;\n buttonElement.onmousedown = null;\n buttonElement.onmouseup = null;\n\n buttonElement.remove();\n buttonElement = null;\n }\n };\n\n this.recurseButtons(deleteButton);\n\n /**\n * Remove wrapper events\n */\n this.keyboardDOM.onpointerdown = null;\n this.keyboardDOM.ontouchstart = null;\n this.keyboardDOM.onmousedown = null;\n\n /**\n * Clearing keyboard rows\n */\n this.resetRows();\n\n /**\n * Candidate box\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n this.candidateBox = null;\n }\n\n /**\n * Clearing activeInputElement\n */\n this.activeInputElement = null;\n\n /**\n * Removing instance attribute\n */\n this.keyboardDOM.removeAttribute(\"data-skInstance\");\n\n /**\n * Clearing keyboardDOM\n */\n this.keyboardDOM.innerHTML = \"\";\n\n /**\n * Remove instance\n */\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = null;\n delete window[\"SimpleKeyboardInstances\"][this.currentInstanceName];\n\n /**\n * Reset initialized flag\n */\n this.initialized = false;\n }\n\n /**\n * Process buttonTheme option\n */\n getButtonThemeClasses(button: string): string[] {\n const buttonTheme = this.options.buttonTheme;\n let buttonClasses: string[] = [];\n\n if (Array.isArray(buttonTheme)) {\n buttonTheme.forEach((themeObj) => {\n if (\n themeObj &&\n themeObj.class &&\n typeof themeObj.class === \"string\" &&\n themeObj.buttons &&\n typeof themeObj.buttons === \"string\"\n ) {\n const themeObjClasses = themeObj.class.split(\" \");\n const themeObjButtons = themeObj.buttons.split(\" \");\n\n if (themeObjButtons.includes(button)) {\n buttonClasses = [...buttonClasses, ...themeObjClasses];\n }\n } else {\n console.warn(\n `Incorrect \"buttonTheme\". Please check the documentation.`,\n themeObj\n );\n }\n });\n }\n\n return buttonClasses;\n }\n\n /**\n * Process buttonAttributes option\n */\n setDOMButtonAttributes(button: string, callback: any): void {\n const buttonAttributes = this.options.buttonAttributes;\n\n if (Array.isArray(buttonAttributes)) {\n buttonAttributes.forEach((attrObj) => {\n if (\n attrObj.attribute &&\n typeof attrObj.attribute === \"string\" &&\n attrObj.value &&\n typeof attrObj.value === \"string\" &&\n attrObj.buttons &&\n typeof attrObj.buttons === \"string\"\n ) {\n const attrObjButtons = attrObj.buttons.split(\" \");\n\n if (attrObjButtons.includes(button)) {\n callback(attrObj.attribute, attrObj.value);\n }\n } else {\n console.warn(\n `Incorrect \"buttonAttributes\". Please check the documentation.`,\n attrObj\n );\n }\n });\n }\n }\n\n onTouchDeviceDetected() {\n /**\n * Processing autoTouchEvents\n */\n this.processAutoTouchEvents();\n\n /**\n * Disabling contextual window on touch devices\n */\n this.disableContextualWindow();\n }\n\n /**\n * Disabling contextual window for hg-button\n */\n /* istanbul ignore next */\n disableContextualWindow() {\n window.oncontextmenu = (event: KeyboardHandlerEvent) => {\n if (event.target.classList.contains(\"hg-button\")) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n };\n }\n\n /**\n * Process autoTouchEvents option\n */\n processAutoTouchEvents() {\n if (this.options.autoUseTouchEvents) {\n this.options.useTouchEvents = true;\n\n if (this.options.debug) {\n console.log(\n `autoUseTouchEvents: Touch device detected, useTouchEvents enabled.`\n );\n }\n }\n }\n\n /**\n * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n */\n onInit() {\n if (this.options.debug) {\n console.log(`${this.keyboardDOMClass} Initialized`);\n }\n\n /**\n * setEventListeners\n */\n this.setEventListeners();\n\n if (typeof this.options.onInit === \"function\") this.options.onInit(this);\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeFirstRender() {\n /**\n * Performing actions when touch device detected\n */\n if (this.utilities.isTouchDevice()) {\n this.onTouchDeviceDetected();\n }\n\n if (typeof this.options.beforeFirstRender === \"function\")\n this.options.beforeFirstRender(this);\n\n /**\n * Notify about PointerEvents usage\n */\n if (\n this.isFirstKeyboardInstance &&\n this.utilities.pointerEventsSupported() &&\n !this.options.useTouchEvents &&\n !this.options.useMouseEvents\n ) {\n if (this.options.debug) {\n console.log(\"Using PointerEvents as it is supported by this browser\");\n }\n }\n\n /**\n * Notify about touch events usage\n */\n if (this.options.useTouchEvents) {\n if (this.options.debug) {\n console.log(\n \"useTouchEvents has been enabled. Only touch events will be used.\"\n );\n }\n }\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeRender() {\n if (typeof this.options.beforeRender === \"function\")\n this.options.beforeRender(this);\n }\n\n /**\n * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n */\n onRender() {\n if (typeof this.options.onRender === \"function\")\n this.options.onRender(this);\n }\n\n /**\n * Executes the callback function once all modules have been loaded\n */\n onModulesLoaded() {\n if (typeof this.options.onModulesLoaded === \"function\")\n this.options.onModulesLoaded(this);\n }\n\n /**\n * Register module\n */\n registerModule = (name: string, initCallback: any) => {\n if (!this.modules[name]) this.modules[name] = {};\n\n initCallback(this.modules[name]);\n };\n\n /**\n * Load modules\n */\n loadModules() {\n if (Array.isArray(this.options.modules)) {\n this.options.modules.forEach((KeyboardModule) => {\n const keyboardModule = new KeyboardModule(this);\n keyboardModule.init && keyboardModule.init(this);\n });\n\n this.keyboardPluginClasses = \"modules-loaded\";\n\n this.render();\n this.onModulesLoaded();\n }\n }\n\n /**\n * Get module prop\n */\n getModuleProp(name: string, prop: string) {\n if (!this.modules[name]) return false;\n\n return this.modules[name][prop];\n }\n\n /**\n * getModulesList\n */\n getModulesList() {\n return Object.keys(this.modules);\n }\n\n /**\n * Parse Row DOM containers\n */\n parseRowDOMContainers(\n rowDOM: HTMLDivElement,\n rowIndex: number,\n containerStartIndexes: number[],\n containerEndIndexes: number[]\n ) {\n const rowDOMArray = Array.from(rowDOM.children);\n let removedElements = 0;\n\n if (rowDOMArray.length) {\n containerStartIndexes.forEach((startIndex, arrIndex) => {\n const endIndex = containerEndIndexes[arrIndex];\n\n /**\n * If there exists a respective end index\n * if end index comes after start index\n */\n if (!endIndex || !(endIndex > startIndex)) {\n return false;\n }\n\n /**\n * Updated startIndex, endIndex\n * This is since the removal of buttons to place a single button container\n * results in a modified array size\n */\n const updated_startIndex = startIndex - removedElements;\n const updated_endIndex = endIndex - removedElements;\n\n /**\n * Create button container\n */\n const containerDOM = document.createElement(\"div\");\n containerDOM.className += \"hg-button-container\";\n const containerUID = `${this.options.layoutName}-r${rowIndex}c${arrIndex}`;\n containerDOM.setAttribute(\"data-skUID\", containerUID);\n\n /**\n * Taking elements due to be inserted into container\n */\n const containedElements = rowDOMArray.splice(\n updated_startIndex,\n updated_endIndex - updated_startIndex + 1\n );\n removedElements = updated_endIndex - updated_startIndex;\n\n /**\n * Inserting elements to container\n */\n containedElements.forEach((element) =>\n containerDOM.appendChild(element)\n );\n\n /**\n * Adding container at correct position within rowDOMArray\n */\n rowDOMArray.splice(updated_startIndex, 0, containerDOM);\n\n /**\n * Clearing old rowDOM children structure\n */\n rowDOM.innerHTML = \"\";\n\n /**\n * Appending rowDOM new children list\n */\n rowDOMArray.forEach((element) => rowDOM.appendChild(element));\n\n if (this.options.debug) {\n console.log(\n \"rowDOMContainer\",\n containedElements,\n updated_startIndex,\n updated_endIndex,\n removedElements + 1\n );\n }\n });\n }\n\n return rowDOM;\n }\n\n /**\n * getKeyboardClassString\n */\n getKeyboardClassString = (...baseDOMClasses: any[]) => {\n const keyboardClasses = [this.keyboardDOMClass, ...baseDOMClasses].filter(\n (DOMClass) => !!DOMClass\n );\n\n return keyboardClasses.join(\" \");\n };\n\n /**\n * Renders rows and buttons as per options\n */\n render() {\n /**\n * Clear keyboard\n */\n this.resetRows();\n\n /**\n * Calling beforeFirstRender\n */\n if (!this.initialized) {\n this.beforeFirstRender();\n }\n\n /**\n * Calling beforeRender\n */\n this.beforeRender();\n\n const layoutClass = `hg-layout-${this.options.layoutName}`;\n const layout = this.options.layout || getDefaultLayout();\n const useTouchEvents = this.options.useTouchEvents || false;\n const useTouchEventsClass = useTouchEvents ? \"hg-touch-events\" : \"\";\n const useMouseEvents = this.options.useMouseEvents || false;\n const disableRowButtonContainers = this.options.disableRowButtonContainers;\n\n /**\n * Adding themeClass, layoutClass to keyboardDOM\n */\n this.keyboardDOM.className = this.getKeyboardClassString(\n this.options.theme,\n layoutClass,\n this.keyboardPluginClasses,\n useTouchEventsClass\n );\n\n /**\n * Adding keyboard identifier\n */\n this.keyboardDOM.setAttribute(\"data-skInstance\", this.currentInstanceName);\n\n /**\n * Create row wrapper\n */\n this.keyboardRowsDOM = document.createElement(\"div\");\n this.keyboardRowsDOM.className = \"hg-rows\";\n\n /**\n * Iterating through each row\n */\n layout[this.options.layoutName || this.defaultName].forEach(\n (row: string, rIndex: number) => {\n let rowArray = row.split(\" \");\n\n /**\n * Enforce excludeFromLayout\n */\n if (\n this.options.excludeFromLayout &&\n this.options.excludeFromLayout[\n this.options.layoutName || this.defaultName\n ]\n ) {\n rowArray = rowArray.filter(\n (buttonName) =>\n this.options.excludeFromLayout &&\n !this.options.excludeFromLayout[\n this.options.layoutName || this.defaultName\n ].includes(buttonName)\n );\n }\n\n /**\n * Creating empty row\n */\n let rowDOM = document.createElement(\"div\");\n rowDOM.className += \"hg-row\";\n\n /**\n * Tracking container indicators in rows\n */\n const containerStartIndexes: number[] = [];\n const containerEndIndexes: number[] = [];\n\n /**\n * Iterating through each button in row\n */\n rowArray.forEach((button, bIndex) => {\n /**\n * Check if button has a container indicator\n */\n const buttonHasContainerStart =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"[\") === 0;\n\n const buttonHasContainerEnd =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"]\") === button.length - 1;\n\n /**\n * Save container start index, if applicable\n */\n if (buttonHasContainerStart) {\n containerStartIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\[/g, \"\");\n }\n\n if (buttonHasContainerEnd) {\n containerEndIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\]/g, \"\");\n }\n\n /**\n * Processing button options\n */\n const fctBtnClass = this.utilities.getButtonClass(button);\n const buttonDisplayName = this.utilities.getButtonDisplayName(\n button,\n this.options.display,\n this.options.mergeDisplay\n );\n\n /**\n * Creating button\n */\n const buttonType = this.options.useButtonTag ? \"button\" : \"div\";\n const buttonDOM = document.createElement(buttonType);\n buttonDOM.className += `hg-button ${fctBtnClass}`;\n\n /**\n * Adding buttonTheme\n */\n buttonDOM.classList.add(...this.getButtonThemeClasses(button));\n\n /**\n * Adding buttonAttributes\n */\n this.setDOMButtonAttributes(\n button,\n (attribute: string, value: string) => {\n buttonDOM.setAttribute(attribute, value);\n }\n );\n\n this.activeButtonClass = \"hg-activeButton\";\n\n /**\n * Handle button click event\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n /**\n * Handle PointerEvents\n */\n buttonDOM.onpointerdown = (e: KeyboardHandlerEvent) => {\n this.handleButtonClicked(button, e);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onpointerup = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n buttonDOM.onpointercancel = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n } else {\n /**\n * Fallback for browsers not supporting PointerEvents\n */\n if (useTouchEvents) {\n /**\n * Handle touch events\n */\n buttonDOM.ontouchstart = (e: KeyboardHandlerEvent) => {\n this.handleButtonClicked(button, e);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.ontouchend = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n buttonDOM.ontouchcancel = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n } else {\n /**\n * Handle mouse events\n */\n buttonDOM.onclick = (e: KeyboardHandlerEvent) => {\n this.setMouseHold(false);\n /**\n * Fire button handler in onclick for compatibility reasons\n * This fires handler before onKeyReleased, therefore when that option is set we will fire the handler\n * in onmousedown instead\n */\n if (typeof this.options.onKeyReleased !== \"function\") {\n this.handleButtonClicked(button, e);\n }\n };\n buttonDOM.onmousedown = (e: KeyboardHandlerEvent) => {\n /**\n * Fire button handler for onKeyReleased use-case\n */\n if (\n typeof this.options.onKeyReleased === \"function\" &&\n !this.isMouseHold\n ) {\n this.handleButtonClicked(button, e);\n }\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onmouseup = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n }\n }\n\n /**\n * Adding identifier\n */\n buttonDOM.setAttribute(\"data-skBtn\", button);\n\n /**\n * Adding unique id\n * Since there's no limit on spawning same buttons, the unique id ensures you can style every button\n */\n const buttonUID = `${this.options.layoutName}-r${rIndex}b${bIndex}`;\n buttonDOM.setAttribute(\"data-skBtnUID\", buttonUID);\n\n /**\n * Adding button label to button\n */\n const buttonSpanDOM = document.createElement(\"span\");\n buttonSpanDOM.innerHTML = buttonDisplayName;\n buttonDOM.appendChild(buttonSpanDOM);\n\n /**\n * Adding to buttonElements\n */\n if (!this.buttonElements[button]) this.buttonElements[button] = [];\n\n this.buttonElements[button].push(buttonDOM);\n\n /**\n * Appending button to row\n */\n rowDOM.appendChild(buttonDOM);\n });\n\n /**\n * Parse containers in row\n */\n rowDOM = this.parseRowDOMContainers(\n rowDOM,\n rIndex,\n containerStartIndexes,\n containerEndIndexes\n );\n\n /**\n * Appending row to hg-rows\n */\n this.keyboardRowsDOM.appendChild(rowDOM);\n }\n );\n\n /**\n * Appending row to keyboard\n */\n this.keyboardDOM.appendChild(this.keyboardRowsDOM);\n\n /**\n * Calling onRender\n */\n this.onRender();\n\n if (!this.initialized) {\n /**\n * Ensures that onInit and beforeFirstRender are only called once per instantiation\n */\n this.initialized = true;\n\n /**\n * Handling parent events\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n document.onpointerup = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n this.keyboardDOM.onpointerdown = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n } else if (useTouchEvents) {\n /**\n * Handling ontouchend, ontouchcancel\n */\n document.ontouchend = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n document.ontouchcancel = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n\n this.keyboardDOM.ontouchstart = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n } else if (!useTouchEvents) {\n /**\n * Handling mouseup\n */\n document.onmouseup = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n this.keyboardDOM.onmousedown = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n }\n\n /**\n * Calling onInit\n */\n this.onInit();\n }\n }\n}\n\nexport default SimpleKeyboard;\n","export const getDefaultLayout = () => {\n return {\n default: [\n \"` 1 2 3 4 5 6 7 8 9 0 - = {bksp}\",\n \"{tab} q w e r t y u i o p [ ] \\\\\",\n \"{lock} a s d f g h j k l ; ' {enter}\",\n \"{shift} z x c v b n m , . / {shift}\",\n \".com @ {space}\",\n ],\n shift: [\n \"~ ! @ # $ % ^ & * ( ) _ + {bksp}\",\n \"{tab} Q W E R T Y U I O P { } |\",\n '{lock} A S D F G H J K L : \" {enter}',\n \"{shift} Z X C V B N M < > ? {shift}\",\n \".com @ {space}\",\n ],\n };\n};\n","import SimpleKeyboard from \"./components/Keyboard\";\nexport { SimpleKeyboard };\nexport default SimpleKeyboard;\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Utilities","_ref","getOptions","getCaretPosition","getCaretPositionEnd","dispatch","_classCallCheck","_defineProperty","button","length","bindMethods","includes","buttonTypeClass","getButtonType","buttonWithoutBraces","replace","buttonNormalized","concat","display","arguments","undefined","assign","getDefaultDiplay","input","caretPos","caretPosEnd","moveCaret","options","commonParams","output","removeAt","apply","removeForwardsAt","addStringAt","tabCharOnTab","newLineOnEnter","Number","isInteger","debug","console","log","minus","newCaretPos","updateCaretPosAction","instance","setCaretPosition","caretPosition","source","str","position","positionEnd","slice","join","isMaxLengthReached","updateCaretPos","emojiMatchedReg","substring","match","substr","inputObj","updatedInput","maxLength","currentInput","inputName","condition","maxLengthReached","_typeof","Boolean","window","navigator","maxTouchPoints","PointerEvent","toLowerCase","trim","split","reduce","word","toUpperCase","arr","size","_toConsumableArray","Array","Math","ceil","map","_","i","index","newIndex","startMarkerIndex","indexOf","myClass","_step","_iterator","_createForOfIteratorHelper","getOwnPropertyNames","s","n","done","myMethod","bind","err","e","f","PhysicalKeyboard","_this","altKey","ctrlKey","shiftKey","code","keyCodeToKey","keyCode","physicalKeyboardHighlightPreventDefault","isModifierKey","preventDefault","stopImmediatePropagation","buttonPressed","getSimpleKeyboardLayoutKey","buttonDOM","buttonName","standardButtonPressed","getButtonElement","functionButtonPressed","_buttonDOM$","_buttonDOM$$onpointer","_buttonDOM","_buttonDOM$onpointerd","applyButtonStyle","buttonElement","style","background","physicalKeyboardHighlightBgColor","color","physicalKeyboardHighlightTextColor","isArray","forEach","physicalKeyboardHighlightPress","physicalKeyboardHighlightPressUsePointerEvents","onpointerdown","physicalKeyboardHighlightPressUseClick","_buttonDOM$2","click","handleButtonClicked","_buttonDOM$3","_buttonDOM$3$onpointe","_buttonDOM$onpointeru","removeAttribute","onpointerup","_output","keyId","CandidateBox","utilities","pageSize","layoutCandidatesPageSize","candidateBoxElement","remove","pageIndex","_ref2","candidateValue","targetElement","onSelect","candidateListPages","chunkArray","renderPage","nbPages","onItemSelected","selectedCandidate","destroy","_ref3","_this$candidateBoxEle","_this2","document","createElement","className","candidateListULElement","candidateListItem","_this2$options$displa","candidateListLIElement","getMouseEvent","mouseEvent","useTouchEvents","TouchEvent","MouseEvent","innerHTML","ontouchstart","onclick","appendChild","isPrevBtnElementActive","prevBtnElement","classList","add","prevBtnElementClickAction","isNextBtnElementActive","nextBtnElement","nextBtnElementClickAction","prepend","SimpleKeyboard","selectorOrOptions","keyboardOptions","keyboardDOMClass","keyboardDOM","querySelector","HTMLDivElement","warn","Error","caretPositionEnd","name","initCallback","modules","_len","baseDOMClasses","_key","filter","DOMClass","_this$handleParams","handleParams","_this$handleParams$op","_objectSpread","layoutName","theme","preventMouseDownDefault","enableLayoutCandidates","excludeFromLayout","keyboardPluginClasses","_this$options$inputNa","defaultName","buttonElements","currentInstanceName","camelCase","allKeyboardInstances","keyboardInstanceNames","keys","isFirstKeyboardInstance","physicalKeyboard","candidateBox","render","loadModules","endPosition","_this$options","layoutCandidatesObj","layoutCandidates","layoutCandidatesCaseSensitiveMatch","layoutCandidate","inputSubstr","regexp","RegExp","escapeRegex","matchAll","candidateKey","sort","a","b","_this3","show","_this3$options","disableCandidateNormalization","enableLayoutCandidatesKeyPress","candidateStr","normalize","getInput","initialCaretPosition","newInputSubstr","newInput","caretPositionDiff","newCaretPosition","setInput","onKeyPress","onChange","onChangeAll","getAllInputs","_this$options2","_this$options2$inputN","getUpdatedInput","isStandardButton","activeInputElement","setSelectionRange","inputPattern","inputPatternIsValid","handleMaxLength","newInputValue","type","syncInstanceInputs","target","_this$candidateBox","_this$getInputCandida","getInputCandidates","showCandidatesBox","isMouseHold","_this4","stopMouseDownPropagation","stopPropagation","activeButtonClass","holdInteractionTimeout","clearTimeout","holdTimeout","setMouseHold","disableButtonHold","setTimeout","getMouseHold","handleButtonHold","_this5","preventMouseUpDefault","stopMouseUpPropagation","contains","recurseButtons","onKeyReleased","_this6","_this7","replaceInput","skipSync","rtl","_this8","changedOptions","onSetOptions","newOptions","_this9","optionName","JSON","stringify","keyboardRowsDOM","setAttribute","callback","buttons","_this10","classNameItem","buttonTheme","classNameFound","buttonThemeArray","push","class","_this11","_this11$options","_buttonTheme","_this11$options$butto","filteredButtonArray","item","splice","buttonArr","inputVal","inputPatternRaw","didInputMatch","test","_this$options$physica","addEventListener","handleKeyUp","handleKeyDown","handleMouseUp","handleTouchEnd","handleSelectionChange","handleSelect","event","caretEventHandler","physicalKeyboardHighlight","handleHighlightKeyUp","handleHighlightKeyDown","userAgent","targetTagName","_this12","tagName","isKeyboard","path","some","_item$hasAttribute","hasAttribute","disableCaretPositioning","selectionStart","selectionEnd","getRtlOffset","fn","_this13","_this$options$physica2","removeEventListener","ontouchend","ontouchcancel","onmouseup","onpointercancel","onmousedown","resetRows","initialized","buttonClasses","themeObj","themeObjClasses","buttonAttributes","attrObj","attribute","processAutoTouchEvents","disableContextualWindow","oncontextmenu","autoUseTouchEvents","setEventListeners","onInit","isTouchDevice","onTouchDeviceDetected","beforeFirstRender","pointerEventsSupported","useMouseEvents","beforeRender","onRender","onModulesLoaded","_this14","KeyboardModule","keyboardModule","init","rowDOM","rowIndex","containerStartIndexes","containerEndIndexes","_this15","rowDOMArray","from","children","removedElements","startIndex","arrIndex","endIndex","updated_startIndex","updated_endIndex","containerDOM","containerUID","containedElements","element","_this16","layoutClass","layout","default","shift","useTouchEventsClass","disableRowButtonContainers","getKeyboardClassString","row","rIndex","rowArray","bIndex","_buttonDOM$classList","buttonHasContainerStart","buttonHasContainerEnd","fctBtnClass","getButtonClass","buttonDisplayName","getButtonDisplayName","mergeDisplay","buttonType","useButtonTag","getButtonThemeClasses","setDOMButtonAttributes","handleButtonMouseDown","handleButtonMouseUp","buttonUID","buttonSpanDOM","parseRowDOMContainers","handleKeyboardContainerMouseDown"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.modern.js","mappings":";;;;;;;;;;;;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAwB,eAAID,IAE5BD,EAAqB,eAAIC,GAC1B,CATD,CASGK,MAAM,WACT,kB,aCTA,IAAIC,EAAsB,CCA1BA,EAAwB,SAASL,EAASM,GACzC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAG3E,ECPAF,EAAwB,SAASQ,EAAKC,GAAQ,OAAOL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,EAAO,ECCtGT,EAAwB,SAASL,GACX,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GACvD,G,4oDCHA,IAGMC,EAAS,WA2Bb,O,EAjBA,SAAAA,EAAAC,GAKoB,IAJlBC,EAAUD,EAAVC,WACAC,EAAgBF,EAAhBE,iBACAC,EAAmBH,EAAnBG,oBACAC,EAAQJ,EAARI,U,4FAAQC,CAAA,KAAAN,GAAAO,EAAA,0BAAAA,EAAA,gCAAAA,EAAA,mCAAAA,EAAA,wBAAAA,EAAA,gCA6RVA,EAAA,yBAGmB,SAACC,GAAc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D+T,EAAK6B,iCAAiC5V,EAAE,GAChC8E,IAIVT,SAAS2M,UAAY,SAAChR,GAAuB,OAC3C+T,EAAKyB,yBAAoB1a,EAAWkF,EAAE,EACxCvH,KAAKyN,YAAYgL,YAAc,SAAClR,GAAuB,OACrD+T,EAAK6B,iCAAiC5V,EAAE,IAtB1CqE,SAASxB,YAAc,SAAC7C,GAAuB,OAC7C+T,EAAKyB,yBAAoB1a,EAAWkF,EAAE,EACxCvH,KAAKyN,YAAY9D,cAAgB,SAACpC,GAAuB,OACvD+T,EAAK6B,iCAAiC5V,EAAE,GAyB5CvH,KAAKuZ,SAET,I,4FAAC,CA5+DiB,GA++DpB,IEngEA,I,SVQA,E","sources":["webpack://SimpleKeyboard/webpack/universalModuleDefinition","webpack://SimpleKeyboard/webpack/bootstrap","webpack://SimpleKeyboard/webpack/runtime/define property getters","webpack://SimpleKeyboard/webpack/runtime/hasOwnProperty shorthand","webpack://SimpleKeyboard/webpack/runtime/make namespace object","webpack://SimpleKeyboard/./src/lib/services/Utilities.ts","webpack://SimpleKeyboard/./src/lib/services/PhysicalKeyboard.ts","webpack://SimpleKeyboard/./src/lib/components/CandidateBox.ts","webpack://SimpleKeyboard/./src/lib/components/Keyboard.ts","webpack://SimpleKeyboard/./src/lib/services/KeyboardLayout.ts","webpack://SimpleKeyboard/./src/lib/index.modern.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SimpleKeyboard\"] = factory();\n\telse\n\t\troot[\"SimpleKeyboard\"] = factory();\n})(this, function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { KeyboardInput } from \"./../interfaces\";\nimport { KeyboardOptions, UtilitiesParams } from \"../interfaces\";\n\n/**\n * Utility Service\n */\nclass Utilities {\n getOptions: () => KeyboardOptions;\n getCaretPosition: () => number | null;\n getCaretPositionEnd: () => number | null;\n dispatch: any;\n maxLengthReached!: boolean;\n\n /**\n * Creates an instance of the Utility service\n */\n constructor({\n getOptions,\n getCaretPosition,\n getCaretPositionEnd,\n dispatch,\n }: UtilitiesParams) {\n this.getOptions = getOptions;\n this.getCaretPosition = getCaretPosition;\n this.getCaretPositionEnd = getCaretPositionEnd;\n this.dispatch = dispatch;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(Utilities, this);\n }\n\n /**\n * Retrieve button type\n *\n * @param {string} button The button's layout name\n * @return {string} The button type\n */\n getButtonType(button: string): string {\n return button.includes(\"{\") && button.includes(\"}\") && button !== \"{//}\"\n ? \"functionBtn\"\n : \"standardBtn\";\n }\n\n /**\n * Adds default classes to a given button\n *\n * @param {string} button The button's layout name\n * @return {string} The classes to be added to the button\n */\n getButtonClass(button: string): string {\n const buttonTypeClass = this.getButtonType(button);\n const buttonWithoutBraces = button.replace(\"{\", \"\").replace(\"}\", \"\");\n let buttonNormalized = \"\";\n\n if (buttonTypeClass !== \"standardBtn\")\n buttonNormalized = ` hg-button-${buttonWithoutBraces}`;\n\n return `hg-${buttonTypeClass}${buttonNormalized}`;\n }\n\n /**\n * Default button display labels\n */\n getDefaultDiplay() {\n return {\n \"{bksp}\": \"backspace\",\n \"{backspace}\": \"backspace\",\n \"{enter}\": \"< enter\",\n \"{shift}\": \"shift\",\n \"{shiftleft}\": \"shift\",\n \"{shiftright}\": \"shift\",\n \"{alt}\": \"alt\",\n \"{s}\": \"shift\",\n \"{tab}\": \"tab\",\n \"{lock}\": \"caps\",\n \"{capslock}\": \"caps\",\n \"{accept}\": \"Submit\",\n \"{space}\": \" \",\n \"{//}\": \" \",\n \"{esc}\": \"esc\",\n \"{escape}\": \"esc\",\n \"{f1}\": \"f1\",\n \"{f2}\": \"f2\",\n \"{f3}\": \"f3\",\n \"{f4}\": \"f4\",\n \"{f5}\": \"f5\",\n \"{f6}\": \"f6\",\n \"{f7}\": \"f7\",\n \"{f8}\": \"f8\",\n \"{f9}\": \"f9\",\n \"{f10}\": \"f10\",\n \"{f11}\": \"f11\",\n \"{f12}\": \"f12\",\n \"{numpaddivide}\": \"/\",\n \"{numlock}\": \"lock\",\n \"{arrowup}\": \"↑\",\n \"{arrowleft}\": \"←\",\n \"{arrowdown}\": \"↓\",\n \"{arrowright}\": \"→\",\n \"{prtscr}\": \"print\",\n \"{scrolllock}\": \"scroll\",\n \"{pause}\": \"pause\",\n \"{insert}\": \"ins\",\n \"{home}\": \"home\",\n \"{pageup}\": \"up\",\n \"{delete}\": \"del\",\n \"{forwarddelete}\": \"del\",\n \"{end}\": \"end\",\n \"{pagedown}\": \"down\",\n \"{numpadmultiply}\": \"*\",\n \"{numpadsubtract}\": \"-\",\n \"{numpadadd}\": \"+\",\n \"{numpadenter}\": \"enter\",\n \"{period}\": \".\",\n \"{numpaddecimal}\": \".\",\n \"{numpad0}\": \"0\",\n \"{numpad1}\": \"1\",\n \"{numpad2}\": \"2\",\n \"{numpad3}\": \"3\",\n \"{numpad4}\": \"4\",\n \"{numpad5}\": \"5\",\n \"{numpad6}\": \"6\",\n \"{numpad7}\": \"7\",\n \"{numpad8}\": \"8\",\n \"{numpad9}\": \"9\",\n };\n }\n /**\n * Returns the display (label) name for a given button\n *\n * @param {string} button The button's layout name\n * @param {object} display The provided display option\n * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.\n */\n getButtonDisplayName(\n button: string,\n display: KeyboardOptions[\"display\"],\n mergeDisplay = false\n ) {\n if (mergeDisplay) {\n display = Object.assign({}, this.getDefaultDiplay(), display);\n } else {\n display = display || this.getDefaultDiplay();\n }\n\n return display[button] || button;\n }\n\n /**\n * Returns the updated input resulting from clicking a given button\n *\n * @param {string} button The button's layout name\n * @param {string} input The input string\n * @param {number} caretPos The cursor's current position\n * @param {number} caretPosEnd The cursor's current end position\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n getUpdatedInput(\n button: string,\n input: string,\n caretPos: any,\n caretPosEnd = caretPos,\n moveCaret = false\n ) {\n const options = this.getOptions();\n const commonParams: [number | undefined, number | undefined, boolean] = [\n caretPos,\n caretPosEnd,\n moveCaret,\n ];\n\n let output = input;\n\n if (\n (button === \"{bksp}\" || button === \"{backspace}\") &&\n output.length > 0\n ) {\n output = this.removeAt(output, ...commonParams);\n } else if (\n (button === \"{delete}\" || button === \"{forwarddelete}\") &&\n output.length > 0\n ) {\n output = this.removeForwardsAt(output, ...commonParams);\n } else if (button === \"{space}\")\n output = this.addStringAt(output, \" \", ...commonParams);\n else if (\n button === \"{tab}\" &&\n !(\n typeof options.tabCharOnTab === \"boolean\" &&\n options.tabCharOnTab === false\n )\n ) {\n output = this.addStringAt(output, \"\\t\", ...commonParams);\n } else if (\n (button === \"{enter}\" || button === \"{numpadenter}\") &&\n options.newLineOnEnter\n )\n output = this.addStringAt(output, \"\\n\", ...commonParams);\n else if (\n button.includes(\"numpad\") &&\n Number.isInteger(Number(button[button.length - 2]))\n ) {\n output = this.addStringAt(\n output,\n button[button.length - 2],\n ...commonParams\n );\n } else if (button === \"{numpaddivide}\")\n output = this.addStringAt(output, \"/\", ...commonParams);\n else if (button === \"{numpadmultiply}\")\n output = this.addStringAt(output, \"*\", ...commonParams);\n else if (button === \"{numpadsubtract}\")\n output = this.addStringAt(output, \"-\", ...commonParams);\n else if (button === \"{numpadadd}\")\n output = this.addStringAt(output, \"+\", ...commonParams);\n else if (button === \"{numpaddecimal}\")\n output = this.addStringAt(output, \".\", ...commonParams);\n else if (button === \"{\" || button === \"}\")\n output = this.addStringAt(output, button, ...commonParams);\n else if (!button.includes(\"{\") && !button.includes(\"}\"))\n output = this.addStringAt(output, button, ...commonParams);\n\n if(options.debug){\n console.log(\"Input will be: \"+ output);\n }\n\n return output;\n }\n\n /**\n * Moves the cursor position by a given amount\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPos(length: number, minus = false) {\n const newCaretPos = this.updateCaretPosAction(length, minus);\n\n this.dispatch((instance: any) => {\n instance.setCaretPosition(newCaretPos);\n });\n }\n\n /**\n * Action method of updateCaretPos\n *\n * @param {number} length Represents by how many characters the input should be moved\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\n */\n updateCaretPosAction(length: number, minus = false) {\n const options = this.getOptions();\n let caretPosition = this.getCaretPosition();\n\n if (caretPosition != null) {\n if (minus) {\n if (caretPosition > 0) caretPosition = caretPosition - length;\n } else {\n caretPosition = caretPosition + length;\n }\n }\n\n if (options.debug) {\n console.log(\"Caret at:\", caretPosition);\n }\n\n return caretPosition;\n }\n\n /**\n * Adds a string to the input at a given position\n *\n * @param {string} source The source input\n * @param {string} str The string to add\n * @param {number} position The (cursor) position where the string should be added\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n addStringAt(\n source: string,\n str: string,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n let output;\n\n if (!position && position !== 0) {\n output = source + str;\n } else {\n output = [source.slice(0, position), str, source.slice(positionEnd)].join(\n \"\"\n );\n\n /**\n * Avoid caret position change when maxLength is set\n */\n if (!this.isMaxLengthReached()) {\n if (moveCaret) this.updateCaretPos(str.length);\n }\n }\n\n return output;\n }\n\n /**\n * Check whether the button is a standard button\n */\n isStandardButton = (button: string) =>\n button && !(button[0] === \"{\" && button[button.length - 1] === \"}\");\n\n /**\n * Removes an amount of characters before a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n * @param {boolean} moveCaret Whether to update simple-keyboard's cursor\n */\n removeAt(\n source: string,\n position = source.length,\n positionEnd = source.length,\n moveCaret = false\n ) {\n if (position === 0 && positionEnd === 0) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n let prevTwoChars;\n let emojiMatched;\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n if (position && position >= 0) {\n prevTwoChars = source.substring(position - 2, position);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position - 2) + source.substr(position);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.substr(0, position - 1) + source.substr(position);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n } else {\n prevTwoChars = source.slice(-2);\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.slice(0, -2);\n if (moveCaret) this.updateCaretPos(2, true);\n } else {\n output = source.slice(0, -1);\n if (moveCaret) this.updateCaretPos(1, true);\n }\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch((instance: any) => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n\n /**\n * Removes an amount of characters after a given position\n *\n * @param {string} source The source input\n * @param {number} position The (cursor) position from where the characters should be removed\n */\n removeForwardsAt(\n source: string,\n position: number = source.length,\n positionEnd: number = source.length,\n moveCaret = false\n ) {\n if (!source?.length || position === null) {\n return source;\n }\n\n let output;\n\n if (position === positionEnd) {\n const emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n\n /**\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\n */\n const nextTwoChars = source.substring(position, position + 2);\n const emojiMatched = nextTwoChars.match(emojiMatchedReg);\n\n if (emojiMatched) {\n output = source.substr(0, position) + source.substr(position + 2);\n } else {\n output = source.substr(0, position) + source.substr(position + 1);\n }\n } else {\n output = source.slice(0, position) + source.slice(positionEnd);\n if (moveCaret) {\n this.dispatch((instance: any) => {\n instance.setCaretPosition(position);\n });\n }\n }\n\n return output;\n }\n\n /**\n * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.\n *\n * @param {object} inputObj\n * @param {string} updatedInput\n */\n handleMaxLength(inputObj: KeyboardInput, updatedInput: string) {\n const options = this.getOptions();\n const maxLength = options.maxLength;\n const currentInput = inputObj[options.inputName || \"default\"];\n const condition = updatedInput.length - 1 >= maxLength;\n\n if (\n /**\n * If pressing this button won't add more characters\n * We exit out of this limiter function\n */\n updatedInput.length <= currentInput.length\n ) {\n return false;\n }\n\n if (Number.isInteger(maxLength)) {\n if (options.debug) {\n console.log(\"maxLength (num) reached:\", condition);\n }\n\n if (condition) {\n /**\n * @type {boolean} Boolean value that shows whether maxLength has been reached\n */\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n\n if (typeof maxLength === \"object\") {\n const condition =\n updatedInput.length - 1 >= maxLength[options.inputName || \"default\"];\n\n if (options.debug) {\n console.log(\"maxLength (obj) reached:\", condition);\n }\n\n if (condition) {\n this.maxLengthReached = true;\n return true;\n } else {\n this.maxLengthReached = false;\n return false;\n }\n }\n }\n\n /**\n * Gets the current value of maxLengthReached\n */\n isMaxLengthReached() {\n return Boolean(this.maxLengthReached);\n }\n\n /**\n * Determines whether a touch device is being used\n */\n isTouchDevice() {\n return \"ontouchstart\" in window || navigator.maxTouchPoints;\n }\n\n /**\n * Determines whether pointer events are supported\n */\n pointerEventsSupported() {\n return !!window.PointerEvent;\n }\n\n /**\n * Bind all methods in a given class\n */\n\n static bindMethods(myClass: any, instance: any) {\n // eslint-disable-next-line no-unused-vars\n for (const myMethod of Object.getOwnPropertyNames(myClass.prototype)) {\n const excludeMethod =\n myMethod === \"constructor\" || myMethod === \"bindMethods\";\n if (!excludeMethod) {\n instance[myMethod] = instance[myMethod].bind(instance);\n }\n }\n }\n\n /**\n * Transforms an arbitrary string to camelCase\n *\n * @param {string} str The string to transform.\n */\n camelCase(str: string): string {\n if (!str) return \"\";\n\n return str\n .toLowerCase()\n .trim()\n .split(/[.\\-_\\s]/g)\n .reduce((str, word) =>\n word.length ? str + word[0].toUpperCase() + word.slice(1) : str\n );\n }\n\n /**\n * Split array into chunks\n */\n chunkArray(arr: T[], size: number): T[][] {\n return [...Array(Math.ceil(arr.length / size))].map((_, i) =>\n arr.slice(size * i, size + size * i)\n );\n }\n\n /**\n * Escape regex input\n */\n escapeRegex(str: string) {\n return str.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n }\n\n /**\n * Calculate caret position offset when using rtl option\n */\n getRtlOffset(index: number, input: string) {\n let newIndex = index;\n const startMarkerIndex = input.indexOf(\"\\u202B\");\n const endMarkerIndex = input.indexOf(\"\\u202C\");\n\n if(startMarkerIndex < index && startMarkerIndex != -1){ newIndex--; }\n if(endMarkerIndex < index && startMarkerIndex != -1){ newIndex--; }\n\n return newIndex < 0 ? 0 : newIndex;\n }\n\n /**\n * Reusable empty function\n */\n static noop = () => {};\n}\n\nexport default Utilities;\n","import { KeyboardOptions, PhysicalKeyboardParams } from \"../interfaces\";\nimport Utilities from \"../services/Utilities\";\n\n/**\n * Physical Keyboard Service\n */\nclass PhysicalKeyboard {\n getOptions: () => KeyboardOptions;\n dispatch: any;\n\n /**\n * Creates an instance of the PhysicalKeyboard service\n */\n constructor({ dispatch, getOptions }: PhysicalKeyboardParams) {\n /**\n * @type {object} A simple-keyboard instance\n */\n this.dispatch = dispatch;\n this.getOptions = getOptions;\n\n /**\n * Bindings\n */\n Utilities.bindMethods(PhysicalKeyboard, this);\n }\n\n handleHighlightKeyDown(e: KeyboardEvent) {\n const options = this.getOptions();\n\n if(options.physicalKeyboardHighlightPreventDefault && this.isModifierKey(e)){\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n const buttonPressed = this.getSimpleKeyboardLayoutKey(e);\n\n this.dispatch((instance: any) => {\n const standardButtonPressed = instance.getButtonElement(buttonPressed);\n const functionButtonPressed = instance.getButtonElement(\n `{${buttonPressed}}`\n );\n let buttonDOM;\n let buttonName: string;\n\n if (standardButtonPressed) {\n buttonDOM = standardButtonPressed;\n buttonName = buttonPressed;\n } else if (functionButtonPressed) {\n buttonDOM = functionButtonPressed;\n buttonName = `{${buttonPressed}}`;\n } else {\n return;\n }\n\n const applyButtonStyle = (buttonElement: HTMLElement) => {\n buttonElement.style.background =\n options.physicalKeyboardHighlightBgColor || \"#dadce4\";\n buttonElement.style.color =\n options.physicalKeyboardHighlightTextColor || \"black\";\n }\n\n if (buttonDOM) {\n if(Array.isArray(buttonDOM)){\n buttonDOM.forEach(buttonElement => applyButtonStyle(buttonElement));\n\n // Even though we have an array of buttons, we just want to press one of them\n if (options.physicalKeyboardHighlightPress) {\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM[0]?.onpointerdown?.(e);\n } else if (options.physicalKeyboardHighlightPressUseClick) {\n buttonDOM[0]?.click();\n } else {\n instance.handleButtonClicked(buttonName, e);\n }\n }\n } else {\n applyButtonStyle(buttonDOM);\n\n if (options.physicalKeyboardHighlightPress) {\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM?.onpointerdown?.(e);\n } else if (options.physicalKeyboardHighlightPressUseClick) {\n buttonDOM.click();\n } else {\n instance.handleButtonClicked(buttonName, e);\n }\n }\n }\n }\n });\n }\n\n handleHighlightKeyUp(e: KeyboardEvent) {\n const options = this.getOptions();\n\n if(options.physicalKeyboardHighlightPreventDefault && this.isModifierKey(e)){\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n \n const buttonPressed = this.getSimpleKeyboardLayoutKey(e);\n\n this.dispatch((instance: any) => {\n const buttonDOM =\n instance.getButtonElement(buttonPressed) ||\n instance.getButtonElement(`{${buttonPressed}}`);\n\n const applyButtonStyle = (buttonElement: HTMLElement) => {\n if(buttonElement.removeAttribute){\n buttonElement.removeAttribute(\"style\");\n }\n };\n\n if (buttonDOM) {\n if(Array.isArray(buttonDOM)){\n buttonDOM.forEach(buttonElement => applyButtonStyle(buttonElement));\n\n // Even though we have an array of buttons, we just want to press one of them\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM[0]?.onpointerup?.(e);\n }\n } else {\n applyButtonStyle(buttonDOM);\n\n if (options.physicalKeyboardHighlightPressUsePointerEvents) {\n buttonDOM?.onpointerup?.(e);\n }\n }\n }\n });\n }\n\n /**\n * Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format\n * @param {object} e The KeyboardEvent\n */\n getSimpleKeyboardLayoutKey(e: KeyboardEvent) {\n let output = \"\";\n const keyId = e.code || e.key || this.keyCodeToKey(e?.keyCode);\n\n if (\n keyId?.includes(\"Numpad\") ||\n keyId?.includes(\"Shift\") ||\n keyId?.includes(\"Space\") ||\n keyId?.includes(\"Backspace\") ||\n keyId?.includes(\"Control\") ||\n keyId?.includes(\"Alt\") ||\n keyId?.includes(\"Meta\")\n ) {\n output = e.code || \"\";\n } else {\n output = e.key || this.keyCodeToKey(e?.keyCode) || \"\";\n }\n\n return output.length > 1 ? output?.toLowerCase() : output;\n }\n\n /**\n * Retrieve key from keyCode\n */\n keyCodeToKey(keyCode: number): string {\n return {\n 8: \"Backspace\",\n 9: \"Tab\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Ctrl\",\n 18: \"Alt\",\n 19: \"Pause\",\n 20: \"CapsLock\",\n 27: \"Esc\",\n 32: \"Space\",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 45: \"Insert\",\n 46: \"Delete\",\n 48: \"0\",\n 49: \"1\",\n 50: \"2\",\n 51: \"3\",\n 52: \"4\",\n 53: \"5\",\n 54: \"6\",\n 55: \"7\",\n 56: \"8\",\n 57: \"9\",\n 65: \"A\",\n 66: \"B\",\n 67: \"C\",\n 68: \"D\",\n 69: \"E\",\n 70: \"F\",\n 71: \"G\",\n 72: \"H\",\n 73: \"I\",\n 74: \"J\",\n 75: \"K\",\n 76: \"L\",\n 77: \"M\",\n 78: \"N\",\n 79: \"O\",\n 80: \"P\",\n 81: \"Q\",\n 82: \"R\",\n 83: \"S\",\n 84: \"T\",\n 85: \"U\",\n 86: \"V\",\n 87: \"W\",\n 88: \"X\",\n 89: \"Y\",\n 90: \"Z\",\n 91: \"Meta\",\n 96: \"Numpad0\",\n 97: \"Numpad1\",\n 98: \"Numpad2\",\n 99: \"Numpad3\",\n 100: \"Numpad4\",\n 101: \"Numpad5\",\n 102: \"Numpad6\",\n 103: \"Numpad7\",\n 104: \"Numpad8\",\n 105: \"Numpad9\",\n 106: \"NumpadMultiply\",\n 107: \"NumpadAdd\",\n 109: \"NumpadSubtract\",\n 110: \"NumpadDecimal\",\n 111: \"NumpadDivide\",\n 112: \"F1\",\n 113: \"F2\",\n 114: \"F3\",\n 115: \"F4\",\n 116: \"F5\",\n 117: \"F6\",\n 118: \"F7\",\n 119: \"F8\",\n 120: \"F9\",\n 121: \"F10\",\n 122: \"F11\",\n 123: \"F12\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\",\n }[keyCode] || \"\";\n }\n\n isModifierKey = (e: KeyboardEvent): boolean => {\n return (\n e.altKey\n || e.ctrlKey\n || e.shiftKey\n || [\"Tab\", \"CapsLock\", \"Esc\", \"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"].includes(\n e.code || e.key || this.keyCodeToKey(e?.keyCode)\n )\n )\n }\n}\n\nexport default PhysicalKeyboard;\n","import \"./css/CandidateBox.css\";\n\nimport Utilities from \"../services/Utilities\";\nimport {\n CandidateBoxParams,\n CandidateBoxRenderParams,\n CandidateBoxShowParams,\n KeyboardOptions,\n} from \"./../interfaces\";\n\nclass CandidateBox {\n utilities: Utilities;\n options: KeyboardOptions;\n candidateBoxElement!: HTMLDivElement;\n pageIndex = 0;\n pageSize: number;\n\n constructor({ utilities, options }: CandidateBoxParams) {\n this.utilities = utilities;\n this.options = options;\n Utilities.bindMethods(CandidateBox, this);\n this.pageSize = this.utilities.getOptions().layoutCandidatesPageSize || 5;\n }\n\n destroy() {\n if (this.candidateBoxElement) {\n this.candidateBoxElement.remove();\n this.pageIndex = 0;\n }\n }\n\n show({\n candidateValue,\n targetElement,\n onSelect,\n }: CandidateBoxShowParams): void {\n if (!candidateValue || !candidateValue.length) {\n return;\n }\n\n const candidateListPages = this.utilities.chunkArray(\n candidateValue.split(\" \"),\n this.pageSize\n );\n\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: this.pageIndex,\n nbPages: candidateListPages.length,\n onItemSelected: (selectedCandidate: string, e: MouseEvent) => {\n onSelect(selectedCandidate, e);\n this.destroy();\n },\n });\n }\n\n renderPage({\n candidateListPages,\n targetElement,\n pageIndex,\n nbPages,\n onItemSelected,\n }: CandidateBoxRenderParams) {\n // Remove current candidate box, if any\n this.candidateBoxElement?.remove();\n\n // Create candidate box element\n this.candidateBoxElement = document.createElement(\"div\");\n this.candidateBoxElement.className = \"hg-candidate-box\";\n\n // Candidate box list\n const candidateListULElement = document.createElement(\"ul\");\n candidateListULElement.className = \"hg-candidate-box-list\";\n\n // Create Candidate box list items\n candidateListPages[pageIndex].forEach((candidateListItem) => {\n const candidateListLIElement = document.createElement(\"li\");\n const getMouseEvent = () => {\n const mouseEvent = new (this.options.useTouchEvents ? TouchEvent : MouseEvent)(\"click\");\n Object.defineProperty(mouseEvent, \"target\", {\n value: candidateListLIElement,\n });\n return mouseEvent;\n };\n\n candidateListLIElement.className = \"hg-candidate-box-list-item\";\n candidateListLIElement.innerHTML = this.options.display?.[candidateListItem] || candidateListItem;\n\n if(this.options.useTouchEvents) {\n candidateListLIElement.ontouchstart = (e: any) =>\n onItemSelected(candidateListItem, e || getMouseEvent());\n } else {\n candidateListLIElement.onclick = (e = getMouseEvent() as MouseEvent) =>\n onItemSelected(candidateListItem, e);\n }\n\n // Append list item to ul\n candidateListULElement.appendChild(candidateListLIElement);\n });\n\n // Add previous button\n const isPrevBtnElementActive = pageIndex > 0;\n const prevBtnElement = document.createElement(\"div\");\n prevBtnElement.classList.add(\"hg-candidate-box-prev\");\n isPrevBtnElementActive &&\n prevBtnElement.classList.add(\"hg-candidate-box-btn-active\");\n\n const prevBtnElementClickAction = () => {\n if (!isPrevBtnElementActive) return;\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: pageIndex - 1,\n nbPages,\n onItemSelected,\n });\n };\n\n if(this.options.useTouchEvents) {\n prevBtnElement.ontouchstart = prevBtnElementClickAction;\n } else {\n prevBtnElement.onclick = prevBtnElementClickAction;\n }\n \n this.candidateBoxElement.appendChild(prevBtnElement);\n\n // Add elements to container\n this.candidateBoxElement.appendChild(candidateListULElement);\n\n // Add next button\n const isNextBtnElementActive = pageIndex < nbPages - 1;\n const nextBtnElement = document.createElement(\"div\");\n nextBtnElement.classList.add(\"hg-candidate-box-next\");\n isNextBtnElementActive &&\n nextBtnElement.classList.add(\"hg-candidate-box-btn-active\");\n\n const nextBtnElementClickAction = () => {\n if (!isNextBtnElementActive) return;\n this.renderPage({\n candidateListPages,\n targetElement,\n pageIndex: pageIndex + 1,\n nbPages,\n onItemSelected,\n });\n };\n\n if(this.options.useTouchEvents) {\n nextBtnElement.ontouchstart = nextBtnElementClickAction;\n } else {\n nextBtnElement.onclick = nextBtnElementClickAction;\n }\n\n this.candidateBoxElement.appendChild(nextBtnElement);\n\n // Append candidate box to target element\n targetElement.prepend(this.candidateBoxElement);\n }\n}\n\nexport default CandidateBox;\n","import \"./css/Keyboard.css\";\n\n// Services\nimport { getDefaultLayout } from \"../services/KeyboardLayout\";\nimport PhysicalKeyboard from \"../services/PhysicalKeyboard\";\nimport Utilities from \"../services/Utilities\";\nimport {\n KeyboardOptions,\n KeyboardInput,\n KeyboardButtonElements,\n KeyboardHandlerEvent,\n KeyboardElement,\n} from \"../interfaces\";\nimport CandidateBox from \"./CandidateBox\";\n\n/**\n * Root class for simple-keyboard.\n * This class:\n * - Parses the options\n * - Renders the rows and buttons\n * - Handles button functionality\n */\nclass SimpleKeyboard {\n input!: KeyboardInput;\n options!: KeyboardOptions;\n utilities!: Utilities;\n caretPosition!: number | null;\n caretPositionEnd!: number | null;\n keyboardDOM!: KeyboardElement;\n keyboardPluginClasses!: string;\n keyboardDOMClass!: string;\n buttonElements!: KeyboardButtonElements;\n currentInstanceName!: string;\n allKeyboardInstances!: { [key: string]: SimpleKeyboard };\n keyboardInstanceNames!: string[];\n isFirstKeyboardInstance!: boolean;\n physicalKeyboard!: PhysicalKeyboard;\n modules!: { [key: string]: any };\n activeButtonClass!: string;\n holdInteractionTimeout!: number;\n holdTimeout!: number;\n isMouseHold!: boolean;\n initialized!: boolean;\n candidateBox!: CandidateBox | null;\n keyboardRowsDOM!: KeyboardElement;\n defaultName = \"default\";\n activeInputElement: HTMLInputElement | HTMLTextAreaElement | null = null;\n\n /**\n * Creates an instance of SimpleKeyboard\n * @param {Array} params If first parameter is a string, it is considered the container class. The second parameter is then considered the options object. If first parameter is an object, it is considered the options object.\n */\n constructor(\n selectorOrOptions?: string | HTMLDivElement | KeyboardOptions,\n keyboardOptions?: KeyboardOptions\n ) {\n if (typeof window === \"undefined\") return;\n\n const {\n keyboardDOMClass,\n keyboardDOM,\n options = {},\n } = this.handleParams(selectorOrOptions, keyboardOptions);\n\n /**\n * Initializing Utilities\n */\n this.utilities = new Utilities({\n getOptions: this.getOptions,\n getCaretPosition: this.getCaretPosition,\n getCaretPositionEnd: this.getCaretPositionEnd,\n dispatch: this.dispatch,\n });\n\n /**\n * Caret position\n */\n this.caretPosition = null;\n\n /**\n * Caret position end\n */\n this.caretPositionEnd = null;\n\n /**\n * Processing options\n */\n this.keyboardDOM = keyboardDOM;\n\n /**\n * @type {object}\n * @property {object} layout Modify the keyboard layout.\n * @property {string} layoutName Specifies which layout should be used.\n * @property {object} display Replaces variable buttons (such as {bksp}) with a human-friendly name (e.g.: “backspace”).\n * @property {boolean} mergeDisplay By default, when you set the display property, you replace the default one. This setting merges them instead.\n * @property {string} theme A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space.\n * @property {array} buttonTheme A prop to add your own css classes to one or several buttons.\n * @property {array} buttonAttributes A prop to add your own attributes to one or several buttons.\n * @property {boolean} debug Runs a console.log every time a key is pressed. Displays the buttons pressed and the current input.\n * @property {boolean} newLineOnEnter Specifies whether clicking the “ENTER” button will input a newline (\\n) or not.\n * @property {boolean} tabCharOnTab Specifies whether clicking the “TAB” button will input a tab character (\\t) or not.\n * @property {string} inputName Allows you to use a single simple-keyboard instance for several inputs.\n * @property {number} maxLength Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {object} maxLength Restrains simple-keyboard’s individual inputs to a certain length. This should be used in addition to the input element’s maxlengthattribute.\n * @property {boolean} syncInstanceInputs When set to true, this option synchronizes the internal input of every simple-keyboard instance.\n * @property {boolean} physicalKeyboardHighlight Enable highlighting of keys pressed on physical keyboard.\n * @property {boolean} physicalKeyboardHighlightPress Presses keys highlighted by physicalKeyboardHighlight\n * @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.\n * @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have.\n * @property {boolean} physicalKeyboardHighlightPressUseClick Whether physicalKeyboardHighlightPress should use clicks to trigger buttons.\n * @property {boolean} physicalKeyboardHighlightPressUsePointerEvents Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.\n * @property {boolean} physicalKeyboardHighlightPreventDefault Whether physicalKeyboardHighlight should use preventDefault to disable default browser actions.\n * @property {boolean} preventMouseDownDefault Calling preventDefault for the mousedown events keeps the focus on the input.\n * @property {boolean} preventMouseUpDefault Calling preventDefault for the mouseup events.\n * @property {boolean} stopMouseDownPropagation Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.\n * @property {boolean} stopMouseUpPropagation Stops pointer up events on simple-keyboard buttons from bubbling to parent elements.\n * @property {function(button: string):string} onKeyPress Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”).\n * @property {function(input: string):string} onChange Executes the callback function on input change. Returns the current input’s string.\n * @property {function} onRender Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n * @property {function} onInit Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n * @property {function(inputs: object):object} onChangeAll Executes the callback function on input change. Returns the input object with all defined inputs.\n * @property {boolean} useButtonTag Render buttons as a button element instead of a div element.\n * @property {boolean} disableCaretPositioning A prop to ensure characters are always be added/removed at the end of the string.\n * @property {object} inputPattern Restrains input(s) change to the defined regular expression pattern.\n * @property {boolean} useTouchEvents Instructs simple-keyboard to use touch events instead of click events.\n * @property {boolean} autoUseTouchEvents Enable useTouchEvents automatically when touch device is detected.\n * @property {boolean} useMouseEvents Opt out of PointerEvents handling, falling back to the prior mouse event logic.\n * @property {function} destroy Clears keyboard listeners and DOM elements.\n * @property {boolean} disableButtonHold Disable button hold action.\n * @property {boolean} rtl Adds unicode right-to-left control characters to input return values.\n * @property {function} onKeyReleased Executes the callback function on key release.\n * @property {array} modules Module classes to be loaded by simple-keyboard.\n * @property {boolean} enableLayoutCandidates Enable input method editor candidate list support.\n * @property {object} excludeFromLayout Buttons to exclude from layout\n * @property {number} layoutCandidatesPageSize Determines size of layout candidate list\n * @property {boolean} layoutCandidatesCaseSensitiveMatch Determines whether layout candidate match should be case sensitive.\n * @property {boolean} disableCandidateNormalization Disables the automatic normalization for selected layout candidates\n * @property {boolean} enableLayoutCandidatesKeyPress Enables onKeyPress triggering for layoutCandidate items\n */\n this.options = {\n layoutName: \"default\",\n theme: \"hg-theme-default\",\n inputName: \"default\",\n preventMouseDownDefault: false,\n enableLayoutCandidates: true,\n excludeFromLayout: {},\n ...options,\n };\n\n /**\n * @type {object} Classes identifying loaded plugins\n */\n this.keyboardPluginClasses = \"\";\n\n /**\n * Bindings\n */\n Utilities.bindMethods(SimpleKeyboard, this);\n\n /**\n * simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).\n * This removes any dependency to input DOM elements. You can type and directly display the value in a div element, for example.\n * @example\n * // To get entered input\n * const input = keyboard.getInput();\n *\n * // To clear entered input.\n * keyboard.clearInput();\n *\n * @type {object}\n * @property {object} default Default SimpleKeyboard internal input.\n * @property {object} myInputName Example input that can be set through `options.inputName:\"myInputName\"`.\n */\n const { inputName = this.defaultName } = this.options;\n this.input = {};\n this.input[inputName] = \"\";\n\n /**\n * @type {string} DOM class of the keyboard wrapper, normally \"simple-keyboard\" by default.\n */\n this.keyboardDOMClass = keyboardDOMClass;\n\n /**\n * @type {object} Contains the DOM elements of every rendered button, the key being the button's layout name (e.g.: \"{enter}\").\n */\n this.buttonElements = {};\n\n /**\n * Simple-keyboard Instances\n * This enables multiple simple-keyboard support with easier management\n */\n if (!window[\"SimpleKeyboardInstances\"])\n window[\"SimpleKeyboardInstances\"] = {};\n\n this.currentInstanceName = this.utilities.camelCase(this.keyboardDOMClass);\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = this;\n\n /**\n * Instance vars\n */\n this.allKeyboardInstances = window[\"SimpleKeyboardInstances\"];\n this.keyboardInstanceNames = Object.keys(window[\"SimpleKeyboardInstances\"]);\n this.isFirstKeyboardInstance =\n this.keyboardInstanceNames[0] === this.currentInstanceName;\n\n /**\n * Physical Keyboard support\n */\n this.physicalKeyboard = new PhysicalKeyboard({\n dispatch: this.dispatch,\n getOptions: this.getOptions,\n });\n\n /**\n * Initializing CandidateBox\n */\n this.candidateBox = this.options.enableLayoutCandidates\n ? new CandidateBox({\n utilities: this.utilities,\n options: this.options,\n })\n : null;\n\n /**\n * Rendering keyboard\n */\n if (this.keyboardDOM) this.render();\n else {\n console.warn(`\".${keyboardDOMClass}\" was not found in the DOM.`);\n throw new Error(\"KEYBOARD_DOM_ERROR\");\n }\n\n /**\n * Modules\n */\n this.modules = {};\n this.loadModules();\n }\n\n /**\n * parseParams\n */\n handleParams = (\n selectorOrOptions?: string | HTMLDivElement | KeyboardOptions,\n keyboardOptions?: KeyboardOptions\n ): {\n keyboardDOMClass: string;\n keyboardDOM: KeyboardElement;\n options: Partial;\n } => {\n let keyboardDOMClass;\n let keyboardDOM;\n let options;\n\n /**\n * If first parameter is a string:\n * Consider it as an element's class\n */\n if (typeof selectorOrOptions === \"string\") {\n keyboardDOMClass = selectorOrOptions.split(\".\").join(\"\");\n keyboardDOM = document.querySelector(\n `.${keyboardDOMClass}`\n ) as KeyboardElement;\n options = keyboardOptions;\n\n /**\n * If first parameter is an KeyboardElement\n * Consider it as the keyboard DOM element\n */\n } else if (selectorOrOptions instanceof HTMLDivElement) {\n /**\n * This element must have a class, otherwise throw\n */\n if (!selectorOrOptions.className) {\n console.warn(\"Any DOM element passed as parameter must have a class.\");\n throw new Error(\"KEYBOARD_DOM_CLASS_ERROR\");\n }\n\n keyboardDOMClass = selectorOrOptions.className.split(\" \")[0];\n keyboardDOM = selectorOrOptions;\n options = keyboardOptions;\n\n /**\n * Otherwise, search for .simple-keyboard DOM element\n */\n } else {\n keyboardDOMClass = \"simple-keyboard\";\n keyboardDOM = document.querySelector(\n `.${keyboardDOMClass}`\n ) as KeyboardElement;\n options = selectorOrOptions;\n }\n\n return {\n keyboardDOMClass,\n keyboardDOM,\n options,\n };\n };\n\n /**\n * Getters\n */\n getOptions = (): KeyboardOptions => this.options;\n getCaretPosition = (): number | null => this.caretPosition;\n getCaretPositionEnd = (): number | null => this.caretPositionEnd;\n\n /**\n * Changes the internal caret position\n * @param {number} position The caret's start position\n * @param {number} positionEnd The caret's end position\n */\n setCaretPosition(position: number | null, endPosition = position): void {\n this.caretPosition = position;\n this.caretPositionEnd = endPosition;\n }\n\n /**\n * Retrieve the candidates for a given input\n * @param input The input string to check\n */\n getInputCandidates(\n input: string\n ): { candidateKey: string; candidateValue: string } | Record {\n const {\n layoutCandidates: layoutCandidatesObj,\n layoutCandidatesCaseSensitiveMatch,\n } = this.options;\n\n if (!layoutCandidatesObj || typeof layoutCandidatesObj !== \"object\") {\n return {};\n }\n\n const layoutCandidates = Object.keys(layoutCandidatesObj).filter(\n (layoutCandidate: string) => {\n const inputSubstr =\n input.substring(0, this.getCaretPositionEnd() || 0) || input;\n const regexp = new RegExp(\n `${this.utilities.escapeRegex(layoutCandidate)}$`,\n layoutCandidatesCaseSensitiveMatch ? \"g\" : \"gi\"\n );\n const matches = [...inputSubstr.matchAll(regexp)];\n return !!matches.length;\n }\n );\n\n if (layoutCandidates.length > 1) {\n const candidateKey = layoutCandidates.sort(\n (a, b) => b.length - a.length\n )[0];\n return {\n candidateKey,\n candidateValue: layoutCandidatesObj[candidateKey],\n };\n } else if (layoutCandidates.length) {\n const candidateKey = layoutCandidates[0];\n return {\n candidateKey,\n candidateValue: layoutCandidatesObj[candidateKey],\n };\n } else {\n return {};\n }\n }\n\n /**\n * Shows a suggestion box with a list of candidate words\n * @param candidates The chosen candidates string as defined in the layoutCandidates option\n * @param targetElement The element next to which the candidates box will be shown\n */\n showCandidatesBox(\n candidateKey: string,\n candidateValue: string,\n targetElement: KeyboardElement\n ): void {\n if (this.candidateBox) {\n this.candidateBox.show({\n candidateValue,\n targetElement,\n onSelect: (selectedCandidate: string, e: MouseEvent) => {\n const {\n layoutCandidatesCaseSensitiveMatch,\n disableCandidateNormalization,\n enableLayoutCandidatesKeyPress\n } = this.options;\n\n let candidateStr = selectedCandidate;\n\n if(!disableCandidateNormalization) {\n /**\n * Making sure that our suggestions are not composed characters\n */\n candidateStr = selectedCandidate.normalize(\"NFD\");\n }\n\n const currentInput = this.getInput(this.options.inputName, true);\n const initialCaretPosition = this.getCaretPositionEnd() || 0;\n const inputSubstr =\n currentInput.substring(0, initialCaretPosition || 0) ||\n currentInput;\n\n const regexp = new RegExp(\n `${this.utilities.escapeRegex(candidateKey)}$`,\n layoutCandidatesCaseSensitiveMatch ? \"g\" : \"gi\"\n );\n const newInputSubstr = inputSubstr.replace(\n regexp,\n candidateStr\n );\n const newInput = currentInput.replace(inputSubstr, newInputSubstr);\n\n const caretPositionDiff = newInputSubstr.length - inputSubstr.length;\n let newCaretPosition =\n (initialCaretPosition || currentInput.length) + caretPositionDiff;\n\n if (newCaretPosition < 0) newCaretPosition = 0;\n\n this.setInput(newInput, this.options.inputName, true);\n this.setCaretPosition(newCaretPosition);\n\n /**\n * Calling onKeyPress\n * We pass in the composed candidate instead of the decomposed one\n * To prevent confusion for users\n */\n if (enableLayoutCandidatesKeyPress && typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(selectedCandidate, e);\n\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(\n this.getInput(this.options.inputName, true),\n e\n );\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.getAllInputs(), e);\n },\n });\n }\n }\n\n /**\n * Handles clicks made to keyboard buttons\n * @param {string} button The button's layout name.\n */\n handleButtonClicked(button: string, e?: KeyboardHandlerEvent): void {\n const { inputName = this.defaultName, debug } = this.options;\n /**\n * Ignoring placeholder buttons\n */\n if (button === \"{//}\") return;\n\n /**\n * Creating inputName if it doesn't exist\n */\n if (!this.input[inputName]) this.input[inputName] = \"\";\n\n /**\n * Calculating new input\n */\n const updatedInput = this.utilities.getUpdatedInput(\n button,\n this.input[inputName],\n this.caretPosition,\n this.caretPositionEnd\n );\n\n /**\n * EDGE CASE: Check for whole input selection changes that will yield same updatedInput\n */\n if (this.utilities.isStandardButton(button) && this.activeInputElement) {\n const isEntireInputSelection =\n this.input[inputName] &&\n this.input[inputName] === updatedInput &&\n this.caretPosition === 0 &&\n this.caretPositionEnd === updatedInput.length;\n\n if (isEntireInputSelection) {\n this.setInput(\"\", this.options.inputName, true);\n this.setCaretPosition(0);\n this.activeInputElement.value = \"\";\n this.activeInputElement.setSelectionRange(0, 0);\n this.handleButtonClicked(button, e);\n return;\n }\n }\n\n /**\n * Calling onKeyPress\n */\n if (typeof this.options.onKeyPress === \"function\")\n this.options.onKeyPress(button, e);\n\n if (\n // If input will change as a result of this button press\n this.input[inputName] !== updatedInput &&\n // This pertains to the \"inputPattern\" option:\n // If inputPattern isn't set\n (!this.options.inputPattern ||\n // Or, if it is set and if the pattern is valid - we proceed.\n (this.options.inputPattern && this.inputPatternIsValid(updatedInput)))\n ) {\n /**\n * If maxLength and handleMaxLength yield true, halting\n */\n if (\n this.options.maxLength &&\n this.utilities.handleMaxLength(this.input, updatedInput)\n ) {\n return;\n }\n\n /**\n * Updating input\n */\n const newInputValue = this.utilities.getUpdatedInput(\n button,\n this.input[inputName],\n this.caretPosition,\n this.caretPositionEnd,\n true\n );\n\n this.setInput(newInputValue, this.options.inputName, true);\n\n if (debug) console.log(\"Input changed:\", this.getAllInputs());\n\n if (this.options.debug) {\n console.log(\n \"Caret at: \",\n this.getCaretPosition(),\n this.getCaretPositionEnd(),\n `(${this.keyboardDOMClass})`,\n e?.type\n );\n }\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n\n /**\n * Calling onChange\n */\n if (typeof this.options.onChange === \"function\")\n this.options.onChange(this.getInput(this.options.inputName, true), e);\n\n /**\n * Calling onChangeAll\n */\n if (typeof this.options.onChangeAll === \"function\")\n this.options.onChangeAll(this.getAllInputs(), e);\n\n /**\n * Check if this new input has candidates (suggested words)\n */\n if (e?.target && this.options.enableLayoutCandidates) {\n const { candidateKey, candidateValue } =\n this.getInputCandidates(updatedInput);\n\n if (candidateKey && candidateValue) {\n this.showCandidatesBox(\n candidateKey,\n candidateValue,\n this.keyboardDOM\n );\n } else {\n this.candidateBox?.destroy();\n }\n }\n }\n\n /**\n * After a button is clicked the selection (if any) will disappear\n * we should reflect this in our state, as applicable\n */\n if(this.caretPositionEnd && this.caretPosition !== this.caretPositionEnd){\n this.setCaretPosition(this.caretPositionEnd, this.caretPositionEnd);\n\n if(this.activeInputElement){\n this.activeInputElement.setSelectionRange(this.caretPositionEnd, this.caretPositionEnd);\n }\n \n if(this.options.debug){\n console.log(\"Caret position aligned\", this.caretPosition);\n }\n }\n\n if (debug) {\n console.log(\"Key pressed:\", button);\n }\n }\n\n /**\n * Get mouse hold state\n */\n getMouseHold() {\n return this.isMouseHold;\n }\n\n /**\n * Mark mouse hold state as set\n */\n setMouseHold(value: boolean) {\n if (this.options.syncInstanceInputs) {\n this.dispatch((instance: SimpleKeyboard) => {\n instance.isMouseHold = value;\n });\n } else {\n this.isMouseHold = value;\n }\n }\n\n /**\n * Handles button mousedown\n */\n /* istanbul ignore next */\n handleButtonMouseDown(button: string, e: KeyboardHandlerEvent): void {\n if (e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n if (this.options.stopMouseDownPropagation) e.stopPropagation();\n\n /**\n * Add active class\n */\n e.target.classList.add(this.activeButtonClass);\n }\n\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n if (this.holdTimeout) clearTimeout(this.holdTimeout);\n\n /**\n * @type {boolean} Whether the mouse is being held onKeyPress\n */\n this.setMouseHold(true);\n\n /**\n * @type {object} Time to wait until a key hold is detected\n */\n if (!this.options.disableButtonHold) {\n this.holdTimeout = window.setTimeout(() => {\n if (\n (this.getMouseHold() &&\n // TODO: This needs to be configurable through options\n ((!button.includes(\"{\") && !button.includes(\"}\")) ||\n button === \"{delete}\" ||\n button === \"{backspace}\" ||\n button === \"{bksp}\" ||\n button === \"{space}\" ||\n button === \"{tab}\")) ||\n button === \"{arrowright}\" ||\n button === \"{arrowleft}\" ||\n button === \"{arrowup}\" ||\n button === \"{arrowdown}\"\n ) {\n if (this.options.debug) console.log(\"Button held:\", button);\n\n this.handleButtonHold(button);\n }\n clearTimeout(this.holdTimeout);\n }, 500);\n }\n }\n\n /**\n * Handles button mouseup\n */\n handleButtonMouseUp(button?: string, e?: KeyboardHandlerEvent): void {\n if (e) {\n /**\n * Handle event options\n */\n if (this.options.preventMouseUpDefault && e.preventDefault)\n e.preventDefault();\n if (this.options.stopMouseUpPropagation && e.stopPropagation)\n e.stopPropagation();\n\n /* istanbul ignore next */\n const isKeyboard =\n e.target === this.keyboardDOM ||\n (e.target && this.keyboardDOM.contains(e.target)) ||\n (this.candidateBox &&\n this.candidateBox.candidateBoxElement &&\n (e.target === this.candidateBox.candidateBoxElement ||\n (e.target &&\n this.candidateBox.candidateBoxElement.contains(e.target))));\n\n /**\n * On click outside, remove candidateBox\n */\n if (!isKeyboard && this.candidateBox) {\n this.candidateBox.destroy();\n }\n }\n\n /**\n * Remove active class\n */\n this.recurseButtons((buttonElement: Element) => {\n buttonElement.classList.remove(this.activeButtonClass);\n });\n\n this.setMouseHold(false);\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * Calling onKeyReleased\n */\n if (button && typeof this.options.onKeyReleased === \"function\")\n this.options.onKeyReleased(button, e);\n }\n\n /**\n * Handles container mousedown\n */\n handleKeyboardContainerMouseDown(e: KeyboardHandlerEvent): void {\n /**\n * Handle event options\n */\n if (this.options.preventMouseDownDefault) e.preventDefault();\n }\n\n /**\n * Handles button hold\n */\n /* istanbul ignore next */\n handleButtonHold(button: string): void {\n if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);\n\n /**\n * @type {object} Timeout dictating the speed of key hold iterations\n */\n this.holdInteractionTimeout = window.setTimeout(() => {\n if (this.getMouseHold()) {\n this.handleButtonClicked(button);\n this.handleButtonHold(button);\n } else {\n clearTimeout(this.holdInteractionTimeout);\n }\n }, 100);\n }\n\n /**\n * Send a command to all simple-keyboard instances (if you have several instances).\n */\n syncInstanceInputs(): void {\n this.dispatch((instance: SimpleKeyboard) => {\n instance.replaceInput(this.input);\n instance.setCaretPosition(this.caretPosition, this.caretPositionEnd);\n });\n }\n\n /**\n * Clear the keyboard’s input.\n * @param {string} [inputName] optional - the internal input to select\n */\n clearInput(\n inputName: string = this.options.inputName || this.defaultName\n ): void {\n this.input[inputName] = \"\";\n\n /**\n * Reset caretPosition\n */\n this.setCaretPosition(0);\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Get the keyboard’s input (You can also get it from the onChange prop).\n * @param {string} [inputName] optional - the internal input to select\n */\n getInput(\n inputName: string = this.options.inputName || this.defaultName,\n skipSync = false\n ): string {\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (this.options.syncInstanceInputs && !skipSync) this.syncInstanceInputs();\n\n if (this.options.rtl) {\n // Remove existing control chars\n const inputWithoutRTLControl = this.input[inputName]\n .replace(\"\\u202B\", \"\")\n .replace(\"\\u202C\", \"\");\n\n return \"\\u202B\" + inputWithoutRTLControl + \"\\u202C\";\n } else {\n return this.input[inputName];\n }\n }\n\n /**\n * Get all simple-keyboard inputs\n */\n getAllInputs(): KeyboardInput {\n const output = {};\n const inputNames = Object.keys(this.input);\n\n inputNames.forEach((inputName) => {\n output[inputName] = this.getInput(inputName, true);\n });\n\n return output;\n }\n\n /**\n * Set the keyboard’s input.\n * @param {string} input the input value\n * @param {string} inputName optional - the internal input to select\n */\n setInput(\n input: string,\n inputName: string = this.options.inputName || this.defaultName,\n skipSync?: boolean\n ): void {\n this.input[inputName] = input;\n\n /**\n * Enforce syncInstanceInputs, if set\n */\n if (!skipSync && this.options.syncInstanceInputs) this.syncInstanceInputs();\n }\n\n /**\n * Replace the input object (`keyboard.input`)\n * @param {object} inputObj The input object\n */\n replaceInput(inputObj: KeyboardInput): void {\n this.input = inputObj;\n }\n\n /**\n * Set new option or modify existing ones after initialization.\n * @param {object} options The options to set\n */\n setOptions(options = {}): void {\n const changedOptions = this.changedOptions(options);\n this.options = Object.assign(this.options, options);\n\n if (changedOptions.length) {\n if (this.options.debug) {\n console.log(\"changedOptions\", changedOptions);\n }\n\n /**\n * Some option changes require adjustments before re-render\n */\n this.onSetOptions(changedOptions);\n\n /**\n * Rendering\n */\n this.render();\n }\n }\n\n /**\n * Detecting changes to non-function options\n * This allows us to ascertain whether a button re-render is needed\n */\n changedOptions(newOptions: Partial): string[] {\n return Object.keys(newOptions).filter(\n (optionName) =>\n JSON.stringify(newOptions[optionName]) !==\n JSON.stringify(this.options[optionName])\n );\n }\n\n /**\n * Executing actions depending on changed options\n * @param {object} options The options to set\n */\n onSetOptions(changedOptions: string[] = []): void {\n /**\n * Changed: layoutName\n */\n if (changedOptions.includes(\"layoutName\")) {\n /**\n * Reset candidateBox\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n }\n }\n\n /**\n * Changed: layoutCandidatesPageSize, layoutCandidates\n */\n if (\n changedOptions.includes(\"layoutCandidatesPageSize\") ||\n changedOptions.includes(\"layoutCandidates\")\n ) {\n /**\n * Reset and recreate candidateBox\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n this.candidateBox = new CandidateBox({\n utilities: this.utilities,\n options: this.options,\n });\n }\n }\n }\n\n /**\n * Remove all keyboard rows and reset keyboard values.\n * Used internally between re-renders.\n */\n resetRows(): void {\n if (this.keyboardRowsDOM) {\n this.keyboardRowsDOM.remove();\n }\n\n this.keyboardDOM.className = this.keyboardDOMClass;\n this.keyboardDOM.setAttribute(\"data-skInstance\", this.currentInstanceName);\n this.buttonElements = {};\n }\n\n /**\n * Send a command to all simple-keyboard instances at once (if you have multiple instances).\n * @param {function(instance: object, key: string)} callback Function to run on every instance\n */\n // eslint-disable-next-line no-unused-vars\n dispatch(callback: (instance: SimpleKeyboard, key?: string) => void): void {\n if (!window[\"SimpleKeyboardInstances\"]) {\n console.warn(\n `SimpleKeyboardInstances is not defined. Dispatch cannot be called.`\n );\n throw new Error(\"INSTANCES_VAR_ERROR\");\n }\n\n return Object.keys(window[\"SimpleKeyboardInstances\"]).forEach((key) => {\n callback(window[\"SimpleKeyboardInstances\"][key], key);\n });\n }\n\n /**\n * Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n addButtonTheme(buttons: string, className: string): void {\n if (!className || !buttons) return;\n\n buttons.split(\" \").forEach((button) => {\n className.split(\" \").forEach((classNameItem) => {\n if (!this.options.buttonTheme) this.options.buttonTheme = [];\n\n let classNameFound = false;\n\n /**\n * If class is already defined, we add button to class definition\n */\n this.options.buttonTheme.map((buttonTheme) => {\n if (buttonTheme?.class.split(\" \").includes(classNameItem)) {\n classNameFound = true;\n\n const buttonThemeArray = buttonTheme.buttons.split(\" \");\n if (!buttonThemeArray.includes(button)) {\n classNameFound = true;\n buttonThemeArray.push(button);\n buttonTheme.buttons = buttonThemeArray.join(\" \");\n }\n }\n return buttonTheme;\n });\n\n /**\n * If class is not defined, we create a new entry\n */\n if (!classNameFound) {\n this.options.buttonTheme.push({\n class: classNameItem,\n buttons: buttons,\n });\n }\n });\n });\n\n this.render();\n }\n\n /**\n * Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.\n * @param {string} buttons List of buttons to select (separated by a space).\n * @param {string} className Classes to give to the selected buttons (separated by space).\n */\n removeButtonTheme(buttons: string, className: string): void {\n /**\n * When called with empty parameters, remove all button themes\n */\n if (!buttons && !className) {\n this.options.buttonTheme = [];\n this.render();\n return;\n }\n\n /**\n * If buttons are passed and buttonTheme has items\n */\n if (\n buttons &&\n Array.isArray(this.options.buttonTheme) &&\n this.options.buttonTheme.length\n ) {\n const buttonArray = buttons.split(\" \");\n buttonArray.forEach((button) => {\n this.options?.buttonTheme?.map((buttonTheme, index) => {\n /**\n * If className is set, we affect the buttons only for that class\n * Otherwise, we afect all classes\n */\n if (\n (buttonTheme &&\n className &&\n className.includes(buttonTheme.class)) ||\n !className\n ) {\n const filteredButtonArray = buttonTheme?.buttons\n .split(\" \")\n .filter((item) => item !== button);\n\n /**\n * If buttons left, return them, otherwise, remove button Theme\n */\n if (buttonTheme && filteredButtonArray?.length) {\n buttonTheme.buttons = filteredButtonArray.join(\" \");\n } else {\n this.options.buttonTheme?.splice(index, 1);\n buttonTheme = null;\n }\n }\n\n return buttonTheme;\n });\n });\n\n this.render();\n }\n }\n\n /**\n * Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned.\n * @param {string} button The button layout name to select\n */\n getButtonElement(\n button: string\n ): KeyboardElement | KeyboardElement[] | undefined {\n let output;\n\n const buttonArr = this.buttonElements[button];\n if (buttonArr) {\n if (buttonArr.length > 1) {\n output = buttonArr;\n } else {\n output = buttonArr[0];\n }\n }\n\n return output;\n }\n\n /**\n * This handles the \"inputPattern\" option\n * by checking if the provided inputPattern passes\n */\n inputPatternIsValid(inputVal: string): boolean {\n const inputPatternRaw = this.options.inputPattern;\n let inputPattern;\n\n /**\n * Check if input pattern is global or targeted to individual inputs\n */\n if (inputPatternRaw instanceof RegExp) {\n inputPattern = inputPatternRaw;\n } else {\n inputPattern =\n inputPatternRaw[this.options.inputName || this.defaultName];\n }\n\n if (inputPattern && inputVal) {\n const didInputMatch = inputPattern.test(inputVal);\n\n if (this.options.debug) {\n console.log(\n `inputPattern (\"${inputPattern}\"): ${\n didInputMatch ? \"passed\" : \"did not pass!\"\n }`\n );\n }\n\n return didInputMatch;\n } else {\n /**\n * inputPattern doesn't seem to be set for the current input, or input is empty. Pass.\n */\n return true;\n }\n }\n\n /**\n * Handles simple-keyboard event listeners\n */\n setEventListeners(): void {\n /**\n * Only first instance should set the event listeners\n */\n if (this.isFirstKeyboardInstance || !this.allKeyboardInstances) {\n if (this.options.debug) {\n console.log(`Caret handling started (${this.keyboardDOMClass})`);\n }\n\n const { physicalKeyboardHighlightPreventDefault = false } = this.options;\n\n /**\n * Event Listeners\n */\n document.addEventListener(\"keyup\", this.handleKeyUp, physicalKeyboardHighlightPreventDefault);\n document.addEventListener(\"keydown\", this.handleKeyDown, physicalKeyboardHighlightPreventDefault);\n document.addEventListener(\"mouseup\", this.handleMouseUp);\n document.addEventListener(\"touchend\", this.handleTouchEnd);\n document.addEventListener(\"selectionchange\", this.handleSelectionChange);\n document.addEventListener(\"select\", this.handleSelect);\n }\n }\n\n /**\n * Event Handler: KeyUp\n */\n handleKeyUp(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyUp(event);\n }\n }\n\n /**\n * Event Handler: KeyDown\n */\n handleKeyDown(event: KeyboardHandlerEvent): void {\n if (this.options.physicalKeyboardHighlight) {\n this.physicalKeyboard.handleHighlightKeyDown(event);\n }\n }\n\n /**\n * Event Handler: MouseUp\n */\n handleMouseUp(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: TouchEnd\n */\n /* istanbul ignore next */\n handleTouchEnd(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: Select\n */\n /* istanbul ignore next */\n handleSelect(event: KeyboardHandlerEvent): void {\n this.caretEventHandler(event);\n }\n\n /**\n * Event Handler: SelectionChange\n */\n /* istanbul ignore next */\n handleSelectionChange(event: KeyboardHandlerEvent): void {\n /**\n * Firefox is not reporting the correct caret position through this event\n * https://github.com/hodgef/simple-keyboard/issues/1839\n */\n if(navigator.userAgent.includes('Firefox')){\n return;\n }\n this.caretEventHandler(event);\n }\n\n /**\n * Called by {@link setEventListeners} when an event that warrants a cursor position update is triggered\n */\n caretEventHandler(event: KeyboardHandlerEvent): void {\n let targetTagName: string;\n if (event.target.tagName) {\n targetTagName = event.target.tagName.toLowerCase();\n }\n\n this.dispatch((instance) => {\n let isKeyboard =\n event.target === instance.keyboardDOM ||\n (event.target && instance.keyboardDOM.contains(event.target));\n\n /**\n * If syncInstanceInputs option is enabled, make isKeyboard match any instance\n * not just the current one\n */\n if (this.options.syncInstanceInputs && Array.isArray(event.path)) {\n isKeyboard = event.path.some((item: HTMLElement) =>\n item?.hasAttribute?.(\"data-skInstance\")\n );\n }\n\n if (\n (targetTagName === \"textarea\" ||\n (targetTagName === \"input\" &&\n [\"text\", \"search\", \"url\", \"tel\", \"password\"].includes(\n event.target.type\n ))) &&\n !instance.options.disableCaretPositioning\n ) {\n /**\n * Tracks current cursor position\n * As keys are pressed, text will be added/removed at that position within the input.\n */\n let selectionStart = event.target.selectionStart;\n let selectionEnd = event.target.selectionEnd;\n\n if(instance.options.rtl){\n selectionStart = instance.utilities.getRtlOffset(selectionStart, instance.getInput());\n selectionEnd = instance.utilities.getRtlOffset(selectionEnd, instance.getInput());\n }\n\n instance.setCaretPosition(selectionStart, selectionEnd);\n\n /**\n * Tracking current input in order to handle caret positioning edge cases\n */\n this.activeInputElement = event.target;\n\n if (instance.options.debug) {\n console.log(\n \"Caret at: \",\n instance.getCaretPosition(),\n instance.getCaretPositionEnd(),\n event && event.target.tagName.toLowerCase(),\n `(${instance.keyboardDOMClass})`,\n event?.type\n );\n }\n } else if (\n (instance.options.disableCaretPositioning || !isKeyboard) &&\n event?.type !== \"selectionchange\"\n ) {\n /**\n * If we toggled off disableCaretPositioning, we must ensure caretPosition doesn't persist once reactivated.\n */\n instance.setCaretPosition(null);\n\n /**\n * Resetting activeInputElement\n */\n this.activeInputElement = null;\n\n if (instance.options.debug) {\n console.log(\n `Caret position reset due to \"${event?.type}\" event`,\n event\n );\n }\n }\n });\n }\n\n /**\n * Execute an operation on each button\n */\n recurseButtons(fn: any): void {\n if (!fn) return;\n\n Object.keys(this.buttonElements).forEach((buttonName) =>\n this.buttonElements[buttonName].forEach(fn)\n );\n }\n\n /**\n * Destroy keyboard listeners and DOM elements\n */\n destroy(): void {\n if (this.options.debug)\n console.log(\n `Destroying simple-keyboard instance: ${this.currentInstanceName}`\n );\n\n const { physicalKeyboardHighlightPreventDefault = false } = this.options;\n\n /**\n * Remove document listeners\n */\n document.removeEventListener(\"keyup\", this.handleKeyUp, physicalKeyboardHighlightPreventDefault);\n document.removeEventListener(\"keydown\", this.handleKeyDown, physicalKeyboardHighlightPreventDefault);\n document.removeEventListener(\"mouseup\", this.handleMouseUp);\n document.removeEventListener(\"touchend\", this.handleTouchEnd);\n document.removeEventListener(\"select\", this.handleSelect);\n document.removeEventListener(\"selectionchange\", this.handleSelectionChange);\n document.onpointerup = null;\n document.ontouchend = null;\n document.ontouchcancel = null;\n document.onmouseup = null;\n\n /**\n * Remove buttons\n */\n const deleteButton = (buttonElement: KeyboardElement | null) => {\n if (buttonElement) {\n buttonElement.onpointerdown = null;\n buttonElement.onpointerup = null;\n buttonElement.onpointercancel = null;\n buttonElement.ontouchstart = null;\n buttonElement.ontouchend = null;\n buttonElement.ontouchcancel = null;\n buttonElement.onclick = null;\n buttonElement.onmousedown = null;\n buttonElement.onmouseup = null;\n\n buttonElement.remove();\n buttonElement = null;\n }\n };\n\n this.recurseButtons(deleteButton);\n\n /**\n * Remove wrapper events\n */\n this.keyboardDOM.onpointerdown = null;\n this.keyboardDOM.ontouchstart = null;\n this.keyboardDOM.onmousedown = null;\n\n /**\n * Clearing keyboard rows\n */\n this.resetRows();\n\n /**\n * Candidate box\n */\n if (this.candidateBox) {\n this.candidateBox.destroy();\n this.candidateBox = null;\n }\n\n /**\n * Clearing activeInputElement\n */\n this.activeInputElement = null;\n\n /**\n * Removing instance attribute\n */\n this.keyboardDOM.removeAttribute(\"data-skInstance\");\n\n /**\n * Clearing keyboardDOM\n */\n this.keyboardDOM.innerHTML = \"\";\n\n /**\n * Remove instance\n */\n window[\"SimpleKeyboardInstances\"][this.currentInstanceName] = null;\n delete window[\"SimpleKeyboardInstances\"][this.currentInstanceName];\n\n /**\n * Reset initialized flag\n */\n this.initialized = false;\n }\n\n /**\n * Process buttonTheme option\n */\n getButtonThemeClasses(button: string): string[] {\n const buttonTheme = this.options.buttonTheme;\n let buttonClasses: string[] = [];\n\n if (Array.isArray(buttonTheme)) {\n buttonTheme.forEach((themeObj) => {\n if (\n themeObj &&\n themeObj.class &&\n typeof themeObj.class === \"string\" &&\n themeObj.buttons &&\n typeof themeObj.buttons === \"string\"\n ) {\n const themeObjClasses = themeObj.class.split(\" \");\n const themeObjButtons = themeObj.buttons.split(\" \");\n\n if (themeObjButtons.includes(button)) {\n buttonClasses = [...buttonClasses, ...themeObjClasses];\n }\n } else {\n console.warn(\n `Incorrect \"buttonTheme\". Please check the documentation.`,\n themeObj\n );\n }\n });\n }\n\n return buttonClasses;\n }\n\n /**\n * Process buttonAttributes option\n */\n setDOMButtonAttributes(button: string, callback: any): void {\n const buttonAttributes = this.options.buttonAttributes;\n\n if (Array.isArray(buttonAttributes)) {\n buttonAttributes.forEach((attrObj) => {\n if (\n attrObj.attribute &&\n typeof attrObj.attribute === \"string\" &&\n attrObj.value &&\n typeof attrObj.value === \"string\" &&\n attrObj.buttons &&\n typeof attrObj.buttons === \"string\"\n ) {\n const attrObjButtons = attrObj.buttons.split(\" \");\n\n if (attrObjButtons.includes(button)) {\n callback(attrObj.attribute, attrObj.value);\n }\n } else {\n console.warn(\n `Incorrect \"buttonAttributes\". Please check the documentation.`,\n attrObj\n );\n }\n });\n }\n }\n\n onTouchDeviceDetected() {\n /**\n * Processing autoTouchEvents\n */\n this.processAutoTouchEvents();\n\n /**\n * Disabling contextual window on touch devices\n */\n this.disableContextualWindow();\n }\n\n /**\n * Disabling contextual window for hg-button\n */\n /* istanbul ignore next */\n disableContextualWindow() {\n window.oncontextmenu = (event: KeyboardHandlerEvent) => {\n if (event.target.classList.contains(\"hg-button\")) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n };\n }\n\n /**\n * Process autoTouchEvents option\n */\n processAutoTouchEvents() {\n if (this.options.autoUseTouchEvents) {\n this.options.useTouchEvents = true;\n\n if (this.options.debug) {\n console.log(\n `autoUseTouchEvents: Touch device detected, useTouchEvents enabled.`\n );\n }\n }\n }\n\n /**\n * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\n */\n onInit() {\n if (this.options.debug) {\n console.log(`${this.keyboardDOMClass} Initialized`);\n }\n\n /**\n * setEventListeners\n */\n this.setEventListeners();\n\n if (typeof this.options.onInit === \"function\") this.options.onInit(this);\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeFirstRender() {\n /**\n * Performing actions when touch device detected\n */\n if (this.utilities.isTouchDevice()) {\n this.onTouchDeviceDetected();\n }\n\n if (typeof this.options.beforeFirstRender === \"function\")\n this.options.beforeFirstRender(this);\n\n /**\n * Notify about PointerEvents usage\n */\n if (\n this.isFirstKeyboardInstance &&\n this.utilities.pointerEventsSupported() &&\n !this.options.useTouchEvents &&\n !this.options.useMouseEvents\n ) {\n if (this.options.debug) {\n console.log(\"Using PointerEvents as it is supported by this browser\");\n }\n }\n\n /**\n * Notify about touch events usage\n */\n if (this.options.useTouchEvents) {\n if (this.options.debug) {\n console.log(\n \"useTouchEvents has been enabled. Only touch events will be used.\"\n );\n }\n }\n }\n\n /**\n * Executes the callback function before a simple-keyboard render.\n */\n beforeRender() {\n if (typeof this.options.beforeRender === \"function\")\n this.options.beforeRender(this);\n }\n\n /**\n * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\n */\n onRender() {\n if (typeof this.options.onRender === \"function\")\n this.options.onRender(this);\n }\n\n /**\n * Executes the callback function once all modules have been loaded\n */\n onModulesLoaded() {\n if (typeof this.options.onModulesLoaded === \"function\")\n this.options.onModulesLoaded(this);\n }\n\n /**\n * Register module\n */\n registerModule = (name: string, initCallback: any) => {\n if (!this.modules[name]) this.modules[name] = {};\n\n initCallback(this.modules[name]);\n };\n\n /**\n * Load modules\n */\n loadModules() {\n if (Array.isArray(this.options.modules)) {\n this.options.modules.forEach((KeyboardModule) => {\n const keyboardModule = new KeyboardModule(this);\n keyboardModule.init && keyboardModule.init(this);\n });\n\n this.keyboardPluginClasses = \"modules-loaded\";\n\n this.render();\n this.onModulesLoaded();\n }\n }\n\n /**\n * Get module prop\n */\n getModuleProp(name: string, prop: string) {\n if (!this.modules[name]) return false;\n\n return this.modules[name][prop];\n }\n\n /**\n * getModulesList\n */\n getModulesList() {\n return Object.keys(this.modules);\n }\n\n /**\n * Parse Row DOM containers\n */\n parseRowDOMContainers(\n rowDOM: HTMLDivElement,\n rowIndex: number,\n containerStartIndexes: number[],\n containerEndIndexes: number[]\n ) {\n const rowDOMArray = Array.from(rowDOM.children);\n let removedElements = 0;\n\n if (rowDOMArray.length) {\n containerStartIndexes.forEach((startIndex, arrIndex) => {\n const endIndex = containerEndIndexes[arrIndex];\n\n /**\n * If there exists a respective end index\n * if end index comes after start index\n */\n if (!endIndex || !(endIndex > startIndex)) {\n return false;\n }\n\n /**\n * Updated startIndex, endIndex\n * This is since the removal of buttons to place a single button container\n * results in a modified array size\n */\n const updated_startIndex = startIndex - removedElements;\n const updated_endIndex = endIndex - removedElements;\n\n /**\n * Create button container\n */\n const containerDOM = document.createElement(\"div\");\n containerDOM.className += \"hg-button-container\";\n const containerUID = `${this.options.layoutName}-r${rowIndex}c${arrIndex}`;\n containerDOM.setAttribute(\"data-skUID\", containerUID);\n\n /**\n * Taking elements due to be inserted into container\n */\n const containedElements = rowDOMArray.splice(\n updated_startIndex,\n updated_endIndex - updated_startIndex + 1\n );\n removedElements = updated_endIndex - updated_startIndex;\n\n /**\n * Inserting elements to container\n */\n containedElements.forEach((element) =>\n containerDOM.appendChild(element)\n );\n\n /**\n * Adding container at correct position within rowDOMArray\n */\n rowDOMArray.splice(updated_startIndex, 0, containerDOM);\n\n /**\n * Clearing old rowDOM children structure\n */\n rowDOM.innerHTML = \"\";\n\n /**\n * Appending rowDOM new children list\n */\n rowDOMArray.forEach((element) => rowDOM.appendChild(element));\n\n if (this.options.debug) {\n console.log(\n \"rowDOMContainer\",\n containedElements,\n updated_startIndex,\n updated_endIndex,\n removedElements + 1\n );\n }\n });\n }\n\n return rowDOM;\n }\n\n /**\n * getKeyboardClassString\n */\n getKeyboardClassString = (...baseDOMClasses: any[]) => {\n const keyboardClasses = [this.keyboardDOMClass, ...baseDOMClasses].filter(\n (DOMClass) => !!DOMClass\n );\n\n return keyboardClasses.join(\" \");\n };\n\n /**\n * Renders rows and buttons as per options\n */\n render() {\n /**\n * Clear keyboard\n */\n this.resetRows();\n\n /**\n * Calling beforeFirstRender\n */\n if (!this.initialized) {\n this.beforeFirstRender();\n }\n\n /**\n * Calling beforeRender\n */\n this.beforeRender();\n\n const layoutClass = `hg-layout-${this.options.layoutName}`;\n const layout = this.options.layout || getDefaultLayout();\n const useTouchEvents = this.options.useTouchEvents || false;\n const useTouchEventsClass = useTouchEvents ? \"hg-touch-events\" : \"\";\n const useMouseEvents = this.options.useMouseEvents || false;\n const disableRowButtonContainers = this.options.disableRowButtonContainers;\n\n /**\n * Adding themeClass, layoutClass to keyboardDOM\n */\n this.keyboardDOM.className = this.getKeyboardClassString(\n this.options.theme,\n layoutClass,\n this.keyboardPluginClasses,\n useTouchEventsClass\n );\n\n /**\n * Adding keyboard identifier\n */\n this.keyboardDOM.setAttribute(\"data-skInstance\", this.currentInstanceName);\n\n /**\n * Create row wrapper\n */\n this.keyboardRowsDOM = document.createElement(\"div\");\n this.keyboardRowsDOM.className = \"hg-rows\";\n\n /**\n * Iterating through each row\n */\n layout[this.options.layoutName || this.defaultName].forEach(\n (row: string, rIndex: number) => {\n let rowArray = row.split(\" \");\n\n /**\n * Enforce excludeFromLayout\n */\n if (\n this.options.excludeFromLayout &&\n this.options.excludeFromLayout[\n this.options.layoutName || this.defaultName\n ]\n ) {\n rowArray = rowArray.filter(\n (buttonName) =>\n this.options.excludeFromLayout &&\n !this.options.excludeFromLayout[\n this.options.layoutName || this.defaultName\n ].includes(buttonName)\n );\n }\n\n /**\n * Creating empty row\n */\n let rowDOM = document.createElement(\"div\");\n rowDOM.className += \"hg-row\";\n\n /**\n * Tracking container indicators in rows\n */\n const containerStartIndexes: number[] = [];\n const containerEndIndexes: number[] = [];\n\n /**\n * Iterating through each button in row\n */\n rowArray.forEach((button, bIndex) => {\n /**\n * Check if button has a container indicator\n */\n const buttonHasContainerStart =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"[\") === 0;\n\n const buttonHasContainerEnd =\n !disableRowButtonContainers &&\n typeof button === \"string\" &&\n button.length > 1 &&\n button.indexOf(\"]\") === button.length - 1;\n\n /**\n * Save container start index, if applicable\n */\n if (buttonHasContainerStart) {\n containerStartIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\[/g, \"\");\n }\n\n if (buttonHasContainerEnd) {\n containerEndIndexes.push(bIndex);\n\n /**\n * Removing indicator\n */\n button = button.replace(/\\]/g, \"\");\n }\n\n /**\n * Processing button options\n */\n const fctBtnClass = this.utilities.getButtonClass(button);\n const buttonDisplayName = this.utilities.getButtonDisplayName(\n button,\n this.options.display,\n this.options.mergeDisplay\n );\n\n /**\n * Creating button\n */\n const buttonType = this.options.useButtonTag ? \"button\" : \"div\";\n const buttonDOM = document.createElement(buttonType);\n buttonDOM.className += `hg-button ${fctBtnClass}`;\n\n /**\n * Adding buttonTheme\n */\n buttonDOM.classList.add(...this.getButtonThemeClasses(button));\n\n /**\n * Adding buttonAttributes\n */\n this.setDOMButtonAttributes(\n button,\n (attribute: string, value: string) => {\n buttonDOM.setAttribute(attribute, value);\n }\n );\n\n this.activeButtonClass = \"hg-activeButton\";\n\n /**\n * Handle button click event\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n /**\n * Handle PointerEvents\n */\n buttonDOM.onpointerdown = (e: KeyboardHandlerEvent) => {\n this.handleButtonClicked(button, e);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onpointerup = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n buttonDOM.onpointercancel = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n } else {\n /**\n * Fallback for browsers not supporting PointerEvents\n */\n if (useTouchEvents) {\n /**\n * Handle touch events\n */\n buttonDOM.ontouchstart = (e: KeyboardHandlerEvent) => {\n this.handleButtonClicked(button, e);\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.ontouchend = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n buttonDOM.ontouchcancel = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n } else {\n /**\n * Handle mouse events\n */\n buttonDOM.onclick = (e: KeyboardHandlerEvent) => {\n this.setMouseHold(false);\n /**\n * Fire button handler in onclick for compatibility reasons\n * This fires handler before onKeyReleased, therefore when that option is set we will fire the handler\n * in onmousedown instead\n */\n if (typeof this.options.onKeyReleased !== \"function\") {\n this.handleButtonClicked(button, e);\n }\n };\n buttonDOM.onmousedown = (e: KeyboardHandlerEvent) => {\n /**\n * Fire button handler for onKeyReleased use-case\n */\n if (\n typeof this.options.onKeyReleased === \"function\" &&\n !this.isMouseHold\n ) {\n this.handleButtonClicked(button, e);\n }\n this.handleButtonMouseDown(button, e);\n };\n buttonDOM.onmouseup = (e: KeyboardHandlerEvent) => {\n this.handleButtonMouseUp(button, e);\n };\n }\n }\n\n /**\n * Adding identifier\n */\n buttonDOM.setAttribute(\"data-skBtn\", button);\n\n /**\n * Adding unique id\n * Since there's no limit on spawning same buttons, the unique id ensures you can style every button\n */\n const buttonUID = `${this.options.layoutName}-r${rIndex}b${bIndex}`;\n buttonDOM.setAttribute(\"data-skBtnUID\", buttonUID);\n\n /**\n * Adding button label to button\n */\n const buttonSpanDOM = document.createElement(\"span\");\n buttonSpanDOM.innerHTML = buttonDisplayName;\n buttonDOM.appendChild(buttonSpanDOM);\n\n /**\n * Adding to buttonElements\n */\n if (!this.buttonElements[button]) this.buttonElements[button] = [];\n\n this.buttonElements[button].push(buttonDOM);\n\n /**\n * Appending button to row\n */\n rowDOM.appendChild(buttonDOM);\n });\n\n /**\n * Parse containers in row\n */\n rowDOM = this.parseRowDOMContainers(\n rowDOM,\n rIndex,\n containerStartIndexes,\n containerEndIndexes\n );\n\n /**\n * Appending row to hg-rows\n */\n this.keyboardRowsDOM.appendChild(rowDOM);\n }\n );\n\n /**\n * Appending row to keyboard\n */\n this.keyboardDOM.appendChild(this.keyboardRowsDOM);\n\n /**\n * Calling onRender\n */\n this.onRender();\n\n if (!this.initialized) {\n /**\n * Ensures that onInit and beforeFirstRender are only called once per instantiation\n */\n this.initialized = true;\n\n /**\n * Handling parent events\n */\n /* istanbul ignore next */\n if (\n this.utilities.pointerEventsSupported() &&\n !useTouchEvents &&\n !useMouseEvents\n ) {\n document.onpointerup = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n this.keyboardDOM.onpointerdown = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n } else if (useTouchEvents) {\n /**\n * Handling ontouchend, ontouchcancel\n */\n document.ontouchend = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n document.ontouchcancel = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n\n this.keyboardDOM.ontouchstart = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n } else if (!useTouchEvents) {\n /**\n * Handling mouseup\n */\n document.onmouseup = (e: KeyboardHandlerEvent) =>\n this.handleButtonMouseUp(undefined, e);\n this.keyboardDOM.onmousedown = (e: KeyboardHandlerEvent) =>\n this.handleKeyboardContainerMouseDown(e);\n }\n\n /**\n * Calling onInit\n */\n this.onInit();\n }\n }\n}\n\nexport default SimpleKeyboard;\n","export const getDefaultLayout = () => {\n return {\n default: [\n \"` 1 2 3 4 5 6 7 8 9 0 - = {bksp}\",\n \"{tab} q w e r t y u i o p [ ] \\\\\",\n \"{lock} a s d f g h j k l ; ' {enter}\",\n \"{shift} z x c v b n m , . / {shift}\",\n \".com @ {space}\",\n ],\n shift: [\n \"~ ! @ # $ % ^ & * ( ) _ + {bksp}\",\n \"{tab} Q W E R T Y U I O P { } |\",\n '{lock} A S D F G H J K L : \" {enter}',\n \"{shift} Z X C V B N M < > ? {shift}\",\n \".com @ {space}\",\n ],\n };\n};\n","import SimpleKeyboard from \"./components/Keyboard\";\nexport { SimpleKeyboard };\nexport default SimpleKeyboard;\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Utilities","_ref","getOptions","getCaretPosition","getCaretPositionEnd","dispatch","_classCallCheck","_defineProperty","button","length","bindMethods","includes","buttonTypeClass","getButtonType","buttonWithoutBraces","replace","buttonNormalized","concat","display","arguments","undefined","assign","getDefaultDiplay","input","caretPos","caretPosEnd","moveCaret","options","commonParams","output","removeAt","apply","removeForwardsAt","addStringAt","tabCharOnTab","newLineOnEnter","Number","isInteger","debug","console","log","minus","newCaretPos","updateCaretPosAction","instance","setCaretPosition","caretPosition","source","str","position","positionEnd","slice","join","isMaxLengthReached","updateCaretPos","emojiMatchedReg","substring","match","substr","inputObj","updatedInput","maxLength","currentInput","inputName","condition","maxLengthReached","_typeof","Boolean","window","navigator","maxTouchPoints","PointerEvent","toLowerCase","trim","split","reduce","word","toUpperCase","arr","size","_toConsumableArray","Array","Math","ceil","map","_","i","index","newIndex","startMarkerIndex","indexOf","myClass","_step","_iterator","_createForOfIteratorHelper","getOwnPropertyNames","s","n","done","myMethod","bind","err","e","f","PhysicalKeyboard","_this","altKey","ctrlKey","shiftKey","code","keyCodeToKey","keyCode","physicalKeyboardHighlightPreventDefault","isModifierKey","preventDefault","stopImmediatePropagation","buttonPressed","getSimpleKeyboardLayoutKey","buttonDOM","buttonName","standardButtonPressed","getButtonElement","functionButtonPressed","_buttonDOM$","_buttonDOM$$onpointer","_buttonDOM","_buttonDOM$onpointerd","applyButtonStyle","buttonElement","style","background","physicalKeyboardHighlightBgColor","color","physicalKeyboardHighlightTextColor","isArray","forEach","physicalKeyboardHighlightPress","physicalKeyboardHighlightPressUsePointerEvents","onpointerdown","physicalKeyboardHighlightPressUseClick","_buttonDOM$2","click","handleButtonClicked","_buttonDOM$3","_buttonDOM$3$onpointe","_buttonDOM$onpointeru","removeAttribute","onpointerup","_output","keyId","CandidateBox","utilities","pageSize","layoutCandidatesPageSize","candidateBoxElement","remove","pageIndex","_ref2","candidateValue","targetElement","onSelect","candidateListPages","chunkArray","renderPage","nbPages","onItemSelected","selectedCandidate","destroy","_ref3","_this$candidateBoxEle","_this2","document","createElement","className","candidateListULElement","candidateListItem","_this2$options$displa","candidateListLIElement","getMouseEvent","mouseEvent","useTouchEvents","TouchEvent","MouseEvent","innerHTML","ontouchstart","onclick","appendChild","isPrevBtnElementActive","prevBtnElement","classList","add","prevBtnElementClickAction","isNextBtnElementActive","nextBtnElement","nextBtnElementClickAction","prepend","SimpleKeyboard","selectorOrOptions","keyboardOptions","keyboardDOMClass","keyboardDOM","querySelector","HTMLDivElement","warn","Error","caretPositionEnd","name","initCallback","modules","_len","baseDOMClasses","_key","filter","DOMClass","_this$handleParams","handleParams","_this$handleParams$op","_objectSpread","layoutName","theme","preventMouseDownDefault","enableLayoutCandidates","excludeFromLayout","keyboardPluginClasses","_this$options$inputNa","defaultName","buttonElements","currentInstanceName","camelCase","allKeyboardInstances","keyboardInstanceNames","keys","isFirstKeyboardInstance","physicalKeyboard","candidateBox","render","loadModules","endPosition","_this$options","layoutCandidatesObj","layoutCandidates","layoutCandidatesCaseSensitiveMatch","layoutCandidate","inputSubstr","regexp","RegExp","escapeRegex","matchAll","candidateKey","sort","a","b","_this3","show","_this3$options","disableCandidateNormalization","enableLayoutCandidatesKeyPress","candidateStr","normalize","getInput","initialCaretPosition","newInputSubstr","newInput","caretPositionDiff","newCaretPosition","setInput","onKeyPress","onChange","onChangeAll","getAllInputs","_this$options2","_this$options2$inputN","getUpdatedInput","isStandardButton","activeInputElement","setSelectionRange","inputPattern","inputPatternIsValid","handleMaxLength","newInputValue","type","syncInstanceInputs","target","_this$candidateBox","_this$getInputCandida","getInputCandidates","showCandidatesBox","isMouseHold","_this4","stopMouseDownPropagation","stopPropagation","activeButtonClass","holdInteractionTimeout","clearTimeout","holdTimeout","setMouseHold","disableButtonHold","setTimeout","getMouseHold","handleButtonHold","_this5","preventMouseUpDefault","stopMouseUpPropagation","contains","recurseButtons","onKeyReleased","_this6","_this7","replaceInput","skipSync","rtl","_this8","changedOptions","onSetOptions","newOptions","_this9","optionName","JSON","stringify","keyboardRowsDOM","setAttribute","callback","buttons","_this10","classNameItem","buttonTheme","classNameFound","buttonThemeArray","push","class","_this11","_this11$options","_buttonTheme","_this11$options$butto","filteredButtonArray","item","splice","buttonArr","inputVal","inputPatternRaw","didInputMatch","test","_this$options$physica","addEventListener","handleKeyUp","handleKeyDown","handleMouseUp","handleTouchEnd","handleSelectionChange","handleSelect","event","caretEventHandler","physicalKeyboardHighlight","handleHighlightKeyUp","handleHighlightKeyDown","userAgent","targetTagName","_this12","tagName","isKeyboard","path","some","_item$hasAttribute","hasAttribute","disableCaretPositioning","selectionStart","selectionEnd","getRtlOffset","fn","_this13","_this$options$physica2","removeEventListener","ontouchend","ontouchcancel","onmouseup","onpointercancel","onmousedown","resetRows","initialized","buttonClasses","themeObj","themeObjClasses","buttonAttributes","attrObj","attribute","processAutoTouchEvents","disableContextualWindow","oncontextmenu","autoUseTouchEvents","setEventListeners","onInit","isTouchDevice","onTouchDeviceDetected","beforeFirstRender","pointerEventsSupported","useMouseEvents","beforeRender","onRender","onModulesLoaded","_this14","KeyboardModule","keyboardModule","init","rowDOM","rowIndex","containerStartIndexes","containerEndIndexes","_this15","rowDOMArray","from","children","removedElements","startIndex","arrIndex","endIndex","updated_startIndex","updated_endIndex","containerDOM","containerUID","containedElements","element","_this16","layoutClass","layout","default","shift","useTouchEventsClass","disableRowButtonContainers","getKeyboardClassString","row","rIndex","rowArray","bIndex","_buttonDOM$classList","buttonHasContainerStart","buttonHasContainerEnd","fctBtnClass","getButtonClass","buttonDisplayName","getButtonDisplayName","mergeDisplay","buttonType","useButtonTag","getButtonThemeClasses","setDOMButtonAttributes","handleButtonMouseDown","handleButtonMouseUp","buttonUID","buttonSpanDOM","parseRowDOMContainers","handleKeyboardContainerMouseDown"],"sourceRoot":""} \ No newline at end of file