import{d as k,n as B,c as p,x as f,P as b,O as _,v as w,b4 as $,o as a,a$ as V,s as C}from"./index-BXlk60bP.js";import{a7 as d,n as A,$ as y,k as G,aq as I}from"./common-vYHpopNV.js";import{B as R}from"./Button-LyDQSUp0.js";const q={class:"relative"},x={key:0,class:"flex border-r border-gray-300 dark:border-gray-600"},E=["type","autofocus","placeholder"],F={key:1,class:"flex"},D=k({__name:"InputItem",props:{modelValue:{},type:{},disabled:{type:Boolean},icon:{},autofocus:{type:Boolean},required:{type:Boolean},placeholder:{}},emits:["change","update:modelValue"],setup(g,{expose:m,emit:c}){const r=c,l=g,s=B({get:()=>l.modelValue,set:e=>r("update:modelValue",e)}),n=d(null),t=d(null),i=d(l.type),h=()=>{var e;l.required&&!s.value&&((e=n.value)==null||e.classList.add("error"))};return m({focus:()=>{var e;(e=t.value)==null||e.focus()},blur:()=>{var e;(e=t.value)==null||e.blur()}}),(e,o)=>(a(),p("div",q,[f("div",{ref_key:"inputIWrapRef",ref:n,class:"input-item"},[e.icon?(a(),p("div",x,[f("i",{class:A(e.icon)},null,2)])):_("",!0),w(f("input",{ref_key:"inputRef",ref:t,"onUpdate:modelValue":o[0]||(o[0]=u=>G(s)?s.value=u:null),type:e.type,autofocus:e.autofocus,placeholder:e.placeholder,onFocusin:o[1]||(o[1]=u=>{var v;return(v=y(n))==null?void 0:v.classList.remove("error")}),onBlur:h,onChange:o[2]||(o[2]=u=>e.$emit("change"))},null,40,E),[[$,y(s)]]),e.type=="password"?(a(),p("div",F,[e.type=="password"?(a(),p("i",{key:0,class:"i-ant-design:eye-twotone !bg-transparent text-gray-500",onClick:o[3]||(o[3]=u=>i.value="text")})):(a(),p("i",{key:1,class:"i-ant-design:eye-invisible-twotone !bg-transparent text-gray-500",onClick:o[4]||(o[4]=u=>i.value="password")}))])):_("",!0)],512),b(e.$slots,"default",{},void 0,!0)]))}}),S=V(D,[["__scopeId","data-v-a84df11a"]]),T=k({__name:"GoogleAuth",emits:["success","error"],setup(g,{emit:m}){const c=m,r=d(!1),l=async()=>(r.value=!0,new Promise(async(s,n)=>{chrome.identity.getAuthToken({interactive:!0},async t=>{t?I({token:t}).then(async i=>{s(i),c("success",i)}):(c("error",new Error("Google Auth Failed")),n(new Error("Google Auth Failed"))),r.value=!1})}));return(s,n)=>{const t=R;return a(),C(t,{loading:y(r),type:"primary",icon:"i-flat-color-icons:google",text:"Sign in with Google",onClick:l},null,8,["loading"])}}});export{S as _,T as a};
