"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),n=require("primereact/componentbase"),r=require("primereact/hooks"),a=require("primereact/inputtext"),l=require("primereact/utils");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(e);function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0&&Number(e.key)<=9)||I.join("").length>=h.length&&"Delete"!==e.code)&&e.preventDefault()}},J=function(e,t){return e.length===t&&e.every((function(e){return""===e||null==e}))};r.useUpdateEffect((function(){var e,t,n=h.value?null===(e=h.value)||void 0===e||null===(e=e.toString())||void 0===e||null===(t=e.split)||void 0===t?void 0:t.call(e,""):new Array(h.length);T(n)}),[h.value]);var V=function(e){if(e<=0)return[];var n=h.length-e,r={onInput:function(e){return B(e,n)},onKeyDown:H,onFocus:R,onBlur:L,onPaste:K},o={value:I[n]||"",type:null!=h&&h.mask?"password":"text",variant:null==h?void 0:h.variant,readOnly:null==h?void 0:h.readOnly,disabled:null==h?void 0:h.disabled,tabIndex:null==h?void 0:h.tabIndex,autoFocus:(null==h?void 0:h.autoFocus)&&0===n,"aria-label":t.ariaLabel("otpLabel",{0:n+1}),"data-index":n,className:x("input")};return[null!=h&&h.inputTemplate?l.ObjectUtils.getJSXElement(null==h?void 0:h.inputTemplate,{events:r,props:o}):i.default.createElement(a.InputText,u({},o,r,{invalid:null==h?void 0:h.invalid,unstyled:null==h?void 0:h.unstyled,pt:S("input"),inputMode:null!=h&&h.integerOnly?"numeric":"text",key:n}))].concat(v(V(e-1))).map((function(e,t){return i.default.createElement(i.default.Fragment,{key:t},e)}))},X=g({className:x("root"),ref:d,style:null==h?void 0:h.style},S("root"));return i.default.createElement("div",X,V(h.length))})));x.displayName="InputOtp",exports.InputOtp=x;