"use strict";(self.webpackChunkhws_app_captain_password=self.webpackChunkhws_app_captain_password||[]).push([[180],{3180:(e,t,n)=>{n.r(t),n.d(t,{default:()=>l});var s=n(4848),o=n(6782),a=n(7963),r=n(5685),i=n(2943),c=n(6302);const l=()=>{(0,i.useLocation)();const{enqueueSnackbar:e}=(0,c.useSnackbar)(),[t,n]=(0,o.useState)(!0),[l,d]=(0,o.useState)(!0),[x,h]=(0,o.useState)(!0),[b,j]=(0,o.useState)(!0),[S,A]=(0,o.useState)(16),[g,_]=(0,o.useState)(""),[u,C]=(0,o.useState)(0),[P,p]=(0,o.useState)(""),O=e=>{var t,n,s;return null!==(s=null===(n=null===(t=null===window||void 0===window?void 0:window.HWS)||void 0===t?void 0:t.I18n)||void 0===n?void 0:n.t(e))&&void 0!==s?s:e};(0,o.useEffect)(()=>{W()},[t,l,x,b,S]);const W=()=>{let e="";if(t&&(e+="abcdefghijklmnopqrstuvwxyz"),l&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),x&&(e+="0123456789"),b&&(e+="@#=+!£%&?[](){}"),!e)return _(""),void C(0);let n="";for(let t=0;t<S;t++)n+=e[Math.floor(Math.random()*e.length)];_(n),T(n)},T=e=>{let t=0;e.length>=8&&(t+=.2),/[A-Z]/.test(e)&&(t+=.2),/[0-9]/.test(e)&&(t+=.2),/[@#=+!£%&?[\]{}()]/.test(e)&&(t+=.2),e.length>=16&&(t+=.2),C(t),p(O(t<=.3?"HWS_APP_CAPTAIN_PASSWORD_WEAK":t<=.5?"HWS_APP_CAPTAIN_PASSWORD_GOOD":t<=.7?"HWS_APP_CAPTAIN_PASSWORD_STRONG":"HWS_APP_CAPTAIN_PASSWORD_EXCELLENT"))};return(0,s.jsx)(a.Box,Object.assign({display:"flex",justifyContent:"center",mt:4,px:2},{children:(0,s.jsx)(a.Card,Object.assign({sx:{width:"100%",maxWidth:700,boxShadow:3}},{children:(0,s.jsxs)(a.CardContent,{children:[(0,s.jsx)(a.Typography,Object.assign({variant:"h5",textAlign:"center",mb:3},{children:O("HWS_APP_CAPTAIN_PASSWORD_GENERATE_PASSWORD")})),(0,s.jsxs)(a.Stack,Object.assign({direction:"row",justifyContent:"center",flexWrap:"wrap",gap:2},{children:[(0,s.jsx)(a.FormControlLabel,{control:(0,s.jsx)(a.Checkbox,{checked:l,onChange:()=>d(!l)}),label:"ABC"}),(0,s.jsx)(a.FormControlLabel,{control:(0,s.jsx)(a.Checkbox,{checked:t,onChange:()=>n(!t)}),label:"abc"}),(0,s.jsx)(a.FormControlLabel,{control:(0,s.jsx)(a.Checkbox,{checked:x,onChange:()=>h(!x)}),label:"123"}),(0,s.jsx)(a.FormControlLabel,{control:(0,s.jsx)(a.Checkbox,{checked:b,onChange:()=>j(!b)}),label:"#@&"})]})),(0,s.jsxs)(a.Typography,Object.assign({variant:"h6",textAlign:"center",mt:4},{children:[O("HWS_APP_CAPTAIN_PASSWORD_LENGTH"),": ",S]})),(0,s.jsx)(a.Slider,{value:S,onChange:(e,t)=>A(t),min:4,max:128,step:1,sx:{width:"80%",mx:"auto",display:"block"}}),g&&(0,s.jsxs)(a.Box,Object.assign({mt:4,textAlign:"center"},{children:[(0,s.jsxs)(a.Box,Object.assign({display:"flex",justifyContent:"center",alignItems:"center",gap:1},{children:[(0,s.jsx)(a.Tooltip,Object.assign({title:"Generate new"},{children:(0,s.jsx)(a.IconButton,Object.assign({onClick:W},{children:(0,s.jsx)(r.Refresh,{})}))})),(0,s.jsx)(a.Typography,Object.assign({variant:"body1",sx:{px:2,py:1,border:"1px solid #ccc",borderRadius:1,minWidth:200,overflowX:"auto",bgcolor:"#f9f9f9"}},{children:g})),(0,s.jsx)(a.Tooltip,Object.assign({title:"Copy to clipboard"},{children:(0,s.jsx)(a.IconButton,Object.assign({onClick:()=>{g&&(navigator.clipboard.writeText(g),e(O("HWS_APP_CAPTAIN_PASSWORD_COPIED_TO_CLIPBOARD"),{variant:"success"}))}},{children:(0,s.jsx)(r.ContentCopy,{})}))}))]})),(0,s.jsxs)(a.Box,Object.assign({mt:3,width:"80%",mx:"auto"},{children:[(0,s.jsx)(a.LinearProgress,{variant:"determinate",value:100*u,sx:{height:8,borderRadius:1,bgcolor:"#eee","& .MuiLinearProgress-bar":{bgcolor:u<=.3?"red":u<=.5?"orange":u<=.7?"blue":"green"}}}),(0,s.jsxs)(a.Typography,Object.assign({mt:1,textAlign:"center",variant:"body2",color:"text.secondary"},{children:[O("HWS_APP_CAPTAIN_PASSWORD_PASSWORD_STRENGTH"),": ",P]}))]}))]}))]})}))}))}}}]);