diff --git a/build/css/index.css b/build/css/index.css index 1032a371..2444aeba 100644 --- a/build/css/index.css +++ b/build/css/index.css @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v3.8.154 + * simple-keyboard v3.8.155 * 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 31b3312d..e0e98939 100644 --- a/build/index.js +++ b/build/index.js @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v3.8.154 + * simple-keyboard v3.8.155 * 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(4527),d=n(81),p=n(851),h=n(9539),v=Array;t.exports=function(t){var e=u(this),n=arguments.length,y=n>1?arguments[1]:void 0,g=void 0!==y;g&&(y=o(y,n>2?arguments[2]:void 0));var m,b,w,x,E,O,S=i(t),k=p(S),P=0;if(!k||this===v&&s(k))for(m=c(S),b=e?new this(m):v(m);m>P;P++)O=g?y(S[P],P):S[P],l(b,P,O);else for(b=e?new this:[],E=(x=d(S,k)).next;!(w=r(E,x)).done;P++){O=g?a(x,y,[w.value,P],!0):w.value;try{l(b,P,O)}catch(t){h(x,"throw",t)}}return f(b,P),b}},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(7055),i=n(8981),a=n(6198),s=n(1469),u=n(4659),c=function(t){var e=1===t,n=2===t,c=3===t,l=4===t,f=6===t,d=7===t,p=5===t||f;return function(h,v,y){for(var g,m,b=i(h),w=r(b),x=a(w),E=o(v,y),O=0,S=0,k=e?s(h,x):n||d?s(h,0):void 0;x>O;O++)if((p||O in w)&&(m=E(g=w[O],O,b),t))if(e)u(k,O,m);else if(m)switch(t){case 3:return!0;case 5:return g;case 6:return O;case 2:u(k,S++,g)}else switch(t){case 4:return!1;case 7:u(k,S++,g)}return f?-1:c||l?l:k}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6),filterReject:c(7)}},597:function(t,e,n){var o=n(9039),r=n(8227),i=n(9519),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 new 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},8727:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3709:function(t,e,n){var o=n(2839).match(/firefox\/(\d+)/i);t.exports=!!o&&+o[1]},3763:function(t,e,n){var o=n(2839);t.exports=/MSIE|Trident/.test(o)},6193:function(t,e,n){var o=n(4215);t.exports="NODE"===o},2839:function(t,e,n){var o=n(4576).navigator,r=o&&o.userAgent;t.exports=r?String(r):""},9519:function(t,e,n){var o,r,i=n(4576),a=n(2839),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},3607:function(t,e,n){var o=n(2839).match(/AppleWebKit\/(\d+)\./);t.exports=!!o&&+o[1]},4215:function(t,e,n){var o=n(4576),r=n(2839),i=n(2195),a=function(t){return r.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":o.Bun&&"string"==typeof Bun.version?"BUN":o.Deno&&"object"==typeof Deno.version?"DENO":"process"===i(o.process)?"NODE":o.window&&o.document?"BROWSER":"REST"},6518:function(t,e,n){var o=n(4576),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/;if("split"===t){var o={};o[c]=function(){return n},(n={constructor:o,flags:""})[d]=/./[d]}return 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")}))},566:function(t,e,n){var o=n(9504),r=n(9306),i=n(34),a=n(9297),s=n(7680),u=n(616),c=Function,l=o([].concat),f=o([].join),d={};t.exports=u?c.bind:function(t){var e=r(this),n=e.prototype,o=s(arguments,1),u=function(){var n=l(o,s(arguments));return this instanceof u?function(t,e,n){if(!a(d,e)){for(var o=[],r=0;r]*>)/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}))}},4576: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(2195),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(4576),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(2195);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},5810:function(t,e,n){var o=n(34),r=n(1181).get;t.exports=function(t){if(!o(t))return!1;var e=r(t);return!!e&&"RawJSON"===e.type}},788:function(t,e,n){var o=n(34),r=n(2195),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,w=y.BUGGY_SAFARI_ITERATORS,x=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(!w&&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)}},D=e+" Iterator",T=!1,N=t.prototype,j=N[x]||N["@@iterator"]||h&&N[h],R=!w&&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[x])||p(I,x,k)),f(I,D,!0,!0),i&&(v[D]=k)),g&&h===O&&j&&j.name!==O&&(!i&&m?d(N,"name",O):(T=!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)(w||T||!(A in N))&&p(N,A,C[A]);else o({target:e,proto:!0,forced:w||T},C);return i&&!P||N[x]===R||p(N,x,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"),w=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=w((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)}},7819:function(t,e,n){var o=n(9039);t.exports=!o((function(){var t="9007199254740993",e=JSON.rawJSON(t);return!JSON.isRawJSON(e)||JSON.stringify(e)!==t}))},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(2195),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(4576),i=n(9039),a=n(3607);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}},8235:function(t,e,n){var o=n(9504),r=n(9297),i=SyntaxError,a=parseInt,s=String.fromCharCode,u=o("".charAt),c=o("".slice),l=o(/./.exec),f={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},d=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;t.exports=function(t,e){for(var n=!0,o="";e0&&m(c,r.lastIndex-1);r.lastIndex>0&&(!r.multiline||r.multiline&&"\n"!==A&&"\r"!==A&&"\u2028"!==A&&"\u2029"!==A)&&(P="(?: (?:"+P+"))",C=" "+C,I++),n=new RegExp("^(?:"+P+")",h)}S&&(n=new RegExp("^"+P+"$(?!\\s)",h)),E&&(o=r.lastIndex);var M=i(y,p?n:r,C);return p?M?(M.input=c,M[0]=x(M[0],I),M.index=r.lastIndex,r.lastIndex+=M[0].length):r.lastIndex=0:E&&M&&(r.lastIndex=r.global?M.index+M[0].length:o),S&&M&&M.length>1&&i(v,M[0],n,(function(){for(var t=1;tb)","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(4576),i=n(9433),a="__core-js_shared__",s=t.exports=r[a]||i(a,{});(s.versions||(s.versions=[])).push({version:"3.49.0",mode:o?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/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(9519),r=n(9039),i=n(4576).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.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.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(4576),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(4576),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(4527),d=n(1469),p=n(597),h=n(8227),v=n(9519),y=h("isConcatSpreadable"),g=v>=51||!r((function(){var t=[];return t[y]=!1,t.concat()[0]!==t})),m=function(t){if(!a(t))return!1;var e=t[y];return void 0!==e?!!e:i(t)};o({target:"Array",proto:!0,arity:1,forced:!g||!p("concat")},{concat:function(t){var e,n,o,r,i,a=s(this),p=d(a,0),h=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),s=i((function(){return!Array(1).includes()})),u=i((function(){return[,1].includes(void 0,1)}));o({target:"Array",proto:!0,forced:s||u},{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=null,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(9519);o({target:"Array",proto:!0,forced:!n(6193)&&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(4527),d=n(8227),p=n(597),h=n(7680),v=p("slice"),y=d("species"),g=Array,m=Math.max;o({target:"Array",proto:!0,forced:!v},{slice:function(t,e){var n,o,d,p=c(this),v=u(p),b=s(t,v),w=s(void 0===e?v:e,v);if(r(p)&&(n=p.constructor,(i(n)&&(n===g||r(n.prototype))||a(n)&&null===(n=n[y]))&&(n=void 0),n===g||void 0===n))return h(p,b,w);for(o=new(void 0===n?g:n)(m(w-b,0)),d=0;b3)){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;or?1:-1}}(t)),n=s(r),o=0;ow-o+n;y--)d(b,y-1)}else if(n>o)for(y=w-o;y>x;y--)m=y+n-1,(g=y+o-1)in b?b[m]=b[g]:d(b,m);for(y=0;y2)if(c=w(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(x,!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 D=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&&D(s[x],O),(A||r)&&D(s[x],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})},825:function(t,e,n){var o=n(6518),r=n(7751),i=n(8745),a=n(566),s=n(5548),u=n(8551),c=n(34),l=n(2360),f=n(9039),d=r("Reflect","construct"),p=Object.prototype,h=[].push,v=f((function(){function t(){}return!(d((function(){}),[],t)instanceof t)})),y=!f((function(){d((function(){}))})),g=v||y;o({target:"Reflect",stat:!0,forced:g,sham:g},{construct:function(t,e){s(t);var n=arguments.length<3?t:s(arguments[2]);if(u(e),y&&!v)return d(t,e,n);if(t===n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var o=[null];return i(h,o,e),new(i(a,t,o))}var r=n.prototype,f=l(c(r)?r:p),g=i(t,f,e);return c(g)?g:f}})},4864:function(t,e,n){var o=n(3724),r=n(4576),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),w=n(1181).enforce,x=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),D=i("".replace),T=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 U=function(t,e){var n,o,r,i,a,l,v=f(I,this),y=d(t),g=void 0===e,m=[],x=t;if(!v&&y&&g&&t.constructor===U)return t;if((y||f(I,t))&&(t=t.source,g&&(e=h(x))),t=void 0===t?"":p(t),e=void 0===e?"":p(e),x=t,O&&"dotAll"in R&&(o=!!e&&T(e,"s")>-1)&&(e=D(e,/s/g,"")),n=e,K&&"sticky"in R&&(r=!!e&&T(e,"y")>-1)&&F&&(e=D(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"===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}for(var d=0;d",h="\\"+i[d][1];T(r,p)>-1;)r=D(r,p,h);return[r,i]}(t),t=i[0],m=i[1]),a=s(P(t,e),v?this:I,U),(o||r||m.length)&&(l=w(a),o&&(l.dotAll=!0,l.raw=U(function(t){for(var e,n=t.length,o=0,r="",i=!1;o$;)y(U,P,H[$++]);I.constructor=U,U.prototype=I,g(r,"RegExp",U,{constructor:!0})}x("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(34),p=n(2195),h=n(788),v=n(1034),y=n(5966),g=n(6840),m=n(9039),b=n(8227),w=n(2293),x=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,D=TypeError,T=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=x(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=w(r,RegExp),s=l(v(r));return e=new a(a===RegExp?r.source:r,s),n=!!~T(s,"g"),o=!!~T(s,"u")||!!~T(s,"v"),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(h(t)&&(e=l(u(v(t))),!~T(e,"g")))throw new D("`.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)}else if(j)return N(a,t);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(9504),i=n(9228),a=n(8551),s=n(34),u=n(8014),c=n(655),l=n(7750),f=n(5966),d=n(7829),p=n(1034),h=n(6682),v=r("".indexOf);i("match",(function(t,e,n){return[function(e){var n=l(this),r=s(e)?f(e,t):void 0;return r?o(r,e,n):new RegExp(e)[t](c(n))},function(t){var o=a(this),r=c(t),i=n(e,o,r);if(i.done)return i.value;var s=c(p(o));if(!~v(s,"g"))return h(o,r);var l=!!~v(s,"u")||!!~v(s,"v");o.lastIndex=0;for(var f,y=[],g=0;null!==(f=h(o,r));){var m=c(f[0]);y[g]=m,""===m&&(o.lastIndex=d(r,u(o.lastIndex),l)),g++}return 0===g?null:y}]}))},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(34),f=n(1291),d=n(8014),p=n(655),h=n(7750),v=n(7829),y=n(5966),g=n(2478),m=n(1034),b=n(6682),w=n(8227)("replace"),x=Math.max,E=Math.min,O=i([].concat),S=i([].push),k=i("".indexOf),P=i("".slice),I="$0"==="a".replace(/./,"$0"),C=!!/./[w]&&""===/./[w]("a","$0");a("replace",(function(t,e,n){var i=C?"$":"$0";return[function(t,n){var o=h(this),i=l(t)?y(t,w):void 0;return i?r(i,t,o,n):r(e,p(o),t,n)},function(t,r){var a=u(this),s=p(t),l=c(r);l||(r=p(r));var h=p(m(a));if("string"==typeof r&&!~k(r,i)&&!~k(r,"$<")&&!~k(h,"y")){var y=n(e,a,s,r);if(y.done)return y.value}var w,I=!!~k(h,"g");I&&(w=!!~k(h,"u")||!!~k(h,"v"),a.lastIndex=0);for(var C,A=[];null!==(C=b(a,s))&&(S(A,C),I);){""===p(C[0])&&(a.lastIndex=v(s,d(a.lastIndex),w))}for(var M,D="",T=0,N=0;N=T&&(D+=P(s,T,L)+j,T=L+R.length)}return D+P(s,T)}]}),!!s((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}))||!I||C)},744:function(t,e,n){var o=n(9565),r=n(9504),i=n(9228),a=n(8551),s=n(34),u=n(7750),c=n(2293),l=n(7829),f=n(8014),d=n(655),p=n(5966),h=n(1034),v=n(6682),y=n(8429),g=n(9039),m=y.UNSUPPORTED_Y,b=Math.min,w=r([].push),x=r("".slice),E=r("".indexOf),O=!g((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]})),S="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)?p(e,t):void 0;return a?o(a,e,i,n):o(r,d(i),e,n)},function(t,o){var i=a(this),s=d(t);if(!S){var u=n(r,i,s,o,r!==e);if(u.done)return u.value}var p=c(i,RegExp),y=d(h(i)),g=!!~E(y,"u")||!!~E(y,"v");m?~E(y,"g")||(y+="g"):~E(y,"y")||(y+="y");var O=new p(m?"^(?:"+i.source+")":i,y),k=void 0===o?4294967295:o>>>0;if(0===k)return[];if(0===s.length)return null===v(O,s)?[s]:[];for(var P=0,I=0,C=[];It.length)&&(e=t.length);for(var n=0,o=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"],i=e.length-1>=o;if(e.length<=r.length)return!1;if(Number.isInteger(o))return n.debug&&console.log("maxLength (num) reached:",i),i?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===s(o)){var a=e.length-1>=o[n.inputName||"default"];return n.debug&&console.log("maxLength (obj) reached:",a),a?(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 r(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[o++]}},e:function(t){throw t},f:r}}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(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}(Object.getOwnPropertyNames(t.prototype));try{for(o.s();!(n=o.n()).done;){var r=n.value;"constructor"===r||"bindMethods"===r||(e[r]=e[r].bind(e))}}catch(t){o.e(t)}finally{o.f()}}}],e&&u(t.prototype,e),n&&u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();c(f,"noop",(function(){}));var d=f;function p(t){return p="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},p(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]||""}}],e&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function m(t){return m="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},m(t)}function b(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=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"!==P(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!!S(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")),"function"==typeof o.options.beforeInputUpdate&&o.options.beforeInputUpdate(o);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]=""),"function"==typeof this.options.beforeInputUpdate&&this.options.beforeInputUpdate(this);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 O({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),this.options.updateCaretOnSelectionChange&&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),o.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),o.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),this.options.updateCaretOnSelectionChange&&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(S(n),S(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):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){var e;if(null!==(e=t.target.classList)&&void 0!==e&&e.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=t.utilities.isConstructor(e)?new e(t):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,S(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.options.useMouseEvents&&t.options.clickOnMouseDown||t.handleButtonClicked(e,n)},y.onmousedown=function(n){("function"==typeof t.options.onKeyReleased||t.options.useMouseEvents&&t.options.clickOnMouseDown)&&!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&&C(t.prototype,e),n&&C(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}(),T=D,N=T;return 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(4527),d=n(81),p=n(851),h=n(9539),v=Array;t.exports=function(t){var e=u(this),n=arguments.length,y=n>1?arguments[1]:void 0,g=void 0!==y;g&&(y=o(y,n>2?arguments[2]:void 0));var m,b,w,x,E,O,S=i(t),k=p(S),P=0;if(!k||this===v&&s(k))for(m=c(S),b=e?new this(m):v(m);m>P;P++)O=g?y(S[P],P):S[P],l(b,P,O);else for(b=e?new this:[],E=(x=d(S,k)).next;!(w=r(E,x)).done;P++){O=g?a(x,y,[w.value,P],!0):w.value;try{l(b,P,O)}catch(t){h(x,"throw",t)}}return f(b,P),b}},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(7055),i=n(8981),a=n(6198),s=n(1469),u=n(4659),c=function(t){var e=1===t,n=2===t,c=3===t,l=4===t,f=6===t,d=7===t,p=5===t||f;return function(h,v,y){for(var g,m,b=i(h),w=r(b),x=a(w),E=o(v,y),O=0,S=0,k=e?s(h,x):n||d?s(h,0):void 0;x>O;O++)if((p||O in w)&&(m=E(g=w[O],O,b),t))if(e)u(k,O,m);else if(m)switch(t){case 3:return!0;case 5:return g;case 6:return O;case 2:u(k,S++,g)}else switch(t){case 4:return!1;case 7:u(k,S++,g)}return f?-1:c||l?l:k}};t.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6),filterReject:c(7)}},597:function(t,e,n){var o=n(9039),r=n(8227),i=n(9519),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 new 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},8727:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3709:function(t,e,n){var o=n(2839).match(/firefox\/(\d+)/i);t.exports=!!o&&+o[1]},3763:function(t,e,n){var o=n(2839);t.exports=/MSIE|Trident/.test(o)},6193:function(t,e,n){var o=n(4215);t.exports="NODE"===o},2839:function(t,e,n){var o=n(4576).navigator,r=o&&o.userAgent;t.exports=r?String(r):""},9519:function(t,e,n){var o,r,i=n(4576),a=n(2839),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},3607:function(t,e,n){var o=n(2839).match(/AppleWebKit\/(\d+)\./);t.exports=!!o&&+o[1]},4215:function(t,e,n){var o=n(4576),r=n(2839),i=n(2195),a=function(t){return r.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":o.Bun&&"string"==typeof Bun.version?"BUN":o.Deno&&"object"==typeof Deno.version?"DENO":"process"===i(o.process)?"NODE":o.window&&o.document?"BROWSER":"REST"},6518:function(t,e,n){var o=n(4576),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/;if("split"===t){var o={};o[c]=function(){return n},(n={constructor:o,flags:""})[d]=/./[d]}return 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")}))},566:function(t,e,n){var o=n(9504),r=n(9306),i=n(34),a=n(9297),s=n(7680),u=n(616),c=Function,l=o([].concat),f=o([].join),d={};t.exports=u?c.bind:function(t){var e=r(this),n=e.prototype,o=s(arguments,1),u=function(){var n=l(o,s(arguments));return this instanceof u?function(t,e,n){if(!a(d,e)){for(var o=[],r=0;r]*>)/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}))}},4576: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(2195),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(4576),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(2195);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},5810:function(t,e,n){var o=n(34),r=n(1181).get;t.exports=function(t){if(!o(t))return!1;var e=r(t);return!!e&&"RawJSON"===e.type}},788:function(t,e,n){var o=n(34),r=n(2195),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,w=y.BUGGY_SAFARI_ITERATORS,x=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(!w&&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)}},D=e+" Iterator",T=!1,N=t.prototype,j=N[x]||N["@@iterator"]||h&&N[h],R=!w&&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[x])||p(I,x,k)),f(I,D,!0,!0),i&&(v[D]=k)),g&&h===O&&j&&j.name!==O&&(!i&&m?d(N,"name",O):(T=!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)(w||T||!(A in N))&&p(N,A,C[A]);else o({target:e,proto:!0,forced:w||T},C);return i&&!P||N[x]===R||p(N,x,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"),w=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=w((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)}},7819:function(t,e,n){var o=n(9039);t.exports=!o((function(){var t="9007199254740993",e=JSON.rawJSON(t);return!JSON.isRawJSON(e)||JSON.stringify(e)!==t}))},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(2195),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(4576),i=n(9039),a=n(3607);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}},8235:function(t,e,n){var o=n(9504),r=n(9297),i=SyntaxError,a=parseInt,s=String.fromCharCode,u=o("".charAt),c=o("".slice),l=o(/./.exec),f={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},d=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;t.exports=function(t,e){for(var n=!0,o="";e0&&m(c,r.lastIndex-1);r.lastIndex>0&&(!r.multiline||r.multiline&&"\n"!==A&&"\r"!==A&&"\u2028"!==A&&"\u2029"!==A)&&(P="(?: (?:"+P+"))",C=" "+C,I++),n=new RegExp("^(?:"+P+")",h)}S&&(n=new RegExp("^"+P+"$(?!\\s)",h)),E&&(o=r.lastIndex);var M=i(y,p?n:r,C);return p?M?(M.input=c,M[0]=x(M[0],I),M.index=r.lastIndex,r.lastIndex+=M[0].length):r.lastIndex=0:E&&M&&(r.lastIndex=r.global?M.index+M[0].length:o),S&&M&&M.length>1&&i(v,M[0],n,(function(){for(var t=1;tb)","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(4576),i=n(9433),a="__core-js_shared__",s=t.exports=r[a]||i(a,{});(s.versions||(s.versions=[])).push({version:"3.49.0",mode:o?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/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(9519),r=n(9039),i=n(4576).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.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.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(4576),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(4576),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(4527),d=n(1469),p=n(597),h=n(8227),v=n(9519),y=h("isConcatSpreadable"),g=v>=51||!r((function(){var t=[];return t[y]=!1,t.concat()[0]!==t})),m=function(t){if(!a(t))return!1;var e=t[y];return void 0!==e?!!e:i(t)};o({target:"Array",proto:!0,arity:1,forced:!g||!p("concat")},{concat:function(t){var e,n,o,r,i,a=s(this),p=d(a,0),h=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),s=i((function(){return!Array(1).includes()})),u=i((function(){return[,1].includes(void 0,1)}));o({target:"Array",proto:!0,forced:s||u},{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=null,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(9519);o({target:"Array",proto:!0,forced:!n(6193)&&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(4527),d=n(8227),p=n(597),h=n(7680),v=p("slice"),y=d("species"),g=Array,m=Math.max;o({target:"Array",proto:!0,forced:!v},{slice:function(t,e){var n,o,d,p=c(this),v=u(p),b=s(t,v),w=s(void 0===e?v:e,v);if(r(p)&&(n=p.constructor,(i(n)&&(n===g||r(n.prototype))||a(n)&&null===(n=n[y]))&&(n=void 0),n===g||void 0===n))return h(p,b,w);for(o=new(void 0===n?g:n)(m(w-b,0)),d=0;b3)){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;or?1:-1}}(t)),n=s(r),o=0;ow-o+n;y--)d(b,y-1)}else if(n>o)for(y=w-o;y>x;y--)m=y+n-1,(g=y+o-1)in b?b[m]=b[g]:d(b,m);for(y=0;y2)if(c=w(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(x,!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 D=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&&D(s[x],O),(A||r)&&D(s[x],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})},825:function(t,e,n){var o=n(6518),r=n(7751),i=n(8745),a=n(566),s=n(5548),u=n(8551),c=n(34),l=n(2360),f=n(9039),d=r("Reflect","construct"),p=Object.prototype,h=[].push,v=f((function(){function t(){}return!(d((function(){}),[],t)instanceof t)})),y=!f((function(){d((function(){}))})),g=v||y;o({target:"Reflect",stat:!0,forced:g,sham:g},{construct:function(t,e){s(t);var n=arguments.length<3?t:s(arguments[2]);if(u(e),y&&!v)return d(t,e,n);if(t===n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var o=[null];return i(h,o,e),new(i(a,t,o))}var r=n.prototype,f=l(c(r)?r:p),g=i(t,f,e);return c(g)?g:f}})},4864:function(t,e,n){var o=n(3724),r=n(4576),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),w=n(1181).enforce,x=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),D=i("".replace),T=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 U=function(t,e){var n,o,r,i,a,l,v=f(I,this),y=d(t),g=void 0===e,m=[],x=t;if(!v&&y&&g&&t.constructor===U)return t;if((y||f(I,t))&&(t=t.source,g&&(e=h(x))),t=void 0===t?"":p(t),e=void 0===e?"":p(e),x=t,O&&"dotAll"in R&&(o=!!e&&T(e,"s")>-1)&&(e=D(e,/s/g,"")),n=e,K&&"sticky"in R&&(r=!!e&&T(e,"y")>-1)&&F&&(e=D(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"===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}for(var d=0;d",h="\\"+i[d][1];T(r,p)>-1;)r=D(r,p,h);return[r,i]}(t),t=i[0],m=i[1]),a=s(P(t,e),v?this:I,U),(o||r||m.length)&&(l=w(a),o&&(l.dotAll=!0,l.raw=U(function(t){for(var e,n=t.length,o=0,r="",i=!1;o$;)y(U,P,H[$++]);I.constructor=U,U.prototype=I,g(r,"RegExp",U,{constructor:!0})}x("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(34),p=n(2195),h=n(788),v=n(1034),y=n(5966),g=n(6840),m=n(9039),b=n(8227),w=n(2293),x=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,D=TypeError,T=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=x(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=w(r,RegExp),s=l(v(r));return e=new a(a===RegExp?r.source:r,s),n=!!~T(s,"g"),o=!!~T(s,"u")||!!~T(s,"v"),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(h(t)&&(e=l(u(v(t))),!~T(e,"g")))throw new D("`.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)}else if(j)return N(a,t);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(9504),i=n(9228),a=n(8551),s=n(34),u=n(8014),c=n(655),l=n(7750),f=n(5966),d=n(7829),p=n(1034),h=n(6682),v=r("".indexOf);i("match",(function(t,e,n){return[function(e){var n=l(this),r=s(e)?f(e,t):void 0;return r?o(r,e,n):new RegExp(e)[t](c(n))},function(t){var o=a(this),r=c(t),i=n(e,o,r);if(i.done)return i.value;var s=c(p(o));if(!~v(s,"g"))return h(o,r);var l=!!~v(s,"u")||!!~v(s,"v");o.lastIndex=0;for(var f,y=[],g=0;null!==(f=h(o,r));){var m=c(f[0]);y[g]=m,""===m&&(o.lastIndex=d(r,u(o.lastIndex),l)),g++}return 0===g?null:y}]}))},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(34),f=n(1291),d=n(8014),p=n(655),h=n(7750),v=n(7829),y=n(5966),g=n(2478),m=n(1034),b=n(6682),w=n(8227)("replace"),x=Math.max,E=Math.min,O=i([].concat),S=i([].push),k=i("".indexOf),P=i("".slice),I="$0"==="a".replace(/./,"$0"),C=!!/./[w]&&""===/./[w]("a","$0");a("replace",(function(t,e,n){var i=C?"$":"$0";return[function(t,n){var o=h(this),i=l(t)?y(t,w):void 0;return i?r(i,t,o,n):r(e,p(o),t,n)},function(t,r){var a=u(this),s=p(t),l=c(r);l||(r=p(r));var h=p(m(a));if("string"==typeof r&&!~k(r,i)&&!~k(r,"$<")&&!~k(h,"y")){var y=n(e,a,s,r);if(y.done)return y.value}var w,I=!!~k(h,"g");I&&(w=!!~k(h,"u")||!!~k(h,"v"),a.lastIndex=0);for(var C,A=[];null!==(C=b(a,s))&&(S(A,C),I);){""===p(C[0])&&(a.lastIndex=v(s,d(a.lastIndex),w))}for(var M,D="",T=0,N=0;N=T&&(D+=P(s,T,L)+j,T=L+R.length)}return D+P(s,T)}]}),!!s((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}))||!I||C)},744:function(t,e,n){var o=n(9565),r=n(9504),i=n(9228),a=n(8551),s=n(34),u=n(7750),c=n(2293),l=n(7829),f=n(8014),d=n(655),p=n(5966),h=n(1034),v=n(6682),y=n(8429),g=n(9039),m=y.UNSUPPORTED_Y,b=Math.min,w=r([].push),x=r("".slice),E=r("".indexOf),O=!g((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]})),S="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)?p(e,t):void 0;return a?o(a,e,i,n):o(r,d(i),e,n)},function(t,o){var i=a(this),s=d(t);if(!S){var u=n(r,i,s,o,r!==e);if(u.done)return u.value}var p=c(i,RegExp),y=d(h(i)),g=!!~E(y,"u")||!!~E(y,"v");m?~E(y,"g")||(y+="g"):~E(y,"y")||(y+="y");var O=new p(m?"^(?:"+i.source+")":i,y),k=void 0===o?4294967295:o>>>0;if(0===k)return[];if(0===s.length)return null===v(O,s)?[s]:[];for(var P=0,I=0,C=[];It.length)&&(e=t.length);for(var n=0,o=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"],i=e.length-1>=o;if(e.length<=r.length)return!1;if(Number.isInteger(o))return n.debug&&console.log("maxLength (num) reached:",i),i?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if("object"===s(o)){var a=e.length-1>=o[n.inputName||"default"];return n.debug&&console.log("maxLength (obj) reached:",a),a?(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 r(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[o++]}},e:function(t){throw t},f:r}}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(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}(Object.getOwnPropertyNames(t.prototype));try{for(o.s();!(n=o.n()).done;){var r=n.value;"constructor"===r||"bindMethods"===r||(e[r]=e[r].bind(e))}}catch(t){o.e(t)}finally{o.f()}}}],e&&u(t.prototype,e),n&&u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();c(f,"noop",(function(){}));var d=f;function p(t){return p="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},p(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]||""}}],e&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function m(t){return m="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},m(t)}function b(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=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"!==P(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!!S(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")),"function"==typeof o.options.beforeInputUpdate&&o.options.beforeInputUpdate(o);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]=""),"function"==typeof this.options.beforeInputUpdate&&this.options.beforeInputUpdate(this);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 O({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),this.options.updateCaretOnSelectionChange&&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),o.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),o.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),this.options.updateCaretOnSelectionChange&&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(S(n),S(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):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){var e;if(null!==(e=t.target.classList)&&void 0!==e&&e.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=t.utilities.isConstructor(e)?new e(t):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,S(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.options.useMouseEvents&&t.options.clickOnMouseDown||t.handleButtonClicked(e,n)},y.onmousedown=function(n){("function"==typeof t.options.onKeyReleased||t.options.useMouseEvents&&t.options.clickOnMouseDown)&&!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&&C(t.prototype,e),n&&C(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}(),T=D,N=T;return o}()})); \ No newline at end of file diff --git a/build/index.modern.esm.js b/build/index.modern.esm.js index d5dc34f3..7834e8cd 100644 --- a/build/index.modern.esm.js +++ b/build/index.modern.esm.js @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v3.8.154 (index.modern.esm.js - Modern Browsers bundle, ESM output) + * simple-keyboard v3.8.155 (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 diff --git a/build/index.modern.js b/build/index.modern.js index a689acdf..e16d6cab 100644 --- a/build/index.modern.js +++ b/build/index.modern.js @@ -1,6 +1,6 @@ /*! * - * simple-keyboard v3.8.154 (index.modern.js - Modern Browsers bundle) + * simple-keyboard v3.8.155 (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={}.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=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]||""}}],e&&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=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")),"function"==typeof o.options.beforeInputUpdate&&o.options.beforeInputUpdate(o);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]=""),"function"==typeof this.options.beforeInputUpdate&&this.options.beforeInputUpdate(this);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),this.options.updateCaretOnSelectionChange&&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),o.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),o.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),this.options.updateCaretOnSelectionChange&&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):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){var e;if(null!==(e=t.target.classList)&&void 0!==e&&e.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=t.utilities.isConstructor(e)?new e(t):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.options.useMouseEvents&&t.options.clickOnMouseDown||t.handleButtonClicked(e,n)},v.onmousedown=function(n){("function"==typeof t.options.onKeyReleased||t.options.useMouseEvents&&t.options.clickOnMouseDown)&&!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}()})); +!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){if(Array.isArray(n))for(var o=0;ot.length)&&(e=t.length);for(var n=0,o=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]||""}}],e&&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=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")),"function"==typeof o.options.beforeInputUpdate&&o.options.beforeInputUpdate(o);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]=""),"function"==typeof this.options.beforeInputUpdate&&this.options.beforeInputUpdate(this);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),this.options.updateCaretOnSelectionChange&&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),o.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),o.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),this.options.updateCaretOnSelectionChange&&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):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){var e;if(null!==(e=t.target.classList)&&void 0!==e&&e.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=t.utilities.isConstructor(e)?new e(t):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.options.useMouseEvents&&t.options.clickOnMouseDown||t.handleButtonClicked(e,n)},v.onmousedown=function(n){("function"==typeof t.options.onKeyReleased||t.options.useMouseEvents&&t.options.clickOnMouseDown)&&!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 b079e151..8132e01d 100644 --- a/build/index.modern.js.map +++ b/build/index.modern.js.map @@ -1 +1 @@ -{"version":3,"file":"index.modern.js","mappings":";;;;;;;;;;;;;;;CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,GAAAH,GACA,iBAAAC,QACAA,QAAA,eAAAD,IAEAD,EAAA,eAAAC,GACC,CATD,CASCK,MAAA,WACD,+BCTA,IAAAC,EAAA,CCAAA,EAAA,SAAAL,EAAAM,GACA,QAAAC,KAAAD,EACAD,EAAAG,EAAAF,EAAAC,KAAAF,EAAAG,EAAAR,EAAAO,IACAE,OAAAC,eAAAV,EAAAO,EAAA,CAAyCI,YAAA,EAAAC,IAAAN,EAAAC,IAGzC,ECPAF,EAAA,SAAAQ,EAAAC,GAA8C,OAAAL,OAAAM,UAAAC,eAAAC,KAAAJ,EAAAC,EAAA,ECC9CT,EAAA,SAAAL,GACA,oBAAAkB,QAAAA,OAAAC,aACAV,OAAAC,eAAAV,EAAAkB,OAAAC,YAAA,CAAuDC,MAAA,WAEvDX,OAAAC,eAAAV,EAAA,cAAgDoB,OAAA,GAChD,6nDCHA,IAGMC,EAAS,WA2Bb,SAjBA,SAAAA,EAAAC,GAKoB,IAJlBC,EAAUD,EAAVC,WACAC,EAAgBF,EAAhBE,iBACAC,EAAmB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9W,EAAE,GAChC0F,IAIVT,SAAS8M,UAAY,SAAC/R,GAAuB,OAC3CgV,EAAKyB,yBAAoBpb,EAAW2E,EAAE,EACxChH,KAAK+N,YAAYkL,YAAc,SAACjS,GAAuB,OACrDgV,EAAK8B,iCAAiC9W,EAAE,IAtB1CiF,SAASxB,YAAc,SAACzD,GAAuB,OAC7CgV,EAAKyB,yBAAoBpb,EAAW2E,EAAE,EACxChH,KAAK+N,YAAY/D,cAAgB,SAAChD,GAAuB,OACvDgV,EAAK8B,iCAAiC9W,EAAE,GAyB5ChH,KAAKga,SAET,gGAAC,CAlhEiB,GAqhEpB+D,EAAA,EEziEAC,EAAA","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 /**\n * Check if a function is a constructor\n */\n isConstructor(f: any) {\n try {\n Reflect.construct(String, [], f);\n } catch (e) {\n return false;\n }\n return true;\n }\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\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 SKWindow,\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} selectorOrOptions 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(keyboard: Keyboard):void} beforeInputUpdate Perform an action before any input change\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 * @property {boolean} updateCaretOnSelectionChange Updates caret when selectionchange event is fired\n * @property {boolean} clickOnMouseDown When useMouseEvents is enabled, this option allows you to trigger a button click event on mousedown\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 as SKWindow)[\"SimpleKeyboardInstances\"])\n (window as SKWindow)[\"SimpleKeyboardInstances\"] = {};\n\n this.currentInstanceName = this.utilities.camelCase(this.keyboardDOMClass);\n (window as SKWindow)[\"SimpleKeyboardInstances\"][this.currentInstanceName] = this;\n\n /**\n * Instance vars\n */\n this.allKeyboardInstances = (window as SKWindow)[\"SimpleKeyboardInstances\"];\n this.keyboardInstanceNames = Object.keys((window as SKWindow)[\"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 /**\n * Perform an action before any input change\n */\n if (typeof this.options.beforeInputUpdate === \"function\") {\n this.options.beforeInputUpdate(this);\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 * Perform an action before any input change\n */\n if (typeof this.options.beforeInputUpdate === \"function\") {\n this.options.beforeInputUpdate(this);\n }\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 = {} as KeyboardInput;\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 as SKWindow)[\"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 as SKWindow)[\"SimpleKeyboardInstances\"]).forEach((key) => {\n callback((window as SKWindow)[\"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\n if (this.options.updateCaretOnSelectionChange) {\n document.addEventListener(\"selectionchange\", this.handleSelectionChange);\n }\n\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 instance.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 instance.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\n // selectionchange is causing caret update issues on Chrome\n // https://github.com/hodgef/simple-keyboard/issues/2346\n if (this.options.updateCaretOnSelectionChange) {\n document.removeEventListener(\"selectionchange\", this.handleSelectionChange);\n }\n\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 as SKWindow)[\"SimpleKeyboardInstances\"][this.currentInstanceName] = null;\n delete (window as SKWindow)[\"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 ) {\n // If buttons is empty, undefined, or not a string, apply to all buttons\n if (!attrObj.buttons || typeof attrObj.buttons !== \"string\") {\n callback(attrObj.attribute, attrObj.value);\n } else {\n const attrObjButtons = attrObj.buttons.split(\" \");\n\n if (attrObjButtons.includes(button)) {\n callback(attrObj.attribute, attrObj.value);\n }\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 = this.utilities.isConstructor(KeyboardModule) ?\n new KeyboardModule(this) : KeyboardModule(this);\n\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 (\n typeof this.options.onKeyReleased !== \"function\" &&\n !(this.options.useMouseEvents && this.options.clickOnMouseDown)\n ) {\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 (\n typeof this.options.onKeyReleased === \"function\" ||\n (this.options.useMouseEvents && this.options.clickOnMouseDown)\n ) &&\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","import { KeyboardLayoutObject } from \"../interfaces\";\n\nexport const getDefaultLayout = (): KeyboardLayoutObject => {\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","f","Reflect","construct","String","e","myClass","_step","_iterator","_createForOfIteratorHelper","getOwnPropertyNames","s","n","done","myMethod","bind","err","services_Utilities","services_PhysicalKeyboard","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","components_CandidateBox","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","beforeInputUpdate","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","_this0","classNameItem","buttonTheme","classNameFound","buttonThemeArray","push","class","_this1","_this1$options","_buttonTheme","_this1$options$button","filteredButtonArray","item","splice","buttonArr","inputVal","inputPatternRaw","didInputMatch","test","_this$options$physica","addEventListener","handleKeyUp","handleKeyDown","handleMouseUp","handleTouchEnd","updateCaretOnSelectionChange","handleSelectionChange","handleSelect","event","caretEventHandler","physicalKeyboardHighlight","handleHighlightKeyUp","handleHighlightKeyDown","userAgent","targetTagName","_this10","tagName","isKeyboard","path","some","_item$hasAttribute","hasAttribute","disableCaretPositioning","selectionStart","selectionEnd","getRtlOffset","fn","_this11","_this$options$physica2","removeEventListener","ontouchend","ontouchcancel","onmouseup","onpointercancel","onmousedown","resetRows","initialized","buttonClasses","themeObj","themeObjClasses","buttonAttributes","attrObj","attribute","processAutoTouchEvents","disableContextualWindow","oncontextmenu","_event$target$classLi","autoUseTouchEvents","setEventListeners","onInit","isTouchDevice","onTouchDeviceDetected","beforeFirstRender","pointerEventsSupported","useMouseEvents","beforeRender","onRender","onModulesLoaded","_this12","KeyboardModule","keyboardModule","isConstructor","init","rowDOM","rowIndex","containerStartIndexes","containerEndIndexes","_this13","rowDOMArray","from","children","removedElements","startIndex","arrIndex","endIndex","updated_startIndex","updated_endIndex","containerDOM","containerUID","containedElements","element","_this14","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","clickOnMouseDown","buttonUID","buttonSpanDOM","parseRowDOMContainers","handleKeyboardContainerMouseDown","Keyboard","index_modern"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.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7W,EAAE,GAChCyF,IAIVT,SAAS8M,UAAY,SAAC9R,GAAuB,OAC3C+U,EAAKyB,yBAAoBjb,EAAWyE,EAAE,EACxClH,KAAKgO,YAAYkL,YAAc,SAAChS,GAAuB,OACrD+U,EAAK8B,iCAAiC7W,EAAE,IAtB1CgF,SAASxB,YAAc,SAACxD,GAAuB,OAC7C+U,EAAKyB,yBAAoBjb,EAAWyE,EAAE,EACxClH,KAAKgO,YAAY/D,cAAgB,SAAC/C,GAAuB,OACvD+U,EAAK8B,iCAAiC7W,EAAE,GAyB5ClH,KAAKia,SAET,gGAAC,CAlhEiB,GAqhEpB+D,EAAA,EEziEAC,EAAA","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/value functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tif(Array.isArray(definition)) {\n\t\tvar i = 0;\n\t\twhile(i < definition.length) {\n\t\t\tvar key = definition[i++];\n\t\t\tvar binding = definition[i++];\n\t\t\tif(!__webpack_require__.o(exports, key)) {\n\t\t\t\tif(binding === 0) {\n\t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, value: definition[i++] });\n\t\t\t\t} else {\n\t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: binding });\n\t\t\t\t}\n\t\t\t} else if(binding === 0) { i++; }\n\t\t}\n\t} else {\n\t\tfor(var key in definition) {\n\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t\t}\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 /**\n * Check if a function is a constructor\n */\n isConstructor(f: any) {\n try {\n Reflect.construct(String, [], f);\n } catch (e) {\n return false;\n }\n return true;\n }\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\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 SKWindow,\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} selectorOrOptions 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(keyboard: Keyboard):void} beforeInputUpdate Perform an action before any input change\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 * @property {boolean} updateCaretOnSelectionChange Updates caret when selectionchange event is fired\n * @property {boolean} clickOnMouseDown When useMouseEvents is enabled, this option allows you to trigger a button click event on mousedown\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 as SKWindow)[\"SimpleKeyboardInstances\"])\n (window as SKWindow)[\"SimpleKeyboardInstances\"] = {};\n\n this.currentInstanceName = this.utilities.camelCase(this.keyboardDOMClass);\n (window as SKWindow)[\"SimpleKeyboardInstances\"][this.currentInstanceName] = this;\n\n /**\n * Instance vars\n */\n this.allKeyboardInstances = (window as SKWindow)[\"SimpleKeyboardInstances\"];\n this.keyboardInstanceNames = Object.keys((window as SKWindow)[\"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 /**\n * Perform an action before any input change\n */\n if (typeof this.options.beforeInputUpdate === \"function\") {\n this.options.beforeInputUpdate(this);\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 * Perform an action before any input change\n */\n if (typeof this.options.beforeInputUpdate === \"function\") {\n this.options.beforeInputUpdate(this);\n }\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 = {} as KeyboardInput;\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 as SKWindow)[\"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 as SKWindow)[\"SimpleKeyboardInstances\"]).forEach((key) => {\n callback((window as SKWindow)[\"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\n if (this.options.updateCaretOnSelectionChange) {\n document.addEventListener(\"selectionchange\", this.handleSelectionChange);\n }\n\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 instance.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 instance.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\n // selectionchange is causing caret update issues on Chrome\n // https://github.com/hodgef/simple-keyboard/issues/2346\n if (this.options.updateCaretOnSelectionChange) {\n document.removeEventListener(\"selectionchange\", this.handleSelectionChange);\n }\n\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 as SKWindow)[\"SimpleKeyboardInstances\"][this.currentInstanceName] = null;\n delete (window as SKWindow)[\"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 ) {\n // If buttons is empty, undefined, or not a string, apply to all buttons\n if (!attrObj.buttons || typeof attrObj.buttons !== \"string\") {\n callback(attrObj.attribute, attrObj.value);\n } else {\n const attrObjButtons = attrObj.buttons.split(\" \");\n\n if (attrObjButtons.includes(button)) {\n callback(attrObj.attribute, attrObj.value);\n }\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 = this.utilities.isConstructor(KeyboardModule) ?\n new KeyboardModule(this) : KeyboardModule(this);\n\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 (\n typeof this.options.onKeyReleased !== \"function\" &&\n !(this.options.useMouseEvents && this.options.clickOnMouseDown)\n ) {\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 (\n typeof this.options.onKeyReleased === \"function\" ||\n (this.options.useMouseEvents && this.options.clickOnMouseDown)\n ) &&\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","import { KeyboardLayoutObject } from \"../interfaces\";\n\nexport const getDefaultLayout = (): KeyboardLayoutObject => {\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","Array","isArray","i","length","key","binding","o","Object","defineProperty","enumerable","value","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","Utilities","_ref","getOptions","getCaretPosition","getCaretPositionEnd","dispatch","_classCallCheck","_defineProperty","button","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","Math","ceil","map","_","index","newIndex","startMarkerIndex","indexOf","f","Reflect","construct","String","e","myClass","_step","_iterator","_createForOfIteratorHelper","getOwnPropertyNames","s","n","done","myMethod","bind","err","services_Utilities","services_PhysicalKeyboard","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","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","components_CandidateBox","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","beforeInputUpdate","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","_this0","classNameItem","buttonTheme","classNameFound","buttonThemeArray","push","class","_this1","_this1$options","_buttonTheme","_this1$options$button","filteredButtonArray","item","splice","buttonArr","inputVal","inputPatternRaw","didInputMatch","test","_this$options$physica","addEventListener","handleKeyUp","handleKeyDown","handleMouseUp","handleTouchEnd","updateCaretOnSelectionChange","handleSelectionChange","handleSelect","event","caretEventHandler","physicalKeyboardHighlight","handleHighlightKeyUp","handleHighlightKeyDown","userAgent","targetTagName","_this10","tagName","isKeyboard","path","some","_item$hasAttribute","hasAttribute","disableCaretPositioning","selectionStart","selectionEnd","getRtlOffset","fn","_this11","_this$options$physica2","removeEventListener","ontouchend","ontouchcancel","onmouseup","onpointercancel","onmousedown","resetRows","initialized","buttonClasses","themeObj","themeObjClasses","buttonAttributes","attrObj","attribute","processAutoTouchEvents","disableContextualWindow","oncontextmenu","_event$target$classLi","autoUseTouchEvents","setEventListeners","onInit","isTouchDevice","onTouchDeviceDetected","beforeFirstRender","pointerEventsSupported","useMouseEvents","beforeRender","onRender","onModulesLoaded","_this12","KeyboardModule","keyboardModule","isConstructor","init","rowDOM","rowIndex","containerStartIndexes","containerEndIndexes","_this13","rowDOMArray","from","children","removedElements","startIndex","arrIndex","endIndex","updated_startIndex","updated_endIndex","containerDOM","containerUID","containedElements","element","_this14","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","clickOnMouseDown","buttonUID","buttonSpanDOM","parseRowDOMContainers","handleKeyboardContainerMouseDown","Keyboard","index_modern"],"sourceRoot":""} \ No newline at end of file