1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8761],{28761:function(e,a,t){var n=t(57437),s=t(2265),u=t(44811),i=t(12713),l=t(31691),r=t(82156),o=t(1899);function d(e){return e>5?5:e<0?0:e}let c={inputValues:Array(6).fill(""),focusedIndex:0,status:"idle"},p=e=>{let{index:a,value:t,onChange:u,onPaste:l,onBackspace:r,isFocused:o,onFocus:d,isDisabled:c}=e,p=(0,s.useRef)(null);return(0,s.useEffect)(()=>{p.current&&o&&p.current.focus()},[o]),(0,n.jsx)(i.Z,{inputRef:p,type:"text",value:t,onChange:e=>{u(a,e.target.value)},onPaste:e=>{l(e.clipboardData.getData("text"))},onKeyDown:e=>{"Backspace"===e.key&&""===t&&r(a)},inputProps:{maxLength:1,style:{textAlign:"center"},autoComplete:"off"},onFocus:()=>{d(a)},disabled:c,variant:"outlined",size:"medium"})};function y(e,a){switch(a.type){case"INPUT":return{...e,inputValues:[...e.inputValues.slice(0,a.payload.index),a.payload.value,...e.inputValues.slice(a.payload.index+1)],focusedIndex:d(a.payload.index+1)};case"BACK":{let t=d(a.payload.index-1);return{...e,inputValues:[...e.inputValues.slice(0,t),"",...e.inputValues.slice(t+1)],focusedIndex:t}}case"PASTE":return{...e,inputValues:e.inputValues.map((e,t)=>a.payload.pastedValue[t]||"")};case"FOCUS":return{...e,focusedIndex:a.payload.focusedIndex};case"VERIFY":return{...e,status:"pending"};case"VERIFY_SUCCESS":return{...e,status:"success"};case"VERIFY_FAILURE":return{...e,status:"failure"};case"CLEAR_INPUTS":return{...c};default:throw Error("unknown action")}}a.Z=e=>{let{defaultButtonText:a="Submit",footer:t,loadingButtonText:i="Loading...",handleSubmit:d,showButton:f=!0,buttonColor:x,fullWidthButton:h=!1,buttonMarginTop:m=0}=e,[{inputValues:E,focusedIndex:I,status:C},b]=(0,s.useReducer)(y,c),g=(0,l.Z)(),S=(0,r.Z)(g.breakpoints.down("sm")),V=(e,a)=>{b({type:"INPUT",payload:{index:e,value:a}})},k=e=>{b({type:"BACK",payload:{index:e}})},F=e=>{b({type:"PASTE",payload:{pastedValue:e}})},R=e=>{b({type:"FOCUS",payload:{focusedIndex:e}})},v=E.every(e=>""!==e),w=async e=>{if(e.preventDefault(),v){b({type:"VERIFY"});try{await d(E),b({type:"VERIFY_SUCCESS"})}catch(e){b({type:"VERIFY_FAILURE"})}finally{setTimeout(()=>{b({type:"CLEAR_INPUTS"})},2e3)}}};return(0,s.useEffect)(()=>{v&&!f&&w(new Event("submit"))},[v,f]),(0,n.jsx)("form",{onSubmit:w,children:(0,n.jsxs)(o.Z,{display:"flex",flexDirection:"column",gap:2,alignItems:"center",children:[(0,n.jsx)(o.Z,{display:"flex",gap:S?.5:2,children:E.map((e,a)=>(0,n.jsx)(p,{index:a,value:e,onChange:V,onBackspace:k,onPaste:F,isFocused:a===I,onFocus:R,isDisabled:"pending"===C},a))}),t&&(0,n.jsx)(o.Z,{width:"100%",children:t}),f&&(0,n.jsx)(u.Z,{type:"submit",disabled:"pending"===C||!v,variant:"header",fullWidth:h,sx:{mt:m,pt:1.5,pb:1.5,pr:4,pl:4,backgroundColor:x?"".concat(x,".main"):"primary.main","&:hover":{backgroundColor:x?"".concat(x,".dark"):"primary.dark"},...x&&{boxShadow:2,"&:hover":{backgroundColor:"".concat(x,".dark"),boxShadow:2}}},children:"pending"===C?i:a})]})})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.