import { jsx, jsxs } from "react/jsx-runtime";
import "react";
import { connect, mapReadPretty } from "@tachybase/schema";
import { Input } from "antd";
import { PasswordStrength } from "./PasswordStrength.mjs";
const Password_Password = connect((props)=>{
    const { value, className, checkStrength, ...others } = props;
    const blockStyle = {
        position: 'absolute',
        zIndex: 1,
        height: 8,
        top: 0,
        background: '#fff',
        width: 1,
        transform: 'translate(-50%, 0)'
    };
    return /*#__PURE__*/ jsxs("span", {
        className: className,
        children: [
            /*#__PURE__*/ jsx(Input.Password, {
                ...others,
                value: value
            }),
            checkStrength && /*#__PURE__*/ jsx(PasswordStrength, {
                value: value,
                children: (score)=>/*#__PURE__*/ jsxs("div", {
                        style: {
                            background: '#e0e0e0',
                            marginBottom: 3,
                            position: 'relative'
                        },
                        children: [
                            /*#__PURE__*/ jsx("div", {
                                style: {
                                    ...blockStyle,
                                    left: '20%'
                                }
                            }),
                            /*#__PURE__*/ jsx("div", {
                                style: {
                                    ...blockStyle,
                                    left: '40%'
                                }
                            }),
                            /*#__PURE__*/ jsx("div", {
                                style: {
                                    ...blockStyle,
                                    left: '60%'
                                }
                            }),
                            /*#__PURE__*/ jsx("div", {
                                style: {
                                    ...blockStyle,
                                    left: '80%'
                                }
                            }),
                            /*#__PURE__*/ jsx("div", {
                                style: {
                                    position: 'relative',
                                    backgroundImage: '-webkit-linear-gradient(left, #ff5500, #ff9300)',
                                    transition: 'all 0.35s ease-in-out',
                                    height: 8,
                                    width: '100%',
                                    marginTop: 5,
                                    clipPath: "polygon(0 0,".concat(score, "% 0,").concat(score, "% 100%,0 100%)")
                                }
                            })
                        ]
                    })
            })
        ]
    });
}, mapReadPretty((props)=>{
    if (!props.value) return /*#__PURE__*/ jsx("div", {});
    return /*#__PURE__*/ jsx("div", {
        children: "********"
    });
}));
const Password = Password_Password;
export { Password_Password as Password, Password as default };
