1import{aX as L,aY as I,a$ as $,bn as u,bd as f,b2 as A,a_ as l,b7 as P,bp as F,bq as N,b6 as d,bm as E,ba as b,br as D,b8 as p,bs as T,bc as v,bt as j,aZ as O,b0 as S}from"./index-fRjvnjyY.js";import{n as q,r as c,c as _,o as y}from"./if-defined-BMfMamqp.js";import{O as W}from"./index-BsYo1aDC.js";import{e as M}from"./index-Bm2AFnnm.js";import"./index-DtjBaJMW.js";import"./index-DXtw0ihU.js";import"./index-Byc1oIob.js";import"./index-Bl4QydjO.js";import"./index-Dvw7uUs7.js";import"./index-p1RRXqFe.js";import"./ref-CR2UIgGF.js";import"./ConstantsUtil-Dmg8YACJ.js";import"./index-Dpva4LFm.js";import"./index-D7xWvKv-.js";const z=L` 2 :host { 3 margin-top: var(--wui-spacing-3xs); 4 } 5 wui-separator { 6 margin: var(--wui-spacing-m) calc(var(--wui-spacing-m) * -1) var(--wui-spacing-xs) 7 calc(var(--wui-spacing-m) * -1); 8 width: calc(100% + var(--wui-spacing-s) * 2); 9 } 10`;var x=function(n,e,t,o){var r=arguments.length,i=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(i=(r<3?s(i):r>3?s(e,t,i):s(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i};let w=class extends I{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=$.state.connectors,this.authConnector=this.connectors.find(e=>e.type==="AUTH"),this.remoteFeatures=u.state.remoteFeatures,this.isPwaLoading=!1,this.unsubscribe.push($.subscribeKey("connectors",e=>{this.connectors=e,this.authConnector=this.connectors.find(t=>t.type==="AUTH")}),u.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e))}connectedCallback(){super.connectedCallback(),this.handlePwaFrameLoad()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var i;let e=((i=this.remoteFeatures)==null?void 0:i.socials)||[];const t=!!this.authConnector,o=e==null?void 0:e.length,r=f.state.view==="ConnectSocials";return(!t||!o)&&!r?null:(r&&!o&&(e=A.DEFAULT_SOCIALS),l` <wui-flex flexDirection="column" gap="xs"> 11 ${e.map(s=>l`<wui-list-social 12 @click=${()=>{this.onSocialClick(s)}} 13 data-testid=${`social-selector-${s}`} 14 name=${s} 15 logo=${s} 16 ?disabled=${this.isPwaLoading} 17 ></wui-list-social>`)} 18 </wui-flex>`)}async onSocialClick(e){e&&await M(e)}async handlePwaFrameLoad(){var e;if(P.isPWA()){this.isPwaLoading=!0;try{((e=this.authConnector)==null?void 0:e.provider)instanceof F&&await this.authConnector.provider.init()}catch(t){N.open({shortMessage:"Error loading embedded wallet in PWA",longMessage:t.message},"error")}finally{this.isPwaLoading=!1}}}};w.styles=z;x([q()],w.prototype,"tabIdx",void 0);x([c()],w.prototype,"connectors",void 0);x([c()],w.prototype,"authConnector",void 0);x([c()],w.prototype,"remoteFeatures",void 0);x([c()],w.prototype,"isPwaLoading",void 0);w=x([_("w3m-social-login-list")],w);const B=L` 19 wui-flex { 20 max-height: clamp(360px, 540px, 80vh); 21 overflow: scroll; 22 scrollbar-width: none; 23 transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); 24 will-change: opacity; 25 } 26 wui-flex::-webkit-scrollbar {
27 display: none; 28 } 29 wui-flex.disabled { 30 opacity: 0.3; 31 pointer-events: none; 32 user-select: none; 33 } 34`;var U=function(n,e,t,o){var r=arguments.length,i=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(i=(r<3?s(i):r>3?s(e,t,i):s(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i};let k=class extends I{constructor(){super(),this.unsubscribe=[],this.checked=W.state.isLegalCheckboxChecked,this.unsubscribe.push(W.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var R;const{termsConditionsUrl:e,privacyPolicyUrl:t}=u.state,o=(R=u.state.features)==null?void 0:R.legalCheckbox,i=!!(e||t)&&!!o,s=i&&!this.checked,a=s?-1:void 0;return l` 35 <w3m-legal-checkbox></w3m-legal-checkbox> 36 <wui-flex 37 flexDirection="column" 38 .padding=${i?["0","s","s","s"]:"s"} 39 gap="xs" 40 class=${y(s?"disabled":void 0)} 41 > 42 <w3m-social-login-list tabIdx=${y(a)}></w3m-social-login-list> 43 </wui-flex> 44 <w3m-legal-footer></w3m-legal-footer> 45 `}};k.styles=B;U([c()],k.prototype,"checked",void 0);k=U([_("w3m-connect-socials-view")],k);const V=L` 46 wui-logo { 47 width: 80px; 48 height: 80px; 49 border-radius: var(--wui-border-radius-m); 50 } 51 @keyframes shake { 52 0% { 53 transform: translateX(0); 54 } 55 25% { 56 transform: translateX(3px); 57 } 58 50% { 59 transform: translateX(-3px); 60 } 61 75% { 62 transform: translateX(3px); 63 } 64 100% { 65 transform: translateX(0); 66 } 67 } 68 wui-flex:first-child:not(:only-child) { 69 position: relative; 70 } 71 wui-loading-thumbnail { 72 position: absolute; 73 } 74 wui-icon-box { 75 position: absolute; 76 right: calc(var(--wui-spacing-3xs) * -1); 77 bottom: calc(var(--wui-spacing-3xs) * -1); 78 opacity: 0; 79 transform: scale(0.5); 80 transition: all var(--wui-ease-out-power-2) var(--wui-duration-lg); 81 } 82 wui-text[align='center'] { 83 width: 100%; 84 padding: 0px var(--wui-spacing-l); 85 } 86 [data-error='true'] wui-icon-box { 87 opacity: 1; 88 transform: scale(1); 89 } 90 [data-error='true'] > wui-flex:first-child { 91 animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; 92 } 93 .capitalize { 94 text-transform: capitalize; 95 } 96`;var g=function(n,e,t,o){var r=arguments.length,i=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(i=(r<3?s(i):r>3?s(e,t,i):s(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i};let h=class extends I{constructor(){super(),this.unsubscribe=[],this.socialProvider=d.state.socialProvider,this.socialWindow=d.state.socialWindow,this.error=!1,this.connecting=!1,this.message="Connect in the provider window",this.remoteFeatures=u.state.remoteFeatures,this.address=d.state.address,this.connectionsByNamespace=E.getConnections(b.state.activeChain),this.hasMultipleConnections=this.connectionsByNamespace.length>0,this.authConnector=$.getAuthConnector(),this.handleSocialConnection=async t=>{var o,r;if((o=t.data)!=null&&o.resultUri)if(t.origin===D.SECURE_SITE_ORIGIN){window.removeEventListener("message",this.handleSocialConnection,!1);try{if(this.authConnector&&!this.connecting){this.socialWindow&&(this.socialWindow.close(),d.setSocialWindow(void 0,b.state.activeChain)),this.connecting=!0,this.updateMessage();const i=t.data.resultUri;this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:this.socialProvider}}),await E.connectExternal({id:this.authConnector.id,type:this.authConnector.type,socialUri:i},this.authConnector.chain),this.socialProvider&&(T.setConnectedSocialProvider(this.socialProvider),p.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:this.socialProvider,caipNetworkId:(r=b.getActiveCaipNetwork())==null?void 0:r.caipNetworkId}}))}}catch{this.error=!0,this.updateMessage(),this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider}})}}else f.goBack(),v.showError("Untrusted Origin"),this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider}})},j.EmbeddedWalletAbortController.signal.addEventListener("abort",()=>{this.socialWindow&&(this.socialWindow.close(),d.setSocialWindow(void 0,b.state.activeChain))}),this.unsubscribe.push(d.subscribe(t=>{t.socialProvider&&(this.socialProvider=t.socialProvider),t.socialWindow&&(this.socialWindow=t.socialWindow)}),u.subscribeKey("remoteFeatures",t=>{this.remoteFeatures=t}),d.subscribeKey("address",t=>{var r;const o=(r=this.remoteFeatures)==null?void 0:r.multiWallet;t&&t!==this.address&&(this.hasMultipleConnections&&o?(f.replace("ProfileWallets"),v.showSuccess("New Wallet Added")):(O.state.open||u.state.enableEmbedded)&&O.close())})),this.authConnector&&this.connectSocial()}disconnectedCallback(){var e;this.unsubscribe.forEach(t=>t()),window.removeEventListener("message",this.handleSocialConnection,!1),(e=this.socialWindow)==null||e.close(),d.setSocialWindow(void 0,b.state.activeChain)}render(){return l` 97 <wui-flex 98 data-error=${y(this.error)} 99 flexDirection="column" 100 alignItems="center" 101 .padding=${["3xl","xl","xl","xl"]} 102 gap="xl" 103 > 104 <wui-flex justifyContent="center" alignItems="center"> 105 <wui-logo logo=${y(this.socialProvider)}></wui-logo> 106 ${this.error?null:this.loaderTemplate()} 107 <wui-icon-box 108 backgroundColor="error-100" 109 background="opaque" 110 iconColor="error-100" 111 icon="close" 112 size="sm" 113 border 114 borderColor="wui-color-bg-125" 115 ></wui-icon-box> 116 </wui-flex> 117 <wui-flex flexDirection="column" alignItems="center" gap="xs"> 118 <wui-text align="center" variant="paragraph-500" color="fg-100" 119 >
119Log in with 120 <span class="capitalize">${this.socialProvider??"Social"}</span></wui-text 121 > 122 <wui-text align="center" variant="small-400" color=${this.error?"error-100":"fg-200"} 123 >${this.message}</wui-text 124 ></wui-flex 125 > 126 </wui-flex> 127 `}loaderTemplate(){const e=S.state.themeVariables["--w3m-border-radius-master"],t=e?parseInt(e.replace("px",""),10):4;return l`<wui-loading-thumbnail radius=${t*9}></wui-loading-thumbnail>`}connectSocial(){const e=setInterval(()=>{var t;(t=this.socialWindow)!=null&&t.closed&&(!this.connecting&&f.state.view==="ConnectingSocial"&&(this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_CANCELED",properties:{provider:this.socialProvider}}),f.goBack()),clearInterval(e))},1e3);window.addEventListener("message",this.handleSocialConnection,!1)}updateMessage(){this.error?this.message="Something went wrong":this.connecting?this.message="Retrieving user data":this.message="Connect in the provider window"}};h.styles=V;g([c()],h.prototype,"socialProvider",void 0);g([c()],h.prototype,"socialWindow",void 0);g([c()],h.prototype,"error",void 0);g([c()],h.prototype,"connecting",void 0);g([c()],h.prototype,"message",void 0);g([c()],h.prototype,"remoteFeatures",void 0);h=g([_("w3m-connecting-social-view")],h);const G=L` 128 @keyframes fadein { 129 from { 130 opacity: 0; 131 } 132 to { 133 opacity: 1; 134 } 135 } 136 137 wui-shimmer { 138 width: 100%; 139 aspect-ratio: 1 / 1; 140 border-radius: clamp(0px, var(--wui-border-radius-l), 40px) !important; 141 } 142 143 wui-qr-code { 144 opacity: 0; 145 animation-duration: 200ms; 146 animation-timing-function: ease; 147 animation-name: fadein; 148 animation-fill-mode: forwards; 149 } 150 151 wui-logo { 152 width: 80px; 153 height: 80px; 154 border-radius: var(--wui-border-radius-m); 155 } 156 157 wui-flex:first-child:not(:only-child) { 158 position: relative; 159 } 160 wui-loading-thumbnail { 161 position: absolute; 162 } 163 wui-icon-box { 164 position: absolute; 165 right: calc(var(--wui-spacing-3xs) * -1); 166 bottom: calc(var(--wui-spacing-3xs) * -1); 167 opacity: 0; 168 transform: scale(0.5); 169 transition: all var(--wui-ease-out-power-2) var(--wui-duration-lg); 170 } 171`;var C=function(n,e,t,o){var r=arguments.length,i=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(i=(r<3?s(i):r>3?s(e,t,i):s(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i};let m=class extends I{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.socialProvider=d.state.socialProvider,this.uri=d.state.farcasterUrl,this.ready=!1,this.loading=!1,this.remoteFeatures=u.state.remoteFeatures,this.authConnector=$.getAuthConnector(),this.forceUpdate=()=>{this.requestUpdate()},this.unsubscribe.push(d.subscribeKey("farcasterUrl",e=>{e&&(this.uri=e,this.connectFarcaster())}),d.subscribeKey("socialProvider",e=>{e&&(this.socialProvider=e)}),u.subscribeKey("remoteFeatures",e=>{this.remoteFeatures=e})),window.addEventListener("resize",this.forceUpdate)}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.timeout),window.removeEventListener("resize",this.forceUpdate)}render(){return this.onRenderProxy(),l`${this.platformTemplate()}`}platformTemplate(){return P.isMobile()?l`${this.mobileTemplate()}`:l`${this.desktopTemplate()}`}desktopTemplate(){return this.loading?l`${this.loadingTemplate()}`:l`${this.qrTemplate()}`}qrTemplate(){return l` <wui-flex 172 flexDirection="column" 173 alignItems="center" 174 .padding=${["0","xl","xl","xl"]} 175 gap="xl" 176 > 177 <wui-shimmer borderRadius="l" width="100%"> ${this.qrCodeTemplate()} </wui-shimmer> 178 179 <wui-text variant="paragraph-500" color="fg-100"> 180 Scan this QR Code with your phone 181 </wui-text> 182 ${this.copyTemplate()} 183 </wui-flex>`}loadingTemplate(){return l` 184 <wui-flex 185 flexDirection="column" 186 alignItems="center" 187 .padding=${["xl","xl","xl","xl"]} 188 gap="xl" 189 > 190 <wui-flex justifyContent="center" alignItems="center"> 191 <wui-logo logo="farcaster"></wui-logo> 192 ${this.loaderTemplate()} 193 <wui-icon-box 194 backgroundColor="error-100" 195 background="opaque" 196 iconColor="error-100" 197 icon="close" 198 size="sm" 199 border 200 borderColor="wui-color-bg-125" 201 ></wui-icon-box> 202 </wui-flex> 203 <wui-flex flexDirection="column" alignItems="center" gap="xs"> 204 <wui-text align="center" variant="paragraph-500" color="fg-100"> 205 Loading user data 206 </wui-text> 207 <wui-text align="center" variant="small-400" color="fg-200"> 208 Please wait a moment while we load your data. 209 </wui-text> 210 </wui-flex> 211 </wui-flex> 212 `}mobileTemplate(){return l` <wui-flex 213 flexDirection="column" 214 alignItems="center" 215 .padding=${["3xl","xl","xl","xl"]} 216 gap="xl" 217 > 218 <wui-flex justifyContent="center" alignItems="center"> 219 <wui-logo logo="farcaster"></wui-logo> 220 ${this.loaderTemplate()} 221 <wui-icon-box 222 backgroundColor="error-100" 223 background="opaque" 224 iconColor="error-100" 225 icon="close" 226 size="sm" 227 border 228 borderColor="wui-color-bg-125" 229 ></wui-icon-box> 230 </wui-flex> 231 <wui-flex flexDirection="column" alignItems="center" gap="xs"> 232 <wui-text align="center" variant="paragraph-500" color="fg-100" 233 >
233Continue in Farcaster</span></wui-text 234 > 235 <wui-text align="center" variant="small-400" color="fg-200" 236 >Accept connection request in the app</wui-text 237 ></wui-flex 238 > 239 ${this.mobileLinkTemplate()} 240 </wui-flex>`}loaderTemplate(){const e=S.state.themeVariables["--w3m-border-radius-master"],t=e?parseInt(e.replace("px",""),10):4;return l`<wui-loading-thumbnail radius=${t*9}></wui-loading-thumbnail>`}async connectFarcaster(){var e,t,o;if(this.authConnector)try{await((e=this.authConnector)==null?void 0:e.provider.connectFarcaster()),this.socialProvider&&(T.setConnectedSocialProvider(this.socialProvider),p.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:this.socialProvider}})),this.loading=!0;const i=E.getConnections(this.authConnector.chain).length>0;await E.connectExternal(this.authConnector,this.authConnector.chain);const s=(t=this.remoteFeatures)==null?void 0:t.multiWallet;this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:this.socialProvider,caipNetworkId:(o=b.getActiveCaipNetwork())==null?void 0:o.caipNetworkId}}),this.loading=!1,i&&s?(f.replace("ProfileWallets"),v.showSuccess("New Wallet Added")):O.close()}catch(r){this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider}}),f.goBack(),v.showError(r)}}mobileLinkTemplate(){return l`<wui-button 241 size="md" 242 ?loading=${this.loading} 243 ?disabled=${!this.uri||this.loading} 244 @click=${()=>{this.uri&&P.openHref(this.uri,"_blank")}} 245 > 246 Open farcaster</wui-button 247 >`}onRenderProxy(){!this.ready&&this.uri&&(this.timeout=setTimeout(()=>{this.ready=!0},200))}qrCodeTemplate(){if(!this.uri||!this.ready)return null;const e=this.getBoundingClientRect().width-40;return l` <wui-qr-code 248 size=${e} 249 theme=${S.state.themeMode} 250 uri=${this.uri} 251 ?farcaster=${!0} 252 data-testid="wui-qr-code" 253 color=${y(S.state.themeVariables["--w3m-qr-color"])} 254 ></wui-qr-code>`}copyTemplate(){const e=!this.uri||!this.ready;return l`<wui-link 255 .disabled=${e} 256 @click=${this.onCopyUri} 257 color="fg-200" 258 data-testid="copy-wc2-uri" 259 > 260 <wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon> 261 Copy link 262 </wui-link>`}onCopyUri(){try{this.uri&&(P.copyToClopboard(this.uri),v.showSuccess("Link copied"))}catch{v.showError("Failed to copy")}}};m.styles=G;C([c()],m.prototype,"socialProvider",void 0);C([c()],m.prototype,"uri",void 0);C([c()],m.prototype,"ready",void 0);C([c()],m.prototype,"loading",void 0);C([c()],m.prototype,"remoteFeatures",void 0);m=C([_("w3m-connecting-farcaster-view")],m);export{k as W3mConnectSocialsView,m as W3mConnectingFarcasterView,h as W3mConnectingSocialView};
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.