import{$n as e,$t as t,Bt as n,Et as r,J as i,Jt as a,Kt as o,Mt as s,Q as c,R as l,Tn as u,Wt as d,X as f,Xn as p,Y as m,Z as h,_t as g,bn as _,dr as v,fr as y,it as b,jt as x,lr as S,or as C,pn as w,st as T,ur as E,vt as D,xn as O}from"./dist-CoD0k1Bd.js";import{i as k}from"./Primitive-GZZWGonv.js";import{n as A,t as j}from"./useForwardPropsEmits-DFv-O8tw.js";import{s as M}from"./shared-C4LIOFnZ.js";import{i as N,n as ee,o as te,t as P}from"./core-BajWuqHF.js";import{n as F}from"./wayfinder-Dp7PqxvV.js";var I=`
[data-input-otp] {
  --nojs-bg: white !important;
  --nojs-fg: black !important;

  background-color: var(--nojs-bg) !important;
  color: var(--nojs-fg) !important;
  caret-color: var(--nojs-fg) !important;
  letter-spacing: .25em !important;
  text-align: center !important;
  border: 1px solid var(--nojs-fg) !important;
  border-radius: 4px !important;
  width: 100% !important;
}
@media (prefers-color-scheme: dark) {
  [data-input-otp] {
    --nojs-bg: black !important;
    --nojs-fg: white !important;
  }
}`,L=T({props:{fallback:{type:String,required:!0}},setup(e){return()=>D(`noscript`,{innerHTML:`<style>${e.fallback}</style>`})}}),R=Symbol(`vue-otp-context`);function z(e){return[setTimeout(e,0),setTimeout(e,10),setTimeout(e,50)]}var B=18,V=40,H=`${V}px`,U=[`[data-lastpass-icon-root]`,`com-1password-button`,`[data-dashlanecreated]`,`[style$="2147483647 !important;"]`].join(`,`);function W({containerRef:e,inputRef:t,pushPasswordManagerStrategy:r,isFocused:a}){let o=p({done:!1,refocused:!1}),s=p(!1),c=p(!1),l=p(!1),u=i(()=>r!==`none`&&(r===`increase-width`||r===`experimental-no-flickering`)&&s.value&&c.value),f=()=>{let n=e.value,i=t.value;if(!n||!i||l.value||r===`none`)return;let a=n,c=a.getBoundingClientRect().left+a.offsetWidth,u=a.getBoundingClientRect().top+a.offsetHeight/2,d=c-B,f=u;if((document.querySelectorAll(U).length!==0||document.elementFromPoint(d,f)!==n)&&(s.value=!0,l.value=!0,!o.value.refocused&&document.activeElement===i)){let e=[i.selectionStart,i.selectionEnd];i.blur(),i.focus(),i.setSelectionRange(e[0],e[1]),o.value.refocused=!0}},m=()=>{let t=e.value;!t||r===`none`||(c.value=window.innerWidth-t.getBoundingClientRect().right>=V)},h;return n(()=>{m(),h=setInterval(m,1e3)}),d(()=>{clearInterval(h)}),_([a,t],(e,t,n)=>{let[i,a]=e,o=i||document.activeElement===a;if(r===`none`||!o)return;let s=setTimeout(f,0),c=setTimeout(f,2e3),u=setTimeout(f,5e3),d=setTimeout(()=>{l.value=!0},6e3);n(()=>{clearTimeout(s),clearTimeout(c),clearTimeout(u),clearTimeout(d)})}),{hasPWMBadge:s,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:H}}var ne={style:{position:`absolute`,inset:`0`,"pointer-events":`none`}},re=[`value`,`data-input-otp-placeholder-shown`,`data-input-otp-mss`,`data-input-otp-mse`,`aria-placeholder`,`pattern`],G=T({name:`OTPInput`,inheritAttrs:!1,__name:`OTPInput`,props:x({maxlength:{},textAlign:{default:`left`},inputmode:{default:`numeric`},containerClass:{},pushPasswordManagerStrategy:{default:`increase-width`},noScriptCssFallback:{default:I},defaultValue:{default:``},pasteTransformer:{},accept:{},alt:{},autocomplete:{default:`one-time-code`},autofocus:{type:Boolean},capture:{type:[Boolean,String]},checked:{type:[Boolean,Array,Set]},crossorigin:{},disabled:{type:Boolean},enterKeyHint:{},form:{},formaction:{},formenctype:{},formmethod:{},formnovalidate:{type:Boolean},formtarget:{},height:{},indeterminate:{type:Boolean},list:{},max:{},min:{},minlength:{},multiple:{type:Boolean},name:{},pattern:{},placeholder:{},readonly:{type:Boolean},required:{type:Boolean},size:{},src:{},step:{},type:{},value:{},width:{}},{modelValue:{default(e){return e.defaultValue}},modelModifiers:{}}),emits:x([`complete`,`change`,`select`,`input`,`focus`,`blur`,`mouseover`,`mouseleave`,`paste`],[`update:modelValue`]),setup(r,{expose:u,emit:p}){let g=r,y=p,[b]=w(r,`modelValue`),x=te(b),T=i(()=>g.pattern?typeof g.pattern==`string`?new RegExp(g.pattern):g.pattern:null),E=e(!1),D=e(!1),k=e(null),j=e(null),F=e(null),I=e(null),B=ee?.CSS?.supports?.(`-webkit-touch-callout`,`none`),V={prev:[F.value?.selectionStart,F.value?.selectionEnd,F.value?.selectionDirection]};function H(e,t){try{e.insertRule(t)}catch{console.error(`input-otp could not insert CSS rule:`,t)}}n(()=>{let e=F.value,t=I.value;if(!e||!t)return;V.prev=[e.selectionStart,e.selectionEnd,e.selectionDirection??`none`];let n=N(P,`selectionchange`,r,{capture:!0});function r(){if(!e)return;if(P?.activeElement!==e){k.value=null,j.value=null;return}let t=e.selectionStart,n=e.selectionEnd,r=e.selectionDirection,i=e.maxLength,a=e.value,o=V.prev,s=-1,c=-1,l;if(a.length!==0&&t!==null&&n!==null){let r=t===n,u=t===a.length&&a.length<i;if(r&&!u){let e=t;if(e===0)s=0,c=1,l=`forward`;else if(e===i)s=e-1,c=e,l=`backward`;else if(i>1&&a.length>1){let t=0;if(o[0]!==null&&o[1]!==null){l=e<o[1]?`backward`:`forward`;let n=o[0]===o[1]&&o[0]<i;l===`backward`&&!n&&(t=-1)}s=t+e,c=t+e+1}}s!==-1&&c!==-1&&s!==c&&e.setSelectionRange(s,c,l)}let u=s===-1?t:s,d=c===-1?n:c,f=l??r;k.value=u,j.value=d,V.prev=[u,d,f]}if(r(),P?.activeElement===e&&(D.value=!0),!P?.getElementById(`input-otp-style`)){let e=P?.createElement(`style`);if(e.id=`input-otp-style`,P?.head.appendChild(e),e.sheet){let t=`background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;`;H(e.sheet,`[data-input-otp]::selection { background: transparent !important; color: transparent !important; }`),H(e.sheet,`[data-input-otp]:autofill { ${t} }`),H(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),H(e.sheet,`@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }`),H(e.sheet,`[data-input-otp] + * { pointer-events: all !important; }`)}}let i=()=>{t&&t.style.setProperty(`--root-height`,`${e.clientHeight}px`)};i();let a=new ResizeObserver(i);a.observe(e),d(()=>{n(),a.disconnect()})}),_([b],()=>{z(()=>{if(!F.value)return;F.value?.dispatchEvent(new Event(`input`));let e=F.value?.selectionStart,t=F.value?.selectionEnd,n=F.value?.selectionDirection;e!==null&&t!==null&&(k.value=e??null,j.value=t??null,V.prev=[e,t,n])})},{immediate:!0}),O(()=>{x.value!==void 0&&b.value!==x.value&&x.value.length<g.maxlength&&b.value.length===g.maxlength&&y(`complete`,b.value)});let U=W({containerRef:I,inputRef:F,pushPasswordManagerStrategy:g.pushPasswordManagerStrategy,isFocused:D});function G(e){if(e.inputType===`insertText`&&e.data!==null){let t=e.currentTarget,n=t.selectionStart??0,r=t.selectionEnd??0,i=t.value,a=(n===r?i.slice(0,n)+e.data+i.slice(n):i.slice(0,n)+e.data+i.slice(r)).slice(0,g.maxlength);a.length>0&&T.value&&!T.value.test(a)&&e.preventDefault()}}function K(e){let t=e.currentTarget.value.slice(0,g.maxlength);if(t.length>0&&T.value&&!T.value.test(t)){e.preventDefault();return}typeof x.value==`string`&&t.length<x.value.length&&P?.dispatchEvent(new Event(`selectionchange`)),b.value=t,y(`input`,t)}function q(){let e=F.value;if(e){let t=Math.min(e.value.length,g.maxlength-1),n=e.value.length;e.setSelectionRange(t,n),k.value=t,j.value=n}D.value=!0}function J(e){let t=F.value;if(!t||!g.pasteTransformer&&(!B||!e.clipboardData||!t))return;let n=e?.clipboardData?.getData(`text/plain`),r=g?.pasteTransformer?g.pasteTransformer(n):n;e.preventDefault();let i=F.value?.selectionStart,a=F.value?.selectionEnd,o=(i===a?b.value.slice(0,i)+r+b.value.slice(i):b.value.slice(0,i)+r+b.value.slice(a)).slice(0,g.maxlength);if(o.length>0&&T.value&&!T.value.test(o))return;b.value=o,y(`input`,o);let s=Math.min(o.length,g.maxlength-1),c=o.length;t?.setSelectionRange(s,c),k.value=s,j.value=c}let Y=A(M(g,`containerClass`,`value`,`pattern`,`defaultValue`,`pushPasswordManagerStrategy`,`noScriptCssFallback`,`modelValue`)),X=i(()=>({position:`relative`,cursor:g.disabled?`default`:`text`,userSelect:`none`,WebkitUserSelect:`none`,pointerEvents:`none`})),Z=i(()=>({position:`absolute`,inset:0,width:U.willPushPWMBadge.value?`calc(100% + ${U.PWM_BADGE_SPACE_WIDTH})`:`100%`,clipPath:U.willPushPWMBadge.value?`inset(0 ${U.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:`100%`,display:`flex`,textAlign:g.textAlign,opacity:`1`,color:`transparent`,pointerEvents:`all`,background:`transparent`,caretColor:`transparent`,border:`0 solid transparent`,outline:`0 solid transparent`,boxShadow:`none`,lineHeight:`1`,letterSpacing:`-.5em`,fontSize:`var(--root-height)`,fontFamily:`monospace`,fontVariantNumeric:`tabular-nums`})),Q=i(()=>({slots:Array.from({length:Number(g.maxlength)}).map((e,t)=>{let n=D.value&&k.value!==null&&j.value!==null&&(k.value===j.value&&t===k.value||t>=k.value&&t<j.value),r=b.value[t]===void 0?null:b.value[t];return{char:r,placeholderChar:r??g?.placeholder?.[t]??null,isActive:n,hasFakeCaret:n&&r===null}}),isFocused:D.value,isHovering:!g.disabled&&E.value}));return a(R,Q),u(Object.defineProperty({},"$el",{enumerable:!0,configurable:!0,get:()=>F})),(e,n)=>(o(),c(l,null,[r.noScriptCssFallback===null?h(`v-if`,!0):(o(),f(C(L),{key:0,fallback:r.noScriptCssFallback},null,8,[`fallback`])),m(`div`,{ref_key:`containerRef`,ref:I,"data-input-otp-container":``,style:v(X.value),class:S(r.containerClass)},[t(e.$slots,`default`,{slots:Q.value.slots,isFocused:D.value,isHovering:!r.disabled&&E.value}),m(`div`,ne,[m(`input`,s({ref_key:`inputRef`,ref:F,value:C(b),"data-input-otp":``,"data-input-otp-placeholder-shown":C(b).length===0||void 0,"data-input-otp-mss":k.value,"data-input-otp-mse":j.value,"aria-placeholder":r.placeholder,style:Z.value,pattern:T.value?.source},{...e.$attrs,...C(Y)},{onBeforeinput:G,onMouseover:n[0]||=e=>{E.value=!0,y(`mouseover`,e)},onMouseleave:n[1]||=e=>{E.value=!1,y(`mouseleave`,e)},onPaste:n[2]||=e=>{J(e),y(`paste`,e)},onInput:K,onFocus:n[3]||=e=>{q(),y(`focus`,e)},onBlur:n[4]||=e=>{D.value=!1,y(`blur`,e)}}),null,16,re)])],6)],64))}});function K(){return r(R)}var q=T({__name:`InputOTP`,props:{maxlength:{},textAlign:{},inputmode:{},containerClass:{},pushPasswordManagerStrategy:{},noScriptCssFallback:{},defaultValue:{},pasteTransformer:{type:Function},accept:{},alt:{},autocomplete:{},autofocus:{type:Boolean},capture:{type:[Boolean,String]},checked:{type:[Boolean,Array,Set]},crossorigin:{},disabled:{type:Boolean},enterKeyHint:{},form:{},formaction:{},formenctype:{},formmethod:{},formnovalidate:{type:Boolean},formtarget:{},height:{},indeterminate:{type:Boolean},list:{},max:{},min:{},minlength:{},multiple:{type:Boolean},name:{},pattern:{},placeholder:{},readonly:{type:Boolean},required:{type:Boolean},size:{},src:{},step:{},type:{},value:{},width:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`complete`,`change`,`select`,`input`,`focus`,`blur`,`mouseover`,`mouseleave`,`paste`],setup(e,{emit:n}){let r=e,i=n,a=M(r,`class`),c=j(a,i);return(e,n)=>(o(),f(C(G),s(C(c),{"container-class":C(k)(`flex items-center gap-2 has-disabled:opacity-50`,r.class),"data-slot":`input-otp`,class:`disabled:cursor-not-allowed`}),{default:u(n=>[t(e.$slots,`default`,E(g(n)))]),_:3},16,[`container-class`]))}}),J=T({__name:`InputOTPGroup`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let n=e,r=M(n,`class`),i=A(r);return(e,r)=>(o(),c(`div`,s({"data-slot":`input-otp-group`},C(i),{class:C(k)(`flex items-center`,n.class)}),[t(e.$slots,`default`)],16))}}),Y=[`data-active`],X={key:0,class:`pointer-events-none absolute inset-0 flex items-center justify-center`},Z=T({__name:`InputOTPSlot`,props:{index:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=M(t,`class`),r=A(n),a=K(),l=i(()=>a?.value.slots[t.index]);return(e,n)=>(o(),c(`div`,s(C(r),{"data-slot":`input-otp-slot`,"data-active":l.value?.isActive,class:C(k)(`data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]`,t.class)}),[b(y(l.value?.char)+` `,1),l.value?.hasFakeCaret?(o(),c(`div`,X,[...n[0]||=[m(`div`,{class:`animate-caret-blink bg-foreground h-4 w-px duration-1000`},null,-1)]])):h(``,!0)],16,Y))}}),Q=e=>({url:Q.url(e),method:`post`});Q.definition={methods:[`post`],url:`/two-factor-challenge`},Q.url=e=>Q.definition.url+F(e),Q.post=e=>({url:Q.url(e),method:`post`});var $=e=>({action:Q.url(e),method:`post`});$.post=e=>({action:Q.url(e),method:`post`}),Q.form=$;var ie={store:Object.assign(Q,Q)};export{q as a,J as i,Q as n,Z as r,ie as t};