PageSourceSearch

https://bitseek.ai/assets/js/ui-BMMTOqvP.js

js bitseek.ai collected 2026-10-05 11:51:25 UTC 19,594 bytes, 246 lines download raw bytes

1import{U as g,bg as j,bh as b,bi as U,P as R,bj as m,V as K,Z as L,bk as z,bl as x,C as M,I as N,J as c,R as f,aw as w,S as v}from"./index-TRWtLqnG.js";import{n as T,c as C,r as u}from"./index-BaKVYbrQ.js";import{U as V}from"./index-DM9s5T3d.js";import{W3mEmailOtpWidget as O}from"./email-Be6fOank.js";import"./index-tMrH40le.js";import"./index-sKa6BoS2.js";import"./index-qpevMtlR.js";import"./ref-CmoQcpo0.js";import"./index-BZ2PiRoR.js";import"./index-CoGWqwxw.js";import"./index-BSI3E0D6.js";class X{constructor(e){this.expiration=e.expiration,this.getNonce=e.getNonce,this.getRequestId=e.getRequestId,this.domain=e.domain,this.uri=e.uri,this.statement=e.statement,this.resources=e.resources}async createMessage(e){var s;const t={accountAddress:e.accountAddress,chainId:e.chainId,version:this.version,domain:this.domain,uri:this.uri,statement:this.statement,resources:this.resources,nonce:await this.getNonce(e),requestId:await((s=this.getRequestId)==null?void 0:s.call(this)),expirationTime:this.getExpirationTime(e),issuedAt:this.getIssuedAt(),notBefore:this.getNotBefore(e)};return Object.assign(t,{toString:()=>this.stringify(t)})}getExpirationTime({notBefore:e}){if(typeof this.expiration>"u")return;const t=e?new Date(e).getTime():Date.now();return this.stringifyDate(new Date(t+this.expiration))}getNotBefore({notBefore:e}){return e?this.stringifyDate(new Date(e)):void 0}getIssuedAt(){return this.stringifyDate(new Date)}stringifyDate(e){return e.toISOString()}}class B extends X{constructor({clearChainIdNamespace:e,...t}){super(t),this.version="1",this.clearChainIdNamespace=e||!1}getNetworkName(e){const t=g.getAllRequestedCaipNetworks();return j.getNetworkNameByCaipNetworkId(t,e)}stringify(e){var s;const t=this.clearChainIdNamespace?e.chainId.split(":")[1]:e.chainId,i=this.getNetworkName(e.chainId);return[`${e.domain} wants you to sign in with your ${i} account:`,e.accountAddress,e.statement?`
2${e.statement}
3`:"",`URI: ${e.uri}`,`Version: ${e.version}`,`Chain ID: ${t}`,`Nonce: ${e.nonce}`,e.issuedAt&&`Issued At: ${e.issuedAt}`,e.expirationTime&&`Expiration Time: ${e.expirationTime}`,e.notBefore&&`Not Before: ${e.notBefore}`,e.requestId&&`Request ID: ${e.requestId}`,((s=e.resources)==null?void 0:s.length)&&e.resources.reduce((n,r)=>`${n}
4- ${r}`,"Resources:")].filter(n=>typeof n=="string").join(`
5`).trim()}}class _{constructor(e={}){this.otpUuid=null,this.listeners={sessionChanged:[]},this.localAuthStorageKey=e.localAuthStorageKey||b.SIWX_AUTH_TOKEN,this.localNonceStorageKey=e.localNonceStorageKey||b.SIWX_NONCE_TOKEN,this.required=e.required??!0,this.messenger=new B({domain:typeof document>"u"?"Unknown Domain":document.location.host,uri:typeof document>"u"?"Unknown URI":document.location.href,getNonce:this.getNonce.bind(this),clearChainIdNamespace:!1})}async createMessage(e){return this.messenger.createMessage(e)}async addSession(e){const t=await this.request({method:"POST",key:"authenticate",body:{data:e.data,message:e.message,signature:e.signature,clientId:this.getClientId(),walletInfo:this.getWalletInfo()},headers:["nonce","otp"]});this.setStorageToken(t.token,this.localAuthStorageKey),this.emit("sessionChanged",e),this.setAppKitAccountUser(H(t.token)),this.otpUuid=null}async getSessions(e,t){try{if(!this.getStorageToken(this.localAuthStorageKey))return[];const i=await this.request({method:"GET",key:"me",query:{},headers:["auth"]});if(!i)return[];const s=i.address.toLowerCase()===t.toLowerCase(),n=i.caip2Network===e;if(!s||!n)return[];const r={data:{accountAddress:i.address,chainId:i.caip2Network},message:"",signature:""};return this.emit("sessionChanged",r),this.setAppKitAccountUser(i),[r]}catch{return[]}}async revokeSession(e,t){return Promise.resolve(this.clearStorageTokens())}async setSessions(e){if(e.length===0)this.clearStorageTokens();else{const t=e.find(i=>{var s;return i.data.chainId===((s=U())==null?void 0:s.caipNetworkId)})||e[0];await this.addSession(t)}}getRequired(){return this.required}async getSessionAccount(){if(!this.getStorageToken(this.localAuthStorageKey))throw new Error("Not authenticated");return this.request({method:"GET",key:"me",body:void 0,query:{includeAppKitAccount:!0},headers:["auth"]})}async setSessionAccountMetadata(e=null){if(!this.getStorageToken(this.localAuthStorageKey))throw new Error("Not authenticated");return this.request({method:"PUT",key:"account-metadata",body:{metadata:e},headers:["auth"]})}on(e,t){return this.listeners[e].push(t),()=>{this.listeners[e]=this.listeners[e].filter(i=>i!==t)}}
5removeAllListeners(){Object.keys(this.listeners).forEach(t=>{this.listeners[t]=[]})}async requestEmailOtp({email:e,account:t}){const i=await this.request({method:"POST",key:"otp",body:{email:e,account:t}});return this.otpUuid=i.uuid,this.messenger.resources=[`email:${e}`],i}confirmEmailOtp({code:e}){return this.request({method:"PUT",key:"otp",body:{code:e},headers:["otp"]})}async request({method:e,key:t,query:i,body:s,headers:n}){var A;const{projectId:r,st:o,sv:P}=this.getSDKProperties(),p=new URL(`${R.W3M_API_URL}/auth/v1/${String(t)}`);p.searchParams.set("projectId",r),p.searchParams.set("st",o),p.searchParams.set("sv",P),i&&Object.entries(i).forEach(([h,$])=>p.searchParams.set(h,String($)));const y=await fetch(p,{method:e,body:s?JSON.stringify(s):void 0,headers:Array.isArray(n)?n.reduce((h,$)=>{switch($){case"nonce":h["x-nonce-jwt"]=`Bearer ${this.getStorageToken(this.localNonceStorageKey)}`;break;case"auth":h.Authorization=`Bearer ${this.getStorageToken(this.localAuthStorageKey)}`;break;case"otp":this.otpUuid&&(h["x-otp"]=this.otpUuid);break}return h},{}):void 0});if(!y.ok)throw new Error(await y.text());return(A=y.headers.get("content-type"))!=null&&A.includes("application/json")?y.json():null}getStorageToken(e){return m.getItem(e)}setStorageToken(e,t){m.setItem(t,e)}clearStorageTokens(){this.otpUuid=null,m.removeItem(this.localAuthStorageKey),m.removeItem(this.localNonceStorageKey),this.emit("sessionChanged",void 0)}async getNonce(){const{nonce:e,token:t}=await this.request({method:"GET",key:"nonce"});return this.setStorageToken(t,this.localNonceStorageKey),e}getClientId(){return K.state.clientId}getWalletInfo(){const{connectedWalletInfo:e}=L.state;if(!e)return;if("social"in e){const n=e.social,r=e.identifier;return{type:"social",social:n,identifier:r}}const{name:t,icon:i}=e;let s="unknown";switch(e.type){case x.CONNECTOR_TYPE_EXTERNAL:case x.CONNECTOR_TYPE_INJECTED:case x.CONNECTOR_TYPE_ANNOUNCED:s="extension";break;case x.CONNECTOR_TYPE_WALLET_CONNECT:s="walletconnect";break;default:s="unknown"}return{type:s,name:t,icon:i}}getSDKProperties(){return z._getSdkProperties()}emit(e,t){this.listeners[e].forEach(i=>i(t))}setAppKitAccountUser(e){const{email:t}=e;
vendor: 2,728 bytes, lines 5-105
5t&&Object.values(R.CHAIN).forEach(i=>{g.setAccountProp("user",{email:t},i)})}}function H(a){const e=a.split(".");if(e.length!==3)throw new Error("Invalid token");const t=e[1];if(typeof t!="string")throw new Error("Invalid token");const i=t.replace(/-/gu,"+").replace(/_/gu,"/"),s=i.padEnd(i.length+(4-i.length%4)%4,"=");return JSON.parse(atob(s))}const k=M`
6  .hero {
7    display: flex;
8    flex-direction: column;
9    align-items: center;
10    justify-content: center;
11    gap: var(--wui-spacing-3xs);
12
13    transition-property: margin, height;
14    transition-duration: var(--wui-duration-md);
15    transition-timing-function: var(--wui-ease-out-power-1);
16    margin-top: -100px;
17
18    &[data-state='loading'] {
19      margin-top: 0px;
20    }
21
22    position: relative;
23    &:after {
24      content: '';
25      position: absolute;
26      bottom: 0;
27      height: 252px;
28      width: 360px;
29      background: radial-gradient(
30        96.11% 53.95% at 50% 51.28%,
31        transparent 0%,
32        color-mix(in srgb, var(--wui-color-bg-100) 5%, transparent) 49%,
33        color-mix(in srgb, var(--wui-color-bg-100) 65%, transparent) 99.43%
34      );
35    }
36  }
37
38  .hero-main-icon {
39    width: 176px;
40    transition-property: background-color;
41    transition-duration: var(--wui-duration-lg);
42    transition-timing-function: var(--wui-ease-out-power-1);
43
44    &[data-state='loading'] {
45      width: 56px;
46    }
47  }
48
49  .hero-row {
50    display: flex;
51    flex-direction: row;
52    align-items: center;
53    justify-content: center;
54    gap: var(--wui-spacing-3xs);
55    flex-wrap: nowrap;
56    min-width: fit-content;
57
58    &:nth-child(1) {
59      transform: translateX(-30px);
60    }
61
62    &:nth-child(2) {
63      transform: translateX(30px);
64    }
65
66    &:nth-child(4) {
67      transform: translateX(40px);
68    }
69
70    transition-property: height;
71    transition-duration: var(--wui-duration-md);
72    transition-timing-function: var(--wui-ease-out-power-1);
73    height: 68px;
74
75    &[data-state='loading'] {
76      height: 0px;
77    }
78  }
79
80  .hero-row-icon {
81    opacity: 0.1;
82    transition-property: opacity;
83    transition-duration: var(--wui-duration-md);
84    transition-timing-function: var(--wui-ease-out-power-1);
85
86    &[data-state='loading'] {
87      opacity: 0;
88    }
89  }
90
91  .email-sufixes {
92    display: flex;
93    flex-direction: row;
94    gap: var(--wui-spacing-3xs);
95    overflow-x: auto;
96    max-width: 100%;
97    margin-top: var(--wui-spacing-s);
98    margin-bottom: calc(-1 * var(--wui-spacing-m));
99    padding-bottom: var(--wui-spacing-m);
100    margin-left: calc(-1 * var(--wui-spacing-m));
101    margin-right: calc(-1 * var(--wui-spacing-m));
102    padding-left: var(--wui-spacing-m);
103    padding-right: var(--wui-spacing-m);
104
105    &::-webkit-scrollbar {
106      display: none;
107    }
108  }
109
110  .recent-emails {
111    display: flex;
112    flex-direction: column;
113    padding: var(--wui-spacing-s) 0;
114    border-top: 1px solid var(--wui-color-gray-glass-005);
115    border-bottom: 1px solid var(--wui-color-gray-glass-005);
116  }
117
118  .recent-emails-heading {
119    margin-bottom: var(--wui-spacing-s);
120  }
121
122  .recent-emails-list-item {
123    --wui-color-gray-glass-002: transparent;
124  }
125`;var q=function(a,e,t,i){var s=arguments.length,n=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(a,e,t,i);else for(var o=a.length-1;o>=0;o--)(r=a[o])&&(n=(s<3?r(n):s>3?r(e,t,n):r(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n};const G=["@gmail.com","@outlook.com","@yahoo.com","@hotmail.com","@aol.com","@icloud.com","@zoho.com"];let E=class extends N{constructor(){super(...arguments),this.email=""}render(){const e=G.filter(this.filter.bind(this)).map(this.item.bind(this));return e.length===0?null:c`<div class="email-sufixes">${e}</div>`}filter(e){if(!this.email)return!1;const t=this.email.split("@");if(t.length<2)return!0;const i=t.pop();return e.includes(i)&&e!==`@${i}`}item(e){return c`<wui-button variant="neutral" size="sm" @click=${()=>{const i=this.email.split("@");i.length>1&&i.pop();const s=i[0]+e;this.dispatchEvent(new CustomEvent("change",{detail:s,bubbles:!0,composed:!0}))}}
126      >${e}</wui-button
127    >`}};E.styles=[k];q([T()],E.prototype,"email",void 0);E=q([C("w3m-email-suffixes-widget")],E);var D=function(a,e,t,i){var s=arguments.length,n=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(a,e,t,i);else for(var o=a.length-1;o>=0;o--)(r=a[o])&&(n=(s<3?r(n):s>3?r(e,t,n):r(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n};let S=class extends N{constructor(){super(...arguments),this.emails=[]}render(){return this.emails.length===0?null:c`<div class="recent-emails">
128      <wui-text variant="micro-600" color="fg-200" class="recent-emails-heading"
129        >Recently used emails</wui-text
130      >
131      ${this.emails.map(this.item.bind(this))}
132    </div>`}item(e){return c`<wui-list-item
133      @click=${()=>{this.dispatchEvent(new CustomEvent("select",{detail:e,bubbles:!0,composed:!0}))}}
134      ?chevron=${!0}
135      icon="mail"
136      iconVariant="overlay"
137      class="recent-emails-list-item"
138    >
139      <wui-text variant="paragraph-500" color="fg-100">${e}</wui-text>
140    </wui-list-item>`}};S.styles=[k];D([T()],S.prototype,"emails",void 0);S=D([C("w3m-recent-emails-widget")],S);var d=function(a,e,t,i){var s=arguments.length,n=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(a,e,t,i);else for(var o=a.length-1;o>=0;o--)(r=a[o])&&(n=(s<3?r(n):s>3?r(e,t,n):r(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n};let l=class extends N{constructor(){var e,t,i,s,n,r,o;super(...arguments),this.email=((e=f.state.data)==null?void 0:e.email)??((i=(t=g.getAccountData())==null?void 0:t.user)==null?void 0:i.email)??"",this.address=((s=g.getAccountData())==null?void 0:s.address)??"",this.loading=!1,this.appName=((n=w.state.metadata)==null?void 0:n.name)??"AppKit",this.siwx=w.state.siwx,this.isRequired=Array.isArray((r=w.state.remoteFeatures)==null?void 0:r.emailCapture)&&((o=w.state.remoteFeatures)==null?void 0:o.emailCapture.includes("required")),this.recentEmails=this.getRecentEmails()}connectedCallback(){(!this.siwx||!(this.siwx instanceof _))&&v.showError("ReownAuthentication is not initialized."),super.connectedCallback()}firstUpdated(){this.loading=!1,this.recentEmails=this.getRecentEmails(),this.email&&this.onSubmit()}render(){return c`
141      <wui-flex flexDirection="column" .padding=${["3xs","m","m","m"]} gap="l">
142        ${this.hero()} ${this.paragraph()} ${this.emailInput()} ${this.recentEmailsWidget()}
143        ${this.footerActions()}
144      </wui-flex>
145    `}hero(){return c`
146      <div class="hero" data-state=${this.loading?"loading":"default"}>
147        ${this.heroRow(["id","mail","wallet","x","solana","qrCode"])}
148        ${this.heroRow(["mail","farcaster","wallet","discord","mobile","qrCode"])}
149        <div class="hero-row">
150          ${this.heroIcon("github")} ${this.heroIcon("bank")}
151          <wui-icon-box
152            size="xl"
153            iconSize="xxl"
154            iconColor=${this.loading?"fg-100":"accent-100"}
155            backgroundColor=${this.loading?"fg-100":"accent-100"}
156            icon=${this.loading?"id":"user"}
157            isOpaque
158            class="hero-main-icon"
159            data-state=${this.loading?"loading":"default"}
160          >
161          </wui-icon-box>
162          ${this.heroIcon("id")} ${this.heroIcon("card")}
163        </div>
164        ${this.heroRow(["google","id","github","verify","apple","mobile"])}
165      </div>
166    `}heroRow(e){return c`
167      <div class="hero-row" data-state=${this.loading?"loading":"default"}>
168        ${e.map(this.heroIcon.bind(this))}
169      </div>
170    `}heroIcon(e){return c`
171      <wui-icon-box
172        size="xl"
173        iconSize="xxl"
174        iconColor="fg-100"
175        backgroundColor="fg-100"
176        icon=${e}
177        data-state=${this.loading?"loading":"default"}
178        isOpaque
179        class="hero-row-icon"
180      >
181      </wui-icon-box>
182    `}paragraph(){return this.loading?c`
183        <wui-text variant="paragraph-400" color="fg-200" align="center"
184          >We are verifying your account with email
185          <wui-text variant="paragraph-600" color="accent-100">${this.email}</wui-text> and address
186          <wui-text variant="paragraph-600" color="fg-100">
187            ${V.getTruncateString({string:this.address,charsEnd:4,charsStart:4,truncate:"middle"})} </wui-text
188          >, please wait a moment.</wui-text
189        >
190      `:this.isRequired?c`
191        <wui-text variant="paragraph-600" color="fg-100" align="center">
192          ${this.appName} requires your email for authentication.
193        </wui-text>
194      `:c`
195      <wui-flex flexDirection="column" gap="xs" alignItems="center">
196        <wui-text variant="paragraph-600" color="fg-100" align="center" size>
197          ${this.appName} would like to collect your email.
198        </wui-text>
199
200        <wui-text variant="small-400" color="fg-200" align="center">
201          Don't worry, it's optional&mdash;
201you can skip this step.
202        </wui-text>
203      </wui-flex>
204    `}emailInput(){if(this.loading)return null;const e=i=>{i.key==="Enter"&&this.onSubmit()},t=i=>{this.email=i.detail};return c`
205      <wui-flex flexDirection="column">
206        <wui-email-input
207          .value=${this.email}
208          .disabled=${this.loading}
209          @inputChange=${t}
210          @keydown=${e}
211        ></wui-email-input>
212
213        <w3m-email-suffixes-widget
214          .email=${this.email}
215          @change=${t}
216        ></w3m-email-suffixes-widget>
217      </wui-flex>
218    `}recentEmailsWidget(){if(this.recentEmails.length===0||this.loading)return null;const e=t=>{this.email=t.detail,this.onSubmit()};return c`
219      <w3m-recent-emails-widget
220        .emails=${this.recentEmails}
221        @select=${e}
222      ></w3m-recent-emails-widget>
223    `}footerActions(){return c`
224      <wui-flex flexDirection="row" fullWidth gap="s">
225        ${this.isRequired?null:c`<wui-button
226              size="lg"
227              variant="neutral"
228              fullWidth
229              .disabled=${this.loading}
230              @click=${this.onSkip.bind(this)}
231              >Skip this step</wui-button
232            >`}
233
234        <wui-button
235          size="lg"
236          variant="main"
237          type="submit"
238          fullWidth
239          .disabled=${!this.email||!this.isValidEmail(this.email)}
240          .loading=${this.loading}
241          @click=${this.onSubmit.bind(this)}
242        >
243          Continue
244        </wui-button>
245      </wui-flex>
246    `}async onSubmit(){const e=g.getActiveCaipAddress();if(!e)throw new Error("Account is not connected.");if(!this.isValidEmail(this.email)){v.showError("Please provide a valid email.");return}try{this.loading=!0;const t=await this.siwx.requestEmailOtp({email:this.email,account:e});this.pushRecentEmail(this.email),t.uuid===null?f.replace("SIWXSignMessage"):f.replace("DataCaptureOtpConfirm",{email:this.email})}catch{v.showError("Failed to send email OTP"),this.loading=!1}}onSkip(){f.replace("SIWXSignMessage")}getRecentEmails(){const e=m.getItem(b.RECENT_EMAILS);return(e?e.split(","):[]).filter(this.isValidEmail.bind(this)).slice(0,3)}pushRecentEmail(e){const t=this.getRecentEmails(),i=Array.from(new Set([e,...t])).slice(0,3);m.setItem(b.RECENT_EMAILS,i.join(","))}isValidEmail(e){return/^\S+@\S+\.\S+$/u.test(e)}};l.styles=[k];d([u()],l.prototype,"email",void 0);d([u()],l.prototype,"address",void 0);d([u()],l.prototype,"loading",void 0);d([u()],l.prototype,"appName",void 0);d([u()],l.prototype,"siwx",void 0);d([u()],l.prototype,"isRequired",void 0);d([u()],l.prototype,"recentEmails",void 0);l=d([C("w3m-data-capture-view")],l);var W=function(a,e,t,i){var s=arguments.length,n=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(a,e,t,i);else for(var o=a.length-1;o>=0;o--)(r=a[o])&&(n=(s<3?r(n):s>3?r(e,t,n):r(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n};let I=class extends O{constructor(){super(...arguments),this.siwx=w.state.siwx,this.onOtpSubmit=async e=>{await this.siwx.confirmEmailOtp({code:e}),f.replace("SIWXSignMessage")},this.onOtpResend=async e=>{const t=g.getAccountData();if(!(t!=null&&t.caipAddress))throw new Error("No account data found");await this.siwx.requestEmailOtp({email:e,account:t.caipAddress})}}connectedCallback(){(!this.siwx||!(this.siwx instanceof _))&&v.showError("ReownAuthentication is not initialized."),super.connectedCallback()}shouldSubmitOnOtpChange(){return this.otp.length===O.OTP_LENGTH}};W([u()],I.prototype,"siwx",void 0);I=W([C("w3m-data-capture-otp-confirm-view")],I);export{I as W3mDataCaptureOtpConfirmView,l as W3mDataCaptureView,E as W3mEmailSuffixesWidget,S as W3mRecentEmailsWidget};

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.