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