import{ag as ct,ah as lt,i as dt,a as pt,b as $,r as $t,f as at,ai as j,h as ft,R as Mt,O as Ot,E as St,g as At,W as Ct}from"./index-B6fu-u6K.js";import{U as xt,n as O,c as ht,o as vt,r as rt}from"./if-defined-D6swbWyQ.js";import"./index-Bl7lS5oY.js";import"./index-BEFi7f_e.js";import"./index-CuJMoJHR.js";import"./index-DUZ-8KUm.js";import"./index-DmDFCnkv.js";var bt={exports:{}};(function(t,e){(function(i,o){t.exports=o()})(lt,function(){var i=1e3,o=6e4,u=36e5,r="millisecond",c="second",d="minute",g="hour",h="day",v="week",x="month",R="quarter",T="year",D="date",k="Invalid Date",W=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Q=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,X={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(p){var a=["th","st","nd","rd"],n=p%100;return"["+p+(a[(n-20)%10]||a[n]||a[0])+"]"}},tt=function(p,a,n){var l=String(p);return!l||l.length>=a?p:""+Array(a+1-l.length).join(n)+p},U={s:tt,z:function(p){var a=-p.utcOffset(),n=Math.abs(a),l=Math.floor(n/60),s=n%60;return(a<=0?"+":"-")+tt(l,2,"0")+":"+tt(s,2,"0")},m:function p(a,n){if(a.date()1)return p(m[0])}else{var y=a.name;C[y]=a,s=y}return!l&&s&&(A=s),s||!l&&A},_=function(p,a){if(H(p))return p.clone();var n=typeof a=="object"?a:{};return n.date=p,n.args=arguments,new ot(n)},w=U;w.l=nt,w.i=H,w.w=function(p,a){return _(p,{locale:a.$L,utc:a.$u,x:a.$x,$offset:a.$offset})};var ot=function(){function p(n){this.$L=nt(n.locale,null,!0),this.parse(n),this.$x=this.$x||n.x||{},this[P]=!0}var a=p.prototype;return a.parse=function(n){this.$d=function(l){var s=l.date,f=l.utc;if(s===null)return new Date(NaN);if(w.u(s))return new Date;if(s instanceof Date)return new Date(s);if(typeof s=="string"&&!/Z$/i.test(s)){var m=s.match(W);if(m){var y=m[2]-1||0,b=(m[7]||"0").substring(0,3);return f?new Date(Date.UTC(m[1],y,m[3]||1,m[4]||0,m[5]||0,m[6]||0,b)):new Date(m[1],y,m[3]||1,m[4]||0,m[5]||0,m[6]||0,b)}}return new Date(s)}(n),this.init()},a.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},a.$utils=function(){return w},a.isValid=function(){return this.$d.toString()!==k},a.isSame=function(n,l){var s=_(n);return this.startOf(l)<=s&&s<=this.endOf(l)},a.isAfter=function(n,l){return _(n)0,C<=A.r||!A.r){C<=1&&U>0&&(A=X[U-1]);var P=Q[A.l];T&&(C=T(""+C)),k=typeof P=="string"?P.replace("%d",C):P(C,v,A.l,W);break}}if(v)return k;var H=W?Q.future:Q.past;return typeof H=="function"?H(k):H.replace("%s",k)},r.to=function(h,v){return d(h,v,this,!0)},r.from=function(h,v){return d(h,v,this)};var g=function(h){return h.$u?u.utc():u()};r.toNow=function(h){return this.to(g(this),h)},r.fromNow=function(h){return this.from(g(this),h)}}})})(Tt);var Nt=Tt.exports;const jt=ct(Nt);var _t={exports:{}};(function(t,e){(function(i,o){t.exports=o()})(lt,function(){return function(i,o,u){u.updateLocale=function(r,c){var d=u.Ls[r];if(d)return(c?Object.keys(c):[]).forEach(function(g){d[g]=c[g]}),d}}})})(_t);var Ft=_t.exports;const kt=ct(Ft);Z.extend(jt);Z.extend(kt);const Yt={...Lt,name:"en-web3-modal",relativeTime:{future:"in %s",past:"%s ago",s:"%d sec",m:"1 min",mm:"%d min",h:"1 hr",hh:"%d hrs",d:"1 d",dd:"%d d",M:"1 mo",MM:"%d mo",y:"1 yr",yy:"%d yr"}},Bt=["January","February","March","April","May","June","July","August","September","October","November","December"];Z.locale("en-web3-modal",Yt);const mt={getMonthNameByIndex(t){return Bt[t]},getYear(t=new Date().toISOString()){return Z(t).year()},getRelativeDateFromNow(t){return Z(t).locale("en-web3-modal").fromNow(!0)},formatDate(t,e="DD MMM"){return Z(t).format(e)}},Et=3,Wt=["receive","deposit","borrow","claim"],Ut=["withdraw","repay","burn"],K={getTransactionGroupTitle(t,e){const i=mt.getYear(),o=mt.getMonthNameByIndex(e);return t===i?o:`${o} ${t}`},getTransactionImages(t){const[e,i]=t,o=!!e&&(t==null?void 0:t.every(c=>!!c.nft_info)),u=(t==null?void 0:t.length)>1;return(t==null?void 0:t.length)===2&&!o?[this.getTransactionImage(i),this.getTransactionImage(e)]:u?t.map(c=>this.getTransactionImage(c)):[this.getTransactionImage(e)]},getTransactionImage(t){return{type:K.getTransactionTransferTokenType(t),url:K.getTransactionImageURL(t)}},getTransactionImageURL(t){var u,r,c,d,g;let e;const i=!!(t!=null&&t.nft_info),o=!!(t!=null&&t.fungible_info);return t&&i?e=(c=(r=(u=t==null?void 0:t.nft_info)==null?void 0:u.content)==null?void 0:r.preview)==null?void 0:c.url:t&&o&&(e=(g=(d=t==null?void 0:t.fungible_info)==null?void 0:d.icon)==null?void 0:g.url),e},getTransactionTransferTokenType(t){if(t!=null&&t.fungible_info)return"FUNGIBLE";if(t!=null&&t.nft_info)return"NFT"},getTransactionDescriptions(t){var x,R,T;const e=(x=t==null?void 0:t.metadata)==null?void 0:x.operationType,i=t==null?void 0:t.transfers,o=((R=t==null?void 0:t.transfers)==null?void 0:R.length)>0,u=((T=t==null?void 0:t.transfers)==null?void 0:T.length)>1,r=o&&(i==null?void 0:i.every(D=>!!(D!=null&&D.fungible_info))),[c,d]=i;let g=this.getTransferDescription(c),h=this.getTransferDescription(d);if(!o)return(e==="send"||e==="receive")&&r?(g=xt.getTruncateString({string:t==null?void 0:t.metadata.sentFrom,charsStart:4,charsEnd:6,truncate:"middle"}),h=xt.getTruncateString({string:t==null?void 0:t.metadata.sentTo,charsStart:4,charsEnd:6,truncate:"middle"}),[g,h]):[t.metadata.status];if(u)return i.map(D=>this.getTransferDescription(D)).reverse();let v="";return Wt.includes(e)?v="+":Ut.includes(e)&&(v="-"),g=v.concat(g),[g]},getTransferDescription(t){var i;let e="";return t&&(t!=null&&t.nft_info?e=((i=t==null?void 0:t.nft_info)==null?void 0:i.name)||"-":t!=null&&t.fungible_info&&(e=this.getFungibleTransferDescription(t)||"-")),e},getFungibleTransferDescription(t){var o;return t?[this.getQuantityFixedValue(t==null?void 0:t.quantity.numeric),(o=t==null?void 0:t.fungible_info)==null?void 0:o.symbol].join(" ").trim():null},getQuantityFixedValue(t){return t?parseFloat(t).toFixed(Et):null}};var gt;(function(t){t.approve="approved",t.bought="bought",t.borrow="borrowed",t.burn="burnt",t.cancel="canceled",t.claim="claimed",t.deploy="deployed",t.deposit="deposited",t.execute="executed",t.mint="minted",t.receive="received",t.repay="repaid",t.send="sent",t.sell="sold",t.stake="staked",t.trade="swapped",t.unstake="unstaked",t.withdraw="withdrawn"})(gt||(gt={}));const Ht=dt` :host > wui-flex { display: flex; justify-content: center; align-items: center; position: relative; width: 40px; height: 40px; box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); background-color: var(--wui-color-gray-glass-005); } :host > wui-flex wui-image { display: block; } :host > wui-flex, :host > wui-flex wui-image, .swap-images-container, .swap-images-container.nft, wui-image.nft { border-top-left-radius: var(--local-left-border-radius); border-top-right-radius: var(--local-right-border-radius); border-bottom-left-radius: var(--local-left-border-radius); border-bottom-right-radius: var(--local-right-border-radius); } wui-icon { width: 20px; height: 20px; } wui-icon-box { position: absolute; right: 0; bottom: 0; transform: translate(20%, 20%); } .swap-images-container { position: relative; width: 40px; height: 40px; overflow: hidden; } .swap-images-container wui-image:first-child { position: absolute; width: 40px; height: 40px; top: 0; left: 0%; clip-path: inset(0px calc(50% + 2px) 0px 0%); } .swap-images-container wui-image:last-child { clip-path: inset(0px 0px 0px calc(50% + 2px)); } `;var J=function(t,e,i,o){var u=arguments.length,r=u<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,i,o);else for(var d=t.length-1;d>=0;d--)(c=t[d])&&(r=(u<3?c(r):u>3?c(e,i,r):c(e,i))||r);return u>3&&r&&Object.defineProperty(e,i,r),r};let Y=class extends pt{constructor(){super(...arguments),this.images=[],this.secondImage={type:void 0,url:""}}render(){const[e,i]=this.images,o=(e==null?void 0:e.type)==="NFT",u=i!=null&&i.url?i.type==="NFT":o,r=o?"var(--wui-border-radius-xxs)":"var(--wui-border-radius-s)",c=u?"var(--wui-border-radius-xxs)":"var(--wui-border-radius-s)";return this.style.cssText=` --local-left-border-radius: ${r}; --local-right-border-radius: ${c}; `,$` ${this.templateVisual()} ${this.templateIcon()} `}templateVisual(){const[e,i]=this.images,o=e==null?void 0:e.type;return this.images.length===2&&(e!=null&&e.url||i!=null&&i.url)?$`
${e!=null&&e.url?$``:null} ${i!=null&&i.url?$``:null}
`:e!=null&&e.url?$``:o==="NFT"?$``:$``}templateIcon(){let e="accent-100",i;return i=this.getIcon(),this.status&&(e=this.getStatusColor()),i?$` `:null}getDirectionIcon(){switch(this.direction){case"in":return"arrowBottom";case"out":return"arrowTop";default:return}}getIcon(){return this.onlyDirectionIcon?this.getDirectionIcon():this.type==="trade"?"swapHorizontalBold":this.type==="approve"?"checkmark":this.type==="cancel"?"close":this.getDirectionIcon()}getStatusColor(){switch(this.status){case"confirmed":return"success-100";case"failed":return"error-100";case"pending":return"inverse-100";default:return"accent-100"}}};Y.styles=[Ht];J([O()],Y.prototype,"type",void 0);J([O()],Y.prototype,"status",void 0);J([O()],Y.prototype,"direction",void 0);J([O({type:Boolean})],Y.prototype,"onlyDirectionIcon",void 0);J([O({type:Array})],Y.prototype,"images",void 0);J([O({type:Object})],Y.prototype,"secondImage",void 0);Y=J([ht("wui-transaction-visual")],Y);const Vt=dt` :host > wui-flex:first-child { align-items: center; column-gap: var(--wui-spacing-s); padding: 6.5px var(--wui-spacing-xs) 6.5px var(--wui-spacing-xs); width: 100%; } :host > wui-flex:first-child wui-text:nth-child(1) { text-transform: capitalize; } wui-transaction-visual { width: 40px; height: 40px; } wui-flex { flex: 1; } :host wui-flex wui-flex { overflow: hidden; } :host .description-container wui-text span { word-break: break-all; } :host .description-container wui-text { overflow: hidden; } :host .description-separator-icon { margin: 0px 6px; } :host wui-text > span { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; } `;var F=function(t,e,i,o){var u=arguments.length,r=u<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,i,o);else for(var d=t.length-1;d>=0;d--)(c=t[d])&&(r=(u<3?c(r):u>3?c(e,i,r):c(e,i))||r);return u>3&&r&&Object.defineProperty(e,i,r),r};let L=class extends pt{constructor(){super(...arguments),this.type="approve",this.onlyDirectionIcon=!1,this.images=[],this.price=[],this.amount=[],this.symbol=[]}render(){return $` ${gt[this.type]||this.type} ${this.templateDescription()} ${this.templateSecondDescription()} ${this.date} `}templateDescription(){var i;const e=(i=this.descriptions)==null?void 0:i[0];return e?$` ${e} `:null}templateSecondDescription(){var i;const e=(i=this.descriptions)==null?void 0:i[1];return e?$` ${e} `:null}};L.styles=[$t,Vt];F([O()],L.prototype,"type",void 0);F([O({type:Array})],L.prototype,"descriptions",void 0);F([O()],L.prototype,"date",void 0);F([O({type:Boolean})],L.prototype,"onlyDirectionIcon",void 0);F([O()],L.prototype,"status",void 0);F([O()],L.prototype,"direction",void 0);F([O({type:Array})],L.prototype,"images",void 0);F([O({type:Array})],L.prototype,"price",void 0);F([O({type:Array})],L.prototype,"amount",void 0);F([O({type:Array})],L.prototype,"symbol",void 0);L=F([ht("wui-transaction-list-item")],L);const zt=dt` :host > wui-flex:first-child { column-gap: var(--wui-spacing-s); padding: 7px var(--wui-spacing-l) 7px var(--wui-spacing-xs); width: 100%; } wui-flex { display: flex; flex: 1; } `;var Jt=function(t,e,i,o){var u=arguments.length,r=u<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,i,o);else for(var d=t.length-1;d>=0;d--)(c=t[d])&&(r=(u<3?c(r):u>3?c(e,i,r):c(e,i))||r);return u>3&&r&&Object.defineProperty(e,i,r),r};let wt=class extends pt{render(){return $` `}};wt.styles=[$t,zt];wt=Jt([ht("wui-transaction-list-item-loader")],wt);const Gt=dt` :host { min-height: 100%; } .group-container[last-group='true'] { padding-bottom: var(--wui-spacing-m); } .contentContainer { height: 280px; } .contentContainer > wui-icon-box { width: 40px; height: 40px; border-radius: var(--wui-border-radius-xxs); } .contentContainer > .textContent { width: 65%; } .emptyContainer { height: 100%; } `;var G=function(t,e,i,o){var u=arguments.length,r=u<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,i,o);else for(var d=t.length-1;d>=0;d--)(c=t[d])&&(r=(u<3?c(r):u>3?c(e,i,r):c(e,i))||r);return u>3&&r&&Object.defineProperty(e,i,r),r};const ut="last-transaction",Pt=7;let B=class extends pt{constructor(){super(),this.unsubscribe=[],this.paginationObserver=void 0,this.page="activity",this.caipAddress=at.state.activeCaipAddress,this.transactionsByYear=j.state.transactionsByYear,this.loading=j.state.loading,this.empty=j.state.empty,this.next=j.state.next,j.clearCursor(),this.unsubscribe.push(at.subscribeKey("activeCaipAddress",e=>{e&&this.caipAddress!==e&&(j.resetTransactions(),j.fetchTransactions(e)),this.caipAddress=e}),at.subscribeKey("activeCaipNetwork",()=>{this.updateTransactionView()}),j.subscribe(e=>{this.transactionsByYear=e.transactionsByYear,this.loading=e.loading,this.empty=e.empty,this.next=e.next}))}firstUpdated(){this.updateTransactionView(),this.createPaginationObserver()}updated(){this.setPaginationObserver()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return $` ${this.empty?null:this.templateTransactionsByYear()} ${this.loading?this.templateLoading():null} ${!this.loading&&this.empty?this.templateEmpty():null}`}updateTransactionView(){j.resetTransactions(),this.caipAddress&&j.fetchTransactions(ft.getPlainAddress(this.caipAddress))}templateTransactionsByYear(){return Object.keys(this.transactionsByYear).sort().reverse().map(i=>{const o=parseInt(i,10),u=new Array(12).fill(null).map((r,c)=>{var h;const d=K.getTransactionGroupTitle(o,c),g=(h=this.transactionsByYear[o])==null?void 0:h[c];return{groupTitle:d,transactions:g}}).filter(({transactions:r})=>r).reverse();return u.map(({groupTitle:r,transactions:c},d)=>{const g=d===u.length-1;return c?$` ${r} ${this.templateTransactions(c,g)} `:null})})}templateRenderTransaction(e,i){const{date:o,descriptions:u,direction:r,isAllNFT:c,images:d,status:g,transfers:h,type:v}=this.getTransactionListItemProps(e),x=(h==null?void 0:h.length)>1;return(h==null?void 0:h.length)===2&&!c?$` `:x?h.map((T,D)=>{const k=K.getTransferDescription(T),W=i&&D===h.length-1;return $` `}):$` `}templateTransactions(e,i){return e.map((o,u)=>{const r=i&&u===e.length-1;return $`${this.templateRenderTransaction(o,r)}`})}emptyStateActivity(){return $` No Transactions yet Start trading on dApps
to grow your wallet!
`}emptyStateAccount(){return $` No activity yet Your next transactions will appear here Trade `}templateEmpty(){return this.page==="account"?$`${this.emptyStateAccount()}`:$`${this.emptyStateActivity()}`}templateLoading(){return this.page==="activity"?Array(Pt).fill($` `).map(e=>e):null}onReceiveClick(){Mt.push("WalletReceive")}createPaginationObserver(){const{projectId:e}=Ot.state;this.paginationObserver=new IntersectionObserver(([i])=>{i!=null&&i.isIntersecting&&!this.loading&&(j.fetchTransactions(ft.getPlainAddress(this.caipAddress)),St.sendEvent({type:"track",event:"LOAD_MORE_TRANSACTIONS",properties:{address:ft.getPlainAddress(this.caipAddress),projectId:e,cursor:this.next,isSmartAccount:At(at.state.activeChain)===Ct.ACCOUNT_TYPES.SMART_ACCOUNT}}))},{}),this.setPaginationObserver()}setPaginationObserver(){var i,o,u;(i=this.paginationObserver)==null||i.disconnect();const e=(o=this.shadowRoot)==null?void 0:o.querySelector(`#${ut}`);e&&((u=this.paginationObserver)==null||u.observe(e))}getTransactionListItemProps(e){var g,h,v,x,R;const i=mt.formatDate((g=e==null?void 0:e.metadata)==null?void 0:g.minedAt),o=K.getTransactionDescriptions(e),u=e==null?void 0:e.transfers,r=(h=e==null?void 0:e.transfers)==null?void 0:h[0],c=!!r&&((v=e==null?void 0:e.transfers)==null?void 0:v.every(T=>!!T.nft_info)),d=K.getTransactionImages(u);return{date:i,direction:r==null?void 0:r.direction,descriptions:o,isAllNFT:c,images:d,status:(x=e.metadata)==null?void 0:x.status,transfers:u,type:(R=e.metadata)==null?void 0:R.operationType}}};B.styles=Gt;G([O()],B.prototype,"page",void 0);G([rt()],B.prototype,"caipAddress",void 0);G([rt()],B.prototype,"transactionsByYear",void 0);G([rt()],B.prototype,"loading",void 0);G([rt()],B.prototype,"empty",void 0);G([rt()],B.prototype,"next",void 0);B=G([ht("w3m-activity-list")],B);