@safe-stars/components
Version:
React component library for buying Telegram Stars in Telegram Mini Apps via Safe Stars.
469 lines (433 loc) • 28.7 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CtZaCMo8.cjs"),l=require("./if-defined-MmHKu2JE.cjs");require("./index-BB9Vnkx8.cjs");require("./index-BXulAD-4.cjs");require("./index-CKpCHYPu.cjs");require("./index-Cv2JIh3Y.cjs");require("./index--KmZMQQE.cjs");require("./index-CfJmZxsA.cjs");require("./index-DJi4CzE9.cjs");const U=t.i`
:host {
display: block;
border-radius: clamp(0px, var(--wui-border-radius-l), 44px);
box-shadow: 0 0 0 1px var(--wui-color-gray-glass-005);
background-color: var(--wui-color-modal-bg);
overflow: hidden;
}
:host([data-embedded='true']) {
box-shadow:
0 0 0 1px var(--wui-color-gray-glass-005),
0px 4px 12px 4px var(--w3m-card-embedded-shadow-color);
}
`;var M=function(s,e,o,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,o,n);else for(var c=s.length-1;c>=0;c--)(a=s[c])&&(i=(r<3?a(i):r>3?a(e,o,i):a(e,o))||i);return r>3&&i&&Object.defineProperty(e,o,i),i};let E=class extends t.i$1{render(){return t.x`<slot></slot>`}};E.styles=[t.resetStyles,U];E=M([l.customElement("wui-card")],E);const j=t.i`
:host {
display: flex;
align-items: center;
justify-content: center;
padding: var(--wui-spacing-s);
border-radius: var(--wui-border-radius-s);
border: 1px solid var(--wui-color-dark-glass-100);
box-sizing: border-box;
background-color: var(--wui-color-bg-325);
box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.25);
}
wui-flex {
width: 100%;
}
wui-text {
word-break: break-word;
flex: 1;
}
.close {
cursor: pointer;
}
.icon-box {
height: 40px;
width: 40px;
border-radius: var(--wui-border-radius-3xs);
background-color: var(--local-icon-bg-value);
}
`;var C=function(s,e,o,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,o,n);else for(var c=s.length-1;c>=0;c--)(a=s[c])&&(i=(r<3?a(i):r>3?a(e,o,i):a(e,o))||i);return r>3&&i&&Object.defineProperty(e,o,i),i};let f=class extends t.i$1{constructor(){super(...arguments),this.message="",this.backgroundColor="accent-100",this.iconColor="accent-100",this.icon="info"}render(){return this.style.cssText=`
--local-icon-bg-value: var(--wui-color-${this.backgroundColor});
`,t.x`
<wui-flex flexDirection="row" justifyContent="space-between" alignItems="center">
<wui-flex columnGap="xs" flexDirection="row" alignItems="center">
<wui-flex
flexDirection="row"
alignItems="center"
justifyContent="center"
class="icon-box"
>
<wui-icon color=${this.iconColor} size="md" name=${this.icon}></wui-icon>
</wui-flex>
<wui-text variant="small-500" color="bg-350" data-testid="wui-alertbar-text"
>${this.message}</wui-text
>
</wui-flex>
<wui-icon
class="close"
color="bg-350"
size="sm"
name="close"
=${this.onClose}
></wui-icon>
</wui-flex>
`}onClose(){t.AlertController.close()}};f.styles=[t.resetStyles,j];C([l.n()],f.prototype,"message",void 0);C([l.n()],f.prototype,"backgroundColor",void 0);C([l.n()],f.prototype,"iconColor",void 0);C([l.n()],f.prototype,"icon",void 0);f=C([l.customElement("wui-alertbar")],f);const D=t.i`
:host {
display: block;
position: absolute;
top: var(--wui-spacing-s);
left: var(--wui-spacing-l);
right: var(--wui-spacing-l);
opacity: 0;
pointer-events: none;
}
`;var O=function(s,e,o,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,o,n);else for(var c=s.length-1;c>=0;c--)(a=s[c])&&(i=(r<3?a(i):r>3?a(e,o,i):a(e,o))||i);return r>3&&i&&Object.defineProperty(e,o,i),i};const L={info:{backgroundColor:"fg-350",iconColor:"fg-325",icon:"info"},success:{backgroundColor:"success-glass-reown-020",iconColor:"success-125",icon:"checkmark"},warning:{backgroundColor:"warning-glass-reown-020",iconColor:"warning-100",icon:"warningCircle"},error:{backgroundColor:"error-glass-reown-020",iconColor:"error-125",icon:"exclamationTriangle"}};let S=class extends t.i$1{constructor(){super(),this.unsubscribe=[],this.open=t.AlertController.state.open,this.onOpen(!0),this.unsubscribe.push(t.AlertController.subscribeKey("open",e=>{this.open=e,this.onOpen(!1)}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const{message:e,variant:o}=t.AlertController.state,n=L[o];return t.x`
<wui-alertbar
message=${e}
backgroundColor=${n==null?void 0:n.backgroundColor}
iconColor=${n==null?void 0:n.iconColor}
icon=${n==null?void 0:n.icon}
></wui-alertbar>
`}onOpen(e){this.open?(this.animate([{opacity:0,transform:"scale(0.85)"},{opacity:1,transform:"scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: auto"):e||(this.animate([{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: none")}};S.styles=D;O([l.r()],S.prototype,"open",void 0);S=O([l.customElement("w3m-alertbar")],S);const K=t.i`
button {
display: block;
display: flex;
align-items: center;
padding: var(--wui-spacing-xxs);
gap: var(--wui-spacing-xxs);
transition: all var(--wui-ease-out-power-1) var(--wui-duration-md);
border-radius: var(--wui-border-radius-xxs);
}
wui-image {
border-radius: 100%;
width: var(--wui-spacing-xl);
height: var(--wui-spacing-xl);
}
wui-icon-box {
width: var(--wui-spacing-xl);
height: var(--wui-spacing-xl);
}
button:hover {
background-color: var(--wui-color-gray-glass-002);
}
button:active {
background-color: var(--wui-color-gray-glass-005);
}
`;var I=function(s,e,o,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,o,n);else for(var c=s.length-1;c>=0;c--)(a=s[c])&&(i=(r<3?a(i):r>3?a(e,o,i):a(e,o))||i);return r>3&&i&&Object.defineProperty(e,o,i),i};let A=class extends t.i$1{constructor(){super(...arguments),this.imageSrc=""}render(){return t.x`<button>
${this.imageTemplate()}
<wui-icon size="xs" color="fg-200" name="chevronBottom"></wui-icon>
</button>`}imageTemplate(){return this.imageSrc?t.x`<wui-image src=${this.imageSrc} alt="select visual"></wui-image>`:t.x`<wui-icon-box
size="xxs"
iconColor="fg-200"
backgroundColor="fg-100"
background="opaque"
icon="networkPlaceholder"
></wui-icon-box>`}};A.styles=[t.resetStyles,t.elementStyles,t.colorStyles,K];I([l.n()],A.prototype,"imageSrc",void 0);A=I([l.customElement("wui-select")],A);const H=t.i`
:host {
height: 64px;
}
wui-text {
text-transform: capitalize;
}
wui-flex.w3m-header-title {
transform: translateY(0);
opacity: 1;
}
wui-flex.w3m-header-title[view-direction='prev'] {
animation:
slide-down-out 120ms forwards var(--wui-ease-out-power-2),
slide-down-in 120ms forwards var(--wui-ease-out-power-2);
animation-delay: 0ms, 200ms;
}
wui-flex.w3m-header-title[view-direction='next'] {
animation:
slide-up-out 120ms forwards var(--wui-ease-out-power-2),
slide-up-in 120ms forwards var(--wui-ease-out-power-2);
animation-delay: 0ms, 200ms;
}
wui-icon-link[data-hidden='true'] {
opacity: 0 !important;
pointer-events: none;
}
slide-up-out {
from {
transform: translateY(0px);
opacity: 1;
}
to {
transform: translateY(3px);
opacity: 0;
}
}
slide-up-in {
from {
transform: translateY(-3px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
slide-down-out {
from {
transform: translateY(0px);
opacity: 1;
}
to {
transform: translateY(-3px);
opacity: 0;
}
}
slide-down-in {
from {
transform: translateY(3px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
`;var h=function(s,e,o,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,o,n);else for(var c=s.length-1;c>=0;c--)(a=s[c])&&(i=(r<3?a(i):r>3?a(e,o,i):a(e,o))||i);return r>3&&i&&Object.defineProperty(e,o,i),i};const z=["SmartSessionList"];function R(){var a,c,b,m,v,y,x;const s=(c=(a=t.RouterController.state.data)==null?void 0:a.connector)==null?void 0:c.name,e=(m=(b=t.RouterController.state.data)==null?void 0:b.wallet)==null?void 0:m.name,o=(y=(v=t.RouterController.state.data)==null?void 0:v.network)==null?void 0:y.name,n=e??s,r=t.ConnectorController.getConnectors();return{Connect:`Connect ${r.length===1&&((x=r[0])==null?void 0:x.id)==="w3m-email"?"Email":""} Wallet`,Create:"Create Wallet",ChooseAccountName:void 0,Account:void 0,AccountSettings:void 0,AllWallets:"All Wallets",ApproveTransaction:"Approve Transaction",BuyInProgress:"Buy",ConnectingExternal:n??"Connect Wallet",ConnectingWalletConnect:n??"WalletConnect",ConnectingWalletConnectBasic:"WalletConnect",ConnectingSiwe:"Sign In",Convert:"Convert",ConvertSelectToken:"Select token",ConvertPreview:"Preview convert",Downloads:n?`Get ${n}`:"Downloads",EmailLogin:"Email Login",EmailVerifyOtp:"Confirm Email",EmailVerifyDevice:"Register Device",GetWallet:"Get a wallet",Networks:"Choose Network",OnRampProviders:"Choose Provider",OnRampActivity:"Activity",OnRampTokenSelect:"Select Token",OnRampFiatSelect:"Select Currency",Pay:"How you pay",Profile:void 0,SwitchNetwork:o??"Switch Network",SwitchAddress:"Switch Address",Transactions:"Activity",UnsupportedChain:"Switch Network",UpgradeEmailWallet:"Upgrade your Wallet",UpdateEmailWallet:"Edit Email",UpdateEmailPrimaryOtp:"Confirm Current Email",UpdateEmailSecondaryOtp:"Confirm New Email",WhatIsABuy:"What is Buy?",RegisterAccountName:"Choose name",RegisterAccountNameSuccess:"",WalletReceive:"Receive",WalletCompatibleNetworks:"Compatible Networks",Swap:"Swap",SwapSelectToken:"Select token",SwapPreview:"Preview swap",WalletSend:"Send",WalletSendPreview:"Review send",WalletSendSelectToken:"Select Token",WhatIsANetwork:"What is a network?",WhatIsAWallet:"What is a wallet?",ConnectWallets:"Connect wallet",ConnectSocials:"All socials",ConnectingSocial:t.AccountController.state.socialProvider?t.AccountController.state.socialProvider:"Connect Social",ConnectingMultiChain:"Select chain",ConnectingFarcaster:"Farcaster",SwitchActiveChain:"Switch chain",SmartSessionCreated:void 0,SmartSessionList:"Smart Sessions",SIWXSignMessage:"Sign In",PayLoading:"Payment in progress"}}let d=class extends t.i$1{constructor(){super(),this.unsubscribe=[],this.heading=R()[t.RouterController.state.view],this.network=t.ChainController.state.activeCaipNetwork,this.networkImage=t.AssetUtil.getNetworkImage(this.network),this.showBack=!1,this.prevHistoryLength=1,this.view=t.RouterController.state.view,this.viewDirection="",this.headerText=R()[t.RouterController.state.view],this.unsubscribe.push(t.AssetController.subscribeNetworkImages(()=>{this.networkImage=t.AssetUtil.getNetworkImage(this.network)}),t.RouterController.subscribeKey("view",e=>{setTimeout(()=>{this.view=e,this.headerText=R()[e]},t.ConstantsUtil$3.ANIMATION_DURATIONS.HeaderText),this.onViewChange(),this.onHistoryChange()}),t.ChainController.subscribeKey("activeCaipNetwork",e=>{this.network=e,this.networkImage=t.AssetUtil.getNetworkImage(this.network)}))}disconnectCallback(){this.unsubscribe.forEach(e=>e())}render(){return t.x`
<wui-flex .padding=${this.getPadding()} justifyContent="space-between" alignItems="center">
${this.leftHeaderTemplate()} ${this.titleTemplate()} ${this.rightHeaderTemplate()}
</wui-flex>
`}onWalletHelp(){t.EventsController.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),t.RouterController.push("WhatIsAWallet")}async onClose(){t.RouterController.state.view==="UnsupportedChain"||await t.SIWXUtil.isSIWXCloseDisabled()?t.ModalController.shake():t.ModalController.close(!0)}rightHeaderTemplate(){var o,n,r;const e=(r=(n=(o=t.OptionsController)==null?void 0:o.state)==null?void 0:n.features)==null?void 0:r.smartSessions;return t.RouterController.state.view!=="Account"||!e?this.closeButtonTemplate():t.x`<wui-flex>
<wui-icon-link
icon="clock"
=${()=>t.RouterController.push("SmartSessionList")}
data-testid="w3m-header-smart-sessions"
></wui-icon-link>
${this.closeButtonTemplate()}
</wui-flex> `}closeButtonTemplate(){return t.x`
<wui-icon-link
icon="close"
=${this.onClose.bind(this)}
data-testid="w3m-header-close"
></wui-icon-link>
`}titleTemplate(){const e=z.includes(this.view);return t.x`
<wui-flex
view-direction="${this.viewDirection}"
class="w3m-header-title"
alignItems="center"
gap="xs"
>
<wui-text variant="paragraph-700" color="fg-100" data-testid="w3m-header-text"
>${this.headerText}</wui-text
>
${e?t.x`<wui-tag variant="main">Beta</wui-tag>`:null}
</wui-flex>
`}leftHeaderTemplate(){var m;const{view:e}=t.RouterController.state,o=e==="Connect",n=t.OptionsController.state.enableEmbedded,r=e==="ApproveTransaction",i=e==="ConnectingSiwe",a=e==="Account",c=t.OptionsController.state.enableNetworkSwitch,b=r||i||o&&n;return a&&c?t.x`<wui-select
id="dynamic"
data-testid="w3m-account-select-network"
active-network=${l.o((m=this.network)==null?void 0:m.name)}
=${this.onNetworks.bind(this)}
imageSrc=${l.o(this.networkImage)}
></wui-select>`:this.showBack&&!b?t.x`<wui-icon-link
data-testid="header-back"
id="dynamic"
icon="chevronLeft"
=${this.onGoBack.bind(this)}
></wui-icon-link>`:t.x`<wui-icon-link
data-hidden=${!o}
id="dynamic"
icon="helpCircle"
=${this.onWalletHelp.bind(this)}
></wui-icon-link>`}onNetworks(){this.isAllowedNetworkSwitch()&&(t.EventsController.sendEvent({type:"track",event:"CLICK_NETWORKS"}),t.RouterController.push("Networks"))}isAllowedNetworkSwitch(){const e=t.ChainController.getAllRequestedCaipNetworks(),o=e?e.length>1:!1,n=e==null?void 0:e.find(({id:r})=>{var i;return r===((i=this.network)==null?void 0:i.id)});return o||!n}getPadding(){return this.heading?["l","2l","l","2l"]:["0","2l","0","2l"]}onViewChange(){const{history:e}=t.RouterController.state;let o=t.ConstantsUtil$3.VIEW_DIRECTION.Next;e.length<this.prevHistoryLength&&(o=t.ConstantsUtil$3.VIEW_DIRECTION.Prev),this.prevHistoryLength=e.length,this.viewDirection=o}async onHistoryChange(){var n;const{history:e}=t.RouterController.state,o=(n=this.shadowRoot)==null?void 0:n.querySelector("#dynamic");e.length>1&&!this.showBack&&o?(await o.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!0,o.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"})):e.length<=1&&this.showBack&&o&&(await o.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!1,o.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}onGoBack(){t.RouterController.goBack()}};d.styles=H;h([l.r()],d.prototype,"heading",void 0);h([l.r()],d.prototype,"network",void 0);h([l.r()],d.prototype,"networkImage",void 0);h([l.r()],d.prototype,"showBack",void 0);h([l.r()],d.prototype,"prevHistoryLength",void 0);h([l.r()],d.prototype,"view",void 0);h([l.r()],d.prototype,"viewDirection",void 0);h([l.r()],d.prototype,"headerText",void 0);d=h([l.customElement("w3m-header")],d);const q=t.i`
:host {
display: flex;
column-gap: var(--wui-spacing-s);
align-items: center;
padding: var(--wui-spacing-xs) var(--wui-spacing-m) var(--wui-spacing-xs) var(--wui-spacing-xs);
border-radius: var(--wui-border-radius-s);
border: 1px solid var(--wui-color-gray-glass-005);
box-sizing: border-box;
background-color: var(--wui-color-bg-175);
box-shadow:
0px 14px 64px -4px rgba(0, 0, 0, 0.15),
0px 8px 22px -6px rgba(0, 0, 0, 0.15);
max-width: 300px;
}
:host wui-loading-spinner {
margin-left: var(--wui-spacing-3xs);
}
`;var g=function(s,e,o,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,o,n);else for(var c=s.length-1;c>=0;c--)(a=s[c])&&(i=(r<3?a(i):r>3?a(e,o,i):a(e,o))||i);return r>3&&i&&Object.defineProperty(e,o,i),i};let p=class extends t.i$1{constructor(){super(...arguments),this.backgroundColor="accent-100",this.iconColor="accent-100",this.icon="checkmark",this.message="",this.loading=!1,this.iconType="default"}render(){return t.x`
${this.templateIcon()}
<wui-text variant="paragraph-500" color="fg-100" data-testid="wui-snackbar-message"
>${this.message}</wui-text
>
`}templateIcon(){return this.loading?t.x`<wui-loading-spinner size="md" color="accent-100"></wui-loading-spinner>`:this.iconType==="default"?t.x`<wui-icon size="xl" color=${this.iconColor} name=${this.icon}></wui-icon>`:t.x`<wui-icon-box
size="sm"
iconSize="xs"
iconColor=${this.iconColor}
backgroundColor=${this.backgroundColor}
icon=${this.icon}
background="opaque"
></wui-icon-box>`}};p.styles=[t.resetStyles,q];g([l.n()],p.prototype,"backgroundColor",void 0);g([l.n()],p.prototype,"iconColor",void 0);g([l.n()],p.prototype,"icon",void 0);g([l.n()],p.prototype,"message",void 0);g([l.n()],p.prototype,"loading",void 0);g([l.n()],p.prototype,"iconType",void 0);p=g([l.customElement("wui-snackbar")],p);const Y=t.i`
:host {
display: block;
position: absolute;
opacity: 0;
pointer-events: none;
top: 11px;
left: 50%;
width: max-content;
}
`;var P=function(s,e,o,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,o,n);else for(var c=s.length-1;c>=0;c--)(a=s[c])&&(i=(r<3?a(i):r>3?a(e,o,i):a(e,o))||i);return r>3&&i&&Object.defineProperty(e,o,i),i};const X={loading:void 0,success:{backgroundColor:"success-100",iconColor:"success-100",icon:"checkmark"},error:{backgroundColor:"error-100",iconColor:"error-100",icon:"close"}};let $=class extends t.i$1{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.open=t.SnackController.state.open,this.unsubscribe.push(t.SnackController.subscribeKey("open",e=>{this.open=e,this.onOpen()}))}disconnectedCallback(){clearTimeout(this.timeout),this.unsubscribe.forEach(e=>e())}render(){const{message:e,variant:o,svg:n}=t.SnackController.state,r=X[o],{icon:i,iconColor:a}=n??r??{};return t.x`
<wui-snackbar
message=${e}
backgroundColor=${r==null?void 0:r.backgroundColor}
iconColor=${a}
icon=${i}
.loading=${o==="loading"}
></wui-snackbar>
`}onOpen(){clearTimeout(this.timeout),this.open?(this.animate([{opacity:0,transform:"translateX(-50%) scale(0.85)"},{opacity:1,transform:"translateX(-50%) scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.timeout&&clearTimeout(this.timeout),t.SnackController.state.autoClose&&(this.timeout=setTimeout(()=>t.SnackController.hide(),2500))):this.animate([{opacity:1,transform:"translateX(-50%) scale(1)"},{opacity:0,transform:"translateX(-50%) scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"})}};$.styles=Y;P([l.r()],$.prototype,"open",void 0);$=P([l.customElement("w3m-snackbar")],$);const V=t.i`
:host {
z-index: var(--w3m-z-index);
display: block;
backface-visibility: hidden;
will-change: opacity;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
pointer-events: none;
opacity: 0;
background-color: var(--wui-cover);
transition: opacity 0.2s var(--wui-ease-out-power-2);
will-change: opacity;
}
:host(.open) {
opacity: 1;
}
:host(.appkit-modal) {
position: relative;
pointer-events: unset;
background: none;
width: 100%;
opacity: 1;
}
wui-card {
max-width: var(--w3m-modal-width);
width: 100%;
position: relative;
animation: zoom-in 0.2s var(--wui-ease-out-power-2);
animation-fill-mode: backwards;
outline: none;
transition:
border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1),
background-color var(--wui-duration-lg) var(--wui-ease-out-power-1);
will-change: border-radius, background-color;
}
:host(.appkit-modal) wui-card {
max-width: 400px;
}
wui-card[shake='true'] {
animation:
zoom-in 0.2s var(--wui-ease-out-power-2),
w3m-shake 0.5s var(--wui-ease-out-power-2);
}
wui-flex {
overflow-x: hidden;
overflow-y: auto;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
(max-height: 700px) and (min-width: 431px) {
wui-flex {
align-items: flex-start;
}
wui-card {
margin: var(--wui-spacing-xxl) 0px;
}
}
(max-width: 430px) {
wui-flex {
align-items: flex-end;
}
wui-card {
max-width: 100%;
border-bottom-left-radius: var(--local-border-bottom-mobile-radius);
border-bottom-right-radius: var(--local-border-bottom-mobile-radius);
border-bottom: none;
animation: slide-in 0.2s var(--wui-ease-out-power-2);
}
wui-card[shake='true'] {
animation:
slide-in 0.2s var(--wui-ease-out-power-2),
w3m-shake 0.5s var(--wui-ease-out-power-2);
}
}
zoom-in {
0% {
transform: scale(0.95) translateY(0);
}
100% {
transform: scale(1) translateY(0);
}
}
slide-in {
0% {
transform: scale(1) translateY(50px);
}
100% {
transform: scale(1) translateY(0);
}
}
w3m-shake {
0% {
transform: scale(1) rotate(0deg);
}
20% {
transform: scale(1) rotate(-1deg);
}
40% {
transform: scale(1) rotate(1.5deg);
}
60% {
transform: scale(1) rotate(-1.5deg);
}
80% {
transform: scale(1) rotate(1deg);
}
100% {
transform: scale(1) rotate(0deg);
}
}
w3m-view-height {
from {
height: var(--prev-height);
}
to {
height: var(--new-height);
}
}
`;var w=function(s,e,o,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,o,n);else for(var c=s.length-1;c>=0;c--)(a=s[c])&&(i=(r<3?a(i):r>3?a(e,o,i):a(e,o))||i);return r>3&&i&&Object.defineProperty(e,o,i),i};const T="scroll-lock";class u extends t.i$1{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.hasPrefetched=!1,this.enableEmbedded=t.OptionsController.state.enableEmbedded,this.open=t.ModalController.state.open,this.caipAddress=t.ChainController.state.activeCaipAddress,this.caipNetwork=t.ChainController.state.activeCaipNetwork,this.shake=t.ModalController.state.shake,this.filterByNamespace=t.ConnectorController.state.filterByNamespace,this.initializeTheming(),t.ApiController.prefetchAnalyticsConfig(),this.unsubscribe.push(t.ModalController.subscribeKey("open",e=>e?this.onOpen():this.onClose()),t.ModalController.subscribeKey("shake",e=>this.shake=e),t.ChainController.subscribeKey("activeCaipNetwork",e=>this.onNewNetwork(e)),t.ChainController.subscribeKey("activeCaipAddress",e=>this.onNewAddress(e)),t.OptionsController.subscribeKey("enableEmbedded",e=>this.enableEmbedded=e),t.ConnectorController.subscribeKey("filterByNamespace",e=>{var o;this.filterByNamespace!==e&&!((o=t.ChainController.getAccountData(e))!=null&&o.caipAddress)&&(t.ApiController.fetchRecommendedWallets(),this.filterByNamespace=e)}))}firstUpdated(){if(this.caipAddress){if(this.enableEmbedded){t.ModalController.close(),this.prefetch();return}this.onNewAddress(this.caipAddress)}this.open&&this.onOpen(),this.enableEmbedded&&this.prefetch()}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),this.onRemoveKeyboardListener()}render(){return this.style.cssText=`
--local-border-bottom-mobile-radius: ${this.enableEmbedded?"clamp(0px, var(--wui-border-radius-l), 44px)":"0px"};
`,this.enableEmbedded?t.x`${this.contentTemplate()}
<w3m-tooltip></w3m-tooltip> `:this.open?t.x`
<wui-flex =${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay">
${this.contentTemplate()}
</wui-flex>
<w3m-tooltip></w3m-tooltip>
`:null}contentTemplate(){return t.x` <wui-card
shake="${this.shake}"
data-embedded="${l.o(this.enableEmbedded)}"
role="alertdialog"
aria-modal="true"
tabindex="0"
data-testid="w3m-modal-card"
>
<w3m-header></w3m-header>
<w3m-router></w3m-router>
<w3m-snackbar></w3m-snackbar>
<w3m-alertbar></w3m-alertbar>
</wui-card>`}async onOverlayClick(e){e.target===e.currentTarget&&await this.handleClose()}async handleClose(){t.RouterController.state.view==="UnsupportedChain"||await t.SIWXUtil.isSIWXCloseDisabled()?t.ModalController.shake():t.ModalController.close()}initializeTheming(){const{themeVariables:e,themeMode:o}=t.ThemeController.state,n=l.UiHelperUtil.getColorTheme(o);t.initializeTheming(e,n)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),t.SnackController.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const e=document.createElement("style");e.dataset.w3m=T,e.textContent=`
body {
touch-action: none;
overflow: hidden;
overscroll-behavior: contain;
}
w3m-modal {
pointer-events: auto;
}
`,document.head.appendChild(e)}onScrollUnlock(){const e=document.head.querySelector(`style[data-w3m="${T}"]`);e&&e.remove()}onAddKeyboardListener(){var o;this.abortController=new AbortController;const e=(o=this.shadowRoot)==null?void 0:o.querySelector("wui-card");e==null||e.focus(),window.addEventListener("keydown",n=>{if(n.key==="Escape")this.handleClose();else if(n.key==="Tab"){const{tagName:r}=n.target;r&&!r.includes("W3M-")&&!r.includes("WUI-")&&(e==null||e.focus())}},this.abortController)}onRemoveKeyboardListener(){var e;(e=this.abortController)==null||e.abort(),this.abortController=void 0}async onNewAddress(e){const o=t.ChainController.state.isSwitchingNamespace,n=t.CoreHelperUtil.getPlainAddress(e);!n&&!o?t.ModalController.close():o&&n&&t.RouterController.goBack(),await t.SIWXUtil.initializeIfEnabled(),this.caipAddress=e,t.ChainController.setIsSwitchingNamespace(!1)}onNewNetwork(e){var W,N;const o=this.caipNetwork,n=(W=o==null?void 0:o.caipNetworkId)==null?void 0:W.toString(),r=o==null?void 0:o.chainNamespace,i=(N=e==null?void 0:e.caipNetworkId)==null?void 0:N.toString(),a=e==null?void 0:e.chainNamespace,c=n!==i,m=c&&!(r!==a),v=(o==null?void 0:o.name)===t.ConstantsUtil$1.UNSUPPORTED_NETWORK_NAME,y=t.RouterController.state.view==="ConnectingExternal",x=!this.caipAddress,B=t.RouterController.state.view==="UnsupportedChain",_=t.ModalController.state.open;let k=!1;_&&!y&&(x?c&&(k=!0):(B||m&&!v)&&(k=!0)),k&&t.RouterController.state.view!=="SIWXSignMessage"&&t.RouterController.goBack(),this.caipNetwork=e}prefetch(){this.hasPrefetched||(t.ApiController.prefetch(),t.ApiController.fetchWalletsByPage({page:1}),this.hasPrefetched=!0)}}u.styles=V;w([l.n({type:Boolean})],u.prototype,"enableEmbedded",void 0);w([l.r()],u.prototype,"open",void 0);w([l.r()],u.prototype,"caipAddress",void 0);w([l.r()],u.prototype,"caipNetwork",void 0);w([l.r()],u.prototype,"shake",void 0);w([l.r()],u.prototype,"filterByNamespace",void 0);exports.W3mModal=class extends u{};exports.W3mModal=w([l.customElement("w3m-modal")],exports.W3mModal);exports.AppKitModal=class extends u{};exports.AppKitModal=w([l.customElement("appkit-modal")],exports.AppKitModal);exports.W3mModalBase=u;
//# sourceMappingURL=w3m-modal-DVoR29AS.cjs.map