import{C as e,E as t,R as o,z as i,S as r,a as n,K as a,L as s,q as c,j as l,r as u,l as d,m as f,k as p}from"./p-BxEPsDRj.js";import{n as h,c as w}from"./p-CrMmJdZ6.js";import{o as g}from"./p-zNe_7rLp.js";function b(){try{return n.returnOpenHref(`${c.SECURE_SITE_SDK_ORIGIN}/loading`,"popupWindow","width=600,height=800,scrollbars=yes")}catch(e){throw new Error("Could not open social popup")}}async function v(){o.push("ConnectingFarcaster");const t=i.getAuthConnector();if(t){const i=e.getAccountData();if(!i?.farcasterUrl){try{const{url:o}=await t.provider.getFarcasterUri();e.setAccountProp("farcasterUrl",o,e.state.activeChain)}catch(e){o.goBack();r.showError(e)}}}}async function m(c){o.push("ConnectingSocial");const l=i.getAuthConnector();let u=null;try{const t=setTimeout((()=>{throw new Error("Social login timed out. Please try again.")}),45e3);if(l&&c){if(!n.isTelegram()){u=b()}if(u){e.setAccountProp("socialWindow",a(u),e.state.activeChain)}else if(!n.isTelegram()){throw new Error("Could not create social popup")}const{uri:o}=await l.provider.getSocialRedirectUri({provider:c});if(!o){u?.close();throw new Error("Could not fetch the social redirect uri")}if(u){u.location.href=o}if(n.isTelegram()){s.setTelegramSocialProvider(c);const e=n.formatTelegramSocialLoginUrl(o);n.openHref(e,"_top")}clearTimeout(t)}}catch(e){u?.close();const o=n.parseError(e);r.showError(o);t.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:c,message:o}})}}async function y(o){e.setAccountProp("socialProvider",o,e.state.activeChain);t.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:o}});if(o==="farcaster"){await v()}else{await m(o)}}var x=l`
  :host {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: ${({borderRadius:e})=>e["20"]};
    overflow: hidden;
  }

  wui-icon {
    width: 100%;
    height: 100%;
  }
`;var R=undefined&&undefined.__decorate||function(e,t,o,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)if(a=e[s])n=(r<3?a(n):r>3?a(t,o,n):a(t,o))||n;return r>3&&n&&Object.defineProperty(t,o,n),n};let j=class e extends d{constructor(){super(...arguments);this.logo="google"}render(){return f`<wui-icon color="inherit" size="inherit" name=${this.logo}></wui-icon> `}};j.styles=[u,x];R([h()],j.prototype,"logo",void 0);j=R([w("wui-logo")],j);var $=l`
  :host {
    width: 100%;
  }

  button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: ${({spacing:e})=>e[3]};
    width: 100%;
    background-color: transparent;
    border-radius: ${({borderRadius:e})=>e[4]};
  }

  wui-text {
    text-transform: capitalize;
  }

  @media (hover: hover) {
    button:hover:enabled {
      background-color: ${({tokens:e})=>e.theme.foregroundPrimary};
    }
  }

  button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
`;var C=undefined&&undefined.__decorate||function(e,t,o,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")n=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)if(a=e[s])n=(r<3?a(n):r>3?a(t,o,n):a(t,o))||n;return r>3&&n&&Object.defineProperty(t,o,n),n};let O=class e extends d{constructor(){super(...arguments);this.logo="google";this.name="Continue with google";this.disabled=false}render(){return f`
      <button ?disabled=${this.disabled} tabindex=${g(this.tabIdx)}>
        <wui-flex gap="2" alignItems="center">
          <wui-image ?boxed=${true} logo=${this.logo}></wui-image>
          <wui-text variant="lg-regular" color="primary">${this.name}</wui-text>
        </wui-flex>
        <wui-icon name="chevronRight" size="lg" color="default"></wui-icon>
      </button>
    `}};O.styles=[u,p,$];C([h()],O.prototype,"logo",void 0);C([h()],O.prototype,"name",void 0);C([h()],O.prototype,"tabIdx",void 0);C([h({type:Boolean})],O.prototype,"disabled",void 0);O=C([w("wui-list-social")],O);export{y as e};
//# sourceMappingURL=p-B6UaU4Ic.js.map