diff --git a/assets/DailyMotion-CKPjzhXZ.js b/assets/DailyMotion-D8DjCF95.js similarity index 97% rename from assets/DailyMotion-CKPjzhXZ.js rename to assets/DailyMotion-D8DjCF95.js index 29d8dc7c34..ff1f2d87a0 100644 --- a/assets/DailyMotion-CKPjzhXZ.js +++ b/assets/DailyMotion-D8DjCF95.js @@ -1 +1 @@ -import{g as P,r as v,u as D,p as O}from"./index-CnIrxdGO.js";function b(t,e){for(var r=0;ro[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,s=Object.defineProperty,w=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,j=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,E=(t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of S(e))!T.call(t,a)&&a!==r&&s(t,a,{get:()=>e[a],enumerable:!(o=w(e,a))||o.enumerable});return t},L=(t,e,r)=>(r=t!=null?M(j(t)):{},h(!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),C=t=>h(s({},"__esModule",{value:!0}),t),n=(t,e,r)=>(E(t,typeof e!="symbol"?e+"":e,r),r),d={};A(d,{default:()=>p});var _=C(d),c=L(v),l=D,f=O;const N="https://api.dmcdn.net/all.js",x="DM",K="dmAsyncInit";class p extends c.Component{constructor(){super(...arguments),n(this,"callPlayer",l.callPlayer),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.callPlayer("setMuted",!0)}),n(this,"unmute",()=>{this.callPlayer("setMuted",!1)}),n(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{controls:r,config:o,onError:a,playing:i}=this.props,[,y]=e.match(f.MATCH_URL_DAILYMOTION);if(this.player){this.player.load(y,{start:(0,l.parseStartTime)(e),autoplay:i});return}(0,l.getSDK)(N,x,K,u=>u.player).then(u=>{if(!this.container)return;const g=u.player;this.player=new g(this.container,{width:"100%",height:"100%",video:y,params:{controls:r,autoplay:this.props.playing,mute:this.props.muted,start:(0,l.parseStartTime)(e),origin:window.location.origin,...o.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:m=>a(m)}})},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}n(p,"displayName","DailyMotion");n(p,"canPlay",f.canPlay.dailymotion);n(p,"loopOnEnded",!0);const R=P(_),I=b({__proto__:null,default:R},[_]);export{I as D}; +import{g as P,r as v,u as D,p as O}from"./index-BfxkfOYW.js";function b(t,e){for(var r=0;ro[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,s=Object.defineProperty,w=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,j=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,E=(t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of S(e))!T.call(t,a)&&a!==r&&s(t,a,{get:()=>e[a],enumerable:!(o=w(e,a))||o.enumerable});return t},L=(t,e,r)=>(r=t!=null?M(j(t)):{},h(!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),C=t=>h(s({},"__esModule",{value:!0}),t),n=(t,e,r)=>(E(t,typeof e!="symbol"?e+"":e,r),r),d={};A(d,{default:()=>p});var _=C(d),c=L(v),l=D,f=O;const N="https://api.dmcdn.net/all.js",x="DM",K="dmAsyncInit";class p extends c.Component{constructor(){super(...arguments),n(this,"callPlayer",l.callPlayer),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.callPlayer("setMuted",!0)}),n(this,"unmute",()=>{this.callPlayer("setMuted",!1)}),n(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{controls:r,config:o,onError:a,playing:i}=this.props,[,y]=e.match(f.MATCH_URL_DAILYMOTION);if(this.player){this.player.load(y,{start:(0,l.parseStartTime)(e),autoplay:i});return}(0,l.getSDK)(N,x,K,u=>u.player).then(u=>{if(!this.container)return;const g=u.player;this.player=new g(this.container,{width:"100%",height:"100%",video:y,params:{controls:r,autoplay:this.props.playing,mute:this.props.muted,start:(0,l.parseStartTime)(e),origin:window.location.origin,...o.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:m=>a(m)}})},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}n(p,"displayName","DailyMotion");n(p,"canPlay",f.canPlay.dailymotion);n(p,"loopOnEnded",!0);const R=P(_),I=b({__proto__:null,default:R},[_]);export{I as D}; diff --git a/assets/Facebook-B4ycyCYk.js b/assets/Facebook-B8moW65v.js similarity index 98% rename from assets/Facebook-B4ycyCYk.js rename to assets/Facebook-B8moW65v.js index f7aabf70b2..5160827c8c 100644 --- a/assets/Facebook-B4ycyCYk.js +++ b/assets/Facebook-B8moW65v.js @@ -1 +1 @@ -import{g as _,r as g,u as P,p as m}from"./index-CnIrxdGO.js";function v(t,e){for(var r=0;ra[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var O=Object.create,i=Object.defineProperty,D=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,I=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!j.call(t,s)&&s!==r&&i(t,s,{get:()=>e[s],enumerable:!(a=D(e,s))||a.enumerable});return t},w=(t,e,r)=>(r=t!=null?O(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),F=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(I(t,typeof e!="symbol"?e+"":e,r),r),b={};k(b,{default:()=>l});var d=F(b),u=w(g),n=P,x=m;const c="https://connect.facebook.net/en_US/sdk.js",y="FB",f="fbAsyncInit",L="facebook-player-";class l extends u.Component{constructor(){super(...arguments),o(this,"callPlayer",n.callPlayer),o(this,"playerID",this.props.config.playerId||`${L}${(0,n.randomString)()}`),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){if(r){(0,n.getSDK)(c,y,f).then(a=>a.XFBML.parse());return}(0,n.getSDK)(c,y,f).then(a=>{a.init({appId:this.props.config.appId,xfbml:!0,version:this.props.config.version}),a.Event.subscribe("xfbml.render",s=>{this.props.onLoaded()}),a.Event.subscribe("xfbml.ready",s=>{s.type==="video"&&s.id===this.playerID&&(this.player=s.instance,this.player.subscribe("startedPlaying",this.props.onPlay),this.player.subscribe("paused",this.props.onPause),this.player.subscribe("finishedPlaying",this.props.onEnded),this.player.subscribe("startedBuffering",this.props.onBuffer),this.player.subscribe("finishedBuffering",this.props.onBufferEnd),this.player.subscribe("error",this.props.onError),this.props.muted?this.callPlayer("mute"):this.callPlayer("unmute"),this.props.onReady(),document.getElementById(this.playerID).querySelector("iframe").style.visibility="visible")})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentPosition")}getSecondsLoaded(){return null}render(){const{attributes:e}=this.props.config,r={width:"100%",height:"100%"};return u.default.createElement("div",{style:r,id:this.playerID,className:"fb-video","data-href":this.props.url,"data-autoplay":this.props.playing?"true":"false","data-allowfullscreen":"true","data-controls":this.props.controls?"true":"false",...e})}}o(l,"displayName","Facebook");o(l,"canPlay",x.canPlay.facebook);o(l,"loopOnEnded",!0);const M=_(d),B=v({__proto__:null,default:M},[d]);export{B as F}; +import{g as _,r as g,u as P,p as m}from"./index-BfxkfOYW.js";function v(t,e){for(var r=0;ra[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var O=Object.create,i=Object.defineProperty,D=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,I=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!j.call(t,s)&&s!==r&&i(t,s,{get:()=>e[s],enumerable:!(a=D(e,s))||a.enumerable});return t},w=(t,e,r)=>(r=t!=null?O(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),F=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(I(t,typeof e!="symbol"?e+"":e,r),r),b={};k(b,{default:()=>l});var d=F(b),u=w(g),n=P,x=m;const c="https://connect.facebook.net/en_US/sdk.js",y="FB",f="fbAsyncInit",L="facebook-player-";class l extends u.Component{constructor(){super(...arguments),o(this,"callPlayer",n.callPlayer),o(this,"playerID",this.props.config.playerId||`${L}${(0,n.randomString)()}`),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){if(r){(0,n.getSDK)(c,y,f).then(a=>a.XFBML.parse());return}(0,n.getSDK)(c,y,f).then(a=>{a.init({appId:this.props.config.appId,xfbml:!0,version:this.props.config.version}),a.Event.subscribe("xfbml.render",s=>{this.props.onLoaded()}),a.Event.subscribe("xfbml.ready",s=>{s.type==="video"&&s.id===this.playerID&&(this.player=s.instance,this.player.subscribe("startedPlaying",this.props.onPlay),this.player.subscribe("paused",this.props.onPause),this.player.subscribe("finishedPlaying",this.props.onEnded),this.player.subscribe("startedBuffering",this.props.onBuffer),this.player.subscribe("finishedBuffering",this.props.onBufferEnd),this.player.subscribe("error",this.props.onError),this.props.muted?this.callPlayer("mute"):this.callPlayer("unmute"),this.props.onReady(),document.getElementById(this.playerID).querySelector("iframe").style.visibility="visible")})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentPosition")}getSecondsLoaded(){return null}render(){const{attributes:e}=this.props.config,r={width:"100%",height:"100%"};return u.default.createElement("div",{style:r,id:this.playerID,className:"fb-video","data-href":this.props.url,"data-autoplay":this.props.playing?"true":"false","data-allowfullscreen":"true","data-controls":this.props.controls?"true":"false",...e})}}o(l,"displayName","Facebook");o(l,"canPlay",x.canPlay.facebook);o(l,"loopOnEnded",!0);const M=_(d),B=v({__proto__:null,default:M},[d]);export{B as F}; diff --git a/assets/FilePlayer-Bhc98JXj.js b/assets/FilePlayer-C-fIliW0.js similarity index 99% rename from assets/FilePlayer-Bhc98JXj.js rename to assets/FilePlayer-C-fIliW0.js index 32a9d2fae5..0eb8793124 100644 --- a/assets/FilePlayer-Bhc98JXj.js +++ b/assets/FilePlayer-C-fIliW0.js @@ -1 +1 @@ -import{g as b,r as _,u as O,p as A}from"./index-CnIrxdGO.js";function R(s,e){for(var t=0;ti[n]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var I=Object.create,u=Object.defineProperty,D=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,M=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,U=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,N=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},E=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!k.call(s,n)&&n!==t&&u(s,n,{get:()=>e[n],enumerable:!(i=D(e,n))||i.enumerable});return s},j=(s,e,t)=>(t=s!=null?I(M(s)):{},E(!s||!s.__esModule?u(t,"default",{value:s,enumerable:!0}):t,s)),H=s=>E(u({},"__esModule",{value:!0}),s),r=(s,e,t)=>(U(s,typeof e!="symbol"?e+"":e,t),t),m={};N(m,{default:()=>P});var g=H(m),d=j(_),a=O,c=A;const y=typeof navigator<"u",F=y&&navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,v=y&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||F)&&!window.MSStream,V=y&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!window.MSStream,T="https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js",C="Hls",B="https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js",x="dashjs",K="https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js",G="flvjs",X=/www\.dropbox\.com\/.+/,f=/https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/,W="https://videodelivery.net/{id}/manifest/video.m3u8";class P extends d.Component{constructor(){super(...arguments),r(this,"onReady",(...e)=>this.props.onReady(...e)),r(this,"onPlay",(...e)=>this.props.onPlay(...e)),r(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),r(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),r(this,"onPause",(...e)=>this.props.onPause(...e)),r(this,"onEnded",(...e)=>this.props.onEnded(...e)),r(this,"onError",(...e)=>this.props.onError(...e)),r(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),r(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),r(this,"onDisablePIP",e=>{const{onDisablePIP:t,playing:i}=this.props;t(e),i&&this.play()}),r(this,"onPresentationModeChange",e=>{if(this.player&&(0,a.supportsWebKitPresentationMode)(this.player)){const{webkitPresentationMode:t}=this.player;t==="picture-in-picture"?this.onEnablePIP(e):t==="inline"&&this.onDisablePIP(e)}}),r(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),r(this,"mute",()=>{this.player.muted=!0}),r(this,"unmute",()=>{this.player.muted=!1}),r(this,"renderSourceElement",(e,t)=>typeof e=="string"?d.default.createElement("source",{key:t,src:e}):d.default.createElement("source",{key:t,...e})),r(this,"renderTrack",(e,t)=>d.default.createElement("track",{key:t,...e})),r(this,"ref",e=>{this.player&&(this.prevPlayer=this.player),this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getSource(this.props.url);e&&(this.player.src=e),(v||this.props.config.forceDisableHls)&&this.player.load()}componentDidUpdate(e){this.shouldUseAudio(this.props)!==this.shouldUseAudio(e)&&(this.removeListeners(this.prevPlayer,e.url),this.addListeners(this.player)),this.props.url!==e.url&&!(0,a.isMediaStream)(this.props.url)&&!(this.props.url instanceof Array)&&(this.player.srcObject=null)}componentWillUnmount(){this.player.removeAttribute("src"),this.removeListeners(this.player),this.hls&&this.hls.destroy()}addListeners(e){const{url:t,playsinline:i}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.addEventListener("canplay",this.onReady),i&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""))}removeListeners(e,t){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.removeEventListener("canplay",this.onReady)}shouldUseAudio(e){return e.config.forceVideo||e.config.attributes.poster?!1:c.AUDIO_EXTENSIONS.test(e.url)||e.config.forceAudio}shouldUseHLS(e){return V&&this.props.config.forceSafariHLS||this.props.config.forceHLS?!0:v||this.props.config.forceDisableHls?!1:c.HLS_EXTENSIONS.test(e)||f.test(e)}shouldUseDASH(e){return c.DASH_EXTENSIONS.test(e)||this.props.config.forceDASH}shouldUseFLV(e){return c.FLV_EXTENSIONS.test(e)||this.props.config.forceFLV}load(e){const{hlsVersion:t,hlsOptions:i,dashVersion:n,flvVersion:l}=this.props.config;if(this.hls&&this.hls.destroy(),this.dash&&this.dash.reset(),this.shouldUseHLS(e)&&(0,a.getSDK)(T.replace("VERSION",t),C).then(o=>{if(this.hls=new o(i),this.hls.on(o.Events.MANIFEST_PARSED,()=>{this.props.onReady()}),this.hls.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.hls,o)}),f.test(e)){const h=e.match(f)[1];this.hls.loadSource(W.replace("{id}",h))}else this.hls.loadSource(e);this.hls.attachMedia(this.player),this.props.onLoaded()}),this.shouldUseDASH(e)&&(0,a.getSDK)(B.replace("VERSION",n),x).then(o=>{this.dash=o.MediaPlayer().create(),this.dash.initialize(this.player,e,this.props.playing),this.dash.on("error",this.props.onError),parseInt(n)<3?this.dash.getDebug().setLogToBrowserConsole(!1):this.dash.updateSettings({debug:{logLevel:o.Debug.LOG_LEVEL_NONE}}),this.props.onLoaded()}),this.shouldUseFLV(e)&&(0,a.getSDK)(K.replace("VERSION",l),G).then(o=>{this.flv=o.createPlayer({type:"flv",url:e}),this.flv.attachMediaElement(this.player),this.flv.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.flv,o)}),this.flv.load(),this.props.onLoaded()}),e instanceof Array)this.player.load();else if((0,a.isMediaStream)(e))try{this.player.srcObject=e}catch{this.player.src=window.URL.createObjectURL(e)}}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.removeAttribute("src"),this.dash&&this.dash.reset()}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player?this.player.requestPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="picture-in-picture"&&this.player.webkitSetPresentationMode("picture-in-picture")}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player?document.exitPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="inline"&&this.player.webkitSetPresentationMode("inline")}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getSource(e){const t=this.shouldUseHLS(e),i=this.shouldUseDASH(e),n=this.shouldUseFLV(e);if(!(e instanceof Array||(0,a.isMediaStream)(e)||t||i||n))return X.test(e)?e.replace("www.dropbox.com","dl.dropboxusercontent.com"):e}render(){const{url:e,playing:t,loop:i,controls:n,muted:l,config:o,width:h,height:p}=this.props,L=this.shouldUseAudio(this.props)?"audio":"video",S={width:h==="auto"?h:"100%",height:p==="auto"?p:"100%"};return d.default.createElement(L,{ref:this.ref,src:this.getSource(e),style:S,preload:"auto",autoPlay:t||void 0,controls:n,muted:l,loop:i,...o.attributes},e instanceof Array&&e.map(this.renderSourceElement),o.tracks.map(this.renderTrack))}}r(P,"displayName","FilePlayer");r(P,"canPlay",c.canPlay.file);const z=b(g),J=R({__proto__:null,default:z},[g]);export{J as F}; +import{g as b,r as _,u as O,p as A}from"./index-BfxkfOYW.js";function R(s,e){for(var t=0;ti[n]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var I=Object.create,u=Object.defineProperty,D=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,M=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,U=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,N=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},E=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!k.call(s,n)&&n!==t&&u(s,n,{get:()=>e[n],enumerable:!(i=D(e,n))||i.enumerable});return s},j=(s,e,t)=>(t=s!=null?I(M(s)):{},E(!s||!s.__esModule?u(t,"default",{value:s,enumerable:!0}):t,s)),H=s=>E(u({},"__esModule",{value:!0}),s),r=(s,e,t)=>(U(s,typeof e!="symbol"?e+"":e,t),t),m={};N(m,{default:()=>P});var g=H(m),d=j(_),a=O,c=A;const y=typeof navigator<"u",F=y&&navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,v=y&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||F)&&!window.MSStream,V=y&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!window.MSStream,T="https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js",C="Hls",B="https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js",x="dashjs",K="https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js",G="flvjs",X=/www\.dropbox\.com\/.+/,f=/https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/,W="https://videodelivery.net/{id}/manifest/video.m3u8";class P extends d.Component{constructor(){super(...arguments),r(this,"onReady",(...e)=>this.props.onReady(...e)),r(this,"onPlay",(...e)=>this.props.onPlay(...e)),r(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),r(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),r(this,"onPause",(...e)=>this.props.onPause(...e)),r(this,"onEnded",(...e)=>this.props.onEnded(...e)),r(this,"onError",(...e)=>this.props.onError(...e)),r(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),r(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),r(this,"onDisablePIP",e=>{const{onDisablePIP:t,playing:i}=this.props;t(e),i&&this.play()}),r(this,"onPresentationModeChange",e=>{if(this.player&&(0,a.supportsWebKitPresentationMode)(this.player)){const{webkitPresentationMode:t}=this.player;t==="picture-in-picture"?this.onEnablePIP(e):t==="inline"&&this.onDisablePIP(e)}}),r(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),r(this,"mute",()=>{this.player.muted=!0}),r(this,"unmute",()=>{this.player.muted=!1}),r(this,"renderSourceElement",(e,t)=>typeof e=="string"?d.default.createElement("source",{key:t,src:e}):d.default.createElement("source",{key:t,...e})),r(this,"renderTrack",(e,t)=>d.default.createElement("track",{key:t,...e})),r(this,"ref",e=>{this.player&&(this.prevPlayer=this.player),this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getSource(this.props.url);e&&(this.player.src=e),(v||this.props.config.forceDisableHls)&&this.player.load()}componentDidUpdate(e){this.shouldUseAudio(this.props)!==this.shouldUseAudio(e)&&(this.removeListeners(this.prevPlayer,e.url),this.addListeners(this.player)),this.props.url!==e.url&&!(0,a.isMediaStream)(this.props.url)&&!(this.props.url instanceof Array)&&(this.player.srcObject=null)}componentWillUnmount(){this.player.removeAttribute("src"),this.removeListeners(this.player),this.hls&&this.hls.destroy()}addListeners(e){const{url:t,playsinline:i}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.addEventListener("canplay",this.onReady),i&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""))}removeListeners(e,t){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.removeEventListener("canplay",this.onReady)}shouldUseAudio(e){return e.config.forceVideo||e.config.attributes.poster?!1:c.AUDIO_EXTENSIONS.test(e.url)||e.config.forceAudio}shouldUseHLS(e){return V&&this.props.config.forceSafariHLS||this.props.config.forceHLS?!0:v||this.props.config.forceDisableHls?!1:c.HLS_EXTENSIONS.test(e)||f.test(e)}shouldUseDASH(e){return c.DASH_EXTENSIONS.test(e)||this.props.config.forceDASH}shouldUseFLV(e){return c.FLV_EXTENSIONS.test(e)||this.props.config.forceFLV}load(e){const{hlsVersion:t,hlsOptions:i,dashVersion:n,flvVersion:l}=this.props.config;if(this.hls&&this.hls.destroy(),this.dash&&this.dash.reset(),this.shouldUseHLS(e)&&(0,a.getSDK)(T.replace("VERSION",t),C).then(o=>{if(this.hls=new o(i),this.hls.on(o.Events.MANIFEST_PARSED,()=>{this.props.onReady()}),this.hls.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.hls,o)}),f.test(e)){const h=e.match(f)[1];this.hls.loadSource(W.replace("{id}",h))}else this.hls.loadSource(e);this.hls.attachMedia(this.player),this.props.onLoaded()}),this.shouldUseDASH(e)&&(0,a.getSDK)(B.replace("VERSION",n),x).then(o=>{this.dash=o.MediaPlayer().create(),this.dash.initialize(this.player,e,this.props.playing),this.dash.on("error",this.props.onError),parseInt(n)<3?this.dash.getDebug().setLogToBrowserConsole(!1):this.dash.updateSettings({debug:{logLevel:o.Debug.LOG_LEVEL_NONE}}),this.props.onLoaded()}),this.shouldUseFLV(e)&&(0,a.getSDK)(K.replace("VERSION",l),G).then(o=>{this.flv=o.createPlayer({type:"flv",url:e}),this.flv.attachMediaElement(this.player),this.flv.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.flv,o)}),this.flv.load(),this.props.onLoaded()}),e instanceof Array)this.player.load();else if((0,a.isMediaStream)(e))try{this.player.srcObject=e}catch{this.player.src=window.URL.createObjectURL(e)}}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.removeAttribute("src"),this.dash&&this.dash.reset()}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player?this.player.requestPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="picture-in-picture"&&this.player.webkitSetPresentationMode("picture-in-picture")}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player?document.exitPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="inline"&&this.player.webkitSetPresentationMode("inline")}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getSource(e){const t=this.shouldUseHLS(e),i=this.shouldUseDASH(e),n=this.shouldUseFLV(e);if(!(e instanceof Array||(0,a.isMediaStream)(e)||t||i||n))return X.test(e)?e.replace("www.dropbox.com","dl.dropboxusercontent.com"):e}render(){const{url:e,playing:t,loop:i,controls:n,muted:l,config:o,width:h,height:p}=this.props,L=this.shouldUseAudio(this.props)?"audio":"video",S={width:h==="auto"?h:"100%",height:p==="auto"?p:"100%"};return d.default.createElement(L,{ref:this.ref,src:this.getSource(e),style:S,preload:"auto",autoPlay:t||void 0,controls:n,muted:l,loop:i,...o.attributes},e instanceof Array&&e.map(this.renderSourceElement),o.tracks.map(this.renderTrack))}}r(P,"displayName","FilePlayer");r(P,"canPlay",c.canPlay.file);const z=b(g),J=R({__proto__:null,default:z},[g]);export{J as F}; diff --git a/assets/Kaltura-9vZ2Lv43.js b/assets/Kaltura-BAapSDAT.js similarity index 97% rename from assets/Kaltura-9vZ2Lv43.js rename to assets/Kaltura-BAapSDAT.js index 374f0dc13b..dbc140fd9d 100644 --- a/assets/Kaltura-9vZ2Lv43.js +++ b/assets/Kaltura-BAapSDAT.js @@ -1 +1 @@ -import{g as y,r as f,u as _,p as m}from"./index-CnIrxdGO.js";function P(r,e){for(var t=0;to[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,j=(r,e,t)=>e in r?n(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,L=(r,e)=>{for(var t in e)n(r,t,{get:e[t],enumerable:!0})},c=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!w.call(r,a)&&a!==t&&n(r,a,{get:()=>e[a],enumerable:!(o=b(e,a))||o.enumerable});return r},K=(r,e,t)=>(t=r!=null?g(O(r)):{},c(!r||!r.__esModule?n(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>c(n({},"__esModule",{value:!0}),r),s=(r,e,t)=>(j(r,typeof e!="symbol"?e+"":e,t),t),d={};L(d,{default:()=>i});var h=D(d),u=K(f),p=_,M=m;const S="https://cdn.embed.ly/player-0.1.0.min.js",T="playerjs";class i extends u.Component{constructor(){super(...arguments),s(this,"callPlayer",p.callPlayer),s(this,"duration",null),s(this,"currentTime",null),s(this,"secondsLoaded",null),s(this,"mute",()=>{this.callPlayer("mute")}),s(this,"unmute",()=>{this.callPlayer("unmute")}),s(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,p.getSDK)(S,T).then(t=>{this.iframe&&(this.player=new t.Player(this.iframe),this.player.on("ready",()=>{setTimeout(()=>{this.player.isReady=!0,this.player.setLoop(this.props.loop),this.props.muted&&this.player.mute(),this.addListeners(this.player,this.props),this.props.onReady()},500)}))},this.props.onError)}addListeners(e,t){e.on("play",t.onPlay),e.on("pause",t.onPause),e.on("ended",t.onEnded),e.on("error",t.onError),e.on("timeupdate",({duration:o,seconds:a})=>{this.duration=o,this.currentTime=a})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,t=!0){this.callPlayer("setCurrentTime",e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e={width:"100%",height:"100%"};return u.default.createElement("iframe",{ref:this.ref,src:this.props.url,frameBorder:"0",scrolling:"no",style:e,allow:"encrypted-media; autoplay; fullscreen;",referrerPolicy:"no-referrer-when-downgrade"})}}s(i,"displayName","Kaltura");s(i,"canPlay",M.canPlay.kaltura);const E=y(h),N=P({__proto__:null,default:E},[h]);export{N as K}; +import{g as y,r as f,u as _,p as m}from"./index-BfxkfOYW.js";function P(r,e){for(var t=0;to[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,j=(r,e,t)=>e in r?n(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,L=(r,e)=>{for(var t in e)n(r,t,{get:e[t],enumerable:!0})},c=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!w.call(r,a)&&a!==t&&n(r,a,{get:()=>e[a],enumerable:!(o=b(e,a))||o.enumerable});return r},K=(r,e,t)=>(t=r!=null?g(O(r)):{},c(!r||!r.__esModule?n(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>c(n({},"__esModule",{value:!0}),r),s=(r,e,t)=>(j(r,typeof e!="symbol"?e+"":e,t),t),d={};L(d,{default:()=>i});var h=D(d),u=K(f),p=_,M=m;const S="https://cdn.embed.ly/player-0.1.0.min.js",T="playerjs";class i extends u.Component{constructor(){super(...arguments),s(this,"callPlayer",p.callPlayer),s(this,"duration",null),s(this,"currentTime",null),s(this,"secondsLoaded",null),s(this,"mute",()=>{this.callPlayer("mute")}),s(this,"unmute",()=>{this.callPlayer("unmute")}),s(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,p.getSDK)(S,T).then(t=>{this.iframe&&(this.player=new t.Player(this.iframe),this.player.on("ready",()=>{setTimeout(()=>{this.player.isReady=!0,this.player.setLoop(this.props.loop),this.props.muted&&this.player.mute(),this.addListeners(this.player,this.props),this.props.onReady()},500)}))},this.props.onError)}addListeners(e,t){e.on("play",t.onPlay),e.on("pause",t.onPause),e.on("ended",t.onEnded),e.on("error",t.onError),e.on("timeupdate",({duration:o,seconds:a})=>{this.duration=o,this.currentTime=a})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,t=!0){this.callPlayer("setCurrentTime",e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e={width:"100%",height:"100%"};return u.default.createElement("iframe",{ref:this.ref,src:this.props.url,frameBorder:"0",scrolling:"no",style:e,allow:"encrypted-media; autoplay; fullscreen;",referrerPolicy:"no-referrer-when-downgrade"})}}s(i,"displayName","Kaltura");s(i,"canPlay",M.canPlay.kaltura);const E=y(h),N=P({__proto__:null,default:E},[h]);export{N as K}; diff --git a/assets/Mixcloud-CiD2SqOK.js b/assets/Mixcloud-BOrRDsU8.js similarity index 97% rename from assets/Mixcloud-CiD2SqOK.js rename to assets/Mixcloud-BOrRDsU8.js index 526b9c2bc6..fbed3a77ea 100644 --- a/assets/Mixcloud-CiD2SqOK.js +++ b/assets/Mixcloud-BOrRDsU8.js @@ -1 +1 @@ -import{g as _,r as f,u as m,p as g}from"./index-CnIrxdGO.js";function v(t,e){for(var r=0;rs[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,i=Object.defineProperty,O=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,M=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,x=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,j=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b(e))!w.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(s=O(e,o))||s.enumerable});return t},D=(t,e,r)=>(r=t!=null?P(M(t)):{},c(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>c(i({},"__esModule",{value:!0}),t),a=(t,e,r)=>(x(t,typeof e!="symbol"?e+"":e,r),r),d={};j(d,{default:()=>l});var h=S(d),p=D(f),u=m,y=g;const E="https://widget.mixcloud.com/media/js/widgetApi.js",L="Mixcloud";class l extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",u.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"secondsLoaded",null),a(this,"mute",()=>{}),a(this,"unmute",()=>{}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,L).then(r=>{this.player=r.PlayerWidget(this.iframe),this.player.ready.then(()=>{this.player.events.play.on(this.props.onPlay),this.player.events.pause.on(this.props.onPause),this.player.events.ended.on(this.props.onEnded),this.player.events.error.on(this.props.error),this.player.events.progress.on((s,o)=>{this.currentTime=s,this.duration=o}),this.props.onReady()})},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return null}render(){const{url:e,config:r}=this.props,s=e.match(y.MATCH_URL_MIXCLOUD)[1],o={width:"100%",height:"100%"},n=(0,u.queryString)({...r.options,feed:`/${s}/`});return p.default.createElement("iframe",{key:s,ref:this.ref,style:o,src:`https://www.mixcloud.com/widget/iframe/?${n}`,frameBorder:"0",allow:"autoplay"})}}a(l,"displayName","Mixcloud");a(l,"canPlay",y.canPlay.mixcloud);a(l,"loopOnEnded",!0);const T=_(h),N=v({__proto__:null,default:T},[h]);export{N as M}; +import{g as _,r as f,u as m,p as g}from"./index-BfxkfOYW.js";function v(t,e){for(var r=0;rs[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,i=Object.defineProperty,O=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,M=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,x=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,j=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b(e))!w.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(s=O(e,o))||s.enumerable});return t},D=(t,e,r)=>(r=t!=null?P(M(t)):{},c(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>c(i({},"__esModule",{value:!0}),t),a=(t,e,r)=>(x(t,typeof e!="symbol"?e+"":e,r),r),d={};j(d,{default:()=>l});var h=S(d),p=D(f),u=m,y=g;const E="https://widget.mixcloud.com/media/js/widgetApi.js",L="Mixcloud";class l extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",u.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"secondsLoaded",null),a(this,"mute",()=>{}),a(this,"unmute",()=>{}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,L).then(r=>{this.player=r.PlayerWidget(this.iframe),this.player.ready.then(()=>{this.player.events.play.on(this.props.onPlay),this.player.events.pause.on(this.props.onPause),this.player.events.ended.on(this.props.onEnded),this.player.events.error.on(this.props.error),this.player.events.progress.on((s,o)=>{this.currentTime=s,this.duration=o}),this.props.onReady()})},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return null}render(){const{url:e,config:r}=this.props,s=e.match(y.MATCH_URL_MIXCLOUD)[1],o={width:"100%",height:"100%"},n=(0,u.queryString)({...r.options,feed:`/${s}/`});return p.default.createElement("iframe",{key:s,ref:this.ref,style:o,src:`https://www.mixcloud.com/widget/iframe/?${n}`,frameBorder:"0",allow:"autoplay"})}}a(l,"displayName","Mixcloud");a(l,"canPlay",y.canPlay.mixcloud);a(l,"loopOnEnded",!0);const T=_(h),N=v({__proto__:null,default:T},[h]);export{N as M}; diff --git a/assets/Mux-DZP56nNu.js b/assets/Mux-DDFtGK4v.js similarity index 98% rename from assets/Mux-DZP56nNu.js rename to assets/Mux-DDFtGK4v.js index 3b74ef19db..ce17b37990 100644 --- a/assets/Mux-DZP56nNu.js +++ b/assets/Mux-DDFtGK4v.js @@ -1 +1 @@ -import{g as P,_ as E,r as g,p as _}from"./index-CnIrxdGO.js";function b(r,e){for(var t=0;ti[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var L=Object.create,u=Object.defineProperty,I=Object.getOwnPropertyDescriptor,k=Object.getOwnPropertyNames,O=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,M=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of k(e))!x.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(i=I(e,s))||i.enumerable});return r},w=(r,e,t)=>(t=r!=null?L(O(r)):{},f(!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>f(u({},"__esModule",{value:!0}),r),n=(r,e,t)=>(M(r,typeof e!="symbol"?e+"":e,t),t),y={};R(y,{default:()=>l});var m=D(y),v=w(g),p=_;const j="https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs";class l extends v.Component{constructor(){super(...arguments),n(this,"onReady",(...e)=>this.props.onReady(...e)),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),n(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onError",(...e)=>this.props.onError(...e)),n(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),n(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),n(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.player.muted=!0}),n(this,"unmute",()=>{this.player.muted=!1}),n(this,"ref",e=>{this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getPlaybackId(this.props.url);e&&(this.player.playbackId=e)}componentWillUnmount(){this.player.playbackId=null,this.removeListeners(this.player)}addListeners(e){const{playsinline:t}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),e.addEventListener("canplay",this.onReady),t&&e.setAttribute("playsinline","")}removeListeners(e){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("canplay",this.onReady)}async load(e){var t;const{onError:i,config:s}=this.props;if(!((t=globalThis.customElements)!=null&&t.get("mux-player")))try{const a=j.replace("VERSION",s.version);await E(()=>import(`${a}`),[],import.meta.url),this.props.onLoaded()}catch(a){i(a)}const[,o]=e.match(p.MATCH_URL_MUX);this.player.playbackId=o}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.playbackId=null}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player&&this.player.requestPictureInPicture()}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player&&document.exitPictureInPicture()}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getPlaybackId(e){const[,t]=e.match(p.MATCH_URL_MUX);return t}render(){const{url:e,playing:t,loop:i,controls:s,muted:o,config:a,width:h,height:c}=this.props,d={width:h==="auto"?h:"100%",height:c==="auto"?c:"100%"};return s===!1&&(d["--controls"]="none"),v.default.createElement("mux-player",{ref:this.ref,"playback-id":this.getPlaybackId(e),style:d,preload:"auto",autoPlay:t||void 0,muted:o?"":void 0,loop:i?"":void 0,...a.attributes})}}n(l,"displayName","Mux");n(l,"canPlay",p.canPlay.mux);const C=P(m),B=b({__proto__:null,default:C},[m]);export{B as M}; +import{g as P,_ as E,r as g,p as _}from"./index-BfxkfOYW.js";function b(r,e){for(var t=0;ti[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var L=Object.create,u=Object.defineProperty,I=Object.getOwnPropertyDescriptor,k=Object.getOwnPropertyNames,O=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,M=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of k(e))!x.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(i=I(e,s))||i.enumerable});return r},w=(r,e,t)=>(t=r!=null?L(O(r)):{},f(!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>f(u({},"__esModule",{value:!0}),r),n=(r,e,t)=>(M(r,typeof e!="symbol"?e+"":e,t),t),y={};R(y,{default:()=>l});var m=D(y),v=w(g),p=_;const j="https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs";class l extends v.Component{constructor(){super(...arguments),n(this,"onReady",(...e)=>this.props.onReady(...e)),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),n(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onError",(...e)=>this.props.onError(...e)),n(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),n(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),n(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.player.muted=!0}),n(this,"unmute",()=>{this.player.muted=!1}),n(this,"ref",e=>{this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getPlaybackId(this.props.url);e&&(this.player.playbackId=e)}componentWillUnmount(){this.player.playbackId=null,this.removeListeners(this.player)}addListeners(e){const{playsinline:t}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),e.addEventListener("canplay",this.onReady),t&&e.setAttribute("playsinline","")}removeListeners(e){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("canplay",this.onReady)}async load(e){var t;const{onError:i,config:s}=this.props;if(!((t=globalThis.customElements)!=null&&t.get("mux-player")))try{const a=j.replace("VERSION",s.version);await E(()=>import(`${a}`),[],import.meta.url),this.props.onLoaded()}catch(a){i(a)}const[,o]=e.match(p.MATCH_URL_MUX);this.player.playbackId=o}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.playbackId=null}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player&&this.player.requestPictureInPicture()}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player&&document.exitPictureInPicture()}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getPlaybackId(e){const[,t]=e.match(p.MATCH_URL_MUX);return t}render(){const{url:e,playing:t,loop:i,controls:s,muted:o,config:a,width:h,height:c}=this.props,d={width:h==="auto"?h:"100%",height:c==="auto"?c:"100%"};return s===!1&&(d["--controls"]="none"),v.default.createElement("mux-player",{ref:this.ref,"playback-id":this.getPlaybackId(e),style:d,preload:"auto",autoPlay:t||void 0,muted:o?"":void 0,loop:i?"":void 0,...a.attributes})}}n(l,"displayName","Mux");n(l,"canPlay",p.canPlay.mux);const C=P(m),B=b({__proto__:null,default:C},[m]);export{B as M}; diff --git a/assets/Preview-DqMzhPxX.js b/assets/Preview-CzbJIByW.js similarity index 97% rename from assets/Preview-DqMzhPxX.js rename to assets/Preview-CzbJIByW.js index baa022cfca..10836fe285 100644 --- a/assets/Preview-DqMzhPxX.js +++ b/assets/Preview-CzbJIByW.js @@ -1 +1 @@ -import{g as y,r as v}from"./index-CnIrxdGO.js";function w(r,e){for(var t=0;tn[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,s=Object.defineProperty,O=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,I=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,E=(r,e,t)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,S=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},_=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of x(e))!j.call(r,a)&&a!==t&&s(r,a,{get:()=>e[a],enumerable:!(n=O(e,a))||n.enumerable});return r},C=(r,e,t)=>(t=r!=null?P(I(r)):{},_(!r||!r.__esModule?s(t,"default",{value:r,enumerable:!0}):t,r)),N=r=>_(s({},"__esModule",{value:!0}),r),p=(r,e,t)=>(E(r,typeof e!="symbol"?e+"":e,t),t),g={};S(g,{default:()=>k});var m=N(g),i=C(v);const u="64px",d={};class k extends i.Component{constructor(){super(...arguments),p(this,"mounted",!1),p(this,"state",{image:null}),p(this,"handleKeyPress",e=>{(e.key==="Enter"||e.key===" ")&&this.props.onClick()})}componentDidMount(){this.mounted=!0,this.fetchImage(this.props)}componentDidUpdate(e){const{url:t,light:n}=this.props;(e.url!==t||e.light!==n)&&this.fetchImage(this.props)}componentWillUnmount(){this.mounted=!1}fetchImage({url:e,light:t,oEmbedUrl:n}){if(!i.default.isValidElement(t)){if(typeof t=="string"){this.setState({image:t});return}if(d[e]){this.setState({image:d[e]});return}return this.setState({image:null}),window.fetch(n.replace("{url}",e)).then(a=>a.json()).then(a=>{if(a.thumbnail_url&&this.mounted){const o=a.thumbnail_url.replace("height=100","height=480").replace("-d_295x166","-d_640");this.setState({image:o}),d[e]=o}})}}render(){const{light:e,onClick:t,playIcon:n,previewTabIndex:a,previewAriaLabel:o}=this.props,{image:f}=this.state,l=i.default.isValidElement(e),h={display:"flex",alignItems:"center",justifyContent:"center"},c={preview:{width:"100%",height:"100%",backgroundImage:f&&!l?`url(${f})`:void 0,backgroundSize:"cover",backgroundPosition:"center",cursor:"pointer",...h},shadow:{background:"radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",borderRadius:u,width:u,height:u,position:l?"absolute":void 0,...h},playIcon:{borderStyle:"solid",borderWidth:"16px 0 16px 26px",borderColor:"transparent transparent transparent white",marginLeft:"7px"}},b=i.default.createElement("div",{style:c.shadow,className:"react-player__shadow"},i.default.createElement("div",{style:c.playIcon,className:"react-player__play-icon"}));return i.default.createElement("div",{style:c.preview,className:"react-player__preview",onClick:t,tabIndex:a,onKeyPress:this.handleKeyPress,...o?{"aria-label":o}:{}},l?e:null,n||b)}}const D=y(m),A=w({__proto__:null,default:D},[m]);export{A as P}; +import{g as y,r as v}from"./index-BfxkfOYW.js";function w(r,e){for(var t=0;tn[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,s=Object.defineProperty,O=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,I=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,E=(r,e,t)=>e in r?s(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,S=(r,e)=>{for(var t in e)s(r,t,{get:e[t],enumerable:!0})},_=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of x(e))!j.call(r,a)&&a!==t&&s(r,a,{get:()=>e[a],enumerable:!(n=O(e,a))||n.enumerable});return r},C=(r,e,t)=>(t=r!=null?P(I(r)):{},_(!r||!r.__esModule?s(t,"default",{value:r,enumerable:!0}):t,r)),N=r=>_(s({},"__esModule",{value:!0}),r),p=(r,e,t)=>(E(r,typeof e!="symbol"?e+"":e,t),t),g={};S(g,{default:()=>k});var m=N(g),i=C(v);const u="64px",d={};class k extends i.Component{constructor(){super(...arguments),p(this,"mounted",!1),p(this,"state",{image:null}),p(this,"handleKeyPress",e=>{(e.key==="Enter"||e.key===" ")&&this.props.onClick()})}componentDidMount(){this.mounted=!0,this.fetchImage(this.props)}componentDidUpdate(e){const{url:t,light:n}=this.props;(e.url!==t||e.light!==n)&&this.fetchImage(this.props)}componentWillUnmount(){this.mounted=!1}fetchImage({url:e,light:t,oEmbedUrl:n}){if(!i.default.isValidElement(t)){if(typeof t=="string"){this.setState({image:t});return}if(d[e]){this.setState({image:d[e]});return}return this.setState({image:null}),window.fetch(n.replace("{url}",e)).then(a=>a.json()).then(a=>{if(a.thumbnail_url&&this.mounted){const o=a.thumbnail_url.replace("height=100","height=480").replace("-d_295x166","-d_640");this.setState({image:o}),d[e]=o}})}}render(){const{light:e,onClick:t,playIcon:n,previewTabIndex:a,previewAriaLabel:o}=this.props,{image:f}=this.state,l=i.default.isValidElement(e),h={display:"flex",alignItems:"center",justifyContent:"center"},c={preview:{width:"100%",height:"100%",backgroundImage:f&&!l?`url(${f})`:void 0,backgroundSize:"cover",backgroundPosition:"center",cursor:"pointer",...h},shadow:{background:"radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",borderRadius:u,width:u,height:u,position:l?"absolute":void 0,...h},playIcon:{borderStyle:"solid",borderWidth:"16px 0 16px 26px",borderColor:"transparent transparent transparent white",marginLeft:"7px"}},b=i.default.createElement("div",{style:c.shadow,className:"react-player__shadow"},i.default.createElement("div",{style:c.playIcon,className:"react-player__play-icon"}));return i.default.createElement("div",{style:c.preview,className:"react-player__preview",onClick:t,tabIndex:a,onKeyPress:this.handleKeyPress,...o?{"aria-label":o}:{}},l?e:null,n||b)}}const D=y(m),A=w({__proto__:null,default:D},[m]);export{A as P}; diff --git a/assets/SoundCloud-B9yL4Zna.js b/assets/SoundCloud-CJBssnni.js similarity index 97% rename from assets/SoundCloud-B9yL4Zna.js rename to assets/SoundCloud-CJBssnni.js index 2f42487aaf..820d6d6e39 100644 --- a/assets/SoundCloud-B9yL4Zna.js +++ b/assets/SoundCloud-CJBssnni.js @@ -1 +1 @@ -import{g as P,r as g,u as b,p as v}from"./index-CnIrxdGO.js";function O(t,e){for(var r=0;rs[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var S=Object.create,l=Object.defineProperty,w=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,C=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty,D=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},d=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of j(e))!E.call(t,o)&&o!==r&&l(t,o,{get:()=>e[o],enumerable:!(s=w(e,o))||s.enumerable});return t},M=(t,e,r)=>(r=t!=null?S(C(t)):{},d(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),R=t=>d(l({},"__esModule",{value:!0}),t),a=(t,e,r)=>(D(t,typeof e!="symbol"?e+"":e,r),r),h={};L(h,{default:()=>u});var f=R(h),p=M(g),c=b,T=v;const N="https://w.soundcloud.com/player/api.js",x="SC";class u extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",c.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"fractionLoaded",null),a(this,"mute",()=>{this.setVolume(0)}),a(this,"unmute",()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){(0,c.getSDK)(N,x).then(s=>{if(!this.iframe)return;const{PLAY:o,PLAY_PROGRESS:i,PAUSE:y,FINISH:_,ERROR:m}=s.Widget.Events;r||(this.player=s.Widget(this.iframe),this.player.bind(o,this.props.onPlay),this.player.bind(y,()=>{this.duration-this.currentTime<.05||this.props.onPause()}),this.player.bind(i,n=>{this.currentTime=n.currentPosition/1e3,this.fractionLoaded=n.loadedProgress}),this.player.bind(_,()=>this.props.onEnded()),this.player.bind(m,n=>this.props.onError(n))),this.player.load(e,{...this.props.config.options,callback:()=>{this.player.getDuration(n=>{this.duration=n/1e3,this.props.onReady()})}})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seekTo",e*1e3),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.fractionLoaded*this.duration}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return p.default.createElement("iframe",{ref:this.ref,src:`https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,style:r,frameBorder:0,allow:"autoplay"})}}a(u,"displayName","SoundCloud");a(u,"canPlay",T.canPlay.soundcloud);a(u,"loopOnEnded",!0);const A=P(f),F=O({__proto__:null,default:A},[f]);export{F as S}; +import{g as P,r as g,u as b,p as v}from"./index-BfxkfOYW.js";function O(t,e){for(var r=0;rs[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var S=Object.create,l=Object.defineProperty,w=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,C=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty,D=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},d=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of j(e))!E.call(t,o)&&o!==r&&l(t,o,{get:()=>e[o],enumerable:!(s=w(e,o))||s.enumerable});return t},M=(t,e,r)=>(r=t!=null?S(C(t)):{},d(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),R=t=>d(l({},"__esModule",{value:!0}),t),a=(t,e,r)=>(D(t,typeof e!="symbol"?e+"":e,r),r),h={};L(h,{default:()=>u});var f=R(h),p=M(g),c=b,T=v;const N="https://w.soundcloud.com/player/api.js",x="SC";class u extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",c.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"fractionLoaded",null),a(this,"mute",()=>{this.setVolume(0)}),a(this,"unmute",()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){(0,c.getSDK)(N,x).then(s=>{if(!this.iframe)return;const{PLAY:o,PLAY_PROGRESS:i,PAUSE:y,FINISH:_,ERROR:m}=s.Widget.Events;r||(this.player=s.Widget(this.iframe),this.player.bind(o,this.props.onPlay),this.player.bind(y,()=>{this.duration-this.currentTime<.05||this.props.onPause()}),this.player.bind(i,n=>{this.currentTime=n.currentPosition/1e3,this.fractionLoaded=n.loadedProgress}),this.player.bind(_,()=>this.props.onEnded()),this.player.bind(m,n=>this.props.onError(n))),this.player.load(e,{...this.props.config.options,callback:()=>{this.player.getDuration(n=>{this.duration=n/1e3,this.props.onReady()})}})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seekTo",e*1e3),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.fractionLoaded*this.duration}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return p.default.createElement("iframe",{ref:this.ref,src:`https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,style:r,frameBorder:0,allow:"autoplay"})}}a(u,"displayName","SoundCloud");a(u,"canPlay",T.canPlay.soundcloud);a(u,"loopOnEnded",!0);const A=P(f),F=O({__proto__:null,default:A},[f]);export{F as S}; diff --git a/assets/Streamable-C-aCc4Wc.js b/assets/Streamable-CaSBmFqa.js similarity index 97% rename from assets/Streamable-C-aCc4Wc.js rename to assets/Streamable-CaSBmFqa.js index a7328b9eac..3aa42bbe92 100644 --- a/assets/Streamable-C-aCc4Wc.js +++ b/assets/Streamable-CaSBmFqa.js @@ -1 +1 @@ -import{g as m,r as f,u as _,p as b}from"./index-CnIrxdGO.js";function P(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,l=Object.defineProperty,v=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,L=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of O(e))!j.call(t,a)&&a!==r&&l(t,a,{get:()=>e[a],enumerable:!(s=v(e,a))||s.enumerable});return t},M=(t,e,r)=>(r=t!=null?g(S(t)):{},c(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),D=t=>c(l({},"__esModule",{value:!0}),t),o=(t,e,r)=>(L(t,typeof e!="symbol"?e+"":e,r),r),h={};w(h,{default:()=>i});var y=D(h),p=M(f),u=_,d=b;const E="https://cdn.embed.ly/player-0.1.0.min.js",T="playerjs";class i extends p.Component{constructor(){super(...arguments),o(this,"callPlayer",u.callPlayer),o(this,"duration",null),o(this,"currentTime",null),o(this,"secondsLoaded",null),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")}),o(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,T).then(r=>{this.iframe&&(this.player=new r.Player(this.iframe),this.player.setLoop(this.props.loop),this.player.on("ready",this.props.onReady),this.player.on("play",this.props.onPlay),this.player.on("pause",this.props.onPause),this.player.on("seeked",this.props.onSeek),this.player.on("ended",this.props.onEnded),this.player.on("error",this.props.onError),this.player.on("timeupdate",({duration:s,seconds:a})=>{this.duration=s,this.currentTime=a}),this.player.on("buffered",({percent:s})=>{this.duration&&(this.secondsLoaded=this.duration*s)}),this.props.muted&&this.player.mute())},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("setCurrentTime",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e=this.props.url.match(d.MATCH_URL_STREAMABLE)[1],r={width:"100%",height:"100%"};return p.default.createElement("iframe",{ref:this.ref,src:`https://streamable.com/o/${e}`,frameBorder:"0",scrolling:"no",style:r,allow:"encrypted-media; autoplay; fullscreen;"})}}o(i,"displayName","Streamable");o(i,"canPlay",d.canPlay.streamable);const x=m(y),C=P({__proto__:null,default:x},[y]);export{C as S}; +import{g as m,r as f,u as _,p as b}from"./index-BfxkfOYW.js";function P(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,l=Object.defineProperty,v=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,L=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of O(e))!j.call(t,a)&&a!==r&&l(t,a,{get:()=>e[a],enumerable:!(s=v(e,a))||s.enumerable});return t},M=(t,e,r)=>(r=t!=null?g(S(t)):{},c(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),D=t=>c(l({},"__esModule",{value:!0}),t),o=(t,e,r)=>(L(t,typeof e!="symbol"?e+"":e,r),r),h={};w(h,{default:()=>i});var y=D(h),p=M(f),u=_,d=b;const E="https://cdn.embed.ly/player-0.1.0.min.js",T="playerjs";class i extends p.Component{constructor(){super(...arguments),o(this,"callPlayer",u.callPlayer),o(this,"duration",null),o(this,"currentTime",null),o(this,"secondsLoaded",null),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")}),o(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,T).then(r=>{this.iframe&&(this.player=new r.Player(this.iframe),this.player.setLoop(this.props.loop),this.player.on("ready",this.props.onReady),this.player.on("play",this.props.onPlay),this.player.on("pause",this.props.onPause),this.player.on("seeked",this.props.onSeek),this.player.on("ended",this.props.onEnded),this.player.on("error",this.props.onError),this.player.on("timeupdate",({duration:s,seconds:a})=>{this.duration=s,this.currentTime=a}),this.player.on("buffered",({percent:s})=>{this.duration&&(this.secondsLoaded=this.duration*s)}),this.props.muted&&this.player.mute())},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("setCurrentTime",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e=this.props.url.match(d.MATCH_URL_STREAMABLE)[1],r={width:"100%",height:"100%"};return p.default.createElement("iframe",{ref:this.ref,src:`https://streamable.com/o/${e}`,frameBorder:"0",scrolling:"no",style:r,allow:"encrypted-media; autoplay; fullscreen;"})}}o(i,"displayName","Streamable");o(i,"canPlay",d.canPlay.streamable);const x=m(y),C=P({__proto__:null,default:x},[y]);export{C as S}; diff --git a/assets/Twitch-DI1N8bhx.js b/assets/Twitch-CtVsxlKz.js similarity index 97% rename from assets/Twitch-DI1N8bhx.js rename to assets/Twitch-CtVsxlKz.js index 5bab6c2b37..958e9965c3 100644 --- a/assets/Twitch-DI1N8bhx.js +++ b/assets/Twitch-CtVsxlKz.js @@ -1 +1 @@ -import{g as w,r as D,u as C,p as N}from"./index-CnIrxdGO.js";function I(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,l=Object.defineProperty,S=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,A=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty,R=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},_=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of j(e))!H.call(t,a)&&a!==r&&l(t,a,{get:()=>e[a],enumerable:!(s=S(e,a))||s.enumerable});return t},F=(t,e,r)=>(r=t!=null?M(A(t)):{},_(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),U=t=>_(l({},"__esModule",{value:!0}),t),o=(t,e,r)=>(R(t,typeof e!="symbol"?e+"":e,r),r),P={};x(P,{default:()=>h});var f=U(P),y=F(D),c=C,u=N;const K="https://player.twitch.tv/js/embed/v1.js",V="Twitch",$="twitch-player-";class h extends y.Component{constructor(){super(...arguments),o(this,"callPlayer",c.callPlayer),o(this,"playerID",this.props.config.playerId||`${$}${(0,c.randomString)()}`),o(this,"mute",()=>{this.callPlayer("setMuted",!0)}),o(this,"unmute",()=>{this.callPlayer("setMuted",!1)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){const{playsinline:s,onError:a,config:n,controls:v}=this.props,i=u.MATCH_URL_TWITCH_CHANNEL.test(e),p=i?e.match(u.MATCH_URL_TWITCH_CHANNEL)[1]:e.match(u.MATCH_URL_TWITCH_VIDEO)[1];if(r){i?this.player.setChannel(p):this.player.setVideo("v"+p);return}(0,c.getSDK)(K,V).then(d=>{this.player=new d.Player(this.playerID,{video:i?"":p,channel:i?p:"",height:"100%",width:"100%",playsinline:s,autoplay:this.props.playing,muted:this.props.muted,controls:i?!0:v,time:(0,c.parseStartTime)(e),...n.options});const{READY:g,PLAYING:m,PAUSE:E,ENDED:O,ONLINE:L,OFFLINE:b,SEEK:T}=d.Player;this.player.addEventListener(g,this.props.onReady),this.player.addEventListener(m,this.props.onPlay),this.player.addEventListener(E,this.props.onPause),this.player.addEventListener(O,this.props.onEnded),this.player.addEventListener(T,this.props.onSeek),this.player.addEventListener(L,this.props.onLoaded),this.player.addEventListener(b,this.props.onLoaded)},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){this.callPlayer("pause")}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentTime")}getSecondsLoaded(){return null}render(){const e={width:"100%",height:"100%"};return y.default.createElement("div",{style:e,id:this.playerID})}}o(h,"displayName","Twitch");o(h,"canPlay",u.canPlay.twitch);o(h,"loopOnEnded",!0);const W=w(f),G=I({__proto__:null,default:W},[f]);export{G as T}; +import{g as w,r as D,u as C,p as N}from"./index-BfxkfOYW.js";function I(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,l=Object.defineProperty,S=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,A=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty,R=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},_=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of j(e))!H.call(t,a)&&a!==r&&l(t,a,{get:()=>e[a],enumerable:!(s=S(e,a))||s.enumerable});return t},F=(t,e,r)=>(r=t!=null?M(A(t)):{},_(!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),U=t=>_(l({},"__esModule",{value:!0}),t),o=(t,e,r)=>(R(t,typeof e!="symbol"?e+"":e,r),r),P={};x(P,{default:()=>h});var f=U(P),y=F(D),c=C,u=N;const K="https://player.twitch.tv/js/embed/v1.js",V="Twitch",$="twitch-player-";class h extends y.Component{constructor(){super(...arguments),o(this,"callPlayer",c.callPlayer),o(this,"playerID",this.props.config.playerId||`${$}${(0,c.randomString)()}`),o(this,"mute",()=>{this.callPlayer("setMuted",!0)}),o(this,"unmute",()=>{this.callPlayer("setMuted",!1)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){const{playsinline:s,onError:a,config:n,controls:v}=this.props,i=u.MATCH_URL_TWITCH_CHANNEL.test(e),p=i?e.match(u.MATCH_URL_TWITCH_CHANNEL)[1]:e.match(u.MATCH_URL_TWITCH_VIDEO)[1];if(r){i?this.player.setChannel(p):this.player.setVideo("v"+p);return}(0,c.getSDK)(K,V).then(d=>{this.player=new d.Player(this.playerID,{video:i?"":p,channel:i?p:"",height:"100%",width:"100%",playsinline:s,autoplay:this.props.playing,muted:this.props.muted,controls:i?!0:v,time:(0,c.parseStartTime)(e),...n.options});const{READY:g,PLAYING:m,PAUSE:E,ENDED:O,ONLINE:L,OFFLINE:b,SEEK:T}=d.Player;this.player.addEventListener(g,this.props.onReady),this.player.addEventListener(m,this.props.onPlay),this.player.addEventListener(E,this.props.onPause),this.player.addEventListener(O,this.props.onEnded),this.player.addEventListener(T,this.props.onSeek),this.player.addEventListener(L,this.props.onLoaded),this.player.addEventListener(b,this.props.onLoaded)},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){this.callPlayer("pause")}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentTime")}getSecondsLoaded(){return null}render(){const e={width:"100%",height:"100%"};return y.default.createElement("div",{style:e,id:this.playerID})}}o(h,"displayName","Twitch");o(h,"canPlay",u.canPlay.twitch);o(h,"loopOnEnded",!0);const W=w(f),G=I({__proto__:null,default:W},[f]);export{G as T}; diff --git a/assets/Vidyard-CCSmJFry.js b/assets/Vidyard-CaFKMdon.js similarity index 97% rename from assets/Vidyard-CCSmJFry.js rename to assets/Vidyard-CaFKMdon.js index 60f3f0f82c..8b5777d70b 100644 --- a/assets/Vidyard-CCSmJFry.js +++ b/assets/Vidyard-CaFKMdon.js @@ -1 +1 @@ -import{g as m,r as v,u as b,p as O}from"./index-CnIrxdGO.js";function V(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var D=Object.create,i=Object.defineProperty,j=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,S=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty,A=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of w(e))!M.call(t,a)&&a!==r&&i(t,a,{get:()=>e[a],enumerable:!(s=j(e,a))||s.enumerable});return t},L=(t,e,r)=>(r=t!=null?D(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),R=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(A(t,typeof e!="symbol"?e+"":e,r),r),_={};E(_,{default:()=>y});var f=R(_),c=L(v),d=b,P=O;const x="https://play.vidyard.com/embed/v4.js",C="VidyardV4",N="onVidyardAPI";class y extends c.Component{constructor(){super(...arguments),o(this,"callPlayer",d.callPlayer),o(this,"mute",()=>{this.setVolume(0)}),o(this,"unmute",()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),o(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{playing:r,config:s,onError:a,onDuration:n}=this.props,l=e&&e.match(P.MATCH_URL_VIDYARD)[1];this.player&&this.stop(),(0,d.getSDK)(x,C,N).then(p=>{this.container&&(p.api.addReadyListener((u,g)=>{this.player||(this.player=g,this.player.on("ready",this.props.onReady),this.player.on("play",this.props.onPlay),this.player.on("pause",this.props.onPause),this.player.on("seek",this.props.onSeek),this.player.on("playerComplete",this.props.onEnded))},l),p.api.renderPlayer({uuid:l,container:this.container,autoplay:r?1:0,...s.options}),p.api.getPlayerMetadata(l).then(u=>{this.duration=u.length_in_seconds,n(u.length_in_seconds)}))},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){window.VidyardV4.api.destroyPlayer(this.player)}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setPlaybackRate(e){this.callPlayer("setPlaybackSpeed",e)}getDuration(){return this.duration}getCurrentTime(){return this.callPlayer("currentTime")}getSecondsLoaded(){return null}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}o(y,"displayName","Vidyard");o(y,"canPlay",P.canPlay.vidyard);const T=m(f),K=V({__proto__:null,default:T},[f]);export{K as V}; +import{g as m,r as v,u as b,p as O}from"./index-BfxkfOYW.js";function V(t,e){for(var r=0;rs[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var D=Object.create,i=Object.defineProperty,j=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,S=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty,A=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of w(e))!M.call(t,a)&&a!==r&&i(t,a,{get:()=>e[a],enumerable:!(s=j(e,a))||s.enumerable});return t},L=(t,e,r)=>(r=t!=null?D(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),R=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(A(t,typeof e!="symbol"?e+"":e,r),r),_={};E(_,{default:()=>y});var f=R(_),c=L(v),d=b,P=O;const x="https://play.vidyard.com/embed/v4.js",C="VidyardV4",N="onVidyardAPI";class y extends c.Component{constructor(){super(...arguments),o(this,"callPlayer",d.callPlayer),o(this,"mute",()=>{this.setVolume(0)}),o(this,"unmute",()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),o(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{playing:r,config:s,onError:a,onDuration:n}=this.props,l=e&&e.match(P.MATCH_URL_VIDYARD)[1];this.player&&this.stop(),(0,d.getSDK)(x,C,N).then(p=>{this.container&&(p.api.addReadyListener((u,g)=>{this.player||(this.player=g,this.player.on("ready",this.props.onReady),this.player.on("play",this.props.onPlay),this.player.on("pause",this.props.onPause),this.player.on("seek",this.props.onSeek),this.player.on("playerComplete",this.props.onEnded))},l),p.api.renderPlayer({uuid:l,container:this.container,autoplay:r?1:0,...s.options}),p.api.getPlayerMetadata(l).then(u=>{this.duration=u.length_in_seconds,n(u.length_in_seconds)}))},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){window.VidyardV4.api.destroyPlayer(this.player)}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setPlaybackRate(e){this.callPlayer("setPlaybackSpeed",e)}getDuration(){return this.duration}getCurrentTime(){return this.callPlayer("currentTime")}getSecondsLoaded(){return null}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}o(y,"displayName","Vidyard");o(y,"canPlay",P.canPlay.vidyard);const T=m(f),K=V({__proto__:null,default:T},[f]);export{K as V}; diff --git a/assets/Vimeo-DM5D1w5E.js b/assets/Vimeo-CqPw8YBK.js similarity index 98% rename from assets/Vimeo-DM5D1w5E.js rename to assets/Vimeo-CqPw8YBK.js index 8d96e216ab..6d0ac21196 100644 --- a/assets/Vimeo-DM5D1w5E.js +++ b/assets/Vimeo-CqPw8YBK.js @@ -1 +1 @@ -import{g as d,r as f,u as m,p as _}from"./index-CnIrxdGO.js";function P(t,e){for(var r=0;ra[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty,w=(t,e,r)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!D.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(a=b(e,o))||a.enumerable});return t},j=(t,e,r)=>(r=t!=null?g(O(t)):{},h(!t||!t.__esModule?n(r,"default",{value:t,enumerable:!0}):r,t)),E=t=>h(n({},"__esModule",{value:!0}),t),i=(t,e,r)=>(w(t,typeof e!="symbol"?e+"":e,r),r),c={};M(c,{default:()=>l});var y=E(c),p=j(f),u=m,L=_;const S="https://player.vimeo.com/api/player.js",V="Vimeo",k=t=>t.replace("/manage/videos","");class l extends p.Component{constructor(){super(...arguments),i(this,"callPlayer",u.callPlayer),i(this,"duration",null),i(this,"currentTime",null),i(this,"secondsLoaded",null),i(this,"mute",()=>{this.setMuted(!0)}),i(this,"unmute",()=>{this.setMuted(!1)}),i(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){this.duration=null,(0,u.getSDK)(S,V).then(r=>{if(!this.container)return;const{playerOptions:a,title:o}=this.props.config;this.player=new r.Player(this.container,{url:k(e),autoplay:this.props.playing,muted:this.props.muted,loop:this.props.loop,playsinline:this.props.playsinline,controls:this.props.controls,...a}),this.player.ready().then(()=>{const s=this.container.querySelector("iframe");s.style.width="100%",s.style.height="100%",o&&(s.title=o)}).catch(this.props.onError),this.player.on("loaded",()=>{this.props.onReady(),this.refreshDuration()}),this.player.on("play",()=>{this.props.onPlay(),this.refreshDuration()}),this.player.on("pause",this.props.onPause),this.player.on("seeked",s=>this.props.onSeek(s.seconds)),this.player.on("ended",this.props.onEnded),this.player.on("error",this.props.onError),this.player.on("timeupdate",({seconds:s})=>{this.currentTime=s}),this.player.on("progress",({seconds:s})=>{this.secondsLoaded=s}),this.player.on("bufferstart",this.props.onBuffer),this.player.on("bufferend",this.props.onBufferEnd),this.player.on("playbackratechange",s=>this.props.onPlaybackRateChange(s.playbackRate))},this.props.onError)}refreshDuration(){this.player.getDuration().then(e=>{this.duration=e})}play(){const e=this.callPlayer("play");e&&e.catch(this.props.onError)}pause(){this.callPlayer("pause")}stop(){this.callPlayer("unload")}seekTo(e,r=!0){this.callPlayer("setCurrentTime",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setMuted(e){this.callPlayer("setMuted",e)}setLoop(e){this.callPlayer("setLoop",e)}setPlaybackRate(e){this.callPlayer("setPlaybackRate",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const{display:e}=this.props,r={width:"100%",height:"100%",overflow:"hidden",display:e};return p.default.createElement("div",{key:this.props.url,ref:this.ref,style:r})}}i(l,"displayName","Vimeo");i(l,"canPlay",L.canPlay.vimeo);i(l,"forceLoad",!0);const T=d(y),C=P({__proto__:null,default:T},[y]);export{C as V}; +import{g as d,r as f,u as m,p as _}from"./index-BfxkfOYW.js";function P(t,e){for(var r=0;ra[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty,w=(t,e,r)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!D.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(a=b(e,o))||a.enumerable});return t},j=(t,e,r)=>(r=t!=null?g(O(t)):{},h(!t||!t.__esModule?n(r,"default",{value:t,enumerable:!0}):r,t)),E=t=>h(n({},"__esModule",{value:!0}),t),i=(t,e,r)=>(w(t,typeof e!="symbol"?e+"":e,r),r),c={};M(c,{default:()=>l});var y=E(c),p=j(f),u=m,L=_;const S="https://player.vimeo.com/api/player.js",V="Vimeo",k=t=>t.replace("/manage/videos","");class l extends p.Component{constructor(){super(...arguments),i(this,"callPlayer",u.callPlayer),i(this,"duration",null),i(this,"currentTime",null),i(this,"secondsLoaded",null),i(this,"mute",()=>{this.setMuted(!0)}),i(this,"unmute",()=>{this.setMuted(!1)}),i(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){this.duration=null,(0,u.getSDK)(S,V).then(r=>{if(!this.container)return;const{playerOptions:a,title:o}=this.props.config;this.player=new r.Player(this.container,{url:k(e),autoplay:this.props.playing,muted:this.props.muted,loop:this.props.loop,playsinline:this.props.playsinline,controls:this.props.controls,...a}),this.player.ready().then(()=>{const s=this.container.querySelector("iframe");s.style.width="100%",s.style.height="100%",o&&(s.title=o)}).catch(this.props.onError),this.player.on("loaded",()=>{this.props.onReady(),this.refreshDuration()}),this.player.on("play",()=>{this.props.onPlay(),this.refreshDuration()}),this.player.on("pause",this.props.onPause),this.player.on("seeked",s=>this.props.onSeek(s.seconds)),this.player.on("ended",this.props.onEnded),this.player.on("error",this.props.onError),this.player.on("timeupdate",({seconds:s})=>{this.currentTime=s}),this.player.on("progress",({seconds:s})=>{this.secondsLoaded=s}),this.player.on("bufferstart",this.props.onBuffer),this.player.on("bufferend",this.props.onBufferEnd),this.player.on("playbackratechange",s=>this.props.onPlaybackRateChange(s.playbackRate))},this.props.onError)}refreshDuration(){this.player.getDuration().then(e=>{this.duration=e})}play(){const e=this.callPlayer("play");e&&e.catch(this.props.onError)}pause(){this.callPlayer("pause")}stop(){this.callPlayer("unload")}seekTo(e,r=!0){this.callPlayer("setCurrentTime",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setMuted(e){this.callPlayer("setMuted",e)}setLoop(e){this.callPlayer("setLoop",e)}setPlaybackRate(e){this.callPlayer("setPlaybackRate",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const{display:e}=this.props,r={width:"100%",height:"100%",overflow:"hidden",display:e};return p.default.createElement("div",{key:this.props.url,ref:this.ref,style:r})}}i(l,"displayName","Vimeo");i(l,"canPlay",L.canPlay.vimeo);i(l,"forceLoad",!0);const T=d(y),C=P({__proto__:null,default:T},[y]);export{C as V}; diff --git a/assets/Wistia-BWPNehd-.js b/assets/Wistia-rK1r5TC7.js similarity index 98% rename from assets/Wistia-BWPNehd-.js rename to assets/Wistia-rK1r5TC7.js index 9a6cd9395c..3aebf25ddf 100644 --- a/assets/Wistia-BWPNehd-.js +++ b/assets/Wistia-rK1r5TC7.js @@ -1 +1 @@ -import{g,r as m,u as v,p as w}from"./index-CnIrxdGO.js";function O(t,e){for(var a=0;as[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var C=Object.create,i=Object.defineProperty,k=Object.getOwnPropertyDescriptor,D=Object.getOwnPropertyNames,E=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty,R=(t,e,a)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,j=(t,e)=>{for(var a in e)i(t,a,{get:e[a],enumerable:!0})},h=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of D(e))!S.call(t,r)&&r!==a&&i(t,r,{get:()=>e[r],enumerable:!(s=k(e,r))||s.enumerable});return t},I=(t,e,a)=>(a=t!=null?C(E(t)):{},h(!t||!t.__esModule?i(a,"default",{value:t,enumerable:!0}):a,t)),M=t=>h(i({},"__esModule",{value:!0}),t),n=(t,e,a)=>(R(t,typeof e!="symbol"?e+"":e,a),a),d={};j(d,{default:()=>l});var _=M(d),y=I(m),c=v,P=w;const W="https://fast.wistia.com/assets/external/E-v1.js",x="Wistia",A="wistia-player-";class l extends y.Component{constructor(){super(...arguments),n(this,"callPlayer",c.callPlayer),n(this,"playerID",this.props.config.playerId||`${A}${(0,c.randomString)()}`),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onSeek",(...e)=>this.props.onSeek(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onPlaybackRateChange",(...e)=>this.props.onPlaybackRateChange(...e)),n(this,"mute",()=>{this.callPlayer("mute")}),n(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{playing:a,muted:s,controls:r,onReady:o,config:p,onError:b}=this.props;(0,c.getSDK)(W,x).then(f=>{p.customControls&&p.customControls.forEach(u=>f.defineControl(u)),window._wq=window._wq||[],window._wq.push({id:this.playerID,options:{autoPlay:a,silentAutoPlay:"allow",muted:s,controlsVisibleOnLoad:r,fullscreenButton:r,playbar:r,playbackRateControl:r,qualityControl:r,volumeControl:r,settingsControl:r,smallPlayButton:r,...p.options},onReady:u=>{this.player=u,this.unbind(),this.player.bind("play",this.onPlay),this.player.bind("pause",this.onPause),this.player.bind("seek",this.onSeek),this.player.bind("end",this.onEnded),this.player.bind("playbackratechange",this.onPlaybackRateChange),o()}})},b)}unbind(){this.player.unbind("play",this.onPlay),this.player.unbind("pause",this.onPause),this.player.unbind("seek",this.onSeek),this.player.unbind("end",this.onEnded),this.player.unbind("playbackratechange",this.onPlaybackRateChange)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){this.unbind(),this.callPlayer("remove")}seekTo(e,a=!0){this.callPlayer("time",e),a||this.pause()}setVolume(e){this.callPlayer("volume",e)}setPlaybackRate(e){this.callPlayer("playbackRate",e)}getDuration(){return this.callPlayer("duration")}getCurrentTime(){return this.callPlayer("time")}getSecondsLoaded(){return null}render(){const{url:e}=this.props,a=e&&e.match(P.MATCH_URL_WISTIA)[1],s=`wistia_embed wistia_async_${a}`,r={width:"100%",height:"100%"};return y.default.createElement("div",{id:this.playerID,key:a,className:s,style:r})}}n(l,"displayName","Wistia");n(l,"canPlay",P.canPlay.wistia);n(l,"loopOnEnded",!0);const L=g(_),T=O({__proto__:null,default:L},[_]);export{T as W}; +import{g,r as m,u as v,p as w}from"./index-BfxkfOYW.js";function O(t,e){for(var a=0;as[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var C=Object.create,i=Object.defineProperty,k=Object.getOwnPropertyDescriptor,D=Object.getOwnPropertyNames,E=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty,R=(t,e,a)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,j=(t,e)=>{for(var a in e)i(t,a,{get:e[a],enumerable:!0})},h=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of D(e))!S.call(t,r)&&r!==a&&i(t,r,{get:()=>e[r],enumerable:!(s=k(e,r))||s.enumerable});return t},I=(t,e,a)=>(a=t!=null?C(E(t)):{},h(!t||!t.__esModule?i(a,"default",{value:t,enumerable:!0}):a,t)),M=t=>h(i({},"__esModule",{value:!0}),t),n=(t,e,a)=>(R(t,typeof e!="symbol"?e+"":e,a),a),d={};j(d,{default:()=>l});var _=M(d),y=I(m),c=v,P=w;const W="https://fast.wistia.com/assets/external/E-v1.js",x="Wistia",A="wistia-player-";class l extends y.Component{constructor(){super(...arguments),n(this,"callPlayer",c.callPlayer),n(this,"playerID",this.props.config.playerId||`${A}${(0,c.randomString)()}`),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onSeek",(...e)=>this.props.onSeek(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onPlaybackRateChange",(...e)=>this.props.onPlaybackRateChange(...e)),n(this,"mute",()=>{this.callPlayer("mute")}),n(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{playing:a,muted:s,controls:r,onReady:o,config:p,onError:b}=this.props;(0,c.getSDK)(W,x).then(f=>{p.customControls&&p.customControls.forEach(u=>f.defineControl(u)),window._wq=window._wq||[],window._wq.push({id:this.playerID,options:{autoPlay:a,silentAutoPlay:"allow",muted:s,controlsVisibleOnLoad:r,fullscreenButton:r,playbar:r,playbackRateControl:r,qualityControl:r,volumeControl:r,settingsControl:r,smallPlayButton:r,...p.options},onReady:u=>{this.player=u,this.unbind(),this.player.bind("play",this.onPlay),this.player.bind("pause",this.onPause),this.player.bind("seek",this.onSeek),this.player.bind("end",this.onEnded),this.player.bind("playbackratechange",this.onPlaybackRateChange),o()}})},b)}unbind(){this.player.unbind("play",this.onPlay),this.player.unbind("pause",this.onPause),this.player.unbind("seek",this.onSeek),this.player.unbind("end",this.onEnded),this.player.unbind("playbackratechange",this.onPlaybackRateChange)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){this.unbind(),this.callPlayer("remove")}seekTo(e,a=!0){this.callPlayer("time",e),a||this.pause()}setVolume(e){this.callPlayer("volume",e)}setPlaybackRate(e){this.callPlayer("playbackRate",e)}getDuration(){return this.callPlayer("duration")}getCurrentTime(){return this.callPlayer("time")}getSecondsLoaded(){return null}render(){const{url:e}=this.props,a=e&&e.match(P.MATCH_URL_WISTIA)[1],s=`wistia_embed wistia_async_${a}`,r={width:"100%",height:"100%"};return y.default.createElement("div",{id:this.playerID,key:a,className:s,style:r})}}n(l,"displayName","Wistia");n(l,"canPlay",P.canPlay.wistia);n(l,"loopOnEnded",!0);const L=g(_),T=O({__proto__:null,default:L},[_]);export{T as W}; diff --git a/assets/YouTube-BjhGkced.js b/assets/YouTube-DcDtkFBr.js similarity index 98% rename from assets/YouTube-BjhGkced.js rename to assets/YouTube-DcDtkFBr.js index 77f1436e00..8e6c337198 100644 --- a/assets/YouTube-BjhGkced.js +++ b/assets/YouTube-DcDtkFBr.js @@ -1 +1 @@ -import{g as U,r as I,u as L,p as M}from"./index-CnIrxdGO.js";function Y(a,e){for(var t=0;ts[r]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var k=Object.create,u=Object.defineProperty,N=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,V=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,x=(a,e,t)=>e in a?u(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,K=(a,e)=>{for(var t in e)u(a,t,{get:e[t],enumerable:!0})},v=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of j(e))!B.call(a,r)&&r!==t&&u(a,r,{get:()=>e[r],enumerable:!(s=N(e,r))||s.enumerable});return a},F=(a,e,t)=>(t=a!=null?k(V(a)):{},v(!a||!a.__esModule?u(t,"default",{value:a,enumerable:!0}):t,a)),H=a=>v(u({},"__esModule",{value:!0}),a),o=(a,e,t)=>(x(a,typeof e!="symbol"?e+"":e,t),t),w={};K(w,{default:()=>O});var S=H(w),b=F(I),p=L,D=M;const G="https://www.youtube.com/iframe_api",T="YT",z="onYouTubeIframeAPIReady",f=/[?&](?:list|channel)=([a-zA-Z0-9_-]+)/,m=/user\/([a-zA-Z0-9_-]+)\/?/,Q=/youtube-nocookie\.com/,Z="https://www.youtube-nocookie.com";class O extends b.Component{constructor(){super(...arguments),o(this,"callPlayer",p.callPlayer),o(this,"parsePlaylist",e=>{if(e instanceof Array)return{listType:"playlist",playlist:e.map(this.getID).join(",")};if(f.test(e)){const[,t]=e.match(f);return{listType:"playlist",list:t.replace(/^UC/,"UU")}}if(m.test(e)){const[,t]=e.match(m);return{listType:"user_uploads",list:t}}return{}}),o(this,"onStateChange",e=>{const{data:t}=e,{onPlay:s,onPause:r,onBuffer:n,onBufferEnd:P,onEnded:_,onReady:g,loop:y,config:{playerVars:l,onUnstarted:h}}=this.props,{UNSTARTED:d,PLAYING:c,PAUSED:i,BUFFERING:E,ENDED:A,CUED:C}=window[T].PlayerState;if(t===d&&h(),t===c&&(s(),P()),t===i&&r(),t===E&&n(),t===A){const R=!!this.callPlayer("getPlaylist");y&&!R&&(l.start?this.seekTo(l.start):this.play()),_()}t===C&&g()}),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unMute")}),o(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}getID(e){return!e||e instanceof Array||f.test(e)?null:e.match(D.MATCH_URL_YOUTUBE)[1]}load(e,t){const{playing:s,muted:r,playsinline:n,controls:P,loop:_,config:g,onError:y}=this.props,{playerVars:l,embedOptions:h}=g,d=this.getID(e);if(t){if(f.test(e)||m.test(e)||e instanceof Array){this.player.loadPlaylist(this.parsePlaylist(e));return}this.player.cueVideoById({videoId:d,startSeconds:(0,p.parseStartTime)(e)||l.start,endSeconds:(0,p.parseEndTime)(e)||l.end});return}(0,p.getSDK)(G,T,z,c=>c.loaded).then(c=>{this.container&&(this.player=new c.Player(this.container,{width:"100%",height:"100%",videoId:d,playerVars:{autoplay:s?1:0,mute:r?1:0,controls:P?1:0,start:(0,p.parseStartTime)(e),end:(0,p.parseEndTime)(e),origin:window.location.origin,playsinline:n?1:0,...this.parsePlaylist(e),...l},events:{onReady:()=>{_&&this.player.setLoop(!0),this.props.onReady()},onPlaybackRateChange:i=>this.props.onPlaybackRateChange(i.data),onPlaybackQualityChange:i=>this.props.onPlaybackQualityChange(i),onStateChange:this.onStateChange,onError:i=>y(i.data)},host:Q.test(e)?Z:void 0,...h}))},y),h.events&&console.warn("Using `embedOptions.events` will likely break things. Use ReactPlayer’s callback props instead, eg onReady, onPlay, onPause")}play(){this.callPlayer("playVideo")}pause(){this.callPlayer("pauseVideo")}stop(){document.body.contains(this.callPlayer("getIframe"))&&this.callPlayer("stopVideo")}seekTo(e,t=!1){this.callPlayer("seekTo",e),!t&&!this.props.playing&&this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}setPlaybackRate(e){this.callPlayer("setPlaybackRate",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentTime")}getSecondsLoaded(){return this.callPlayer("getVideoLoadedFraction")*this.getDuration()}render(){const{display:e}=this.props,t={width:"100%",height:"100%",display:e};return b.default.createElement("div",{style:t},b.default.createElement("div",{ref:this.ref}))}}o(O,"displayName","YouTube");o(O,"canPlay",D.canPlay.youtube);const $=U(S),q=Y({__proto__:null,default:$},[S]);export{q as Y}; +import{g as U,r as I,u as L,p as M}from"./index-BfxkfOYW.js";function Y(a,e){for(var t=0;ts[r]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var k=Object.create,u=Object.defineProperty,N=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,V=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,x=(a,e,t)=>e in a?u(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,K=(a,e)=>{for(var t in e)u(a,t,{get:e[t],enumerable:!0})},v=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of j(e))!B.call(a,r)&&r!==t&&u(a,r,{get:()=>e[r],enumerable:!(s=N(e,r))||s.enumerable});return a},F=(a,e,t)=>(t=a!=null?k(V(a)):{},v(!a||!a.__esModule?u(t,"default",{value:a,enumerable:!0}):t,a)),H=a=>v(u({},"__esModule",{value:!0}),a),o=(a,e,t)=>(x(a,typeof e!="symbol"?e+"":e,t),t),w={};K(w,{default:()=>O});var S=H(w),b=F(I),p=L,D=M;const G="https://www.youtube.com/iframe_api",T="YT",z="onYouTubeIframeAPIReady",f=/[?&](?:list|channel)=([a-zA-Z0-9_-]+)/,m=/user\/([a-zA-Z0-9_-]+)\/?/,Q=/youtube-nocookie\.com/,Z="https://www.youtube-nocookie.com";class O extends b.Component{constructor(){super(...arguments),o(this,"callPlayer",p.callPlayer),o(this,"parsePlaylist",e=>{if(e instanceof Array)return{listType:"playlist",playlist:e.map(this.getID).join(",")};if(f.test(e)){const[,t]=e.match(f);return{listType:"playlist",list:t.replace(/^UC/,"UU")}}if(m.test(e)){const[,t]=e.match(m);return{listType:"user_uploads",list:t}}return{}}),o(this,"onStateChange",e=>{const{data:t}=e,{onPlay:s,onPause:r,onBuffer:n,onBufferEnd:P,onEnded:_,onReady:g,loop:y,config:{playerVars:l,onUnstarted:h}}=this.props,{UNSTARTED:d,PLAYING:c,PAUSED:i,BUFFERING:E,ENDED:A,CUED:C}=window[T].PlayerState;if(t===d&&h(),t===c&&(s(),P()),t===i&&r(),t===E&&n(),t===A){const R=!!this.callPlayer("getPlaylist");y&&!R&&(l.start?this.seekTo(l.start):this.play()),_()}t===C&&g()}),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unMute")}),o(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}getID(e){return!e||e instanceof Array||f.test(e)?null:e.match(D.MATCH_URL_YOUTUBE)[1]}load(e,t){const{playing:s,muted:r,playsinline:n,controls:P,loop:_,config:g,onError:y}=this.props,{playerVars:l,embedOptions:h}=g,d=this.getID(e);if(t){if(f.test(e)||m.test(e)||e instanceof Array){this.player.loadPlaylist(this.parsePlaylist(e));return}this.player.cueVideoById({videoId:d,startSeconds:(0,p.parseStartTime)(e)||l.start,endSeconds:(0,p.parseEndTime)(e)||l.end});return}(0,p.getSDK)(G,T,z,c=>c.loaded).then(c=>{this.container&&(this.player=new c.Player(this.container,{width:"100%",height:"100%",videoId:d,playerVars:{autoplay:s?1:0,mute:r?1:0,controls:P?1:0,start:(0,p.parseStartTime)(e),end:(0,p.parseEndTime)(e),origin:window.location.origin,playsinline:n?1:0,...this.parsePlaylist(e),...l},events:{onReady:()=>{_&&this.player.setLoop(!0),this.props.onReady()},onPlaybackRateChange:i=>this.props.onPlaybackRateChange(i.data),onPlaybackQualityChange:i=>this.props.onPlaybackQualityChange(i),onStateChange:this.onStateChange,onError:i=>y(i.data)},host:Q.test(e)?Z:void 0,...h}))},y),h.events&&console.warn("Using `embedOptions.events` will likely break things. Use ReactPlayer’s callback props instead, eg onReady, onPlay, onPause")}play(){this.callPlayer("playVideo")}pause(){this.callPlayer("pauseVideo")}stop(){document.body.contains(this.callPlayer("getIframe"))&&this.callPlayer("stopVideo")}seekTo(e,t=!1){this.callPlayer("seekTo",e),!t&&!this.props.playing&&this.pause()}setVolume(e){this.callPlayer("setVolume",e*100)}setPlaybackRate(e){this.callPlayer("setPlaybackRate",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentTime")}getSecondsLoaded(){return this.callPlayer("getVideoLoadedFraction")*this.getDuration()}render(){const{display:e}=this.props,t={width:"100%",height:"100%",display:e};return b.default.createElement("div",{style:t},b.default.createElement("div",{ref:this.ref}))}}o(O,"displayName","YouTube");o(O,"canPlay",D.canPlay.youtube);const $=U(S),q=Y({__proto__:null,default:$},[S]);export{q as Y}; diff --git a/assets/index-CnIrxdGO.js b/assets/index-BfxkfOYW.js similarity index 98% rename from assets/index-CnIrxdGO.js rename to assets/index-BfxkfOYW.js index a5d328d95f..ad42c0ca8e 100644 --- a/assets/index-CnIrxdGO.js +++ b/assets/index-BfxkfOYW.js @@ -522,7 +522,7 @@ ${ut.map(Et=>`• ${Et}`).join(` 2. Have setup a verifier on dashboard.web3auth.io?`);if(it)throw new Error(`node results do not match at first lookup ${JSON.stringify(ot||{})}, ${JSON.stringify(it||{})}`);if(log$1.debug("> torus.js/getPublicAddress",{keyResult:ot}),!(ot!=null&&ot.keys))throw new Error(`node results do not match at final lookup ${JSON.stringify(ot||{})}, ${JSON.stringify(it||{})}`);if(!ct&&!rt&&!LEGACY_NETWORKS_ROUTE_MAP[this.network])throw new GetOrSetNonceError("metadata nonce is missing in share response");const{pub_key_X:ut,pub_key_Y:ht}=ot.keys[0];let Et;const St=new BN((ct==null?void 0:ct.nonce)||"0",16);let Mt,kt;if(rt)kt=this.ec.keyFromPublic({x:ut,y:ht}).getPublic(),Mt=kt;else{if(LEGACY_NETWORKS_ROUTE_MAP[this.network])return this.formatLegacyPublicKeyData({isNewKey:ot.is_new_key,enableOneKey:j,finalKeyResult:{keys:ot.keys}});{const $t=ct;Mt=this.ec.keyFromPublic({x:ut,y:ht}).getPublic(),kt=this.ec.keyFromPublic({x:ut,y:ht}).getPublic().add(this.ec.keyFromPublic({x:$t.pubNonce.x,y:$t.pubNonce.y}).getPublic()),Et={X:$t.pubNonce.x,Y:$t.pubNonce.y}}}if(!Mt)throw new Error("Unable to derive oAuthPubKey");const Ct=Mt.getX().toString(16,64),Ot=Mt.getY().toString(16,64),zt=generateAddressFromPubKey(this.ec,Mt.getX(),Mt.getY());if(log$1.debug("> torus.js/getPublicAddress, oAuthKeyData",{X:Ct,Y:Ot,oAuthAddress:zt,nonce:St==null?void 0:St.toString(16),pubNonce:Et}),!kt)throw new Error("Unable to derive finalPubKey");const Ut=kt?kt.getX().toString(16,64):"",Vt=kt?kt.getY().toString(16,64):"",jt=kt?generateAddressFromPubKey(this.ec,kt.getX(),kt.getY()):"";return{oAuthKeyData:{evmAddress:zt,X:Ct,Y:Ot},finalKeyData:{evmAddress:jt,X:Ut,Y:Vt},metadata:{pubNonce:Et,nonce:St,upgraded:(ct==null?void 0:ct.upgraded)||!1,typeOfUser:"v2"},nodesData:{nodeIndexes:st}}}async formatLegacyPublicKeyData(a){var $,j;const{finalKeyResult:et,enableOneKey:tt,isNewKey:rt}=a,{pub_key_X:nt,pub_key_Y:it}=et.keys[0];let ot,st,ct,ut,ht;const Et=this.ec.keyFromPublic({x:nt,y:it}).getPublic();if(tt){try{ot=await getOrSetNonce(this.legacyMetadataHost,this.ec,this.serverTimeOffset,nt,it,void 0,!rt),st=new BN(ot.nonce||"0",16),ut=ot.typeOfUser}catch{throw new GetOrSetNonceError}if(ot.typeOfUser==="v1")st=await getMetadata(this.legacyMetadataHost,{pub_key_X:nt,pub_key_Y:it}),ct=this.ec.keyFromPublic({x:nt,y:it}).getPublic().add(this.ec.keyFromPrivate(st.toString(16,64),"hex").getPublic());else if(ot.typeOfUser==="v2")ct=this.ec.keyFromPublic({x:nt,y:it}).getPublic().add(this.ec.keyFromPublic({x:ot.pubNonce.x,y:ot.pubNonce.y}).getPublic()),ht={X:ot.pubNonce.x,Y:ot.pubNonce.y};else throw new Error("getOrSetNonce should always return typeOfUser.")}else ut="v1",st=await getMetadata(this.legacyMetadataHost,{pub_key_X:nt,pub_key_Y:it}),ct=this.ec.keyFromPublic({x:nt,y:it}).getPublic().add(this.ec.keyFromPrivate(st.toString(16,64),"hex").getPublic());if(!Et)throw new Error("Unable to derive oAuthPubKey");const St=Et.getX().toString(16,64),Mt=Et.getY().toString(16,64),kt=generateAddressFromPubKey(this.ec,Et.getX(),Et.getY());if(log$1.debug("> torus.js/getPublicAddress, oAuthKeyData",{X:St,Y:Mt,oAuthAddress:kt,nonce:($=st)===null||$===void 0?void 0:$.toString(16),pubNonce:ht}),ut==="v2"&&!ct)throw new Error("Unable to derive finalPubKey");const Ct=ct?ct.getX().toString(16,64):"",Ot=ct?ct.getY().toString(16,64):"",zt=ct?generateAddressFromPubKey(this.ec,ct.getX(),ct.getY()):"";return{oAuthKeyData:{evmAddress:kt,X:St,Y:Mt},finalKeyData:{evmAddress:zt,X:Ct,Y:Ot},metadata:{pubNonce:ht,nonce:st,upgraded:((j=ot)===null||j===void 0?void 0:j.upgraded)||!1,typeOfUser:ut},nodesData:{nodeIndexes:[]}}}}var isLocalhost=function(){return!!(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/))},waitWindowLoad;typeof window<"u"&&(typeof document<"u"&&(document.readyState==="interactive"||document.readyState==="complete")?waitWindowLoad=Promise.resolve():typeof Promise<"u"?waitWindowLoad=new Promise(function(_){return window.addEventListener("load",_)}):waitWindowLoad={then:function(_){return window.addEventListener("load",_)}});var register=function _(a,$){$===void 0&&($={});var j=$.registrationOptions;j===void 0&&(j={}),delete $.registrationOptions;var et=function(tt){for(var rt=[],nt=arguments.length-1;nt-- >0;)rt[nt]=arguments[nt+1];$&&$[tt]&&$[tt].apply($,rt)};"serviceWorker"in navigator&&waitWindowLoad.then(function(){isLocalhost()?(checkValidServiceWorker(a,et,j),navigator.serviceWorker.ready.then(function(tt){et("ready",tt)}).catch(function(tt){return handleError(et,tt)})):(registerValidSW(a,et,j),navigator.serviceWorker.ready.then(function(tt){et("ready",tt)}).catch(function(tt){return handleError(et,tt)}))})};function handleError(_,a){navigator.onLine||_("offline"),_("error",a)}function registerValidSW(_,a,$){navigator.serviceWorker.register(_,$).then(function(j){if(a("registered",j),j.waiting){a("updated",j);return}j.onupdatefound=function(){a("updatefound",j);var et=j.installing;et.onstatechange=function(){et.state==="installed"&&(navigator.serviceWorker.controller?a("updated",j):a("cached",j))}}}).catch(function(j){return handleError(a,j)})}function checkValidServiceWorker(_,a,$){fetch(_).then(function(j){j.status===404?(a("error",new Error("Service worker not found at "+_)),unregister()):j.headers.get("content-type").indexOf("javascript")===-1?(a("error",new Error("Expected "+_+" to have javascript content-type, but received "+j.headers.get("content-type"))),unregister()):registerValidSW(_,a,$)}).catch(function(j){return handleError(a,j)})}function keccak256(_){return Buffer$g.from(keccak256$3(_))}const ec=new ellipticExports.ec("secp256k1");function encParamsHexToBuf(_){return{iv:Buffer$g.from(_.iv,"hex"),ephemPublicKey:Buffer$g.from(_.ephemPublicKey,"hex"),ciphertext:Buffer$g.from(_.ciphertext,"hex"),mac:Buffer$g.from(_.mac,"hex")}}function encParamsBufToHex(_){return{iv:Buffer$g.from(_.iv).toString("hex"),ephemPublicKey:Buffer$g.from(_.ephemPublicKey).toString("hex"),ciphertext:Buffer$g.from(_.ciphertext).toString("hex"),mac:Buffer$g.from(_.mac).toString("hex")}}async function encryptData(_,a){const $=JSON.stringify(a),j=Buffer$g.from($,"utf-8"),et=await encrypt(getPublic(Buffer$g.from(_,"hex")),j),tt=encParamsBufToHex(et);return JSON.stringify(tt)}async function decryptData(_,a){const $=JSON.parse(a),j=encParamsHexToBuf($),et=ec.keyFromPrivate(_),rt=(await decrypt(Buffer$g.from(et.getPrivate().toString("hex",64),"hex"),j)).toString("utf-8");return JSON.parse(rt)}const LOGIN={GOOGLE:"google",FACEBOOK:"facebook",REDDIT:"reddit",DISCORD:"discord",TWITCH:"twitch",APPLE:"apple",GITHUB:"github",LINKEDIN:"linkedin",TWITTER:"twitter",WEIBO:"weibo",LINE:"line",EMAIL_PASSWORD:"email_password",PASSWORDLESS:"passwordless",JWT:"jwt",WEBAUTHN:"webauthn"},AGGREGATE_VERIFIER={SINGLE_VERIFIER_ID:"single_id_verifier"},UX_MODE={POPUP:"popup",REDIRECT:"redirect"},REDIRECT_PARAMS_STORAGE_METHOD={LOCAL_STORAGE:"localStorage",SESSION_STORAGE:"sessionStorage",SERVER:"server"},TORUS_METHOD={TRIGGER_LOGIN:"triggerLogin",TRIGGER_AGGREGATE_LOGIN:"triggerAggregateLogin",TRIGGER_AGGREGATE_HYBRID_LOGIN:"triggerHybridAggregateLogin"},SENTRY_TXNS={FETCH_NODE_DETAILS:"fetchNodeDetails",PUB_ADDRESS_LOOKUP:"pubAddressLookup",FETCH_SHARES:"fetchShares"};var log=log$1$1.getLogger("customauth");const loginToConnectionMap={[LOGIN.APPLE]:"apple",[LOGIN.GITHUB]:"github",[LOGIN.LINKEDIN]:"linkedin",[LOGIN.TWITTER]:"twitter",[LOGIN.WEIBO]:"weibo",[LOGIN.LINE]:"line",[LOGIN.EMAIL_PASSWORD]:"Username-Password-Authentication",[LOGIN.PASSWORDLESS]:"email"},padUrlString=_=>_.href.endsWith("/")?_.href:`${_.href}/`,randomId=()=>Math.random().toString(36).slice(2),broadcastChannelOptions={webWorkerSupport:!1};function caseSensitiveField(_,a){return a?_:_.toLowerCase()}const getVerifierId=function(_,a,$){let j=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;const{name:et,sub:tt}=_;if($)return caseSensitiveField(_[$],j);switch(a){case LOGIN.PASSWORDLESS:case LOGIN.EMAIL_PASSWORD:return caseSensitiveField(et,j);case LOGIN.WEIBO:case LOGIN.GITHUB:case LOGIN.TWITTER:case LOGIN.APPLE:case LOGIN.LINKEDIN:case LOGIN.LINE:case LOGIN.JWT:return caseSensitiveField(tt,j);default:throw new Error("Invalid login type")}},handleRedirectParameters=(_,a)=>{const $=_.split("&").reduce((tt,rt)=>{const[nt,it]=rt.split("=");return tt[nt]=it,tt},{});log.info($,a);let j={},et="";return Object.keys($).length>0&&$.state?(j=JSON.parse(base64url.decode(decodeURIComponent(decodeURIComponent($.state))))||{},et=$.error_description||$.error||et):Object.keys(a).length>0&&a.state&&(j=JSON.parse(base64url.decode(decodeURIComponent(decodeURIComponent(a.state))))||{},a.error&&(et=a.error)),{error:et,instanceParameters:j,hashParameters:$}};function storageAvailable(_){let a;try{a=window[_];const $="__storage_test__";return a.setItem($,$),a.removeItem($),!0}catch($){const j=$;return j&&(j.code===22||j.code===1014||j.name==="QuotaExceededError"||j.name==="NS_ERROR_DOM_QUOTA_REACHED")&&a&&a.length!==0}}function getPopupFeatures(){const _=window.screenLeft!==void 0?window.screenLeft:window.screenX,a=window.screenTop!==void 0?window.screenTop:window.screenY,$=1200,j=700,et=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,tt=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,rt=1,nt=Math.abs((et-$)/2/rt+_),it=Math.abs((tt-j)/2/rt+a);return`titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=${j/rt},width=${$/rt},top=${it},left=${nt}`}const isFirefox=()=>{var _;return((_=window)===null||_===void 0||(_=_.navigator)===null||_===void 0?void 0:_.userAgent.toLowerCase().indexOf("firefox"))>-1||!1};function constructURL(_){const{baseURL:a,query:$,hash:j}=_,et=new URL(a);if($&&Object.keys($).forEach(tt=>{et.searchParams.append(tt,$[tt])}),j){const tt=new URL(constructURL({baseURL:a,query:j})).searchParams.toString();et.hash=tt}return et.toString()}function are3PCSupported(){var _;const a=Bowser.parse(navigator.userAgent);log.info(JSON.stringify(a),"current browser info");let $=!0;return(_=navigator)!==null&&_!==void 0&&_.brave&&($=!1),(a.engine.name===Bowser.ENGINE_MAP.WebKit||a.engine.name===Bowser.ENGINE_MAP.Gecko)&&($=!1),$}const validateAndConstructUrl=_=>{try{return new URL(decodeURIComponent(_))}catch(a){throw new Error(`${(a==null?void 0:a.message)||""}, Note: Your jwt domain: (i.e ${_}) must have http:// or https:// prefix`)}};function isMobileOrTablet(){const a=Bowser.getParser(navigator.userAgent).getPlatform();return a.type===Bowser.PLATFORMS_MAP.tablet||a.type===Bowser.PLATFORMS_MAP.mobile}function getTimeout(_){return(_===LOGIN.FACEBOOK||_===LOGIN.LINE)&&isMobileOrTablet()?1e3*60:1e3*10}class PopupHandler extends eventsExports.EventEmitter{constructor(a){let{url:$,target:j,features:et,timeout:tt=3e4}=a;super(),_defineProperty$4(this,"url",void 0),_defineProperty$4(this,"target",void 0),_defineProperty$4(this,"features",void 0),_defineProperty$4(this,"window",void 0),_defineProperty$4(this,"windowTimer",void 0),_defineProperty$4(this,"iClosedWindow",void 0),_defineProperty$4(this,"timeout",void 0),this.url=$,this.target=j||"_blank",this.features=et||getPopupFeatures(),this.window=void 0,this.windowTimer=void 0,this.iClosedWindow=!1,this.timeout=tt,this._setupTimer()}_setupTimer(){this.windowTimer=Number(setInterval(()=>{this.window&&this.window.closed&&(clearInterval(this.windowTimer),setTimeout(()=>{this.iClosedWindow||this.emit("close"),this.iClosedWindow=!1,this.window=void 0},this.timeout)),this.window===void 0&&clearInterval(this.windowTimer)},500))}open(){var a;return this.window=window.open(this.url.href,this.target,this.features),(a=this.window)!==null&&a!==void 0&&a.focus&&this.window.focus(),Promise.resolve()}close(){this.iClosedWindow=!0,this.window&&this.window.close()}redirect(a){a?window.location.replace(this.url.href):window.location.href=this.url.href}}const _excluded$2=["access_token","id_token"];class AbstractLoginHandler{constructor(a,$,j,et,tt,rt,nt,it){this.clientId=a,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,_defineProperty$4(this,"nonce",randomId()),_defineProperty$4(this,"finalURL",void 0)}get state(){return encodeURIComponent(base64url.encode(JSON.stringify(_objectSpread2(_objectSpread2({},this.customState||{}),{},{instanceId:this.nonce,verifier:this.verifier,typeOfLogin:this.typeOfLogin,redirectToOpener:this.redirectToOpener||!1}))))}handleLoginWindow(a){const $=new PopupHandler({url:this.finalURL,features:a.popupFeatures,timeout:getTimeout(this.typeOfLogin)});if(this.uxMode===UX_MODE.REDIRECT)$.redirect(a.locationReplaceOnRedirect);else return new Promise((j,et)=>{let tt;const rt=async nt=>{try{const{error:it,data:ot}=nt,st=ot||{},{instanceParams:ct,hashParams:{access_token:ut,id_token:ht}}=st,Et=_objectWithoutProperties(st.hashParams,_excluded$2);if(it){log.error(nt),et(new Error(`Error: ${it}. Info: ${JSON.stringify(nt.data||{})}`));return}nt.data&&ct.verifier===this.verifier&&(log.info(nt.data),!this.redirectToOpener&&tt&&await tt.postMessage({success:!0}),j(_objectSpread2(_objectSpread2({accessToken:ut,idToken:ht||""},Et),{},{state:ct})))}catch(it){log.error(it),et(it)}};if(!this.redirectToOpener)tt=new BroadcastChannel$1(`redirect_channel_${this.nonce}`,broadcastChannelOptions),tt.addEventListener("message",async nt=>{await rt(nt),tt.close(),$.close()});else{const nt=async it=>{if(!it.data)return;const ot=it.data;ot.channel===`redirect_channel_${this.nonce}`&&(window.removeEventListener("message",nt),rt(ot),$.close())};window.addEventListener("message",nt)}$.open(),$.once("close",()=>{tt&&tt.close(),et(new Error("user closed popup"))})});return null}}class DiscordHandler extends AbstractLoginHandler{constructor(a,$,j,et,tt,rt,nt,it){super(a,$,j,et,tt,rt,nt,it),this.clientId=a,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,_defineProperty$4(this,"RESPONSE_TYPE","token"),_defineProperty$4(this,"SCOPE","identify email"),this.setFinalUrl()}setFinalUrl(){const a=new URL("https://discord.com/api/oauth2/authorize"),$=JSON.parse(JSON.stringify(this.jwtParams||{})),j=deepmerge$1({state:this.state,response_type:this.RESPONSE_TYPE,client_id:this.clientId,redirect_uri:this.redirect_uri,scope:this.SCOPE},$);Object.keys(j).forEach(et=>{j[et]&&a.searchParams.append(et,j[et])}),this.finalURL=a}async getUserInfo(a){const{accessToken:$}=a,j=await get$2("https://discord.com/api/users/@me",{headers:{Authorization:`Bearer ${$}`}}),{id:et,avatar:tt,email:rt="",username:nt="",discriminator:it=""}=j;return{profileImage:tt===null?`https://cdn.discordapp.com/embed/avatars/${Number(it)%5}.png`:`https://cdn.discordapp.com/avatars/${et}/${tt}.png?size=2048`,name:`${nt}#${it}`,email:rt,verifierId:et,verifier:this.verifier,typeOfLogin:this.typeOfLogin}}}class FacebookHandler extends AbstractLoginHandler{constructor(a,$,j,et,tt,rt,nt,it){super(a,$,j,et,tt,rt,nt,it),this.clientId=a,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,_defineProperty$4(this,"RESPONSE_TYPE","token"),_defineProperty$4(this,"SCOPE","public_profile email"),this.setFinalUrl()}setFinalUrl(){const a=new URL("https://www.facebook.com/v15.0/dialog/oauth"),$=JSON.parse(JSON.stringify(this.jwtParams||{})),j=deepmerge$1({state:this.state,response_type:this.RESPONSE_TYPE,client_id:this.clientId,redirect_uri:this.redirect_uri,scope:this.SCOPE},$);Object.keys(j).forEach(et=>{j[et]&&a.searchParams.append(et,j[et])}),this.finalURL=a}async getUserInfo(a){const{accessToken:$}=a,j=await get$2("https://graph.facebook.com/me?fields=name,email,picture.type(large)",{headers:{Authorization:`Bearer ${$}`}}),{name:et="",id:tt,picture:rt,email:nt=""}=j;return{email:nt,name:et,profileImage:rt.data.url||"",verifier:this.verifier,verifierId:tt,typeOfLogin:this.typeOfLogin}}}class GoogleHandler extends AbstractLoginHandler{constructor(a,$,j,et,tt,rt,nt,it){super(a,$,j,et,tt,rt,nt,it),this.clientId=a,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,_defineProperty$4(this,"RESPONSE_TYPE","token id_token"),_defineProperty$4(this,"SCOPE","profile email openid"),_defineProperty$4(this,"PROMPT","consent select_account"),this.setFinalUrl()}setFinalUrl(){const a=new URL("https://accounts.google.com/o/oauth2/v2/auth"),$=JSON.parse(JSON.stringify(this.jwtParams||{})),j=deepmerge$1({state:this.state,response_type:this.RESPONSE_TYPE,client_id:this.clientId,prompt:this.PROMPT,redirect_uri:this.redirect_uri,scope:this.SCOPE,nonce:this.nonce},$);Object.keys(j).forEach(et=>{j[et]&&a.searchParams.append(et,j[et])}),this.finalURL=a}async getUserInfo(a){const{accessToken:$}=a,j=await get$2("https://www.googleapis.com/userinfo/v2/me",{headers:{Authorization:`Bearer ${$}`}}),{picture:et="",email:tt="",name:rt=""}=j;return{email:tt,name:rt,profileImage:et,verifier:this.verifier,verifierId:tt.toLowerCase(),typeOfLogin:this.typeOfLogin}}}let JwtHandler$1=class extends AbstractLoginHandler{constructor(a,$,j,et,tt,rt,nt,it){super(a,$,j,et,tt,rt,nt,it),this.clientId=a,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,_defineProperty$4(this,"SCOPE","openid profile email"),_defineProperty$4(this,"RESPONSE_TYPE","token id_token"),_defineProperty$4(this,"PROMPT","login"),this.setFinalUrl()}setFinalUrl(){const{domain:a}=this.jwtParams,$=validateAndConstructUrl(a);$.pathname+=$.pathname.endsWith("/")?"authorize":"/authorize";const j=JSON.parse(JSON.stringify(this.jwtParams));delete j.domain;const et=deepmerge$1({state:this.state,response_type:this.RESPONSE_TYPE,client_id:this.clientId,prompt:this.PROMPT,redirect_uri:this.redirect_uri,scope:this.SCOPE,connection:loginToConnectionMap[this.typeOfLogin],nonce:this.nonce},j);Object.keys(et).forEach(tt=>{et[tt]&&$.searchParams.append(tt,et[tt])}),this.finalURL=$}async getUserInfo(a){const{idToken:$,accessToken:j}=a,{domain:et,verifierIdField:tt,isVerifierIdCaseSensitive:rt,user_info_route:nt="userinfo"}=this.jwtParams;if(j)try{const it=new URL(et),ot=await get$2(`${padUrlString(it)}${nt}`,{headers:{Authorization:`Bearer ${j}`}}),{picture:st,name:ct,email:ut}=ot;return{email:ut,name:ct,profileImage:st,verifierId:getVerifierId(ot,this.typeOfLogin,tt,rt),verifier:this.verifier,typeOfLogin:this.typeOfLogin}}catch(it){log$1$1.warn(it,"Unable to get userinfo from endpoint")}if($){const it=o($),{name:ot,email:st,picture:ct}=it;return{profileImage:ct,name:ot,email:st,verifierId:getVerifierId(it,this.typeOfLogin,tt,rt),verifier:this.verifier,typeOfLogin:this.typeOfLogin}}throw new Error("Access/id token not available")}};class MockLoginHandler extends AbstractLoginHandler{constructor(a,$,j,et,tt,rt,nt,it){super(a,$,j,et,tt,rt,nt,it),this.clientId=a,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,this.setFinalUrl()}setFinalUrl(){const a=JSON.parse(JSON.stringify(this.jwtParams));delete a.domain;const $=deepmerge$1({state:this.state,client_id:this.clientId,nonce:this.nonce},a);this.finalURL=new URL(constructURL({baseURL:this.redirect_uri,query:null,hash:$}))}async getUserInfo(a){const{idToken:$,accessToken:j}=a,{domain:et,verifierIdField:tt,isVerifierIdCaseSensitive:rt,user_info_route:nt="userinfo"}=this.jwtParams;if(j)try{const it=new URL(et),ot=await get$2(`${padUrlString(it)}${nt}`,{headers:{Authorization:`Bearer ${j}`}}),{picture:st,name:ct,email:ut}=ot;return{email:ut,name:ct,profileImage:st,verifierId:getVerifierId(ot,this.typeOfLogin,tt,rt),verifier:this.verifier,typeOfLogin:this.typeOfLogin}}catch(it){log$1$1.warn(it,"Unable to get userinfo from endpoint")}if($){const it=o($),{name:ot,email:st,picture:ct}=it;return{profileImage:ct,name:ot,email:st,verifierId:getVerifierId(it,this.typeOfLogin,tt,rt),verifier:this.verifier,typeOfLogin:this.typeOfLogin}}throw new Error("Access/id token not available")}handleLoginWindow(a){const{id_token:$,access_token:j}=this.jwtParams,et=new PopupHandler({url:this.finalURL,features:a.popupFeatures});if(this.uxMode===UX_MODE.REDIRECT)et.redirect(a.locationReplaceOnRedirect);else return Promise.resolve({state:{},idToken:$,accessToken:j});return null}}const _excluded$1=["access_token","id_token"];class JwtHandler extends AbstractLoginHandler{constructor(a,$,j,et,tt,rt,nt,it){super(a,$,j,et,tt,rt,nt,it),this.clientId=a,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,_defineProperty$4(this,"SCOPE","openid profile email"),_defineProperty$4(this,"RESPONSE_TYPE","token id_token"),_defineProperty$4(this,"PROMPT","login"),this.setFinalUrl()}setFinalUrl(){const{domain:a}=this.jwtParams,$=validateAndConstructUrl(a);$.pathname="/passwordless/start",this.finalURL=$}async getUserInfo(a){const{idToken:$,accessToken:j}=a,{domain:et,verifierIdField:tt,isVerifierIdCaseSensitive:rt}=this.jwtParams;try{const nt=new URL(et),it=await get$2(`${padUrlString(nt)}userinfo`,{headers:{Authorization:`Bearer ${j}`}}),{picture:ot,name:st,email:ct}=it;return{email:ct,name:st,profileImage:ot,verifierId:getVerifierId(it,this.typeOfLogin,tt,rt),verifier:this.verifier,typeOfLogin:this.typeOfLogin}}catch(nt){log.error(nt);const it=o($),{name:ot,email:st,picture:ct}=it;return{profileImage:ct,name:ot,email:st,verifierId:getVerifierId(it,this.typeOfLogin,tt,rt),verifier:this.verifier,typeOfLogin:this.typeOfLogin}}}handleLoginWindow(){return new Promise((a,$)=>{if(this.redirectToOpener){$(new Error("Cannot use redirect to opener for passwordless"));return}const j=tt=>{try{const{error:rt,data:nt}=tt,it=nt||{},{instanceParams:ot,hashParams:{access_token:st,id_token:ct}}=it,ut=_objectWithoutProperties(it.hashParams,_excluded$1);if(rt){log.error(tt.error),$(new Error(rt));return}tt.data&&ot.verifier===this.verifier&&(log.info(tt.data),a(_objectSpread2(_objectSpread2({accessToken:st,idToken:ct||""},ut),{},{state:ot})))}catch(rt){log.error(rt),$(rt)}},et=new BroadcastChannel$1(`redirect_channel_${this.nonce}`,broadcastChannelOptions);et.addEventListener("message",async tt=>{j(tt),et.close()});try{const{connection:tt="email",login_hint:rt}=this.jwtParams,nt=deepmerge$1({client_id:this.clientId,connection:tt,email:tt==="email"?rt:void 0,phone_number:tt==="sms"?rt:void 0,send:"link",authParams:{scope:this.SCOPE,state:this.state,response_type:this.RESPONSE_TYPE,redirect_uri:this.redirect_uri,nonce:this.nonce,prompt:this.PROMPT}},{authParams:this.jwtParams});post$1(this.finalURL.href,JSON.parse(JSON.stringify(nt))).then(it=>{log.info("posted",it)}).catch(it=>{log.error(it),$(it)})}catch(tt){log.error(tt),$(tt)}})}}class RedditHandler extends AbstractLoginHandler{constructor(a,$,j,et,tt,rt,nt,it){super(a,$,j,et,tt,rt,nt,it),this.clientId=a,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,_defineProperty$4(this,"RESPONSE_TYPE","token"),_defineProperty$4(this,"SCOPE","identity"),this.setFinalUrl()}setFinalUrl(){const a=new URL(`https://www.reddit.com/api/v1/authorize${window.innerWidth<600?".compact":""}`),$=JSON.parse(JSON.stringify(this.jwtParams||{})),j=deepmerge$1({state:this.state,response_type:this.RESPONSE_TYPE,client_id:this.clientId,redirect_uri:this.redirect_uri,scope:this.SCOPE},$);Object.keys(j).forEach(et=>{j[et]&&a.searchParams.append(et,j[et])}),this.finalURL=a}async getUserInfo(a){const{accessToken:$}=a,j=await get$2("https://oauth.reddit.com/api/v1/me",{headers:{Authorization:`Bearer ${$}`}}),{icon_img:et="",name:tt=""}=j;return{email:"",name:tt,profileImage:et.split("?").length>0?et.split("?")[0]:et,verifier:this.verifier,verifierId:tt.toLowerCase(),typeOfLogin:this.typeOfLogin}}}class TwitchHandler extends AbstractLoginHandler{constructor(a,$,j,et,tt,rt,nt,it){super(a,$,j,et,tt,rt,nt,it),this.clientId=a,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,_defineProperty$4(this,"RESPONSE_TYPE","token"),_defineProperty$4(this,"SCOPE","user:read:email"),this.setFinalUrl()}setFinalUrl(){const a=new URL("https://id.twitch.tv/oauth2/authorize"),$=JSON.parse(JSON.stringify(this.jwtParams||{})),j=deepmerge$1({state:this.state,response_type:this.RESPONSE_TYPE,client_id:this.clientId,redirect_uri:this.redirect_uri,scope:this.SCOPE,force_verify:!0},$);Object.keys(j).forEach(et=>{j[et]&&a.searchParams.append(et,j[et])}),this.finalURL=a}async getUserInfo(a){const{accessToken:$}=a,j=await get$2("https://api.twitch.tv/helix/users",{headers:{Authorization:`Bearer ${$}`,"Client-ID":this.clientId}}),[{profile_image_url:et="",display_name:tt="",email:rt="",id:nt}]=j.data||[];return{profileImage:et,name:tt,email:rt,verifierId:nt,verifier:this.verifier,typeOfLogin:this.typeOfLogin}}}const WEBAUTHN_LOOKUP_SERVER="https://api.webauthn.openlogin.com";class WebAuthnHandler extends AbstractLoginHandler{constructor(a,$,j,et,tt,rt,nt,it,ot){super(a,$,j,et,tt,rt,nt,it),this.clientId=a,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,this.registerOnly=ot,this.setFinalUrl()}setFinalUrl(){const{webauthnURL:a}=this.customState||{},$=a?new URL(a):new URL("https://webauthn.openlogin.com"),j=JSON.parse(JSON.stringify(this.jwtParams||{})),et=deepmerge$1({register_only:!!this.registerOnly,state:this.state,client_id:this.clientId,redirect_uri:this.redirect_uri},j);Object.keys(et).forEach(tt=>{et[tt]&&$.searchParams.append(tt,et[tt])}),this.finalURL=$}async getUserInfo(a){const{idToken:$,ref:j,extraParamsPassed:et,extraParams:tt}=a;let rt,nt,it,ot,st,ct,ut,ht,Et;if(et==="true"){log.debug("extraParamsPassed is true, using extraParams passed through hashParams");try{({verifier_id:rt,signature:nt,clientDataJSON:it,authenticatorData:ot,publicKey:st,challenge:ct,rpOrigin:ut,credId:ht,transports:Et}=JSON.parse(base64url.decode(tt)))}catch(St){log.warn("unable to parse extraParams",St),{verifier_id:rt,signature:nt,clientDataJSON:it,authenticatorData:ot,publicKey:st,challenge:ct,rpOrigin:ut,credId:ht,transports:Et}=await get$2(`${WEBAUTHN_LOOKUP_SERVER}/signature/fetch/${$}`)}}else log.debug("extraParamsPassed is false, using extraParams passed through bridge server"),{verifier_id:rt,signature:nt,clientDataJSON:it,authenticatorData:ot,publicKey:st,challenge:ct,rpOrigin:ut,credId:ht,transports:Et}=await get$2(`${WEBAUTHN_LOOKUP_SERVER}/signature/fetch/${$}`);if(nt!==$)throw new Error("idtoken should be equal to signature");return{email:"",name:"WebAuthn Login",profileImage:"",verifier:this.verifier,verifierId:rt,typeOfLogin:this.typeOfLogin,ref:j,registerOnly:this.registerOnly,extraVerifierParams:{signature:nt,clientDataJSON:it,authenticatorData:ot,publicKey:st,challenge:ct,rpOrigin:ut,credId:ht,transports:Et}}}}const createHandler=_=>{let{clientId:a,redirect_uri:$,typeOfLogin:j,verifier:et,jwtParams:tt,redirectToOpener:rt,uxMode:nt,customState:it,registerOnly:ot}=_;if(!et||!j||!a)throw new Error("Invalid params");const{domain:st,login_hint:ct,id_token:ut,access_token:ht}=tt||{};switch(j){case LOGIN.GOOGLE:return new GoogleHandler(a,et,$,j,nt,rt,tt,it);case LOGIN.FACEBOOK:return new FacebookHandler(a,et,$,j,nt,rt,tt,it);case LOGIN.TWITCH:return new TwitchHandler(a,et,$,j,nt,rt,tt,it);case LOGIN.REDDIT:return new RedditHandler(a,et,$,j,nt,rt,tt,it);case LOGIN.DISCORD:return new DiscordHandler(a,et,$,j,nt,rt,tt,it);case LOGIN.PASSWORDLESS:if(!st||!ct)throw new Error("Invalid params");return new JwtHandler(a,et,$,j,nt,rt,tt,it);case LOGIN.APPLE:case LOGIN.GITHUB:case LOGIN.LINKEDIN:case LOGIN.TWITTER:case LOGIN.WEIBO:case LOGIN.LINE:case LOGIN.EMAIL_PASSWORD:case LOGIN.JWT:if(ut||ht)return new MockLoginHandler(a,et,$,j,nt,rt,tt,it);if(!st)throw new Error("Invalid params");return new JwtHandler$1(a,et,$,j,nt,rt,tt,it);case LOGIN.WEBAUTHN:return new WebAuthnHandler(a,et,$,j,nt,rt,tt,it,ot);default:throw new Error("Invalid login type")}},registerServiceWorker=_=>new Promise((a,$)=>{const j=`${_}sw.js`;"serviceWorker"in window.navigator?register(j,{ready(){log.info(`App is being served from cache by a service worker. For more details, visit https://goo.gl/AFskqB`),a(void 0)},registered(){log.info("Service worker has been registered."),a(void 0)},cached(){log.info("Content has been cached for offline use."),a(void 0)},updatefound(){log.info("New content is downloading.")},updated(){log.info("New content is available; please refresh.")},offline(){log.info("No internet connection found. App is running in offline mode."),$(new Error("App is offline"))},error(et){log.error("Error during service worker registration:",et),$(et)}}):$(new Error("Service workers are not supported"))});class SentryHandler{constructor(a){_defineProperty$4(this,"sentry",null),this.sentry=a}startTransaction(a){if(this.sentry)return this.sentry.startTransaction(a)}finishTransaction(a){a&&a.finish()}}class StorageHelper{constructor(a){_defineProperty$4(this,"currentStorageMethod",REDIRECT_PARAMS_STORAGE_METHOD.LOCAL_STORAGE),_defineProperty$4(this,"isInitialized",!1),_defineProperty$4(this,"storageServerUrl","https://broadcast-server.tor.us"),this.storageServerUrl=a}init(){const a=are3PCSupported(),$=storageAvailable(REDIRECT_PARAMS_STORAGE_METHOD.LOCAL_STORAGE);a&&$?this.currentStorageMethod=REDIRECT_PARAMS_STORAGE_METHOD.LOCAL_STORAGE:this.currentStorageMethod=REDIRECT_PARAMS_STORAGE_METHOD.SERVER,this.isInitialized=!0}async storeLoginDetails(a,$){if(!this.isInitialized)throw new Error("StorageHelper is not initialized");if(this.currentStorageMethod===REDIRECT_PARAMS_STORAGE_METHOD.SERVER){const j=keccak256(Buffer$g.from($,"utf8")),et=j.toString("hex"),tt=getPublic(j).toString("hex"),rt=await encryptData(et,a),nt=(await sign(j,keccak256(Buffer$g.from(rt,"utf8")))).toString("hex");await post$1(`${this.storageServerUrl}/store/set`,{key:tt,data:rt,signature:nt})}else window.localStorage.setItem(`torus_login_${$}`,JSON.stringify(a))}async retrieveLoginDetails(a){if(!this.isInitialized)throw new Error("StorageHelper is not initialized");if(this.currentStorageMethod===REDIRECT_PARAMS_STORAGE_METHOD.SERVER){const j=keccak256(Buffer$g.from(a,"utf8")),et=j.toString("hex"),tt=getPublic(j).toString("hex");try{const rt=await get$2(`${this.storageServerUrl}/store/get?key=${tt}`);if(rt.message)return await decryptData(et,rt.message)}catch(rt){if(rt.status===404)log.warn(rt,"Session likely expired");else throw rt}}const $=window.localStorage.getItem(`torus_login_${a}`);return JSON.parse($||"{}")}clearLoginDetailsStorage(a){if(!this.isInitialized)throw new Error("StorageHelper is not initialized");this.currentStorageMethod===REDIRECT_PARAMS_STORAGE_METHOD.LOCAL_STORAGE&&window.localStorage.removeItem(`torus_login_${a}`)}clearOrphanedLoginDetails(){if(!this.isInitialized)throw new Error("StorageHelper is not initialized");this.currentStorageMethod===REDIRECT_PARAMS_STORAGE_METHOD.LOCAL_STORAGE&&Object.keys(window.localStorage).forEach($=>{$.startsWith("torus_login_")&&window.localStorage.removeItem($)})}}const _excluded=["access_token","id_token"],_excluded2=["access_token","id_token"],_excluded3=["access_token","id_token"],_excluded4=["args","method"];class CustomAuth{constructor(a){let{baseUrl:$,network:j,enableLogging:et=!1,redirectToOpener:tt=!1,redirectPathName:rt="redirect",apiKey:nt="torus-default",uxMode:it=UX_MODE.POPUP,locationReplaceOnRedirect:ot=!1,popupFeatures:st,storageServerUrl:ct="https://broadcast-server.tor.us",sentry:ut,enableOneKey:ht=!1,web3AuthClientId:Et,metadataUrl:St="https://metadata.tor.us"}=a;if(_defineProperty$4(this,"isInitialized",void 0),_defineProperty$4(this,"config",void 0),_defineProperty$4(this,"torus",void 0),_defineProperty$4(this,"nodeDetailManager",void 0),_defineProperty$4(this,"storageHelper",void 0),_defineProperty$4(this,"sentryHandler",void 0),!Et)throw new Error("Please provide a valid web3AuthClientId in constructor");if(!j)throw new Error("Please provide a valid network in constructor");this.isInitialized=!1;const Mt=new URL($);this.config={baseUrl:padUrlString(Mt),get redirect_uri(){return`${this.baseUrl}${rt}`},redirectToOpener:tt,uxMode:it,locationReplaceOnRedirect:ot,popupFeatures:st};const kt=new Torus({network:j,clientId:Et,enableOneKey:ht,legacyMetadataHost:St});Torus.setAPIKey(nt),this.torus=kt,this.nodeDetailManager=new NodeDetailManager({network:j}),et?log.enableAll():log.disableAll(),this.storageHelper=new StorageHelper(ct),this.sentryHandler=new SentryHandler(ut)}async init(){let{skipSw:a=!1,skipInit:$=!1,skipPrefetch:j=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.storageHelper.init(),$){this.isInitialized=!0;return}if(!a)if((await fetch(`${this.config.baseUrl}sw.js`,{cache:"reload"})).ok)try{await registerServiceWorker(this.config.baseUrl),this.isInitialized=!0;return}catch(tt){log.warn(tt)}else throw new Error("Service worker is not being served. Please serve it");if(!j){if(isFirefox()){this.isInitialized=!0;return}await this.handlePrefetchRedirectUri();return}this.isInitialized=!0}async triggerLogin(a){const{verifier:$,typeOfLogin:j,clientId:et,jwtParams:tt,hash:rt,queryParameters:nt,customState:it,registerOnly:ot}=a;if(log.info("Verifier: ",$),!this.isInitialized)throw new Error("Not initialized yet");if(ot&&j!==LOGIN.WEBAUTHN)throw new Error("registerOnly flag can only be passed for webauthn");const st=createHandler({typeOfLogin:j,clientId:et,verifier:$,redirect_uri:this.config.redirect_uri,redirectToOpener:this.config.redirectToOpener,jwtParams:tt,uxMode:this.config.uxMode,customState:it,registerOnly:ot});let ct;if(rt&&nt){const{error:Et,hashParameters:St,instanceParameters:Mt}=handleRedirectParameters(rt,nt);if(Et)throw new Error(Et);const{access_token:kt,id_token:Ct}=St,Ot=_objectWithoutProperties(St,_excluded);ct=_objectSpread2(_objectSpread2({accessToken:kt,idToken:Ct},Ot),{},{state:Mt})}else if(this.storageHelper.clearOrphanedLoginDetails(),this.config.uxMode===UX_MODE.REDIRECT&&await this.storageHelper.storeLoginDetails({method:TORUS_METHOD.TRIGGER_LOGIN,args:a},st.nonce),ct=await st.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;const ut=await st.getUserInfo(ct);if(ot){const Et=this.sentryHandler.startTransaction({name:SENTRY_TXNS.FETCH_NODE_DETAILS}),St=await this.nodeDetailManager.getNodeDetails({verifier:$,verifierId:ut.verifierId});this.sentryHandler.finishTransaction(Et);const Mt=this.sentryHandler.startTransaction({name:SENTRY_TXNS.PUB_ADDRESS_LOOKUP}),kt=await this.torus.getPublicAddress(St.torusNodeEndpoints,St.torusNodePub,{verifier:$,verifierId:ut.verifierId});this.sentryHandler.finishTransaction(Mt);const Ct={userInfo:_objectSpread2(_objectSpread2({},ut),ct)};return _objectSpread2(_objectSpread2(_objectSpread2({},Ct),kt),{},{finalKeyData:_objectSpread2(_objectSpread2({},kt.finalKeyData),{},{privKey:void 0}),oAuthKeyData:_objectSpread2(_objectSpread2({},kt.finalKeyData),{},{privKey:void 0}),metadata:_objectSpread2(_objectSpread2({},kt.metadata),{},{nonce:void 0}),sessionData:void 0})}const ht=await this.getTorusKey($,ut.verifierId,{verifier_id:ut.verifierId},ct.idToken||ct.accessToken,ut.extraVerifierParams);return _objectSpread2(_objectSpread2({},ht),{},{userInfo:_objectSpread2(_objectSpread2({},ut),ct)})}async triggerAggregateLogin(a){const{aggregateVerifierType:$,verifierIdentifier:j,subVerifierDetailsArray:et}=a;if(!this.isInitialized)throw new Error("Not initialized yet");if(!$||!j||!Array.isArray(et))throw new Error("Invalid params");if($===AGGREGATE_VERIFIER.SINGLE_VERIFIER_ID&&et.length!==1)throw new Error("Single id verifier can only have one sub verifier");const tt=[],rt=[];for(const St of et){const{clientId:Mt,typeOfLogin:kt,verifier:Ct,jwtParams:Ot,hash:zt,queryParameters:Ut,customState:Vt}=St,jt=createHandler({typeOfLogin:kt,clientId:Mt,verifier:Ct,redirect_uri:this.config.redirect_uri,redirectToOpener:this.config.redirectToOpener,jwtParams:Ot,uxMode:this.config.uxMode,customState:Vt});let $t;if(zt&&Ut){const{error:Bt,hashParameters:Nt,instanceParameters:Lt}=handleRedirectParameters(zt,Ut);if(Bt)throw new Error(Bt);const{access_token:Pt,id_token:bt}=Nt,at=_objectWithoutProperties(Nt,_excluded2);$t=_objectSpread2(_objectSpread2({accessToken:Pt,idToken:bt},at),{},{state:Lt})}else if(this.storageHelper.clearOrphanedLoginDetails(),this.config.uxMode===UX_MODE.REDIRECT&&await this.storageHelper.storeLoginDetails({method:TORUS_METHOD.TRIGGER_AGGREGATE_LOGIN,args:a},jt.nonce),$t=await jt.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;tt.push(jt.getUserInfo($t)),rt.push($t)}const it=(await Promise.all(tt)).map(St=>_objectSpread2(_objectSpread2({},St),{},{aggregateVerifier:j})),ot={verify_params:[],sub_verifier_ids:[],verifier_id:""},st=[];let ct="",ut={};for(let St=0;St_objectSpread2(_objectSpread2({},St),rt[Mt]))})}async triggerHybridAggregateLogin(a){const{singleLogin:$,aggregateLoginParams:j}=a;if(!this.isInitialized)throw new Error("Not initialized yet");if(!j.aggregateVerifierType||!j.verifierIdentifier||!Array.isArray(j.subVerifierDetailsArray))throw new Error("Invalid params");if(j.aggregateVerifierType===AGGREGATE_VERIFIER.SINGLE_VERIFIER_ID&&j.subVerifierDetailsArray.length!==1)throw new Error("Single id verifier can only have one sub verifier");const{typeOfLogin:et,clientId:tt,verifier:rt,jwtParams:nt,hash:it,queryParameters:ot,customState:st}=$,ct=createHandler({typeOfLogin:et,clientId:tt,verifier:rt,redirect_uri:this.config.redirect_uri,redirectToOpener:this.config.redirectToOpener,jwtParams:nt,uxMode:this.config.uxMode,customState:st});let ut;if(it&&ot){const{error:$t,hashParameters:Bt,instanceParameters:Nt}=handleRedirectParameters(it,ot);if($t)throw new Error($t);const{access_token:Lt,id_token:Pt}=Bt,bt=_objectWithoutProperties(Bt,_excluded3);ut=_objectSpread2(_objectSpread2({accessToken:Lt,idToken:Pt},bt),{},{state:Nt})}else if(this.storageHelper.clearOrphanedLoginDetails(),this.config.uxMode===UX_MODE.REDIRECT&&await this.storageHelper.storeLoginDetails({method:TORUS_METHOD.TRIGGER_AGGREGATE_HYBRID_LOGIN,args:a},ct.nonce),ut=await ct.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;const ht=await ct.getUserInfo(ut),Et=this.getTorusKey(rt,ht.verifierId,{verifier_id:ht.verifierId},ut.idToken||ut.accessToken,ht.extraVerifierParams),{verifierIdentifier:St,subVerifierDetailsArray:Mt}=j,kt={verify_params:[],sub_verifier_ids:[],verifier_id:""},Ct=[];let Ot="";for(let $t=0;$t0&&arguments[0]!==void 0?arguments[0]:{};await this.init({skipInit:!0});const j=new URL(window.location.href),et=j.hash.substring(1),tt={};if(j.searchParams.forEach((St,Mt)=>{tt[Mt]=St}),a){const St=window.location.origin+window.location.pathname;window.history.replaceState(_objectSpread2(_objectSpread2({},window.history.state),{},{as:St,url:St}),"",St)}if(!et&&Object.keys(tt).length===0)throw new Error("Unable to fetch result from OAuth login");const{error:rt,instanceParameters:nt,hashParameters:it}=handleRedirectParameters(et,tt),{instanceId:ot}=nt;log.info(ot,"instanceId");const st=await this.storageHelper.retrieveLoginDetails(ot),{args:ct,method:ut}=st,ht=_objectWithoutProperties(st,_excluded4);if(log.info(ct,ut),$&&this.storageHelper.clearLoginDetailsStorage(ot),rt)return{error:rt,state:nt||{},method:ut,result:{},hashParameters:it,args:ct};let Et;try{if(ut===TORUS_METHOD.TRIGGER_LOGIN){const St=ct;St.hash=et,St.queryParameters=tt,Et=await this.triggerLogin(St)}else if(ut===TORUS_METHOD.TRIGGER_AGGREGATE_LOGIN){const St=ct;St.subVerifierDetailsArray.forEach(Mt=>{Mt.hash=et,Mt.queryParameters=tt}),Et=await this.triggerAggregateLogin(St)}else if(ut===TORUS_METHOD.TRIGGER_AGGREGATE_HYBRID_LOGIN){const St=ct;St.singleLogin.hash=et,St.singleLogin.queryParameters=tt,Et=await this.triggerHybridAggregateLogin(St)}}catch(St){return log.error(St),_objectSpread2({error:`Could not get result from torus nodes - ${(St==null?void 0:St.message)||""}`,state:nt||{},method:ut,result:{},hashParameters:it,args:ct},ht)}return _objectSpread2(Et?{method:ut,result:Et,state:nt||{},hashParameters:it,args:ct}:{error:"Unsupported method type",state:nt||{},method:ut,result:{},hashParameters:it,args:ct},ht)}async handlePrefetchRedirectUri(){return document?new Promise((a,$)=>{const j=document.createElement("link");j.href=this.config.redirect_uri,window.location.origin!==new URL(this.config.redirect_uri).origin&&(j.crossOrigin="anonymous"),j.type="text/html",j.rel="prefetch";const et=()=>{this.isInitialized=!0,a()};try{j.relList&&j.relList.supports&&j.relList.supports("prefetch")?(j.onload=et,j.onerror=()=>{$(new Error(`Please serve redirect.html present in serviceworker folder of this package on ${this.config.redirect_uri}`))},document.head.appendChild(j)):et()}catch{et()}}):Promise.resolve()}}const WEB3_AUTH_CLIENT_ID="BBQoFIabI50S1-0QsGHGTM4qID_FDjja0ZxIxKPyFqc0El--M-EG0c2giaBYVTVVE6RC9WCUzCJyW24aJrR_Lzc";class Auth{async getTorusClient(){const a=new CustomAuth({web3AuthClientId:WEB3_AUTH_CLIENT_ID,baseUrl:"https://umamiwallet.com/auth/v2.2.0/",redirectPathName:"redirect.html",redirectToOpener:!0,uxMode:"popup",network:"mainnet"});return await a.init({skipSw:!0}),a}async getCredentials(){const a=await this.login(),$=a.finalKeyData.privKey||a.oAuthKeyData.privKey,j=b58cencode($,prefix.spsk),et=Array.isArray(a.userInfo)?a.userInfo[0]:a.userInfo,tt=et.email||et.name||this.idpName;return{secretKey:j,name:tt}}}const parseTorusRedirectParams=_=>{const a=new URLSearchParams(_.replace("umami://auth/","")),$={instanceId:a.get("instanceId"),verifier:a.get("verifier"),typeOfLogin:a.get("typeOfLogin"),redirectToOpener:a.get("redirectToOpener")},j={state:a.get("state"),access_token:a.get("access_token"),token_type:a.get("token_type"),expires_in:a.get("expires_in"),scope:a.get("scope"),id_token:a.get("id_token"),authuser:a.get("authuser"),hd:a.get("hd"),prompt:a.get("prompt")},et={instanceParams:$,hashParams:j};return{channel:a.get("channel"),data:et,error:a.get("error")}},JWT_AUTH_DOMAIN="https://kukai.eu.auth0.com";class EmailAuth extends Auth{constructor(){super(...arguments),this.clientId="LTg6fVsacafGmhv14TZlrWF1EavwQoDZ",this.idpName="email"}async login(){return(await this.getTorusClient()).triggerAggregateLogin({verifierIdentifier:"tezos-google",aggregateVerifierType:"single_id_verifier",subVerifierDetailsArray:[{verifier:"web-kukai-email",typeOfLogin:"jwt",clientId:this.clientId,jwtParams:{connection:"",verifierIdField:"name",domain:JWT_AUTH_DOMAIN}}]})}}class FacebookAuth extends Auth{constructor(){super(...arguments),this.idpName="facebook",this.clientId="523634882377310"}async login(){return(await this.getTorusClient()).triggerLogin({verifier:"tezos-facebook",clientId:this.clientId,typeOfLogin:"facebook",jwtParams:{scope:"public_profile email"}})}}class GoogleAuth extends Auth{constructor(){super(...arguments),this.idpName="google",this.clientId="1070572364808-d31nlkneam5ee6dr0tu28fjjbsdkfta5.apps.googleusercontent.com"}async login(){return(await this.getTorusClient()).triggerAggregateLogin({verifierIdentifier:"tezos-google",aggregateVerifierType:"single_id_verifier",subVerifierDetailsArray:[{clientId:this.clientId,typeOfLogin:"google",verifier:"umami"}]})}}class RedditAuth extends Auth{constructor(){super(...arguments),this.idpName="reddit",this.clientId="zyQ9tnKfdg3VNyj6MGhZq4dHbBzbmEvl"}async login(){return(await this.getTorusClient()).triggerAggregateLogin({verifierIdentifier:"tezos-reddit",aggregateVerifierType:"single_id_verifier",subVerifierDetailsArray:[{verifier:"web-kukai",typeOfLogin:"jwt",clientId:this.clientId,jwtParams:{connection:"Reddit",verifierIdField:"name",domain:JWT_AUTH_DOMAIN}}]})}}class TwitterAuth extends Auth{constructor(){super(...arguments),this.idpName="twitter",this.clientId="3aCoxh3pw8g8JeFsdlJNUGwdgtLwdwgE"}async login(){return(await this.getTorusClient()).triggerLogin({verifier:"tezos-twitter",clientId:this.clientId,typeOfLogin:"twitter",jwtParams:{domain:JWT_AUTH_DOMAIN}})}}const forIDP=_=>{switch(_){case"google":return new GoogleAuth;case"email":return new EmailAuth;case"reddit":return new RedditAuth;case"facebook":return new FacebookAuth;case"twitter":return new TwitterAuth}},MIN_LENGTH=8,PasswordInput=({inputName:_,label:a="Password",placeholder:$="Enter your password",required:j="Password is required",minLength:et=MIN_LENGTH,validate:tt,...rt})=>{const{register:nt}=useFormContext(),[it,ot]=reactExports.useState(!1);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FormLabel,{children:a}),jsxRuntimeExports.jsxs(InputGroup,{marginTop:"12px",children:[jsxRuntimeExports.jsx(Input,{"aria-label":a,autoComplete:"off",placeholder:$,type:it?"text":"password",...nt(_,{required:j,minLength:et&&j?{value:et,message:`Your password must be at least ${et} characters long`}:void 0,validate:tt}),...rt}),jsxRuntimeExports.jsx(InputRightElement,{children:jsxRuntimeExports.jsx(Button,{onClick:()=>ot(st=>!st),tabIndex:-1,variant:"unstyled",children:it?jsxRuntimeExports.jsx(EyeSlashIcon,{"data-testid":"eye-slash-icon"}):jsxRuntimeExports.jsx(EyeIcon,{width:"16.5px","data-testid":"eye-icon"})})})]})]})},SignButton=({signer:_,onSubmit:a,isLoading:$,isDisabled:j,text:et,network:tt})=>{const rt=useForm({mode:"onBlur",defaultValues:{password:""}}),{handleSubmit:nt,formState:{errors:it,isValid:ot}}=rt;let st=useSelectedNetwork();tt&&(st=tt);const{formState:{isValid:ct}}=useFormContext(),ut=j||!ot||!ct,ht=useGetSecretKey(),Et=useToast(),{isLoading:St,handleAsyncAction:Mt}=useAsyncActionHandler(),kt=St||$,Ct=async({password:Vt})=>Mt(async()=>{const jt=await ht(_,Vt);return a(await makeToolkit({type:"mnemonic",secretKey:jt,network:st}))}),Ot=async({password:Vt})=>Mt(async()=>{const jt=await ht(_,Vt);return a(await makeToolkit({type:"secret_key",secretKey:jt,network:st}))}),zt=async()=>Mt(async()=>{const{secretKey:Vt}=await forIDP(_.idp).getCredentials();return a(await makeToolkit({type:"social",secretKey:Vt,network:st}))}),Ut=async()=>Mt(async()=>(Et({id:"ledger-sign-toast",description:"Please approve the operation on your Ledger",status:"info",duration:6e4,isClosable:!0}),a(await makeToolkit({type:"ledger",account:_,network:st}))),Vt=>({description:`${Vt.message} Please connect your ledger, open Tezos app and try submitting transaction again`,status:"error"})).finally(()=>Et.close("ledger-sign-toast"));switch(_.type){case"secret_key":case"mnemonic":return jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsxs(FormProvider,{...rt,children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!it.password,marginY:"16px",children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password"}),it.password&&jsxRuntimeExports.jsx(FormErrorMessage,{children:it.password.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"8px",isDisabled:ut,isLoading:kt,onClick:nt(_.type==="mnemonic"?Ct:Ot),size:"lg",type:"submit",children:et||"Submit Transaction"})]})});case"social":return jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:j,isLoading:kt,onClick:zt,size:"lg",children:et||"Sign with social"});case"ledger":return jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:j,isLoading:kt,onClick:Ut,size:"lg",children:et||"Sign with Ledger"})}},SignPayloadRequestModal=({request:_})=>{const{onClose:a}=reactExports.useContext(DynamicModalContext),j=useGetImplicitAccount()(_.sourceAddress),et=useToast(),tt=useRemovePeerBySenderId(),rt=useForm(),nt=()=>{tt(_.senderId),WalletClient.respond({id:_.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.ABORTED_ERROR})},it=async ot=>{const st=await ot.signer.sign(_.payload),ct={type:BeaconMessageType.SignPayloadResponse,id:_.id,signingType:_.signingType,signature:st.prefixSig};await WalletClient.respond(ct),et({description:"Successfully submitted Beacon operation",status:"success"}),a()};return jsxRuntimeExports.jsx(FormProvider,{...rt,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"32px",textAlign:"center",children:"Connect with pairing request"}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:nt}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"12px",size:"l",children:`${_.appMetadata.name}/dApp Pairing Request`}),jsxRuntimeExports.jsx(Box,{overflowY:"auto",maxHeight:"300px",padding:"15px",border:"1px solid",borderColor:colors.gray[500],borderRadius:"4px",backgroundColor:colors.gray[800],children:jsxRuntimeExports.jsx(Text,{color:colors.gray[450],size:"md",children:decodePayload$1(_.payload)})})]}),jsxRuntimeExports.jsx(ModalFooter,{justifyContent:"center",display:"flex",padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(SignButton,{onSubmit:it,signer:j,text:"Sign"})})]})})},HeaderWrapper=chakra(ModalHeader,{baseStyle:{padding:0,paddingBottom:"32px",textAlign:"center"}}),FormPageHeader=({title:_="Send",subTitle:a="Send one or insert into batch"})=>jsxRuntimeExports.jsxs(HeaderWrapper,{children:[jsxRuntimeExports.jsx(Heading,{size:"2xl",children:_}),jsxRuntimeExports.jsx(Text,{marginTop:"10px",color:colors.gray[400],textAlign:"center",size:"sm",children:a}),jsxRuntimeExports.jsx(ModalCloseButton,{})]});var ChevronDownIcon=createIcon({displayName:"ChevronDownIcon",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}),ArrowBackIcon=createIcon({d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z",displayName:"ArrowBackIcon"});const ModalBackButton=({onClick:_})=>jsxRuntimeExports.jsx(IconButton,{...backButtonStyle,"aria-label":"Back","data-testid":"back-button",icon:jsxRuntimeExports.jsx(ArrowBackIcon,{width:"24px",height:"20px"}),onClick:_,size:"sm",variant:"ghost"}),headerText=(_,a)=>{let $;switch(_){case"implicit":$=a==="batch"?"Submit":"Confirm";break;case"proposal":$="Propose"}switch(a){case"single":return`${$} Transaction`;case"batch":return`${$} Batch`}},subTitle=_=>{switch(_.type){case"ledger":case"social":return;case"mnemonic":case"secret_key":return"Enter your password to confirm this transaction."}},SignPageHeader=({goBack:_,mode:a,operationsType:$,signer:j,title:et,description:tt,children:rt})=>jsxRuntimeExports.jsxs(HeaderWrapper,{children:[_&&jsxRuntimeExports.jsx(ModalBackButton,{onClick:_}),jsxRuntimeExports.jsx(Heading,{"data-testid":"sign-page-header",size:"2xl",children:et||headerText($,a)}),jsxRuntimeExports.jsx(Text,{marginTop:"10px",color:colors.gray[400],textAlign:"center",size:"sm",children:tt||subTitle(j)}),jsxRuntimeExports.jsx(ModalCloseButton,{}),rt]}),Header$1=({operation:_,message:a,mode:$})=>jsxRuntimeExports.jsxs(SignPageHeader,{mode:$,operationsType:_.type,signer:_.signer,children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"center",marginTop:"10px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Network:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:lodashExports.capitalize(a.network.type)})]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"16px",padding:"15px",borderRadius:"4px",backgroundColor:colors.gray[800],children:[jsxRuntimeExports.jsx(AspectRatio,{width:"30px",marginRight:"12px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{borderRadius:"4px",src:a.appMetadata.icon})}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:a.appMetadata.name})]})]}),totalFee=_=>_.map(a=>a.fee).reduce((a,$)=>a.plus($),BigNumber(0)).toNumber(),makeAccountOperations=(_,a,$)=>{switch(_.type){case"ledger":case"mnemonic":case"social":case"secret_key":if(_.address.pkh!==a.address.pkh)throw new Error("Sender and Signer must be the same");return{type:"implicit",operations:$,signer:_,sender:_};case"multisig":return{type:"proposal",operations:$,sender:_,signer:a}}},WindowLinkIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"14px",height:"14px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M13 1L7 7M13 1V4.375M13 1H9.625M12.25 7.375V10.6C12.25 11.4401 12.25 11.8601 12.0865 12.181C11.9427 12.4632 11.7132 12.6927 11.431 12.8365C11.1101 13 10.6901 13 9.85 13H3.4C2.55992 13 2.13988 13 1.81901 12.8365C1.53677 12.6927 1.3073 12.4632 1.16349 12.181C1 11.8601 1 11.4401 1 10.6V4.15C1 3.30992 1 2.88988 1.16349 2.56901C1.3073 2.28677 1.53677 2.0573 1.81901 1.91349C2.13988 1.75 2.55992 1.75 3.4 1.75H6.625",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),SuccessStep=({hash:_})=>{const $=`${useSelectedNetwork().tzktExplorerUrl}/${_}`,{onClose:j}=reactExports.useContext(DynamicModalContext),et=useNavigate();return jsxRuntimeExports.jsxs(ModalContent,{paddingY:"20px",children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{textAlign:"center",children:jsxRuntimeExports.jsx(Heading,{children:"Operation Submitted"})}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(Flex,{justifyContent:"center",marginTop:"10px",children:jsxRuntimeExports.jsx(Text,{color:"text.dark",textAlign:"center",size:"sm",children:"You can follow this operation's progress in the Operations section. It may take up to 30 seconds to appear."})})}),jsxRuntimeExports.jsxs(ModalFooter,{justifyContent:"center",flexDirection:"column",width:"100%",children:[jsxRuntimeExports.jsx(Button,{width:"100%",onClick:()=>{j(),et("/operations")},size:"lg",children:"See all Operations"}),jsxRuntimeExports.jsx(Link,{rel:"noopener noreferrer",target:"_blank",to:$,children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",marginTop:"24px",children:jsxRuntimeExports.jsxs(Button,{variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"View in Tzkt"}),jsxRuntimeExports.jsx(WindowLinkIcon,{stroke:"currentcolor"})]})})})]})]})},useSignWithBeacon=(_,a)=>{const{isLoading:$,handleAsyncAction:j}=useAsyncActionHandler(),{openWith:et}=reactExports.useContext(DynamicModalContext),tt=useFindNetwork(),rt=useForm({defaultValues:{executeParams:_.estimates}}),nt=async it=>j(async()=>{const{opHash:ot}=await executeOperations({..._,estimates:rt.watch("executeParams")},it),st={type:BeaconMessageType.OperationResponse,id:a.id,transactionHash:ot};return await WalletClient.respond(st),et(jsxRuntimeExports.jsx(SuccessStep,{hash:ot}))},ot=>({description:`Failed to confirm Beacon operation: ${ot.message}`}));return{fee:totalFee(rt.watch("executeParams")),isSigning:$,onSign:nt,network:tt(a.network.type),form:rt}},SignPageFee=({fee:_})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Fee:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"fee",size:"sm",children:prettyTezAmount(_)})]}),BatchSignPage=({operation:_,message:a})=>{const{isSigning:$,onSign:j,network:et,fee:tt,form:rt}=useSignWithBeacon(_,a),{signer:nt}=_,it=_.operations.length;return jsxRuntimeExports.jsx(FormProvider,{...rt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:a,mode:"batch",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Accordion,{allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",paddingY:"6px",size:"sm",children:"Operations"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(JsValueWrap,{overflowY:"auto",maxHeight:"200px",value:a.operationDetails})})]})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"16px",children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:nt.address}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",marginY:"12px",paddingX:"4px",children:[jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Transactions:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"transaction-length",size:"sm",children:it})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:tt})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:$,network:et,onSubmit:j,signer:nt,text:headerText(_.type,"batch")})})]})})})},useBatches=()=>{const _=useSelectedNetwork();return useAppSelector($=>$.batches[_.name])||[]},useClearBatch=()=>{const _=useAppDispatch(),a=useSelectedNetwork();return $=>_(batchesActions.clear({pkh:$.address.pkh,network:a}))},useRemoveBatchItem=()=>{const _=useAppDispatch(),a=useSelectedNetwork();return($,j)=>_(batchesActions.removeItem({pkh:$.address.pkh,index:j,network:a}))},FormSubmitButtons=({isLoading:_,isValid:a,onSingleSubmit:$,onAddToBatch:j,showPreview:et=!0})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(Box,{width:"100%",children:[et&&jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"16px",isDisabled:!a,isLoading:_,onClick:$,size:"lg",type:"submit",children:"Preview"}),jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!a,isLoading:_,onClick:j,size:"lg",type:"submit",variant:"tertiary",children:"Insert Into Batch"})]})}),formDefaultValues=({sender:_,form:a})=>a||(_?{sender:_.address.pkh}:{}),useSignPageHelpers=(_,a)=>{const[$,j]=reactExports.useState(!1),et=useGetImplicitAccount(),[tt,rt]=reactExports.useState(_),nt=useSelectedNetwork(),it=useClearBatch(),{isLoading:ot,handleAsyncAction:st,handleAsyncActionUnsafe:ct}=useAsyncActionHandler(),{openWith:ut}=reactExports.useContext(DynamicModalContext),ht=useForm({mode:"onBlur",defaultValues:{signer:tt.signer.address.pkh,sender:tt.sender.address.pkh,executeParams:tt.estimates}}),Et=ht.watch("signer"),St=async kt=>ct(async()=>{const Ct=await estimate({...tt,signer:et(kt)},nt);ht.setValue("executeParams",Ct.estimates),rt(Ct),j(!1)},{isClosable:!0,duration:null}).catch(()=>j(!0)),Mt=async kt=>st(async()=>{const Ct=await executeOperations({...tt,estimates:ht.watch("executeParams")},kt);return a==="batch"&&it(tt.sender),await ut(jsxRuntimeExports.jsx(SuccessStep,{hash:Ct.opHash})),Ct});return{fee:totalFee(ht.watch("executeParams")),estimationFailed:$,operations:tt,isLoading:ot,form:ht,signer:et(Et),reEstimate:St,onSign:Mt}},useMakeFormOperations=_=>{const a=useGetOwnedAccount(),$=useGetBestSignerForAccount();return j=>{const et=a(j.sender);return makeAccountOperations(et,$(et),[_(j)])}},getSmallestUnit=_=>(_<0&&(console.warn("Decimals cannot be negative"),_=0),`${_===0?"":"0."+lodashExports.repeat("0",_-1)}1`),makeValidateDecimals=_=>a=>a.includes(".")&&a.split(".")[1].length>_?`Please enter a value with up to ${_} decimal places`:!0,AdvancedSettingsAccordion=({index:_=0})=>{var it,ot,st,ct;const{register:a,getValues:$,setValue:j,formState:{errors:et}}=useFormContext(),[tt,rt]=reactExports.useState(mutezToTez($().executeParams[_].fee).toFixed()),nt=ut=>{const ht=ut.target.value;makeValidateDecimals(TEZ_DECIMALS)(ht)===!0&&(rt(ht),ht&&j(`executeParams.${_}.fee`,tezToMutez(ht).toNumber()))};return jsxRuntimeExports.jsx(Accordion,{marginTop:"16px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",marginY:"10px",size:"md",children:"Advanced"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsxs(AccordionPanel,{gap:"16px",display:"flex",children:[jsxRuntimeExports.jsxs(FormControl,{children:[jsxRuntimeExports.jsx(FormLabel,{fontSize:"14px",children:"Fee"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{paddingRight:"28px",fontSize:"14px",onBlur:()=>rt(mutezToTez($().executeParams[_].fee).toFixed()),onChange:nt,placeholder:"0.000000",step:getSmallestUnit(TEZ_DECIMALS),type:"number",value:tt}),jsxRuntimeExports.jsx(InputRightElement,{width:"44px",maxWidth:"fit-content",height:"46px",paddingRight:"12px",children:"ꜩ"})]})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!((ot=(it=et.executeParams)==null?void 0:it[_])!=null&&ot.gasLimit),children:[jsxRuntimeExports.jsx(FormLabel,{fontSize:"14px",children:"Gas Limit"}),jsxRuntimeExports.jsx(Input,{...a(`executeParams.${_}.gasLimit`,{valueAsNumber:!0,required:!0}),placeholder:"0",type:"number"})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!((ct=(st=et.executeParams)==null?void 0:st[_])!=null&&ct.storageLimit),children:[jsxRuntimeExports.jsx(FormLabel,{fontSize:"14px",children:"Storage Limit"}),jsxRuntimeExports.jsx(Input,{...a(`executeParams.${_}.storageLimit`,{valueAsNumber:!0,required:!0}),placeholder:"0",type:"number"})]})]})]})})},TezTile=({mutezAmount:_})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"60px",padding:"15px",background:colors.gray[800],borderRadius:"4px",children:[jsxRuntimeExports.jsx(TezIcon,{marginRight:"12px"}),jsxRuntimeExports.jsx(Flex,{alignItems:"end",children:jsxRuntimeExports.jsx(PrettyNumber,{number:prettyTezAmount(_)})})]}),ContractCallSignPage=({operation:_,message:a})=>{const{amount:$,contract:j,entrypoint:et,args:tt}=_.operations[0],{isSigning:rt,onSign:nt,network:it,fee:ot,form:st}=useSignWithBeacon(_,a);return jsxRuntimeExports.jsx(FormProvider,{...st,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:a,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:$}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:ot})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:_.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:j}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"Contract Call Parameter"}),jsxRuntimeExports.jsx(Accordion,{allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Box,{flex:"1",textAlign:"left",children:"JSON"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(JsValueWrap,{value:{entrypoint:et,values:tt}})})]})}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(SignButton,{isLoading:rt,network:it,onSubmit:nt,signer:_.signer,text:headerText(_.type,"single")})})]})})})},DelegationSignPage=({operation:_,message:a})=>{const{recipient:$}=_.operations[0],{isSigning:j,onSign:et,network:tt,fee:rt,form:nt}=useSignWithBeacon(_,a);return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:a,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:_.signer.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(SignPageFee,{fee:rt})})}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:$}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:j,network:tt,onSubmit:et,signer:_.signer,text:headerText(_.type,"single")})})]})})})},OriginationOperationSignPage=({operation:_,message:a})=>{const{isSigning:$,onSign:j,network:et,form:tt,fee:rt}=useSignWithBeacon(_,a),{code:nt,storage:it}=_.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...tt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsxs(ModalHeader,{marginBottom:"24px",children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"center",children:"Operation Request"}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"center",marginTop:"10px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Network:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:lodashExports.capitalize(a.network.type)})]})]}),jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsxs(ModalBody,{"data-testid":"beacon-request-body",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"16px",padding:"15px",borderRadius:"4px",backgroundColor:colors.gray[800],children:[jsxRuntimeExports.jsx(AspectRatio,{width:"60px",marginRight:"12px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{borderRadius:"4px",src:a.appMetadata.icon})}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:a.appMetadata.name})]}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:rt})}),jsxRuntimeExports.jsx(Accordion,{marginTop:"16px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",marginY:"10px",size:"md",children:"Code"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{overflowY:"auto",maxHeight:"300px",children:jsxRuntimeExports.jsx(JsValueWrap,{value:nt})})]})}),jsxRuntimeExports.jsx(Accordion,{marginTop:"16px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",marginY:"10px",size:"md",children:"Storage"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{overflowY:"auto",maxHeight:"300px",children:jsxRuntimeExports.jsx(JsValueWrap,{value:it})})]})}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(SignButton,{isLoading:$,network:et,onSubmit:j,signer:_.signer,text:headerText(_.type,"single")})})]})})})},TezSignPage=({operation:_,message:a})=>{const{amount:$,recipient:j}=_.operations[0],{isSigning:et,onSign:tt,network:rt,fee:nt,form:it}=useSignWithBeacon(_,a);return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:a,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:$}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:nt})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:_.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:j}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:et,network:rt,onSubmit:tt,signer:_.signer,text:headerText(_.type,"single")})})]})})})},UndelegationSignPage=({operation:_,message:a})=>{const{isSigning:$,onSign:j,network:et,form:tt,fee:rt}=useSignWithBeacon(_,a);return jsxRuntimeExports.jsx(FormProvider,{...tt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:a,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:_.signer.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",paddingX:"4px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:rt})}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:$,network:et,onSubmit:j,signer:_.signer,text:headerText(_.type,"single")})})]})})})},BeaconSignPage=({operation:_,message:a})=>{switch(_.operations[0].type){case"tez":return jsxRuntimeExports.jsx(TezSignPage,{message:a,operation:_});case"contract_call":return jsxRuntimeExports.jsx(ContractCallSignPage,{message:a,operation:_});case"delegation":return jsxRuntimeExports.jsx(DelegationSignPage,{message:a,operation:_});case"undelegation":return jsxRuntimeExports.jsx(UndelegationSignPage,{message:a,operation:_});case"contract_origination":return jsxRuntimeExports.jsx(OriginationOperationSignPage,{message:a,operation:_});case"fa1.2":case"fa2":throw new Error("Unsupported operation type")}},useHandleBeaconMessage=()=>{const{openWith:_}=reactExports.useContext(DynamicModalContext),{handleAsyncAction:a}=useAsyncActionHandler(),$=useGetOwnedAccountSafe(),j=useFindNetwork(),et=({id:tt,network:rt})=>{const nt=j(rt.type);if(!nt)throw WalletClient.respond({id:tt,type:BeaconMessageType.Error,errorType:BeaconErrorType.NETWORK_NOT_SUPPORTED}),new Error(`Got Beacon request from an unknown network: ${JSON.stringify(rt)}. Please add it to the networks list and retry.`);return nt};return tt=>{a(async()=>{let rt;switch(tt.type){case BeaconMessageType.PermissionRequest:{et(tt),rt=jsxRuntimeExports.jsx(PermissionRequestModal,{request:tt});break}case BeaconMessageType.SignPayloadRequest:{rt=jsxRuntimeExports.jsx(SignPayloadRequestModal,{request:tt});break}case BeaconMessageType.OperationRequest:{const nt=et(tt),it=$(tt.sourceAddress);if(!it)throw WalletClient.respond({id:tt.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.NO_PRIVATE_KEY_FOUND_ERROR}),new Error(`Unknown account: ${tt.sourceAddress}`);const ot=toAccountOperations(tt.operationDetails,it),st=await estimate(ot,nt);ot.operations.length===1?rt=jsxRuntimeExports.jsx(BeaconSignPage,{message:tt,operation:st}):rt=jsxRuntimeExports.jsx(BatchSignPage,{message:tt,operation:st});break}default:throw WalletClient.respond({id:tt.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.UNKNOWN_ERROR}),new Error(`Unknown Beacon message type: ${tt.type}`)}return _(rt)},rt=>({description:`Error while processing Beacon request: ${rt.message}`}))}},toAccountOperations=(_,a)=>{if(_.length===0)throw new Error("Empty operation details!");const $=_.map(j=>partialOperationToOperation(j,a));return{type:"implicit",sender:a,operations:$,signer:a}},partialOperationToOperation=(_,a)=>{switch(_.kind){case TezosOperationType.TRANSACTION:{const{destination:$,amount:j,parameters:et}=_;return et?{type:"contract_call",amount:j,contract:parsePkh($),entrypoint:et.entrypoint,args:et.value}:{type:"tez",amount:j,recipient:parseImplicitPkh(_.destination)}}case TezosOperationType.DELEGATION:{const{delegate:$}=_;return $?{type:"delegation",sender:a.address,recipient:parseImplicitPkh($)}:{type:"undelegation",sender:a.address}}case TezosOperationType.ORIGINATION:{const{script:$}=_,{code:j,storage:et}=$;return{type:"contract_origination",sender:a.address,code:j,storage:et}}default:throw new Error(`Unsupported operation kind: ${_.kind}`)}},BeaconProvider=({children:_})=>{const a=useToast(),$=useHandleBeaconMessage();return reactExports.useEffect(()=>{WalletClient.init().then(()=>WalletClient.connect($)).catch(j=>{a({status:j,description:`Failed to connect to Beacon: ${j.message}`})})}),_};function toDate(_){const a=Object.prototype.toString.call(_);return _ instanceof Date||typeof _=="object"&&a==="[object Date]"?new _.constructor(+_):typeof _=="number"||a==="[object Number]"||typeof _=="string"||a==="[object String]"?new Date(_):new Date(NaN)}function constructFrom(_,a){return _ instanceof Date?new _.constructor(a):new Date(a)}const millisecondsInWeek=6048e5,millisecondsInDay=864e5,millisecondsInMinute=6e4,millisecondsInHour=36e5,millisecondsInSecond=1e3,minutesInMonth=43200,minutesInDay=1440;let defaultOptions={};function getDefaultOptions(){return defaultOptions}function startOfWeek(_,a){var nt,it,ot,st;const $=getDefaultOptions(),j=(a==null?void 0:a.weekStartsOn)??((it=(nt=a==null?void 0:a.locale)==null?void 0:nt.options)==null?void 0:it.weekStartsOn)??$.weekStartsOn??((st=(ot=$.locale)==null?void 0:ot.options)==null?void 0:st.weekStartsOn)??0,et=toDate(_),tt=et.getDay(),rt=(tt=et.getTime()?$+1:a.getTime()>=rt.getTime()?$:$-1}function startOfDay(_){const a=toDate(_);return a.setHours(0,0,0,0),a}function getTimezoneOffsetInMilliseconds(_){const a=toDate(_),$=new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()));return $.setUTCFullYear(a.getFullYear()),+_-+$}function differenceInCalendarDays(_,a){const $=startOfDay(_),j=startOfDay(a),et=+$-getTimezoneOffsetInMilliseconds($),tt=+j-getTimezoneOffsetInMilliseconds(j);return Math.round((et-tt)/millisecondsInDay)}function startOfISOWeekYear(_){const a=getISOWeekYear(_),$=constructFrom(_,0);return $.setFullYear(a,0,4),$.setHours(0,0,0,0),startOfISOWeek($)}function compareAsc(_,a){const $=toDate(_),j=toDate(a),et=$.getTime()-j.getTime();return et<0?-1:et>0?1:et}function isDate(_){return _ instanceof Date||typeof _=="object"&&Object.prototype.toString.call(_)==="[object Date]"}function isValid(_){if(!isDate(_)&&typeof _!="number")return!1;const a=toDate(_);return!isNaN(Number(a))}function differenceInCalendarMonths(_,a){const $=toDate(_),j=toDate(a),et=$.getFullYear()-j.getFullYear(),tt=$.getMonth()-j.getMonth();return et*12+tt}function differenceInDays(_,a){const $=toDate(_),j=toDate(a),et=compareLocalAsc($,j),tt=Math.abs(differenceInCalendarDays($,j));$.setDate($.getDate()-et*tt);const rt=+(compareLocalAsc($,j)===-et),nt=et*(tt-rt);return nt===0?0:nt}function compareLocalAsc(_,a){const $=_.getFullYear()-a.getFullYear()||_.getMonth()-a.getMonth()||_.getDate()-a.getDate()||_.getHours()-a.getHours()||_.getMinutes()-a.getMinutes()||_.getSeconds()-a.getSeconds()||_.getMilliseconds()-a.getMilliseconds();return $<0?-1:$>0?1:$}function getRoundingMethod(_){return a=>{const j=(_?Math[_]:Math.trunc)(a);return j===0?0:j}}function differenceInMilliseconds(_,a){return+toDate(_)-+toDate(a)}function differenceInMinutes(_,a,$){const j=differenceInMilliseconds(_,a)/millisecondsInMinute;return getRoundingMethod($==null?void 0:$.roundingMethod)(j)}function endOfDay(_){const a=toDate(_);return a.setHours(23,59,59,999),a}function endOfMonth(_){const a=toDate(_),$=a.getMonth();return a.setFullYear(a.getFullYear(),$+1,0),a.setHours(23,59,59,999),a}function isLastDayOfMonth(_){const a=toDate(_);return+endOfDay(a)==+endOfMonth(a)}function differenceInMonths(_,a){const $=toDate(_),j=toDate(a),et=compareAsc($,j),tt=Math.abs(differenceInCalendarMonths($,j));let rt;if(tt<1)rt=0;else{$.getMonth()===1&&$.getDate()>27&&$.setDate(30),$.setMonth($.getMonth()-et*tt);let nt=compareAsc($,j)===-et;isLastDayOfMonth(toDate(_))&&tt===1&&compareAsc(_,j)===1&&(nt=!1),rt=et*(tt-Number(nt))}return rt===0?0:rt}function differenceInSeconds(_,a,$){const j=differenceInMilliseconds(_,a)/1e3;return getRoundingMethod($==null?void 0:$.roundingMethod)(j)}function startOfYear(_){const a=toDate(_),$=constructFrom(_,0);return $.setFullYear(a.getFullYear(),0,1),$.setHours(0,0,0,0),$}const formatDistanceLocale={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},formatDistance$1=(_,a,$)=>{let j;const et=formatDistanceLocale[_];return typeof et=="string"?j=et:a===1?j=et.one:j=et.other.replace("{{count}}",a.toString()),$!=null&&$.addSuffix?$.comparison&&$.comparison>0?"in "+j:j+" ago":j};function buildFormatLongFn(_){return(a={})=>{const $=a.width?String(a.width):_.defaultWidth;return _.formats[$]||_.formats[_.defaultWidth]}}const dateFormats={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},timeFormats={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},dateTimeFormats={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},formatLong={date:buildFormatLongFn({formats:dateFormats,defaultWidth:"full"}),time:buildFormatLongFn({formats:timeFormats,defaultWidth:"full"}),dateTime:buildFormatLongFn({formats:dateTimeFormats,defaultWidth:"full"})},formatRelativeLocale={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},formatRelative$1=(_,a,$,j)=>formatRelativeLocale[_];function buildLocalizeFn(_){return(a,$)=>{const j=$!=null&&$.context?String($.context):"standalone";let et;if(j==="formatting"&&_.formattingValues){const rt=_.defaultFormattingWidth||_.defaultWidth,nt=$!=null&&$.width?String($.width):rt;et=_.formattingValues[nt]||_.formattingValues[rt]}else{const rt=_.defaultWidth,nt=$!=null&&$.width?String($.width):_.defaultWidth;et=_.values[nt]||_.values[rt]}const tt=_.argumentCallback?_.argumentCallback(a):a;return et[tt]}}const eraValues={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},quarterValues={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},monthValues={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dayValues={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},dayPeriodValues={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},formattingDayPeriodValues={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ordinalNumber=(_,a)=>{const $=Number(_),j=$%100;if(j>20||j<10)switch(j%10){case 1:return $+"st";case 2:return $+"nd";case 3:return $+"rd"}return $+"th"},localize={ordinalNumber,era:buildLocalizeFn({values:eraValues,defaultWidth:"wide"}),quarter:buildLocalizeFn({values:quarterValues,defaultWidth:"wide",argumentCallback:_=>_-1}),month:buildLocalizeFn({values:monthValues,defaultWidth:"wide"}),day:buildLocalizeFn({values:dayValues,defaultWidth:"wide"}),dayPeriod:buildLocalizeFn({values:dayPeriodValues,defaultWidth:"wide",formattingValues:formattingDayPeriodValues,defaultFormattingWidth:"wide"})};function buildMatchFn(_){return(a,$={})=>{const j=$.width,et=j&&_.matchPatterns[j]||_.matchPatterns[_.defaultMatchWidth],tt=a.match(et);if(!tt)return null;const rt=tt[0],nt=j&&_.parsePatterns[j]||_.parsePatterns[_.defaultParseWidth],it=Array.isArray(nt)?findIndex(nt,ct=>ct.test(rt)):findKey(nt,ct=>ct.test(rt));let ot;ot=_.valueCallback?_.valueCallback(it):it,ot=$.valueCallback?$.valueCallback(ot):ot;const st=a.slice(rt.length);return{value:ot,rest:st}}}function findKey(_,a){for(const $ in _)if(Object.prototype.hasOwnProperty.call(_,$)&&a(_[$]))return $}function findIndex(_,a){for(let $=0;$<_.length;$++)if(a(_[$]))return $}function buildMatchPatternFn(_){return(a,$={})=>{const j=a.match(_.matchPattern);if(!j)return null;const et=j[0],tt=a.match(_.parsePattern);if(!tt)return null;let rt=_.valueCallback?_.valueCallback(tt[0]):tt[0];rt=$.valueCallback?$.valueCallback(rt):rt;const nt=a.slice(et.length);return{value:rt,rest:nt}}}const matchOrdinalNumberPattern=/^(\d+)(th|st|nd|rd)?/i,parseOrdinalNumberPattern=/\d+/i,matchEraPatterns={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},parseEraPatterns={any:[/^b/i,/^(a|c)/i]},matchQuarterPatterns={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},parseQuarterPatterns={any:[/1/i,/2/i,/3/i,/4/i]},matchMonthPatterns={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},parseMonthPatterns={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},matchDayPatterns={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},parseDayPatterns={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},matchDayPeriodPatterns={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},parseDayPeriodPatterns={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},match={ordinalNumber:buildMatchPatternFn({matchPattern:matchOrdinalNumberPattern,parsePattern:parseOrdinalNumberPattern,valueCallback:_=>parseInt(_,10)}),era:buildMatchFn({matchPatterns:matchEraPatterns,defaultMatchWidth:"wide",parsePatterns:parseEraPatterns,defaultParseWidth:"any"}),quarter:buildMatchFn({matchPatterns:matchQuarterPatterns,defaultMatchWidth:"wide",parsePatterns:parseQuarterPatterns,defaultParseWidth:"any",valueCallback:_=>_+1}),month:buildMatchFn({matchPatterns:matchMonthPatterns,defaultMatchWidth:"wide",parsePatterns:parseMonthPatterns,defaultParseWidth:"any"}),day:buildMatchFn({matchPatterns:matchDayPatterns,defaultMatchWidth:"wide",parsePatterns:parseDayPatterns,defaultParseWidth:"any"}),dayPeriod:buildMatchFn({matchPatterns:matchDayPeriodPatterns,defaultMatchWidth:"any",parsePatterns:parseDayPeriodPatterns,defaultParseWidth:"any"})},enUS={code:"en-US",formatDistance:formatDistance$1,formatLong,formatRelative:formatRelative$1,localize,match,options:{weekStartsOn:0,firstWeekContainsDate:1}};function getDayOfYear(_){const a=toDate(_);return differenceInCalendarDays(a,startOfYear(a))+1}function getISOWeek(_){const a=toDate(_),$=+startOfISOWeek(a)-+startOfISOWeekYear(a);return Math.round($/millisecondsInWeek)+1}function getWeekYear(_,a){var st,ct,ut,ht;const $=toDate(_),j=$.getFullYear(),et=getDefaultOptions(),tt=(a==null?void 0:a.firstWeekContainsDate)??((ct=(st=a==null?void 0:a.locale)==null?void 0:st.options)==null?void 0:ct.firstWeekContainsDate)??et.firstWeekContainsDate??((ht=(ut=et.locale)==null?void 0:ut.options)==null?void 0:ht.firstWeekContainsDate)??1,rt=constructFrom(_,0);rt.setFullYear(j+1,0,tt),rt.setHours(0,0,0,0);const nt=startOfWeek(rt,a),it=constructFrom(_,0);it.setFullYear(j,0,tt),it.setHours(0,0,0,0);const ot=startOfWeek(it,a);return $.getTime()>=nt.getTime()?j+1:$.getTime()>=ot.getTime()?j:j-1}function startOfWeekYear(_,a){var nt,it,ot,st;const $=getDefaultOptions(),j=(a==null?void 0:a.firstWeekContainsDate)??((it=(nt=a==null?void 0:a.locale)==null?void 0:nt.options)==null?void 0:it.firstWeekContainsDate)??$.firstWeekContainsDate??((st=(ot=$.locale)==null?void 0:ot.options)==null?void 0:st.firstWeekContainsDate)??1,et=getWeekYear(_,a),tt=constructFrom(_,0);return tt.setFullYear(et,0,j),tt.setHours(0,0,0,0),startOfWeek(tt,a)}function getWeek(_,a){const $=toDate(_),j=+startOfWeek($,a)-+startOfWeekYear($,a);return Math.round(j/millisecondsInWeek)+1}function addLeadingZeros(_,a){const $=_<0?"-":"",j=Math.abs(_).toString().padStart(a,"0");return $+j}const lightFormatters={y(_,a){const $=_.getFullYear(),j=$>0?$:1-$;return addLeadingZeros(a==="yy"?j%100:j,a.length)},M(_,a){const $=_.getMonth();return a==="M"?String($+1):addLeadingZeros($+1,2)},d(_,a){return addLeadingZeros(_.getDate(),a.length)},a(_,a){const $=_.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return $.toUpperCase();case"aaa":return $;case"aaaaa":return $[0];case"aaaa":default:return $==="am"?"a.m.":"p.m."}},h(_,a){return addLeadingZeros(_.getHours()%12||12,a.length)},H(_,a){return addLeadingZeros(_.getHours(),a.length)},m(_,a){return addLeadingZeros(_.getMinutes(),a.length)},s(_,a){return addLeadingZeros(_.getSeconds(),a.length)},S(_,a){const $=a.length,j=_.getMilliseconds(),et=Math.trunc(j*Math.pow(10,$-3));return addLeadingZeros(et,a.length)}},dayPeriodEnum={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},formatters={G:function(_,a,$){const j=_.getFullYear()>0?1:0;switch(a){case"G":case"GG":case"GGG":return $.era(j,{width:"abbreviated"});case"GGGGG":return $.era(j,{width:"narrow"});case"GGGG":default:return $.era(j,{width:"wide"})}},y:function(_,a,$){if(a==="yo"){const j=_.getFullYear(),et=j>0?j:1-j;return $.ordinalNumber(et,{unit:"year"})}return lightFormatters.y(_,a)},Y:function(_,a,$,j){const et=getWeekYear(_,j),tt=et>0?et:1-et;if(a==="YY"){const rt=tt%100;return addLeadingZeros(rt,2)}return a==="Yo"?$.ordinalNumber(tt,{unit:"year"}):addLeadingZeros(tt,a.length)},R:function(_,a){const $=getISOWeekYear(_);return addLeadingZeros($,a.length)},u:function(_,a){const $=_.getFullYear();return addLeadingZeros($,a.length)},Q:function(_,a,$){const j=Math.ceil((_.getMonth()+1)/3);switch(a){case"Q":return String(j);case"QQ":return addLeadingZeros(j,2);case"Qo":return $.ordinalNumber(j,{unit:"quarter"});case"QQQ":return $.quarter(j,{width:"abbreviated",context:"formatting"});case"QQQQQ":return $.quarter(j,{width:"narrow",context:"formatting"});case"QQQQ":default:return $.quarter(j,{width:"wide",context:"formatting"})}},q:function(_,a,$){const j=Math.ceil((_.getMonth()+1)/3);switch(a){case"q":return String(j);case"qq":return addLeadingZeros(j,2);case"qo":return $.ordinalNumber(j,{unit:"quarter"});case"qqq":return $.quarter(j,{width:"abbreviated",context:"standalone"});case"qqqqq":return $.quarter(j,{width:"narrow",context:"standalone"});case"qqqq":default:return $.quarter(j,{width:"wide",context:"standalone"})}},M:function(_,a,$){const j=_.getMonth();switch(a){case"M":case"MM":return lightFormatters.M(_,a);case"Mo":return $.ordinalNumber(j+1,{unit:"month"});case"MMM":return $.month(j,{width:"abbreviated",context:"formatting"});case"MMMMM":return $.month(j,{width:"narrow",context:"formatting"});case"MMMM":default:return $.month(j,{width:"wide",context:"formatting"})}},L:function(_,a,$){const j=_.getMonth();switch(a){case"L":return String(j+1);case"LL":return addLeadingZeros(j+1,2);case"Lo":return $.ordinalNumber(j+1,{unit:"month"});case"LLL":return $.month(j,{width:"abbreviated",context:"standalone"});case"LLLLL":return $.month(j,{width:"narrow",context:"standalone"});case"LLLL":default:return $.month(j,{width:"wide",context:"standalone"})}},w:function(_,a,$,j){const et=getWeek(_,j);return a==="wo"?$.ordinalNumber(et,{unit:"week"}):addLeadingZeros(et,a.length)},I:function(_,a,$){const j=getISOWeek(_);return a==="Io"?$.ordinalNumber(j,{unit:"week"}):addLeadingZeros(j,a.length)},d:function(_,a,$){return a==="do"?$.ordinalNumber(_.getDate(),{unit:"date"}):lightFormatters.d(_,a)},D:function(_,a,$){const j=getDayOfYear(_);return a==="Do"?$.ordinalNumber(j,{unit:"dayOfYear"}):addLeadingZeros(j,a.length)},E:function(_,a,$){const j=_.getDay();switch(a){case"E":case"EE":case"EEE":return $.day(j,{width:"abbreviated",context:"formatting"});case"EEEEE":return $.day(j,{width:"narrow",context:"formatting"});case"EEEEEE":return $.day(j,{width:"short",context:"formatting"});case"EEEE":default:return $.day(j,{width:"wide",context:"formatting"})}},e:function(_,a,$,j){const et=_.getDay(),tt=(et-j.weekStartsOn+8)%7||7;switch(a){case"e":return String(tt);case"ee":return addLeadingZeros(tt,2);case"eo":return $.ordinalNumber(tt,{unit:"day"});case"eee":return $.day(et,{width:"abbreviated",context:"formatting"});case"eeeee":return $.day(et,{width:"narrow",context:"formatting"});case"eeeeee":return $.day(et,{width:"short",context:"formatting"});case"eeee":default:return $.day(et,{width:"wide",context:"formatting"})}},c:function(_,a,$,j){const et=_.getDay(),tt=(et-j.weekStartsOn+8)%7||7;switch(a){case"c":return String(tt);case"cc":return addLeadingZeros(tt,a.length);case"co":return $.ordinalNumber(tt,{unit:"day"});case"ccc":return $.day(et,{width:"abbreviated",context:"standalone"});case"ccccc":return $.day(et,{width:"narrow",context:"standalone"});case"cccccc":return $.day(et,{width:"short",context:"standalone"});case"cccc":default:return $.day(et,{width:"wide",context:"standalone"})}},i:function(_,a,$){const j=_.getDay(),et=j===0?7:j;switch(a){case"i":return String(et);case"ii":return addLeadingZeros(et,a.length);case"io":return $.ordinalNumber(et,{unit:"day"});case"iii":return $.day(j,{width:"abbreviated",context:"formatting"});case"iiiii":return $.day(j,{width:"narrow",context:"formatting"});case"iiiiii":return $.day(j,{width:"short",context:"formatting"});case"iiii":default:return $.day(j,{width:"wide",context:"formatting"})}},a:function(_,a,$){const et=_.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return $.dayPeriod(et,{width:"abbreviated",context:"formatting"});case"aaa":return $.dayPeriod(et,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return $.dayPeriod(et,{width:"narrow",context:"formatting"});case"aaaa":default:return $.dayPeriod(et,{width:"wide",context:"formatting"})}},b:function(_,a,$){const j=_.getHours();let et;switch(j===12?et=dayPeriodEnum.noon:j===0?et=dayPeriodEnum.midnight:et=j/12>=1?"pm":"am",a){case"b":case"bb":return $.dayPeriod(et,{width:"abbreviated",context:"formatting"});case"bbb":return $.dayPeriod(et,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return $.dayPeriod(et,{width:"narrow",context:"formatting"});case"bbbb":default:return $.dayPeriod(et,{width:"wide",context:"formatting"})}},B:function(_,a,$){const j=_.getHours();let et;switch(j>=17?et=dayPeriodEnum.evening:j>=12?et=dayPeriodEnum.afternoon:j>=4?et=dayPeriodEnum.morning:et=dayPeriodEnum.night,a){case"B":case"BB":case"BBB":return $.dayPeriod(et,{width:"abbreviated",context:"formatting"});case"BBBBB":return $.dayPeriod(et,{width:"narrow",context:"formatting"});case"BBBB":default:return $.dayPeriod(et,{width:"wide",context:"formatting"})}},h:function(_,a,$){if(a==="ho"){let j=_.getHours()%12;return j===0&&(j=12),$.ordinalNumber(j,{unit:"hour"})}return lightFormatters.h(_,a)},H:function(_,a,$){return a==="Ho"?$.ordinalNumber(_.getHours(),{unit:"hour"}):lightFormatters.H(_,a)},K:function(_,a,$){const j=_.getHours()%12;return a==="Ko"?$.ordinalNumber(j,{unit:"hour"}):addLeadingZeros(j,a.length)},k:function(_,a,$){let j=_.getHours();return j===0&&(j=24),a==="ko"?$.ordinalNumber(j,{unit:"hour"}):addLeadingZeros(j,a.length)},m:function(_,a,$){return a==="mo"?$.ordinalNumber(_.getMinutes(),{unit:"minute"}):lightFormatters.m(_,a)},s:function(_,a,$){return a==="so"?$.ordinalNumber(_.getSeconds(),{unit:"second"}):lightFormatters.s(_,a)},S:function(_,a){return lightFormatters.S(_,a)},X:function(_,a,$){const j=_.getTimezoneOffset();if(j===0)return"Z";switch(a){case"X":return formatTimezoneWithOptionalMinutes(j);case"XXXX":case"XX":return formatTimezone(j);case"XXXXX":case"XXX":default:return formatTimezone(j,":")}},x:function(_,a,$){const j=_.getTimezoneOffset();switch(a){case"x":return formatTimezoneWithOptionalMinutes(j);case"xxxx":case"xx":return formatTimezone(j);case"xxxxx":case"xxx":default:return formatTimezone(j,":")}},O:function(_,a,$){const j=_.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+formatTimezoneShort(j,":");case"OOOO":default:return"GMT"+formatTimezone(j,":")}},z:function(_,a,$){const j=_.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+formatTimezoneShort(j,":");case"zzzz":default:return"GMT"+formatTimezone(j,":")}},t:function(_,a,$){const j=Math.trunc(_.getTime()/1e3);return addLeadingZeros(j,a.length)},T:function(_,a,$){const j=_.getTime();return addLeadingZeros(j,a.length)}};function formatTimezoneShort(_,a=""){const $=_>0?"-":"+",j=Math.abs(_),et=Math.trunc(j/60),tt=j%60;return tt===0?$+String(et):$+String(et)+a+addLeadingZeros(tt,2)}function formatTimezoneWithOptionalMinutes(_,a){return _%60===0?(_>0?"-":"+")+addLeadingZeros(Math.abs(_)/60,2):formatTimezone(_,a)}function formatTimezone(_,a=""){const $=_>0?"-":"+",j=Math.abs(_),et=addLeadingZeros(Math.trunc(j/60),2),tt=addLeadingZeros(j%60,2);return $+et+a+tt}const dateLongFormatter=(_,a)=>{switch(_){case"P":return a.date({width:"short"});case"PP":return a.date({width:"medium"});case"PPP":return a.date({width:"long"});case"PPPP":default:return a.date({width:"full"})}},timeLongFormatter=(_,a)=>{switch(_){case"p":return a.time({width:"short"});case"pp":return a.time({width:"medium"});case"ppp":return a.time({width:"long"});case"pppp":default:return a.time({width:"full"})}},dateTimeLongFormatter=(_,a)=>{const $=_.match(/(P+)(p+)?/)||[],j=$[1],et=$[2];if(!et)return dateLongFormatter(_,a);let tt;switch(j){case"P":tt=a.dateTime({width:"short"});break;case"PP":tt=a.dateTime({width:"medium"});break;case"PPP":tt=a.dateTime({width:"long"});break;case"PPPP":default:tt=a.dateTime({width:"full"});break}return tt.replace("{{date}}",dateLongFormatter(j,a)).replace("{{time}}",timeLongFormatter(et,a))},longFormatters={p:timeLongFormatter,P:dateTimeLongFormatter},dayOfYearTokenRE=/^D+$/,weekYearTokenRE=/^Y+$/,throwTokens=["D","DD","YY","YYYY"];function isProtectedDayOfYearToken(_){return dayOfYearTokenRE.test(_)}function isProtectedWeekYearToken(_){return weekYearTokenRE.test(_)}function warnOrThrowProtectedError(_,a,$){const j=message(_,a,$);if(console.warn(j),throwTokens.includes(_))throw new RangeError(j)}function message(_,a,$){const j=_[0]==="Y"?"years":"days of the month";return`Use \`${_.toLowerCase()}\` instead of \`${_}\` (in \`${a}\`) for formatting ${j} to the input \`${$}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const formattingTokensRegExp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,longFormattingTokensRegExp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,escapedStringRegExp=/^'([^]*?)'?$/,doubleQuoteRegExp=/''/g,unescapedLatinCharacterRegExp=/[a-zA-Z]/;function format(_,a,$){var st,ct,ut,ht,Et,St,Mt,kt;const j=getDefaultOptions(),et=($==null?void 0:$.locale)??j.locale??enUS,tt=($==null?void 0:$.firstWeekContainsDate)??((ct=(st=$==null?void 0:$.locale)==null?void 0:st.options)==null?void 0:ct.firstWeekContainsDate)??j.firstWeekContainsDate??((ht=(ut=j.locale)==null?void 0:ut.options)==null?void 0:ht.firstWeekContainsDate)??1,rt=($==null?void 0:$.weekStartsOn)??((St=(Et=$==null?void 0:$.locale)==null?void 0:Et.options)==null?void 0:St.weekStartsOn)??j.weekStartsOn??((kt=(Mt=j.locale)==null?void 0:Mt.options)==null?void 0:kt.weekStartsOn)??0,nt=toDate(_);if(!isValid(nt))throw new RangeError("Invalid time value");let it=a.match(longFormattingTokensRegExp).map(Ct=>{const Ot=Ct[0];if(Ot==="p"||Ot==="P"){const zt=longFormatters[Ot];return zt(Ct,et.formatLong)}return Ct}).join("").match(formattingTokensRegExp).map(Ct=>{if(Ct==="''")return{isToken:!1,value:"'"};const Ot=Ct[0];if(Ot==="'")return{isToken:!1,value:cleanEscapedString(Ct)};if(formatters[Ot])return{isToken:!0,value:Ct};if(Ot.match(unescapedLatinCharacterRegExp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+Ot+"`");return{isToken:!1,value:Ct}});et.localize.preprocessor&&(it=et.localize.preprocessor(nt,it));const ot={firstWeekContainsDate:tt,weekStartsOn:rt,locale:et};return it.map(Ct=>{if(!Ct.isToken)return Ct.value;const Ot=Ct.value;(!($!=null&&$.useAdditionalWeekYearTokens)&&isProtectedWeekYearToken(Ot)||!($!=null&&$.useAdditionalDayOfYearTokens)&&isProtectedDayOfYearToken(Ot))&&warnOrThrowProtectedError(Ot,a,String(_));const zt=formatters[Ot[0]];return zt(nt,Ot,et.localize,ot)}).join("")}function cleanEscapedString(_){const a=_.match(escapedStringRegExp);return a?a[1].replace(doubleQuoteRegExp,"'"):_}function formatDistance(_,a,$){const j=getDefaultOptions(),et=($==null?void 0:$.locale)??j.locale??enUS,tt=2520,rt=compareAsc(_,a);if(isNaN(rt))throw new RangeError("Invalid time value");const nt=Object.assign({},$,{addSuffix:$==null?void 0:$.addSuffix,comparison:rt});let it,ot;rt>0?(it=toDate(a),ot=toDate(_)):(it=toDate(_),ot=toDate(a));const st=differenceInSeconds(ot,it),ct=(getTimezoneOffsetInMilliseconds(ot)-getTimezoneOffsetInMilliseconds(it))/1e3,ut=Math.round((st-ct)/60);let ht;if(ut<2)return $!=null&&$.includeSeconds?st<5?et.formatDistance("lessThanXSeconds",5,nt):st<10?et.formatDistance("lessThanXSeconds",10,nt):st<20?et.formatDistance("lessThanXSeconds",20,nt):st<40?et.formatDistance("halfAMinute",0,nt):st<60?et.formatDistance("lessThanXMinutes",1,nt):et.formatDistance("xMinutes",1,nt):ut===0?et.formatDistance("lessThanXMinutes",1,nt):et.formatDistance("xMinutes",ut,nt);if(ut<45)return et.formatDistance("xMinutes",ut,nt);if(ut<90)return et.formatDistance("aboutXHours",1,nt);if(ut{const _=useAppDispatch(),a=useToast();return reactExports.useCallback(j=>{j&&(_(errorsSlice.actions.add(getErrorContext(j))),a({description:`Data fetching error: ${j.message}`,status:"error",isClosable:!0}))},[_,a])},BAKERS_REFRESH_RATE=hoursToMilliseconds(2),usePollBakers=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useQuery({queryKey:["bakers",_,$],queryFn:()=>getBakers($),retry:!1,refetchInterval:BAKERS_REFRESH_RATE,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),et=j.data;return reactExports.useEffect(()=>{et&&_(assetsActions.updateBakers(et))},[_,et]),a(j.error),j},BLOCK_TIME=secondsToMilliseconds(15),usePollBlockLevel=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useQuery({queryKey:["blockLevel",_,$],queryFn:()=>getLatestBlockLevel($),retry:!1,refetchInterval:BLOCK_TIME,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),et=j.data;return reactExports.useEffect(()=>{et&&_(assetsActions.updateBlockLevel(et))},[_,et]),a(j.error),j},CONVERSION_RATE_REFRESH_RATE=minutesToMilliseconds(5),usePollConversionRate=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useQuery({queryKey:["conversionRate",_],queryFn:getTezosPriceInUSD,refetchInterval:CONVERSION_RATE_REFRESH_RATE,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),j=$.data;return reactExports.useEffect(()=>{_(assetsActions.updateConversionRate(j))},[_,j]),a($.error),$},usePollMultisigs=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useRefetchTrigger(),j=useSelectedNetwork(),et=useImplicitAccounts().map(nt=>nt.address.pkh),tt=useQuery({queryKey:["multisigs",j,et,$],queryFn:()=>getRelevantMultisigContracts(new Set(et),j),retry:!1,refetchInterval:BLOCK_TIME,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),rt=tt.data;return reactExports.useEffect(()=>{rt&&_(multisigActions.setMultisigs(rt))},[rt,_]),a(tt.error),tt},usePollPendingOperations=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useRefetchTrigger(),et=useMultisigAccounts(),tt=useQuery({queryKey:["pendingOperations",$,et,j],queryFn:()=>getPendingOperationsForMultisigs(et,$),retry:!1,refetchInterval:BLOCK_TIME,select:nt=>nt.flat(),refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),rt=tt.data;return reactExports.useEffect(()=>{rt&&_(multisigActions.setPendingOperations(rt))},[_,rt]),a(tt.error),tt},usePollTezBalances=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useRefetchTrigger(),et=useAllAccounts().map(nt=>nt.address.pkh),tt=useQuery({queryKey:["accountInformation",$,et,j],queryFn:()=>getAccounts(et,$),retry:!1,refetchInterval:BLOCK_TIME,select:nt=>nt.flat(),refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),rt=tt.data;return reactExports.useEffect(()=>{rt&&_(assetsActions.updateTezBalance(rt))},[_,rt]),a(tt.error),tt},usePollTokenBalances=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useRefetchTrigger(),et=useAllAccounts().map(nt=>nt.address.pkh),tt=useQuery({queryKey:["tokenBalances",$,et,j],queryFn:()=>getTokenBalances(et,$),retry:!1,refetchInterval:BLOCK_TIME,select:nt=>nt.flat(),refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),rt=tt.data;return reactExports.useEffect(()=>{if(!rt)return;const nt=rt.map(({token:it,lastLevel:ot})=>({...it,lastLevel:ot}));_(tokensActions.addTokens({network:$,tokens:nt})),_(assetsActions.updateTokenBalance(rt))},[_,rt,$]),a(tt.error),tt},useDataPolling=()=>{const _=useAppDispatch(),{dataUpdatedAt:a,isFetching:$}=usePollMultisigs(),{dataUpdatedAt:j,isFetching:et}=usePollPendingOperations(),{dataUpdatedAt:tt,isFetching:rt}=usePollTezBalances(),{dataUpdatedAt:nt,isFetching:it}=usePollTokenBalances();usePollConversionRate(),usePollBlockLevel(),usePollBakers();const ot=$||et||rt||it,st=Math.max(a,j,tt,nt);reactExports.useEffect(()=>{_(assetsActions.setIsLoading(ot)),!ot&&st&&_(assetsActions.setLastTimeUpdated(fromUnixTime(Math.round(st/1e3)).toUTCString()))},[_,ot,st])},useDeeplinkHandler=()=>{const _=useToast(),a=useAddPeer(),$=reactExports.useRef(a),j=reactExports.useRef(_),et=(tt,rt)=>{const nt=rt.replace(":///","://");if(nt.startsWith("umami://auth/")){const it=parseTorusRedirectParams(nt);window.postMessage(it)}else if(nt.startsWith("umami://?type=tzip10&data=")){const ot=new URL(nt).searchParams.get("data");ot?$.current(ot):j.current({title:"Linkhandler",description:"Data Payload missing"})}else j.current({title:"Linkhandler",description:"Unsupported link type"})};reactExports.useEffect(()=>{const tt=window;return tt&&tt.electronAPI&&tt.electronAPI.onDeeplink(et),()=>{}},[])},TOAST_ID="TOAST_ID",CopyableAddress=({pkh:_,formatAddress:a=!0,copyable:$=!0,iconColor:j=colors.gray[600],...et})=>jsxRuntimeExports.jsx(CopyableText,{copyValue:$?_:void 0,displayText:a?formatPkh(_):_,iconColor:j,toastMessage:"Address copied to clipboard",...et}),CopyableText=({displayText:_,copyValue:a,toastMessage:$,iconColor:j,...et})=>{const tt=useToast(),rt=async()=>{a&&(await navigator.clipboard.writeText(a),!(!$||tt.isActive(TOAST_ID))&&tt({status:"success",description:$,id:TOAST_ID,isClosable:!0}))};return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",...et,children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[400],size:"sm",children:_}),a&&jsxRuntimeExports.jsx(FileCopyIcon,{stroke:colors.gray[450],_hover:{stroke:colors.green},cursor:"pointer",onClick:()=>rt()})]})},UpsertContactModal=({contact:_})=>{const{handleAsyncAction:a}=useAsyncActionHandler(),$=useAppDispatch(),{isOpen:j,onClose:et}=reactExports.useContext(DynamicModalContext),tt=useAvailableNetworks(),rt=!!(_!=null&&_.pkh&&_.name),nt=async kt=>{isValidContractPkh(kt.pkh)?await a(async()=>{const Ct=await getNetworksForContracts(tt,[kt.pkh]);if(!Ct.has(kt.pkh))throw new Error(`Network not found for contract ${kt.pkh}`);$(contactsActions.upsert({...kt,network:Ct.get(kt.pkh)}))}):$(contactsActions.upsert({...kt,network:void 0})),et(),ut()},{handleSubmit:it,formState:{isValid:ot,errors:st},register:ct,reset:ut}=useForm({mode:"onBlur",defaultValues:_}),ht=({name:kt,pkh:Ct})=>{nt({name:kt.trim(),pkh:Ct})},Et=reactExports.useRef(ut);reactExports.useEffect(()=>{j&&Et.current(_)},[j,_]);const St=useValidateNewContactPkh(),Mt=useValidateName(_==null?void 0:_.name);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:it(ht),children:[jsxRuntimeExports.jsx(ModalHeader,{textAlign:"center",children:rt?"Edit Contact":"Add Contact"}),jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!st.name,marginY:5,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Name"}),jsxRuntimeExports.jsx(Input,{type:"text",...ct("name",{required:"Name is required",validate:Mt}),placeholder:"Enter contact's name"}),st.name&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"name-error",children:st.name.message})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!st.pkh,marginY:5,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Address"}),jsxRuntimeExports.jsx(Input,{type:"text",...ct("pkh",{required:"Address is required",validate:rt?()=>!0:St}),disabled:rt,placeholder:"Enter contact's tz address",variant:rt?"filled":void 0}),st.pkh&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"address-error",children:st.pkh.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:2,"data-testid":"confirmation-button",isDisabled:!ot,size:"lg",type:"submit",children:rt?"Update":"Add to Address Book"})})})]})})},DeleteContactModal=({contact:_})=>{const a=useAppDispatch(),{onClose:$}=reactExports.useContext(DynamicModalContext),j=()=>{a(contactsActions.remove(_.pkh)),$()};return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"10px",textAlign:"center",children:"Delete Contact"}),jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flexDirection:"column",children:[jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:"Are you sure you want to delete this contact?"}),jsxRuntimeExports.jsxs(Box,{marginTop:5,children:[jsxRuntimeExports.jsx(Heading,{marginBottom:3,textAlign:"center",size:"md",children:_.name}),jsxRuntimeExports.jsx(CopyableAddress,{pkh:_.pkh})]})]})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:2,onClick:j,variant:"warning",children:"Delete Contact"})})})]})},PopoverMenu=_=>{const{onOpen:a,onClose:$,isOpen:j}=useDisclosure$1();return jsxRuntimeExports.jsxs(Popover,{isOpen:j,onClose:$,onOpen:a,placement:"bottom-start",children:[jsxRuntimeExports.jsx(PopoverTrigger,{children:jsxRuntimeExports.jsx(Button,{minWidth:"24px",height:"24px",padding:"0",background:j?colors.green:colors.gray[500],border:"none",borderRadius:"full",_hover:{bg:j?colors.green:colors.gray[450]},"data-testid":"popover-cta",variant:"unstyled",children:jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsx(ThreeDotsIcon,{})})})}),jsxRuntimeExports.jsx(PopoverContent,{width:"100px",background:colors.gray[700],children:jsxRuntimeExports.jsx(PopoverBody,{borderRadius:"lg",children:_.children})})]})},RenameRemoveMenu=({onRename:_,onRemove:a})=>jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(PopoverMenu,{children:jsxRuntimeExports.jsxs(Box,{paddingY:"0",children:[jsxRuntimeExports.jsx(Button,{height:a?"24px":"28px",onClick:_,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Rename"}),jsxRuntimeExports.jsx(PenIcon,{stroke:"inherit"})]})}),a&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:"4px"}),jsxRuntimeExports.jsx(Button,{"data-testid":"popover-remove",onClick:a,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Remove"}),jsxRuntimeExports.jsx(TrashIcon,{stroke:"inherit"})]})})]})]})})}),SendButton=({onClick:_,...a})=>jsxRuntimeExports.jsxs(Button,{width:"60px",onClick:_,variant:"specialCTA",...a,children:[jsxRuntimeExports.jsx(OutgoingArrow,{stroke:"currentcolor"}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",children:"Send"})]}),OperationSignerSelector=({sender:_,operationType:a,isLoading:$,reEstimate:j})=>{switch(a){case"proposal":return jsxRuntimeExports.jsx(FormControl,{marginTop:"24px","data-testid":"signer-selector",children:jsxRuntimeExports.jsx(AvailableSignersAutocomplete,{account:_,inputName:"signer",isLoading:$,keepValid:!0,label:"Select Proposer",onUpdate:j})});case"implicit":return null}},SignPage$6=_=>{const{mode:a,operations:$}=_,{fee:j,operations:et,estimationFailed:tt,isLoading:rt,form:nt,signer:it,reEstimate:ot,onSign:st}=useSignPageHelpers($,a),{amount:ct,recipient:ut}=et.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:et.type,signer:et.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:ct}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:j})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:et.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:ut}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:rt,operationType:et.type,reEstimate:ot,sender:et.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:tt,isLoading:rt,onSubmit:st,signer:it,text:headerText(et.type,a)})})]})})})},estimateAndUpdateBatch=(_,a)=>async $=>{await estimate(_,a),$(batchesActions.add({operations:_,network:a}))},useOpenSignPageFormAction=({SignPage:_,signPageExtraData:a,FormPage:$,defaultFormPageProps:j,toOperation:et})=>{const{openWith:tt}=reactExports.useContext(DynamicModalContext),rt=useMakeFormOperations(et),nt=useSelectedNetwork();return async it=>{const ot=rt(it),st=await estimate(ot,nt);return tt(jsxRuntimeExports.jsx(_,{data:a,goBack:()=>tt(jsxRuntimeExports.jsx($,{...j,form:it})),mode:"single",operations:st}))}},useAddToBatchFormAction=_=>{const{onClose:a}=reactExports.useContext(DynamicModalContext),$=useSelectedNetwork(),j=useMakeFormOperations(_),et=useAppDispatch(),tt=useToast();return async nt=>{const it=j(nt);await et(estimateAndUpdateBatch(it,$)),tt({description:"Transaction added to batch!",status:"success"}),a()}},useHandleOnSubmitFormActions=_=>{const{handleAsyncAction:a,isLoading:$}=useAsyncActionHandler();return{onFormSubmitActionHandlers:_.map(et=>async tt=>a(()=>et(tt))),isLoading:$}},FormPage$4=({showPreview:_=!0,...a})=>{const $=useOpenSignPageFormAction({SignPage:SignPage$6,signPageExtraData:void 0,FormPage:FormPage$4,defaultFormPageProps:a,toOperation:toOperation$5}),j=useAddToBatchFormAction(toOperation$5),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(a)}),{formState:{isValid:it,errors:ot},register:st,handleSubmit:ct}=nt;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(FormPageHeader,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!ot.prettyAmount,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Amount"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{isDisabled:rt,step:getSmallestUnit(TEZ_DECIMALS),type:"number",...st("prettyAmount",{required:"Amount is required",validate:makeValidateDecimals(TEZ_DECIMALS)}),placeholder:"0.000000"}),jsxRuntimeExports.jsx(InputRightElement,{children:TEZ})]}),ot.prettyAmount&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"amount-error",children:ot.prettyAmount.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!!a.sender,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),ot.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:ot.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ct(tt),onSingleSubmit:ct(et),showPreview:_})})]})})})},toOperation$5=_=>({type:"tez",amount:tezToMutez(_.prettyAmount).toFixed(),recipient:parsePkh(_.recipient)}),ContactTable=({contacts:_})=>{const{openWith:a}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsx(Box,{overflow:"auto",background:colors.gray[900],borderRadius:"8px",paddingX:"30px",children:jsxRuntimeExports.jsx(TableContainer,{overflowX:"unset",overflowY:"unset",children:jsxRuntimeExports.jsx(Table,{children:jsxRuntimeExports.jsx(Tbody,{children:_.map(($,j)=>{const et=j===_.length-1?"transparent":colors.gray[700];return jsxRuntimeExports.jsxs(Tr,{"data-testid":"contact-row",children:[jsxRuntimeExports.jsx(Td,{borderColor:et,"data-testid":"contact-row-name",paddingX:"0",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Box,{width:"150px",marginRight:"40px",children:jsxRuntimeExports.jsx(Text,{overflow:"hidden",fontWeight:600,whiteSpace:"nowrap",textOverflow:"ellipsis",children:$.name})}),jsxRuntimeExports.jsx(CopyableAddress,{justifyContent:"space-between","data-testid":"contact-row-pkh",formatAddress:!1,iconColor:colors.gray[400],pkh:$.pkh})]})}),jsxRuntimeExports.jsx(Td,{borderColor:et,paddingX:"0",children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"end",children:[jsxRuntimeExports.jsx(SendButton,{marginRight:"20px",onClick:()=>a(jsxRuntimeExports.jsx(FormPage$4,{form:{sender:"",recipient:$.pkh,prettyAmount:""}}))}),jsxRuntimeExports.jsx(RenameRemoveMenu,{onRemove:()=>a(jsxRuntimeExports.jsx(DeleteContactModal,{contact:$})),onRename:()=>a(jsxRuntimeExports.jsx(UpsertContactModal,{contact:$}))})]})})]},$.pkh)})})})})})},ExternalLink=({href:_,children:a,...$})=>jsxRuntimeExports.jsx(Link$1,{alignItems:"center",display:"flex",_hover:{textDecoration:"none"},href:_,rel:"noopener noreferrer",role:"link",target:"_blank",...$,children:a}),SIZES={md:{heading:"xl",description:"md",button:"md"},lg:{heading:"3xl",description:"xl",button:"lg"}},NoItems=({title:_,description:a,children:$,size:j})=>jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"center",width:"100%",height:"100%",children:jsxRuntimeExports.jsxs(Box,{padding:"30px","data-testid":"empty-state-message",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"10px",textAlign:"center",size:SIZES[j].heading,children:_}),jsxRuntimeExports.jsx(Text,{marginBottom:"30px",color:colors.gray[400],textAlign:"center",size:SIZES[j].description,children:a}),jsxRuntimeExports.jsx(Center,{children:$})]})}),NoOperations=({size:_})=>jsxRuntimeExports.jsx(NoItems,{description:"Your operations history will appear here...",size:_,title:"No operations to show"}),NoNFTs=({size:_})=>jsxRuntimeExports.jsx(NoItems,{description:"Your NFT collection will appear here...",size:_,title:"No NFTs to show",children:jsxRuntimeExports.jsx(ExternalLink,{"data-testid":"buy-nft-button",href:"https://objkt.com",children:jsxRuntimeExports.jsx(Button,{size:SIZES[_].button,children:"Buy your first NFT"})})}),NoTokens=({size:_})=>jsxRuntimeExports.jsx(NoItems,{description:"All of your tokens will appear here...",size:_,title:"No tokens to show"}),NoDelegations=({size:_="lg",onDelegate:a})=>jsxRuntimeExports.jsx(NoItems,{description:"Your delegation history will appear here...",size:_,title:"No delegations to show",children:jsxRuntimeExports.jsx(Button,{"data-testid":"delegation-empty-state-button",onClick:a,size:SIZES[_].button,children:"Delegate"})}),BuyTezForm=({recipient:_=""})=>{const a=useSelectedNetwork(),$=a.name==="mainnet",j=$?"Buy Tez":"Request Tez from faucet",et=useForm({mode:"onBlur",defaultValues:{address:_}}),{formState:{isValid:tt,errors:rt}}=et;let nt=a.buyTezUrl;return a.buyTezUrl&&$&&(nt+="/default/widget/"),jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{action:nt,rel:"noreferrer noopener",target:"_blank",children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"10px",textAlign:"center",children:"Buy Tez"}),$&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("input",{name:"commodity",type:"hidden",value:"XTZ:Tezos"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],textAlign:"center",size:"sm",children:"Please select the recipient account."}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsxs(FormControl,{"data-testid":"buy-tez-selector",isInvalid:!!rt.address,paddingY:5,children:[jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!1,inputName:"address",isDisabled:!!_,label:"Recipient Account"}),rt.address&&jsxRuntimeExports.jsx(FormErrorMessage,{children:rt.address.message})]})})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Box,{width:"100%","data-testid":"buy-tez-button",children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:2,isDisabled:!tt,size:"lg",type:"submit",children:j})})})]})})})},CheckIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"15px",height:"11px",fill:"none",stroke:"white",viewBox:"0 0 15 11",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M1.16602 5.98371L5.06345 9.85408L13.8327 1.14575",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),UpdateButton=()=>{const _=useAppDispatch(),a=useIsLoading(),$=useLastTimeUpdated(),[j,et]=reactExports.useState(!1),[tt,rt]=reactExports.useState(!1),[nt]=useMediaQuery("(max-width: 1200px)");if(reactExports.useEffect(()=>{if(!$||differenceInSeconds(new Date,new Date($))>1)return;et(!0),rt(!0);const ct=setTimeout(()=>et(!1),2e3),ut=setTimeout(()=>rt(!1),3500);return()=>{clearTimeout(ct),clearTimeout(ut)}},[$]),nt||$===null)return null;const it=()=>{_(assetsActions.refetch())},ot=differenceInMinutes(new Date,new Date($))>=2,st={opacity:j?1:0,transition:"opacity 2s ease-in-out"};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Text,{display:"inline",color:colors.gray[400],size:"sm",style:tt?st:void 0,children:[tt&&"Updated just now",ot&&`Updated ${formatDistance(new Date($),new Date)} ago`]}),jsxRuntimeExports.jsx(IconButton,{marginRight:"36px",marginLeft:"8px",_active:{color:"white",bg:colors.green},"aria-label":"refetch",backgroundColor:tt?colors.green:colors.gray[500],"data-testid":"refetch-button",icon:tt?jsxRuntimeExports.jsx(CheckIcon,{style:st}):jsxRuntimeExports.jsx(FetchingIcon,{color:"white"}),isLoading:a,onClick:it,variant:"circle_without_hover_color"})]})},TopBar=({title:_,subtitle:a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",height:"88px",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"end",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"6px",size:"xl",children:_}),jsxRuntimeExports.jsx(Text,{color:colors.gray[450],"data-testid":"nft-total-amount",size:"xs",children:a})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(UpdateButton,{}),jsxRuntimeExports.jsx(Button,{onClick:()=>$(jsxRuntimeExports.jsx(BuyTezForm,{})),variant:"tertiary",children:"Buy Tez"}),jsxRuntimeExports.jsx(Button,{marginLeft:4,onClick:()=>$(jsxRuntimeExports.jsx(FormPage$4,{})),children:"Send"})]})]}),jsxRuntimeExports.jsx(Divider,{})]})},AddContact=()=>{const{openWith:_}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Button,{alignItems:"center",justifyContent:"end",marginTop:"16px",marginBottom:"16px",cursor:"pointer",onClick:()=>_(jsxRuntimeExports.jsx(UpsertContactModal,{})),variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(AddContactIcon,{stroke:"currentcolor"}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Add contact"})]})},AddressBookView=()=>{const _=useSortedContacts();return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Address Book"}),jsxRuntimeExports.jsx(Flex,{flexDirection:"row-reverse",children:jsxRuntimeExports.jsx(AddContact,{})}),_.length>0?jsxRuntimeExports.jsx(ContactTable,{contacts:_}):jsxRuntimeExports.jsx(NoItems,{description:"Your contacts will appear here...",size:"lg",title:"Your address book is empty"})]})};var pluralize$1={exports:{}};(function(_,a){(function($,j){typeof commonjsRequire=="function"?_.exports=j():$.pluralize=j()})(commonjsGlobal,function(){var $=[],j=[],et={},tt={},rt={};function nt(St){return typeof St=="string"?new RegExp("^"+St+"$","i"):St}function it(St,Mt){return St===Mt?Mt:St===St.toLowerCase()?Mt.toLowerCase():St===St.toUpperCase()?Mt.toUpperCase():St[0]===St[0].toUpperCase()?Mt.charAt(0).toUpperCase()+Mt.substr(1).toLowerCase():Mt.toLowerCase()}function ot(St,Mt){return St.replace(/\$(\d{1,2})/g,function(kt,Ct){return Mt[Ct]||""})}function st(St,Mt){return St.replace(Mt[0],function(kt,Ct){var Ot=ot(Mt[1],arguments);return it(kt===""?St[Ct-1]:kt,Ot)})}function ct(St,Mt,kt){if(!St.length||et.hasOwnProperty(St))return Mt;for(var Ct=kt.length;Ct--;){var Ot=kt[Ct];if(Ot[0].test(Mt))return st(Mt,Ot)}return Mt}function ut(St,Mt,kt){return function(Ct){var Ot=Ct.toLowerCase();return Mt.hasOwnProperty(Ot)?it(Ct,Ot):St.hasOwnProperty(Ot)?it(Ct,St[Ot]):ct(Ot,Ct,kt)}}function ht(St,Mt,kt,Ct){return function(Ot){var zt=Ot.toLowerCase();return Mt.hasOwnProperty(zt)?!0:St.hasOwnProperty(zt)?!1:ct(zt,zt,kt)===zt}}function Et(St,Mt,kt){var Ct=Mt===1?Et.singular(St):Et.plural(St);return(kt?Mt+" ":"")+Ct}return Et.plural=ut(rt,tt,$),Et.isPlural=ht(rt,tt,$),Et.singular=ut(tt,rt,j),Et.isSingular=ht(tt,rt,j),Et.addPluralRule=function(St,Mt){$.push([nt(St),Mt])},Et.addSingularRule=function(St,Mt){j.push([nt(St),Mt])},Et.addUncountableRule=function(St){if(typeof St=="string"){et[St.toLowerCase()]=!0;return}Et.addPluralRule(St,"$0"),Et.addSingularRule(St,"$0")},Et.addIrregularRule=function(St,Mt){Mt=Mt.toLowerCase(),St=St.toLowerCase(),rt[St]=Mt,tt[Mt]=St},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(St){return Et.addIrregularRule(St[0],St[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(St){return Et.addPluralRule(St[0],St[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(St){return Et.addSingularRule(St[0],St[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(Et.addUncountableRule),Et})})(pluralize$1);var pluralizeExports=pluralize$1.exports;const pluralize=getDefaultExportFromCjs$1(pluralizeExports),AccountSmallTile=({account:_,...a})=>{const $=useGetAccountBalance()(_.address.pkh);return jsxRuntimeExports.jsxs(Flex,{alignItems:"space-between",cursor:"pointer","data-testid":"account-small-tile",...a,children:[jsxRuntimeExports.jsx(AccountTileIcon,{account:_,size:"sm"}),jsxRuntimeExports.jsxs(Flex,{alignSelf:"center",height:"20px",marginLeft:"12px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"10px","data-testid":"account-small-tile-label",size:"sm",children:_.label}),jsxRuntimeExports.jsx(Text,{marginRight:"35px",color:colors.gray[300],"data-testid":"account-small-tile-pkh",size:"xs",children:formatPkh(_.address.pkh)}),$&&jsxRuntimeExports.jsx(Heading,{"data-testid":"account-small-tile-balance",size:"sm",children:prettyTezAmount($)})]})]})},OperationEstimationStatus=({estimationResult:_})=>{if(!_)return null;const a=lodashExports.get(_,"metadata.operation_result.status");if(!a)return null;let $,j,et;switch(a){case"applied":case"backtracked":j=colors.green,et="Estimated",$=jsxRuntimeExports.jsx(CheckmarkIcon,{height:"14.5px"});break;case"failed":j=colors.orange,et="Failed",$=jsxRuntimeExports.jsx(WarningIcon,{width:"12px",height:"13px",stroke:"currentcolor",marginX:"3px"});break;case"skipped":j=colors.orangeL,et="Not Estimated",$=jsxRuntimeExports.jsx(ExclamationIcon,{stroke:"currentcolor",marginX:"3px"})}return jsxRuntimeExports.jsx(Flex,{marginTop:"8px",color:j,"data-testid":"estimation-status",children:jsxRuntimeExports.jsxs(Center,{children:[$,jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"xs",children:et})]})})},LeftIcon=({addressKind:{type:_},...a})=>{switch(_){case"multisig":return jsxRuntimeExports.jsx(KeyIcon,{"data-testid":`${_}-icon`,...a});case"fa1.2":return jsxRuntimeExports.jsx(FA12Icon,{"data-testid":`${_}-icon`,...a,fill:a.stroke,stroke:"none"});case"fa2":return jsxRuntimeExports.jsx(FA2Icon,{"data-testid":`${_}-icon`,...a,fill:a.stroke,stroke:"none"});case"baker":return jsxRuntimeExports.jsx(BakerIcon,{"data-testid":`${_}-icon`,...a});case"contact":return jsxRuntimeExports.jsx(ContactIcon,{"data-testid":`${_}-icon`,...a});case"unknown":case"implicit":return null}},RightIcon=({addressKind:{type:_,pkh:a},addressPillMode:$,...j})=>{const et=useAddressExistsInContacts(),{openWith:tt}=reactExports.useContext(DynamicModalContext);return $.type==="removable"?jsxRuntimeExports.jsx(XMark,{cursor:"pointer",onClick:$.onRemove,...j}):["implicit","multisig","baker"].includes(_)||et(a)?null:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(AddContactIcon,{"data-testid":"add-contact-icon",onClick:()=>tt(jsxRuntimeExports.jsx(UpsertContactModal,{contact:{name:"",pkh:a}})),...j})})},AddressPillText=({addressKind:{pkh:_,label:a},showPkh:$,alias:j,...et})=>{const tt=useGetContactName(),rt=formatPkh(_),nt=tt(_)||a||j;return $?jsxRuntimeExports.jsx(Text,{...et,children:rt}):jsxRuntimeExports.jsx(Text,{...et,children:nt?truncate(nt,21):rt})},useAddressKind=_=>{const a=useOwnedAccountAddressKind(_),$=useTokenAddressKind(_),j=useBakerAddressKind(_),et=useContactAddressKind(_);return a||$||j||et||{pkh:_.pkh,type:"unknown",label:null}},useOwnedAccountAddressKind=_=>{const a=useOwnedAccountAddressKind$1(_);if(!a)return null;const{pkh:$,label:j}=a;return{type:a.type==="multisig"?"multisig":"implicit",pkh:$,label:j}},useTokenAddressKind=({pkh:_})=>{const a=useSelectedNetwork(),j=useGetTokenType(a)(_);if(!j)return null;switch(j){case"fa1.2":return{pkh:_,type:"fa1.2",label:null};case"fa2":case"nft":return{pkh:_,type:"fa2",label:null}}},AddressPill=({address:_,mode:a={type:"default"},...$})=>{const j=!("pkh"in _&&"type"in _),et=j?parsePkh(_.address):_,tt=useAddressKind(et),rt=a.type!=="no_icons",{onOpen:nt,onClose:it,isOpen:ot}=useDisclosure$1(),[st,ct]=reactExports.useState(!1),ut=async()=>{await navigator.clipboard.writeText(et.pkh),nt(),setTimeout(it,1e3)},ht=reactExports.useRef(null);useOutsideClick$1({ref:ht,handler:()=>{ct(!1)}});let Et,St,Mt;return ot?(Et=colors.green,St=colors.gray[300],Mt="white"):st?(Et=colors.gray[450],St=colors.gray[400],Mt=colors.gray[200]):(Et=colors.gray[500],St=colors.gray[450],Mt=colors.gray[300]),jsxRuntimeExports.jsx(Box,{maxWidth:"max-content","data-testid":"address-pill",...$,children:jsxRuntimeExports.jsxs(Flex,{ref:ht,alignItems:"center",background:Et,borderRadius:"full",onMouseEnter:()=>{ct(!0)},onMouseLeave:()=>{ct(!1)},paddingX:"4px",children:[rt&&jsxRuntimeExports.jsx(LeftIcon,{marginLeft:"4px",stroke:St,addressKind:tt,"data-testid":"address-pill-left-icon"}),jsxRuntimeExports.jsxs(Popover,{autoFocus:!1,isOpen:ot,onOpen:ut,children:[jsxRuntimeExports.jsx(PopoverTrigger,{children:jsxRuntimeExports.jsx(Button,{height:"24px",_focus:{boxShadow:"none"},onClick:kt=>kt.stopPropagation(),variant:"unstyled",children:jsxRuntimeExports.jsx(AddressPillText,{color:Mt,cursor:"pointer",addressKind:tt,alias:j&&_.alias?_.alias:void 0,"data-testid":"address-pill-text",marginX:"4px",showPkh:!rt,size:"sm"})})}),jsxRuntimeExports.jsxs(PopoverContent,{maxWidth:"max-content",background:"white",children:[jsxRuntimeExports.jsx(PopoverArrow,{background:"white !important"}),jsxRuntimeExports.jsx(PopoverBody,{children:jsxRuntimeExports.jsx(Text,{color:"black",size:"sm",children:"Copied!"})})]})]}),rt&&jsxRuntimeExports.jsx(RightIcon,{marginRight:"4px",stroke:colors.gray[300],cursor:"pointer",addressKind:tt,addressPillMode:a,"data-testid":"address-pill-right-icon"})]})})},OperationRecipient=({operation:_})=>{let a;switch(_.type){case"undelegation":case"contract_origination":a=void 0;break;case"tez":case"fa1.2":case"fa2":case"delegation":a=_.recipient;break;case"contract_call":a=_.contract;break}return a?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:a,"data-testid":"recipient"})]}):jsxRuntimeExports.jsx(Text,{color:colors.gray[500],"data-testid":"recipient",children:"N/A"})},tokenTitle=(_,a)=>{if(!_)return`${a} Unknown Token`;const $=tokenName(_),j=tokenPrettyAmount(a,_,{showSymbol:!1}),et=$?void 0:tokenSymbol(_);return lodashExports.compact([j,et,$]).join(" ")},getIPFSurl=_=>_==null?void 0:_.replace("ipfs://","https://ipfs.io/ipfs/"),sortedByLastUpdate=_=>lodashExports.orderBy(_,["lastLevel","id","owner"],["desc"]),OperationView=({operation:_})=>{const a=useGetToken(),$=useSelectedNetwork();switch(_.type){case"tez":return jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutgoingArrow,{marginRight:"8px"}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:prettyTezAmount(_.amount)})]});case"fa1.2":case"fa2":{const j=a(_.contract.pkh,_.tokenId);return(j==null?void 0:j.type)==="nft"?jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutgoingArrow,{marginRight:"8px"}),Number(_.amount)>1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Heading,{color:colors.gray[450],size:"sm",children:["x",_.amount]})," "]}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:jsxRuntimeExports.jsx(Tooltip,{padding:"8px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px",label:jsxRuntimeExports.jsx(AspectRatio,{width:"170px",height:"170px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{src:getIPFSurl(thumbnailUri(j))})}),openDelay:300,children:jsxRuntimeExports.jsx(Link$1,{"data-testid":"link",href:tokenUri(j,$),children:tokenNameSafe(j)})})})]}):jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutgoingArrow,{marginRight:"8px"}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:jsxRuntimeExports.jsx(Link$1,{"data-testid":"link",href:j?tokenUri(j,$):void 0,children:tokenTitle(j,_.amount)})})]})}case"delegation":return jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(BakerIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:"Delegate"})]});case"undelegation":return jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(BakerIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:"End Delegation"})]});case"contract_origination":case"contract_call":throw new Error(`${_.type} is not supported yet`)}},SelectedAccountContext=reactExports.createContext({selectedAccount:null,selectAccount:()=>{}}),AccountTileBase=({icon:_,leftElement:a,rightElement:$,...j})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"90px",marginBottom:"16px",padding:"16px",border:`1px solid ${colors.gray[800]}`,borderRadius:"16px","data-testid":"account-tile-base",...j,children:[_,jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flex:1,children:[a,$]})]}),LabelAndAddress=({label:_,pkh:a})=>jsxRuntimeExports.jsxs(Box,{margin:4,"data-testid":"account-identifier",children:[_&&jsxRuntimeExports.jsx(Heading,{size:"md",children:_}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(Text,{color:"text.dark","data-testid":"short-address",size:"sm",children:formatPkh(a)})})]}),MAX_NFT_COUNT=7,accountIconGradientColor=_=>{switch(_.type){case"mnemonic":case"secret_key":return color(_.address.pkh);case"ledger":case"multisig":return colors.gray[450];case"social":switch(_.idp){case"facebook":return"#1977F2";case"google":case"reddit":return"#EA4335";case"email":case"twitter":return colors.gray[450]}}},accountIconGradient=({account:_,radius:a,left:$="0px",top:j="0px",mainBackgroundColor:et=colors.gray[900],opacity:tt="60"})=>{let rt=accountIconGradientColor(_);return rt+=tt,`radial-gradient(circle farthest-side at ${$} ${j}, ${rt} 0%, ${rt} ${parseInt(a)/4}px, transparent ${a}), ${et}`},AccountTile=({account:_,balance:a})=>{const{selectedAccount:$,selectAccount:j}=reactExports.useContext(SelectedAccountContext),et=($==null?void 0:$.address.pkh)===_.address.pkh,tt=useAddressKind$1(_.address),{address:{pkh:rt}}=_,nt=!!useAppSelector(st=>st.assets.delegationLevels)[rt],it=useGetAccountNFTs(),ot=sortedByLastUpdate(it(rt));return jsxRuntimeExports.jsxs(Box,{zIndex:2,background:accountIconGradient({left:"-10px",top:"-10px",account:_,radius:ot.length>0?"120px":"100px"}),borderWidth:"1px",borderStyle:"solid",borderColor:et?colors.orangeL:colors.gray[900],borderRadius:"8px",_hover:{borderColor:et?colors.orangeL:colors.gray[700]},cursor:"pointer","data-testid":"account-tile-container",onClick:()=>j(_),paddingX:"21px",children:[jsxRuntimeExports.jsx(AccountTileBase,{align:"bottom",marginBottom:0,padding:0,border:"none","data-testid":`account-tile-${rt}`+(et?"-selected":""),icon:jsxRuntimeExports.jsx(AccountTileIcon,{account:_,size:"lg"}),leftElement:jsxRuntimeExports.jsx(LabelAndAddress,{label:tt.label,pkh:rt}),rightElement:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[a&&jsxRuntimeExports.jsx(Heading,{alignSelf:"flex-end","data-testid":"balance",size:"md",children:prettyTezAmount(a)}),jsxRuntimeExports.jsx(Text,{align:"right",color:colors.gray[450],fontWeight:700,"data-testid":"is-delegated",size:"sm",children:nt?"Delegated":jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:" "})})]})}),ot.length>0&&jsxRuntimeExports.jsxs(Flex,{flexDirection:"column","data-testid":"nfts-list",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Flex,{marginY:"21px",children:ot.slice(0,MAX_NFT_COUNT).map((st,ct)=>{const ut=getIPFSurl(thumbnailUri(st));return ct===MAX_NFT_COUNT-1?jsxRuntimeExports.jsx(Link,{"data-testid":"show-more-nfts-link",to:`/nfts?accounts=${rt}`,children:jsxRuntimeExports.jsx(Box,{height:"32px",marginLeft:"4px",background:colors.gray[600],borderRadius:"4px",children:jsxRuntimeExports.jsx(Text,{align:"center",width:"32px",color:colors.gray[450],fontWeight:700,children:"..."})})},"last"):jsxRuntimeExports.jsx(Link,{"data-testid":"nft-link",to:`/home/${rt}/${fullId(st)}`,children:jsxRuntimeExports.jsx(AspectRatio,{width:"32px",height:"32px",marginLeft:ct>0?"4px":0,ratio:1,children:jsxRuntimeExports.jsx(Image$1,{borderRadius:"4px",src:ut})})},fullId(st))})})]})]})},ConfirmationModal=({title:_,description:a,buttonLabel:$,onSubmit:j})=>{const{onClose:et}=reactExports.useContext(DynamicModalContext),tt=()=>{j(),et()};return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalHeader,{marginBottom:"10px",textAlign:"center",children:[jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(WarningIcon,{width:"40px",height:"40px",marginBottom:"16px"})}),jsxRuntimeExports.jsx(Heading,{children:_}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),a&&jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(Text,{align:"center",color:colors.gray[400],"data-testid":"description",children:a})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",onClick:tt,size:"lg",variant:"warning",children:$})})]})},BatchModalBody=({title:_,operation:a,transactionCount:$})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:subTitle(a.signer),title:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:a.signer.address}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",marginY:"12px",paddingX:"4px",children:[jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Transactions:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"transaction-length",size:"sm",children:$})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:totalFee(a.estimates)})]})]})]}),SignPage$5=({initialOperations:_})=>{const{operations:a,estimationFailed:$,isLoading:j,signer:et,form:tt,reEstimate:rt,onSign:nt}=useSignPageHelpers(_,"batch"),it=headerText(a.type,"batch");return jsxRuntimeExports.jsx(FormProvider,{...tt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(BatchModalBody,{operation:a,title:it,transactionCount:a.operations.length}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:j,operationType:a.type,reEstimate:rt,sender:a.sender}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:$,isLoading:j,onSubmit:nt,signer:et,text:it})})]})})})},RightHeader=({operations:_,onSubmit:a,isLoading:$})=>{const{type:j,sender:et,operations:tt}=_,{openWith:rt}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Box,{alignItems:"center",justifyContent:"space-between","data-testid":"right-header",children:[jsxRuntimeExports.jsx(Text,{display:"inline-block",color:colors.gray[400],size:"sm",children:pluralize("transaction",tt.length,!0)}),jsxRuntimeExports.jsx(Button,{marginLeft:"30px",isLoading:$,onClick:a,variant:"primary",children:headerText(j,"batch")}),jsxRuntimeExports.jsx(IconButton,{marginLeft:"16px",borderRadius:"4px","aria-label":"remove-batch","data-testid":"remove-batch",icon:jsxRuntimeExports.jsx(TrashIcon,{stroke:colors.gray[300]}),onClick:()=>rt(jsxRuntimeExports.jsx(ClearBatchConfirmationModal,{sender:et}),"sm"),variant:"circle"})]})},prettyOperationType=_=>{switch(_.type){case"fa1.2":case"fa2":return"Token Transfer";case"undelegation":case"delegation":return"Delegation";case"tez":return`${TEZ} Transfer`;case"contract_origination":case"contract_call":throw new Error(`${_.type} is not supported yet`)}},ClearBatchConfirmationModal=({sender:_})=>{const a=useClearBatch();return jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:"Delete Batch",description:"Are you sure you want to remove all transactions from the batch?",onSubmit:()=>a(_),title:"Delete Batch"})},SUCCESSFUL_ESTIMATION_RESULT={metadata:{operation_result:{status:"applied"}}},BatchView=({operations:_})=>{const{operations:a,sender:$}=_,j=a.length>9,et=useRemoveBatchItem(),{openWith:tt}=reactExports.useContext(DynamicModalContext),rt=useSelectedNetwork(),[nt,it]=React$2.useState([]);reactExports.useEffect(()=>{it([])},[a.length]);const{isLoading:ot,handleAsyncAction:st}=useAsyncActionHandler(),ct=()=>st(async()=>{it([]);try{const ht=await estimate(_,rt);return it(a.map(Et=>SUCCESSFUL_ESTIMATION_RESULT)),tt(jsxRuntimeExports.jsx(SignPage$5,{initialOperations:ht}))}catch(ht){if(ht instanceof TezosOperationError){const Et=ht.operationsWithResults;Et.length>a.length&&Et.shift(),it(Et)}throw ht}}),ut=jsxRuntimeExports.jsx(RightHeader,{isLoading:ot,onSubmit:ct,operations:_});return jsxRuntimeExports.jsxs(Box,{width:"100%",marginBottom:"16px","data-testid":`batch-table-${$.address.pkh}`,children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",padding:"20px 23px 20px 30px",background:accountIconGradient({top:"-10px",left:"-10px",account:$,radius:"100px",opacity:"40",mainBackgroundColor:colors.gray[800]}),borderTopRadius:"8px","data-testid":"header",children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(AccountSmallTile,{paddingLeft:0,account:$})}),ut]}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column",background:colors.gray[900],borderBottomRadius:j?0:"8px",paddingX:"30px",paddingY:"20px",children:a.map((ht,Et)=>{const St=nt.at(Et);return jsxRuntimeExports.jsxs(Box,{"data-testid":"operation",children:[jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:St?"80px":"50px",children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(OperationView,{operation:ht})}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",width:"100%",marginTop:"8px",children:[jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(OperationRecipient,{operation:ht})}),jsxRuntimeExports.jsx(OperationEstimationStatus,{estimationResult:St})]}),jsxRuntimeExports.jsxs(Flex,{alignSelf:"flex-end",children:[jsxRuntimeExports.jsx(Text,{alignSelf:"flex-end",color:colors.gray[450],size:"sm",children:prettyOperationType(ht)}),jsxRuntimeExports.jsx(IconButton,{width:"24px",marginLeft:"12px",borderRadius:"full","aria-label":"Remove",icon:jsxRuntimeExports.jsx(TrashIcon,{stroke:colors.gray[300]}),onClick:()=>et($,Et),size:"xs",variant:"circle"})]})]})]}),Et{const j=document.createElement("link");j.href=this.config.redirect_uri,window.location.origin!==new URL(this.config.redirect_uri).origin&&(j.crossOrigin="anonymous"),j.type="text/html",j.rel="prefetch";const et=()=>{this.isInitialized=!0,a()};try{j.relList&&j.relList.supports&&j.relList.supports("prefetch")?(j.onload=et,j.onerror=()=>{$(new Error(`Please serve redirect.html present in serviceworker folder of this package on ${this.config.redirect_uri}`))},document.head.appendChild(j)):et()}catch{et()}}):Promise.resolve()}}const WEB3_AUTH_CLIENT_ID="BBQoFIabI50S1-0QsGHGTM4qID_FDjja0ZxIxKPyFqc0El--M-EG0c2giaBYVTVVE6RC9WCUzCJyW24aJrR_Lzc";class Auth{async getTorusClient(){const a=new CustomAuth({web3AuthClientId:WEB3_AUTH_CLIENT_ID,baseUrl:"https://umamiwallet.com/auth/v2.2.0/",redirectPathName:"redirect.html",redirectToOpener:!0,uxMode:"popup",network:"mainnet"});return await a.init({skipSw:!0}),a}async getCredentials(){const a=await this.login(),$=a.finalKeyData.privKey||a.oAuthKeyData.privKey,j=b58cencode($,prefix.spsk),et=Array.isArray(a.userInfo)?a.userInfo[0]:a.userInfo,tt=et.email||et.name||this.idpName;return{secretKey:j,name:tt}}}const parseTorusRedirectParams=_=>{const a=new URLSearchParams(_.replace("umami://auth/","")),$={instanceId:a.get("instanceId"),verifier:a.get("verifier"),typeOfLogin:a.get("typeOfLogin"),redirectToOpener:a.get("redirectToOpener")},j={state:a.get("state"),access_token:a.get("access_token"),token_type:a.get("token_type"),expires_in:a.get("expires_in"),scope:a.get("scope"),id_token:a.get("id_token"),authuser:a.get("authuser"),hd:a.get("hd"),prompt:a.get("prompt")},et={instanceParams:$,hashParams:j};return{channel:a.get("channel"),data:et,error:a.get("error")}},JWT_AUTH_DOMAIN="https://kukai.eu.auth0.com";class EmailAuth extends Auth{constructor(){super(...arguments),this.clientId="LTg6fVsacafGmhv14TZlrWF1EavwQoDZ",this.idpName="email"}async login(){return(await this.getTorusClient()).triggerAggregateLogin({verifierIdentifier:"tezos-google",aggregateVerifierType:"single_id_verifier",subVerifierDetailsArray:[{verifier:"web-kukai-email",typeOfLogin:"jwt",clientId:this.clientId,jwtParams:{connection:"",verifierIdField:"name",domain:JWT_AUTH_DOMAIN}}]})}}class FacebookAuth extends Auth{constructor(){super(...arguments),this.idpName="facebook",this.clientId="523634882377310"}async login(){return(await this.getTorusClient()).triggerLogin({verifier:"tezos-facebook",clientId:this.clientId,typeOfLogin:"facebook",jwtParams:{scope:"public_profile email"}})}}class GoogleAuth extends Auth{constructor(){super(...arguments),this.idpName="google",this.clientId="1070572364808-d31nlkneam5ee6dr0tu28fjjbsdkfta5.apps.googleusercontent.com"}async login(){return(await this.getTorusClient()).triggerAggregateLogin({verifierIdentifier:"tezos-google",aggregateVerifierType:"single_id_verifier",subVerifierDetailsArray:[{clientId:this.clientId,typeOfLogin:"google",verifier:"umami"}]})}}class RedditAuth extends Auth{constructor(){super(...arguments),this.idpName="reddit",this.clientId="zyQ9tnKfdg3VNyj6MGhZq4dHbBzbmEvl"}async login(){return(await this.getTorusClient()).triggerAggregateLogin({verifierIdentifier:"tezos-reddit",aggregateVerifierType:"single_id_verifier",subVerifierDetailsArray:[{verifier:"web-kukai",typeOfLogin:"jwt",clientId:this.clientId,jwtParams:{connection:"Reddit",verifierIdField:"name",domain:JWT_AUTH_DOMAIN}}]})}}class TwitterAuth extends Auth{constructor(){super(...arguments),this.idpName="twitter",this.clientId="3aCoxh3pw8g8JeFsdlJNUGwdgtLwdwgE"}async login(){return(await this.getTorusClient()).triggerLogin({verifier:"tezos-twitter",clientId:this.clientId,typeOfLogin:"twitter",jwtParams:{domain:JWT_AUTH_DOMAIN}})}}const forIDP=_=>{switch(_){case"google":return new GoogleAuth;case"email":return new EmailAuth;case"reddit":return new RedditAuth;case"facebook":return new FacebookAuth;case"twitter":return new TwitterAuth}},MIN_LENGTH=8,PasswordInput=({inputName:_,label:a="Password",placeholder:$="Enter your password",required:j="Password is required",minLength:et=MIN_LENGTH,validate:tt,...rt})=>{const{register:nt}=useFormContext(),[it,ot]=reactExports.useState(!1);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FormLabel,{children:a}),jsxRuntimeExports.jsxs(InputGroup,{marginTop:"12px",children:[jsxRuntimeExports.jsx(Input,{"aria-label":a,autoComplete:"off",placeholder:$,type:it?"text":"password",...nt(_,{required:j,minLength:et&&j?{value:et,message:`Your password must be at least ${et} characters long`}:void 0,validate:tt}),...rt}),jsxRuntimeExports.jsx(InputRightElement,{children:jsxRuntimeExports.jsx(Button,{onClick:()=>ot(st=>!st),tabIndex:-1,variant:"unstyled",children:it?jsxRuntimeExports.jsx(EyeSlashIcon,{"data-testid":"eye-slash-icon"}):jsxRuntimeExports.jsx(EyeIcon,{width:"16.5px","data-testid":"eye-icon"})})})]})]})},SignButton=({signer:_,onSubmit:a,isLoading:$,isDisabled:j,text:et,network:tt})=>{const rt=useForm({mode:"onBlur",defaultValues:{password:""}}),{handleSubmit:nt,formState:{errors:it,isValid:ot}}=rt;let st=useSelectedNetwork();tt&&(st=tt);const{formState:{isValid:ct}}=useFormContext(),ut=j||!ot||!ct,ht=useGetSecretKey(),Et=useToast(),{isLoading:St,handleAsyncAction:Mt}=useAsyncActionHandler(),kt=St||$,Ct=async({password:Vt})=>Mt(async()=>{const jt=await ht(_,Vt);return a(await makeToolkit({type:"mnemonic",secretKey:jt,network:st}))}),Ot=async({password:Vt})=>Mt(async()=>{const jt=await ht(_,Vt);return a(await makeToolkit({type:"secret_key",secretKey:jt,network:st}))}),zt=async()=>Mt(async()=>{const{secretKey:Vt}=await forIDP(_.idp).getCredentials();return a(await makeToolkit({type:"social",secretKey:Vt,network:st}))}),Ut=async()=>Mt(async()=>(Et({id:"ledger-sign-toast",description:"Please approve the operation on your Ledger",status:"info",duration:6e4,isClosable:!0}),a(await makeToolkit({type:"ledger",account:_,network:st}))),Vt=>({description:`${Vt.message} Please connect your ledger, open Tezos app and try submitting transaction again`,status:"error"})).finally(()=>Et.close("ledger-sign-toast"));switch(_.type){case"secret_key":case"mnemonic":return jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsxs(FormProvider,{...rt,children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!it.password,marginY:"16px",children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password"}),it.password&&jsxRuntimeExports.jsx(FormErrorMessage,{children:it.password.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"8px",isDisabled:ut,isLoading:kt,onClick:nt(_.type==="mnemonic"?Ct:Ot),size:"lg",type:"submit",children:et||"Submit Transaction"})]})});case"social":return jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:j,isLoading:kt,onClick:zt,size:"lg",children:et||"Sign with social"});case"ledger":return jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:j,isLoading:kt,onClick:Ut,size:"lg",children:et||"Sign with Ledger"})}},SignPayloadRequestModal=({request:_})=>{const{onClose:a}=reactExports.useContext(DynamicModalContext),j=useGetImplicitAccount()(_.sourceAddress),et=useToast(),tt=useRemovePeerBySenderId(),rt=useForm(),nt=()=>{tt(_.senderId),WalletClient.respond({id:_.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.ABORTED_ERROR})},it=async ot=>{const st=await ot.signer.sign(_.payload),ct={type:BeaconMessageType.SignPayloadResponse,id:_.id,signingType:_.signingType,signature:st.prefixSig};await WalletClient.respond(ct),et({description:"Successfully submitted Beacon operation",status:"success"}),a()};return jsxRuntimeExports.jsx(FormProvider,{...rt,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"32px",textAlign:"center",children:"Connect with pairing request"}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:nt}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"12px",size:"l",children:`${_.appMetadata.name}/dApp Pairing Request`}),jsxRuntimeExports.jsx(Box,{overflowY:"auto",maxHeight:"300px",padding:"15px",border:"1px solid",borderColor:colors.gray[500],borderRadius:"4px",backgroundColor:colors.gray[800],children:jsxRuntimeExports.jsx(Text,{color:colors.gray[450],size:"md",children:decodePayload$1(_.payload)})})]}),jsxRuntimeExports.jsx(ModalFooter,{justifyContent:"center",display:"flex",padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(SignButton,{onSubmit:it,signer:j,text:"Sign"})})]})})},HeaderWrapper=chakra(ModalHeader,{baseStyle:{padding:0,paddingBottom:"32px",textAlign:"center"}}),FormPageHeader=({title:_="Send",subTitle:a="Send one or insert into batch"})=>jsxRuntimeExports.jsxs(HeaderWrapper,{children:[jsxRuntimeExports.jsx(Heading,{size:"2xl",children:_}),jsxRuntimeExports.jsx(Text,{marginTop:"10px",color:colors.gray[400],textAlign:"center",size:"sm",children:a}),jsxRuntimeExports.jsx(ModalCloseButton,{})]});var ChevronDownIcon=createIcon({displayName:"ChevronDownIcon",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}),ArrowBackIcon=createIcon({d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z",displayName:"ArrowBackIcon"});const ModalBackButton=({onClick:_})=>jsxRuntimeExports.jsx(IconButton,{...backButtonStyle,"aria-label":"Back","data-testid":"back-button",icon:jsxRuntimeExports.jsx(ArrowBackIcon,{width:"24px",height:"20px"}),onClick:_,size:"sm",variant:"ghost"}),headerText=(_,a)=>{let $;switch(_){case"implicit":$=a==="batch"?"Submit":"Confirm";break;case"proposal":$="Propose"}switch(a){case"single":return`${$} Transaction`;case"batch":return`${$} Batch`}},subTitle=_=>{switch(_.type){case"ledger":case"social":return;case"mnemonic":case"secret_key":return"Enter your password to confirm this transaction."}},SignPageHeader=({goBack:_,mode:a,operationsType:$,signer:j,title:et,description:tt,children:rt})=>jsxRuntimeExports.jsxs(HeaderWrapper,{children:[_&&jsxRuntimeExports.jsx(ModalBackButton,{onClick:_}),jsxRuntimeExports.jsx(Heading,{"data-testid":"sign-page-header",size:"2xl",children:et||headerText($,a)}),jsxRuntimeExports.jsx(Text,{marginTop:"10px",color:colors.gray[400],textAlign:"center",size:"sm",children:tt||subTitle(j)}),jsxRuntimeExports.jsx(ModalCloseButton,{}),rt]}),Header$1=({operation:_,message:a,mode:$})=>jsxRuntimeExports.jsxs(SignPageHeader,{mode:$,operationsType:_.type,signer:_.signer,children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"center",marginTop:"10px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Network:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:lodashExports.capitalize(a.network.type)})]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"16px",padding:"15px",borderRadius:"4px",backgroundColor:colors.gray[800],children:[jsxRuntimeExports.jsx(AspectRatio,{width:"30px",marginRight:"12px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{borderRadius:"4px",src:a.appMetadata.icon})}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:a.appMetadata.name})]})]}),totalFee=_=>_.map(a=>a.fee).reduce((a,$)=>a.plus($),BigNumber(0)).toNumber(),makeAccountOperations=(_,a,$)=>{switch(_.type){case"ledger":case"mnemonic":case"social":case"secret_key":if(_.address.pkh!==a.address.pkh)throw new Error("Sender and Signer must be the same");return{type:"implicit",operations:$,signer:_,sender:_};case"multisig":return{type:"proposal",operations:$,sender:_,signer:a}}},WindowLinkIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"14px",height:"14px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M13 1L7 7M13 1V4.375M13 1H9.625M12.25 7.375V10.6C12.25 11.4401 12.25 11.8601 12.0865 12.181C11.9427 12.4632 11.7132 12.6927 11.431 12.8365C11.1101 13 10.6901 13 9.85 13H3.4C2.55992 13 2.13988 13 1.81901 12.8365C1.53677 12.6927 1.3073 12.4632 1.16349 12.181C1 11.8601 1 11.4401 1 10.6V4.15C1 3.30992 1 2.88988 1.16349 2.56901C1.3073 2.28677 1.53677 2.0573 1.81901 1.91349C2.13988 1.75 2.55992 1.75 3.4 1.75H6.625",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),SuccessStep=({hash:_})=>{const $=`${useSelectedNetwork().tzktExplorerUrl}/${_}`,{onClose:j}=reactExports.useContext(DynamicModalContext),et=useNavigate();return jsxRuntimeExports.jsxs(ModalContent,{paddingY:"20px",children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{textAlign:"center",children:jsxRuntimeExports.jsx(Heading,{children:"Operation Submitted"})}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(Flex,{justifyContent:"center",marginTop:"10px",children:jsxRuntimeExports.jsx(Text,{color:"text.dark",textAlign:"center",size:"sm",children:"You can follow this operation's progress in the Operations section. It may take up to 30 seconds to appear."})})}),jsxRuntimeExports.jsxs(ModalFooter,{justifyContent:"center",flexDirection:"column",width:"100%",children:[jsxRuntimeExports.jsx(Button,{width:"100%",onClick:()=>{j(),et("/operations")},size:"lg",children:"See all Operations"}),jsxRuntimeExports.jsx(Link,{rel:"noopener noreferrer",target:"_blank",to:$,children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",marginTop:"24px",children:jsxRuntimeExports.jsxs(Button,{variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"View in Tzkt"}),jsxRuntimeExports.jsx(WindowLinkIcon,{stroke:"currentcolor"})]})})})]})]})},useSignWithBeacon=(_,a)=>{const{isLoading:$,handleAsyncAction:j}=useAsyncActionHandler(),{openWith:et}=reactExports.useContext(DynamicModalContext),tt=useFindNetwork(),rt=useForm({defaultValues:{executeParams:_.estimates}}),nt=async it=>j(async()=>{const{opHash:ot}=await executeOperations({..._,estimates:rt.watch("executeParams")},it),st={type:BeaconMessageType.OperationResponse,id:a.id,transactionHash:ot};return await WalletClient.respond(st),et(jsxRuntimeExports.jsx(SuccessStep,{hash:ot}))},ot=>({description:`Failed to confirm Beacon operation: ${ot.message}`}));return{fee:totalFee(rt.watch("executeParams")),isSigning:$,onSign:nt,network:tt(a.network.type),form:rt}},SignPageFee=({fee:_})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Fee:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"fee",size:"sm",children:prettyTezAmount(_)})]}),BatchSignPage=({operation:_,message:a})=>{const{isSigning:$,onSign:j,network:et,fee:tt,form:rt}=useSignWithBeacon(_,a),{signer:nt}=_,it=_.operations.length;return jsxRuntimeExports.jsx(FormProvider,{...rt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:a,mode:"batch",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Accordion,{allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",paddingY:"6px",size:"sm",children:"Operations"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(JsValueWrap,{overflowY:"auto",maxHeight:"200px",value:a.operationDetails})})]})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"16px",children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:nt.address}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",marginY:"12px",paddingX:"4px",children:[jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Transactions:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"transaction-length",size:"sm",children:it})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:tt})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:$,network:et,onSubmit:j,signer:nt,text:headerText(_.type,"batch")})})]})})})},useBatches=()=>{const _=useSelectedNetwork();return useAppSelector($=>$.batches[_.name])||[]},useClearBatch=()=>{const _=useAppDispatch(),a=useSelectedNetwork();return $=>_(batchesActions.clear({pkh:$.address.pkh,network:a}))},useRemoveBatchItem=()=>{const _=useAppDispatch(),a=useSelectedNetwork();return($,j)=>_(batchesActions.removeItem({pkh:$.address.pkh,index:j,network:a}))},FormSubmitButtons=({isLoading:_,isValid:a,onSingleSubmit:$,onAddToBatch:j,showPreview:et=!0})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(Box,{width:"100%",children:[et&&jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"16px",isDisabled:!a,isLoading:_,onClick:$,size:"lg",type:"submit",children:"Preview"}),jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!a,isLoading:_,onClick:j,size:"lg",type:"submit",variant:"tertiary",children:"Insert Into Batch"})]})}),formDefaultValues=({sender:_,form:a})=>a||(_?{sender:_.address.pkh}:{}),useSignPageHelpers=(_,a)=>{const[$,j]=reactExports.useState(!1),et=useGetImplicitAccount(),[tt,rt]=reactExports.useState(_),nt=useSelectedNetwork(),it=useClearBatch(),{isLoading:ot,handleAsyncAction:st,handleAsyncActionUnsafe:ct}=useAsyncActionHandler(),{openWith:ut}=reactExports.useContext(DynamicModalContext),ht=useForm({mode:"onBlur",defaultValues:{signer:tt.signer.address.pkh,sender:tt.sender.address.pkh,executeParams:tt.estimates}}),Et=ht.watch("signer"),St=async kt=>ct(async()=>{const Ct=await estimate({...tt,signer:et(kt)},nt);ht.setValue("executeParams",Ct.estimates),rt(Ct),j(!1)},{isClosable:!0,duration:null}).catch(()=>j(!0)),Mt=async kt=>st(async()=>{const Ct=await executeOperations({...tt,estimates:ht.watch("executeParams")},kt);return a==="batch"&&it(tt.sender),await ut(jsxRuntimeExports.jsx(SuccessStep,{hash:Ct.opHash})),Ct});return{fee:totalFee(ht.watch("executeParams")),estimationFailed:$,operations:tt,isLoading:ot,form:ht,signer:et(Et),reEstimate:St,onSign:Mt}},useMakeFormOperations=_=>{const a=useGetOwnedAccount(),$=useGetBestSignerForAccount();return j=>{const et=a(j.sender);return makeAccountOperations(et,$(et),[_(j)])}},getSmallestUnit=_=>(_<0&&(console.warn("Decimals cannot be negative"),_=0),`${_===0?"":"0."+lodashExports.repeat("0",_-1)}1`),makeValidateDecimals=_=>a=>a.includes(".")&&a.split(".")[1].length>_?`Please enter a value with up to ${_} decimal places`:!0,AdvancedSettingsAccordion=({index:_=0})=>{var it,ot,st,ct;const{register:a,getValues:$,setValue:j,formState:{errors:et}}=useFormContext(),[tt,rt]=reactExports.useState(mutezToTez($().executeParams[_].fee).toFixed()),nt=ut=>{const ht=ut.target.value;makeValidateDecimals(TEZ_DECIMALS)(ht)===!0&&(rt(ht),ht&&j(`executeParams.${_}.fee`,tezToMutez(ht).toNumber()))};return jsxRuntimeExports.jsx(Accordion,{marginTop:"16px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",marginY:"10px",size:"md",children:"Advanced"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsxs(AccordionPanel,{gap:"16px",display:"flex",children:[jsxRuntimeExports.jsxs(FormControl,{children:[jsxRuntimeExports.jsx(FormLabel,{fontSize:"14px",children:"Fee"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{paddingRight:"28px",fontSize:"14px",onBlur:()=>rt(mutezToTez($().executeParams[_].fee).toFixed()),onChange:nt,placeholder:"0.000000",step:getSmallestUnit(TEZ_DECIMALS),type:"number",value:tt}),jsxRuntimeExports.jsx(InputRightElement,{width:"44px",maxWidth:"fit-content",height:"46px",paddingRight:"12px",children:"ꜩ"})]})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!((ot=(it=et.executeParams)==null?void 0:it[_])!=null&&ot.gasLimit),children:[jsxRuntimeExports.jsx(FormLabel,{fontSize:"14px",children:"Gas Limit"}),jsxRuntimeExports.jsx(Input,{...a(`executeParams.${_}.gasLimit`,{valueAsNumber:!0,required:!0}),placeholder:"0",type:"number"})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!((ct=(st=et.executeParams)==null?void 0:st[_])!=null&&ct.storageLimit),children:[jsxRuntimeExports.jsx(FormLabel,{fontSize:"14px",children:"Storage Limit"}),jsxRuntimeExports.jsx(Input,{...a(`executeParams.${_}.storageLimit`,{valueAsNumber:!0,required:!0}),placeholder:"0",type:"number"})]})]})]})})},TezTile=({mutezAmount:_})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"60px",padding:"15px",background:colors.gray[800],borderRadius:"4px",children:[jsxRuntimeExports.jsx(TezIcon,{marginRight:"12px"}),jsxRuntimeExports.jsx(Flex,{alignItems:"end",children:jsxRuntimeExports.jsx(PrettyNumber,{number:prettyTezAmount(_)})})]}),ContractCallSignPage=({operation:_,message:a})=>{const{amount:$,contract:j,entrypoint:et,args:tt}=_.operations[0],{isSigning:rt,onSign:nt,network:it,fee:ot,form:st}=useSignWithBeacon(_,a);return jsxRuntimeExports.jsx(FormProvider,{...st,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:a,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:$}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:ot})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:_.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:j}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"Contract Call Parameter"}),jsxRuntimeExports.jsx(Accordion,{allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Box,{flex:"1",textAlign:"left",children:"JSON"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(JsValueWrap,{value:{entrypoint:et,values:tt}})})]})}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(SignButton,{isLoading:rt,network:it,onSubmit:nt,signer:_.signer,text:headerText(_.type,"single")})})]})})})},DelegationSignPage=({operation:_,message:a})=>{const{recipient:$}=_.operations[0],{isSigning:j,onSign:et,network:tt,fee:rt,form:nt}=useSignWithBeacon(_,a);return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:a,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:_.signer.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(SignPageFee,{fee:rt})})}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:$}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:j,network:tt,onSubmit:et,signer:_.signer,text:headerText(_.type,"single")})})]})})})},OriginationOperationSignPage=({operation:_,message:a})=>{const{isSigning:$,onSign:j,network:et,form:tt,fee:rt}=useSignWithBeacon(_,a),{code:nt,storage:it}=_.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...tt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsxs(ModalHeader,{marginBottom:"24px",children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"center",children:"Operation Request"}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"center",marginTop:"10px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Network:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:lodashExports.capitalize(a.network.type)})]})]}),jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsxs(ModalBody,{"data-testid":"beacon-request-body",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"16px",padding:"15px",borderRadius:"4px",backgroundColor:colors.gray[800],children:[jsxRuntimeExports.jsx(AspectRatio,{width:"60px",marginRight:"12px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{borderRadius:"4px",src:a.appMetadata.icon})}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:a.appMetadata.name})]}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:rt})}),jsxRuntimeExports.jsx(Accordion,{marginTop:"16px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",marginY:"10px",size:"md",children:"Code"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{overflowY:"auto",maxHeight:"300px",children:jsxRuntimeExports.jsx(JsValueWrap,{value:nt})})]})}),jsxRuntimeExports.jsx(Accordion,{marginTop:"16px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",marginY:"10px",size:"md",children:"Storage"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{overflowY:"auto",maxHeight:"300px",children:jsxRuntimeExports.jsx(JsValueWrap,{value:it})})]})}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(SignButton,{isLoading:$,network:et,onSubmit:j,signer:_.signer,text:headerText(_.type,"single")})})]})})})},TezSignPage=({operation:_,message:a})=>{const{amount:$,recipient:j}=_.operations[0],{isSigning:et,onSign:tt,network:rt,fee:nt,form:it}=useSignWithBeacon(_,a);return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:a,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:$}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:nt})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:_.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:j}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:et,network:rt,onSubmit:tt,signer:_.signer,text:headerText(_.type,"single")})})]})})})},UndelegationSignPage=({operation:_,message:a})=>{const{isSigning:$,onSign:j,network:et,form:tt,fee:rt}=useSignWithBeacon(_,a);return jsxRuntimeExports.jsx(FormProvider,{...tt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:a,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:_.signer.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",paddingX:"4px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:rt})}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:$,network:et,onSubmit:j,signer:_.signer,text:headerText(_.type,"single")})})]})})})},BeaconSignPage=({operation:_,message:a})=>{switch(_.operations[0].type){case"tez":return jsxRuntimeExports.jsx(TezSignPage,{message:a,operation:_});case"contract_call":return jsxRuntimeExports.jsx(ContractCallSignPage,{message:a,operation:_});case"delegation":return jsxRuntimeExports.jsx(DelegationSignPage,{message:a,operation:_});case"undelegation":return jsxRuntimeExports.jsx(UndelegationSignPage,{message:a,operation:_});case"contract_origination":return jsxRuntimeExports.jsx(OriginationOperationSignPage,{message:a,operation:_});case"fa1.2":case"fa2":throw new Error("Unsupported operation type")}},useHandleBeaconMessage=()=>{const{openWith:_}=reactExports.useContext(DynamicModalContext),{handleAsyncAction:a}=useAsyncActionHandler(),$=useGetOwnedAccountSafe(),j=useFindNetwork(),et=({id:tt,network:rt})=>{const nt=j(rt.type);if(!nt)throw WalletClient.respond({id:tt,type:BeaconMessageType.Error,errorType:BeaconErrorType.NETWORK_NOT_SUPPORTED}),new Error(`Got Beacon request from an unknown network: ${JSON.stringify(rt)}. Please add it to the networks list and retry.`);return nt};return tt=>{a(async()=>{let rt;switch(tt.type){case BeaconMessageType.PermissionRequest:{et(tt),rt=jsxRuntimeExports.jsx(PermissionRequestModal,{request:tt});break}case BeaconMessageType.SignPayloadRequest:{rt=jsxRuntimeExports.jsx(SignPayloadRequestModal,{request:tt});break}case BeaconMessageType.OperationRequest:{const nt=et(tt),it=$(tt.sourceAddress);if(!it)throw WalletClient.respond({id:tt.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.NO_PRIVATE_KEY_FOUND_ERROR}),new Error(`Unknown account: ${tt.sourceAddress}`);const ot=toAccountOperations(tt.operationDetails,it),st=await estimate(ot,nt);ot.operations.length===1?rt=jsxRuntimeExports.jsx(BeaconSignPage,{message:tt,operation:st}):rt=jsxRuntimeExports.jsx(BatchSignPage,{message:tt,operation:st});break}default:throw WalletClient.respond({id:tt.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.UNKNOWN_ERROR}),new Error(`Unknown Beacon message type: ${tt.type}`)}return _(rt)},rt=>({description:`Error while processing Beacon request: ${rt.message}`}))}},toAccountOperations=(_,a)=>{if(_.length===0)throw new Error("Empty operation details!");const $=_.map(j=>partialOperationToOperation(j,a));return{type:"implicit",sender:a,operations:$,signer:a}},partialOperationToOperation=(_,a)=>{switch(_.kind){case TezosOperationType.TRANSACTION:{const{destination:$,amount:j,parameters:et}=_;return et?{type:"contract_call",amount:j,contract:parsePkh($),entrypoint:et.entrypoint,args:et.value}:{type:"tez",amount:j,recipient:parseImplicitPkh(_.destination)}}case TezosOperationType.DELEGATION:{const{delegate:$}=_;return $?{type:"delegation",sender:a.address,recipient:parseImplicitPkh($)}:{type:"undelegation",sender:a.address}}case TezosOperationType.ORIGINATION:{const{script:$}=_,{code:j,storage:et}=$;return{type:"contract_origination",sender:a.address,code:j,storage:et}}default:throw new Error(`Unsupported operation kind: ${_.kind}`)}},BeaconProvider=({children:_})=>{const a=useToast(),$=useHandleBeaconMessage();return reactExports.useEffect(()=>{WalletClient.init().then(()=>WalletClient.connect($)).catch(j=>{a({status:j,description:`Failed to connect to Beacon: ${j.message}`})})}),_};function toDate(_){const a=Object.prototype.toString.call(_);return _ instanceof Date||typeof _=="object"&&a==="[object Date]"?new _.constructor(+_):typeof _=="number"||a==="[object Number]"||typeof _=="string"||a==="[object String]"?new Date(_):new Date(NaN)}function constructFrom(_,a){return _ instanceof Date?new _.constructor(a):new Date(a)}const millisecondsInWeek=6048e5,millisecondsInDay=864e5,millisecondsInMinute=6e4,millisecondsInHour=36e5,millisecondsInSecond=1e3,minutesInMonth=43200,minutesInDay=1440;let defaultOptions={};function getDefaultOptions(){return defaultOptions}function startOfWeek(_,a){var nt,it,ot,st;const $=getDefaultOptions(),j=(a==null?void 0:a.weekStartsOn)??((it=(nt=a==null?void 0:a.locale)==null?void 0:nt.options)==null?void 0:it.weekStartsOn)??$.weekStartsOn??((st=(ot=$.locale)==null?void 0:ot.options)==null?void 0:st.weekStartsOn)??0,et=toDate(_),tt=et.getDay(),rt=(tt=et.getTime()?$+1:a.getTime()>=rt.getTime()?$:$-1}function startOfDay(_){const a=toDate(_);return a.setHours(0,0,0,0),a}function getTimezoneOffsetInMilliseconds(_){const a=toDate(_),$=new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()));return $.setUTCFullYear(a.getFullYear()),+_-+$}function differenceInCalendarDays(_,a){const $=startOfDay(_),j=startOfDay(a),et=+$-getTimezoneOffsetInMilliseconds($),tt=+j-getTimezoneOffsetInMilliseconds(j);return Math.round((et-tt)/millisecondsInDay)}function startOfISOWeekYear(_){const a=getISOWeekYear(_),$=constructFrom(_,0);return $.setFullYear(a,0,4),$.setHours(0,0,0,0),startOfISOWeek($)}function compareAsc(_,a){const $=toDate(_),j=toDate(a),et=$.getTime()-j.getTime();return et<0?-1:et>0?1:et}function isDate(_){return _ instanceof Date||typeof _=="object"&&Object.prototype.toString.call(_)==="[object Date]"}function isValid(_){if(!isDate(_)&&typeof _!="number")return!1;const a=toDate(_);return!isNaN(Number(a))}function differenceInCalendarMonths(_,a){const $=toDate(_),j=toDate(a),et=$.getFullYear()-j.getFullYear(),tt=$.getMonth()-j.getMonth();return et*12+tt}function differenceInDays(_,a){const $=toDate(_),j=toDate(a),et=compareLocalAsc($,j),tt=Math.abs(differenceInCalendarDays($,j));$.setDate($.getDate()-et*tt);const rt=+(compareLocalAsc($,j)===-et),nt=et*(tt-rt);return nt===0?0:nt}function compareLocalAsc(_,a){const $=_.getFullYear()-a.getFullYear()||_.getMonth()-a.getMonth()||_.getDate()-a.getDate()||_.getHours()-a.getHours()||_.getMinutes()-a.getMinutes()||_.getSeconds()-a.getSeconds()||_.getMilliseconds()-a.getMilliseconds();return $<0?-1:$>0?1:$}function getRoundingMethod(_){return a=>{const j=(_?Math[_]:Math.trunc)(a);return j===0?0:j}}function differenceInMilliseconds(_,a){return+toDate(_)-+toDate(a)}function differenceInMinutes(_,a,$){const j=differenceInMilliseconds(_,a)/millisecondsInMinute;return getRoundingMethod($==null?void 0:$.roundingMethod)(j)}function endOfDay(_){const a=toDate(_);return a.setHours(23,59,59,999),a}function endOfMonth(_){const a=toDate(_),$=a.getMonth();return a.setFullYear(a.getFullYear(),$+1,0),a.setHours(23,59,59,999),a}function isLastDayOfMonth(_){const a=toDate(_);return+endOfDay(a)==+endOfMonth(a)}function differenceInMonths(_,a){const $=toDate(_),j=toDate(a),et=compareAsc($,j),tt=Math.abs(differenceInCalendarMonths($,j));let rt;if(tt<1)rt=0;else{$.getMonth()===1&&$.getDate()>27&&$.setDate(30),$.setMonth($.getMonth()-et*tt);let nt=compareAsc($,j)===-et;isLastDayOfMonth(toDate(_))&&tt===1&&compareAsc(_,j)===1&&(nt=!1),rt=et*(tt-Number(nt))}return rt===0?0:rt}function differenceInSeconds(_,a,$){const j=differenceInMilliseconds(_,a)/1e3;return getRoundingMethod($==null?void 0:$.roundingMethod)(j)}function startOfYear(_){const a=toDate(_),$=constructFrom(_,0);return $.setFullYear(a.getFullYear(),0,1),$.setHours(0,0,0,0),$}const formatDistanceLocale={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},formatDistance$1=(_,a,$)=>{let j;const et=formatDistanceLocale[_];return typeof et=="string"?j=et:a===1?j=et.one:j=et.other.replace("{{count}}",a.toString()),$!=null&&$.addSuffix?$.comparison&&$.comparison>0?"in "+j:j+" ago":j};function buildFormatLongFn(_){return(a={})=>{const $=a.width?String(a.width):_.defaultWidth;return _.formats[$]||_.formats[_.defaultWidth]}}const dateFormats={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},timeFormats={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},dateTimeFormats={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},formatLong={date:buildFormatLongFn({formats:dateFormats,defaultWidth:"full"}),time:buildFormatLongFn({formats:timeFormats,defaultWidth:"full"}),dateTime:buildFormatLongFn({formats:dateTimeFormats,defaultWidth:"full"})},formatRelativeLocale={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},formatRelative$1=(_,a,$,j)=>formatRelativeLocale[_];function buildLocalizeFn(_){return(a,$)=>{const j=$!=null&&$.context?String($.context):"standalone";let et;if(j==="formatting"&&_.formattingValues){const rt=_.defaultFormattingWidth||_.defaultWidth,nt=$!=null&&$.width?String($.width):rt;et=_.formattingValues[nt]||_.formattingValues[rt]}else{const rt=_.defaultWidth,nt=$!=null&&$.width?String($.width):_.defaultWidth;et=_.values[nt]||_.values[rt]}const tt=_.argumentCallback?_.argumentCallback(a):a;return et[tt]}}const eraValues={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},quarterValues={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},monthValues={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dayValues={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},dayPeriodValues={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},formattingDayPeriodValues={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ordinalNumber=(_,a)=>{const $=Number(_),j=$%100;if(j>20||j<10)switch(j%10){case 1:return $+"st";case 2:return $+"nd";case 3:return $+"rd"}return $+"th"},localize={ordinalNumber,era:buildLocalizeFn({values:eraValues,defaultWidth:"wide"}),quarter:buildLocalizeFn({values:quarterValues,defaultWidth:"wide",argumentCallback:_=>_-1}),month:buildLocalizeFn({values:monthValues,defaultWidth:"wide"}),day:buildLocalizeFn({values:dayValues,defaultWidth:"wide"}),dayPeriod:buildLocalizeFn({values:dayPeriodValues,defaultWidth:"wide",formattingValues:formattingDayPeriodValues,defaultFormattingWidth:"wide"})};function buildMatchFn(_){return(a,$={})=>{const j=$.width,et=j&&_.matchPatterns[j]||_.matchPatterns[_.defaultMatchWidth],tt=a.match(et);if(!tt)return null;const rt=tt[0],nt=j&&_.parsePatterns[j]||_.parsePatterns[_.defaultParseWidth],it=Array.isArray(nt)?findIndex(nt,ct=>ct.test(rt)):findKey(nt,ct=>ct.test(rt));let ot;ot=_.valueCallback?_.valueCallback(it):it,ot=$.valueCallback?$.valueCallback(ot):ot;const st=a.slice(rt.length);return{value:ot,rest:st}}}function findKey(_,a){for(const $ in _)if(Object.prototype.hasOwnProperty.call(_,$)&&a(_[$]))return $}function findIndex(_,a){for(let $=0;$<_.length;$++)if(a(_[$]))return $}function buildMatchPatternFn(_){return(a,$={})=>{const j=a.match(_.matchPattern);if(!j)return null;const et=j[0],tt=a.match(_.parsePattern);if(!tt)return null;let rt=_.valueCallback?_.valueCallback(tt[0]):tt[0];rt=$.valueCallback?$.valueCallback(rt):rt;const nt=a.slice(et.length);return{value:rt,rest:nt}}}const matchOrdinalNumberPattern=/^(\d+)(th|st|nd|rd)?/i,parseOrdinalNumberPattern=/\d+/i,matchEraPatterns={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},parseEraPatterns={any:[/^b/i,/^(a|c)/i]},matchQuarterPatterns={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},parseQuarterPatterns={any:[/1/i,/2/i,/3/i,/4/i]},matchMonthPatterns={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},parseMonthPatterns={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},matchDayPatterns={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},parseDayPatterns={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},matchDayPeriodPatterns={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},parseDayPeriodPatterns={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},match={ordinalNumber:buildMatchPatternFn({matchPattern:matchOrdinalNumberPattern,parsePattern:parseOrdinalNumberPattern,valueCallback:_=>parseInt(_,10)}),era:buildMatchFn({matchPatterns:matchEraPatterns,defaultMatchWidth:"wide",parsePatterns:parseEraPatterns,defaultParseWidth:"any"}),quarter:buildMatchFn({matchPatterns:matchQuarterPatterns,defaultMatchWidth:"wide",parsePatterns:parseQuarterPatterns,defaultParseWidth:"any",valueCallback:_=>_+1}),month:buildMatchFn({matchPatterns:matchMonthPatterns,defaultMatchWidth:"wide",parsePatterns:parseMonthPatterns,defaultParseWidth:"any"}),day:buildMatchFn({matchPatterns:matchDayPatterns,defaultMatchWidth:"wide",parsePatterns:parseDayPatterns,defaultParseWidth:"any"}),dayPeriod:buildMatchFn({matchPatterns:matchDayPeriodPatterns,defaultMatchWidth:"any",parsePatterns:parseDayPeriodPatterns,defaultParseWidth:"any"})},enUS={code:"en-US",formatDistance:formatDistance$1,formatLong,formatRelative:formatRelative$1,localize,match,options:{weekStartsOn:0,firstWeekContainsDate:1}};function getDayOfYear(_){const a=toDate(_);return differenceInCalendarDays(a,startOfYear(a))+1}function getISOWeek(_){const a=toDate(_),$=+startOfISOWeek(a)-+startOfISOWeekYear(a);return Math.round($/millisecondsInWeek)+1}function getWeekYear(_,a){var st,ct,ut,ht;const $=toDate(_),j=$.getFullYear(),et=getDefaultOptions(),tt=(a==null?void 0:a.firstWeekContainsDate)??((ct=(st=a==null?void 0:a.locale)==null?void 0:st.options)==null?void 0:ct.firstWeekContainsDate)??et.firstWeekContainsDate??((ht=(ut=et.locale)==null?void 0:ut.options)==null?void 0:ht.firstWeekContainsDate)??1,rt=constructFrom(_,0);rt.setFullYear(j+1,0,tt),rt.setHours(0,0,0,0);const nt=startOfWeek(rt,a),it=constructFrom(_,0);it.setFullYear(j,0,tt),it.setHours(0,0,0,0);const ot=startOfWeek(it,a);return $.getTime()>=nt.getTime()?j+1:$.getTime()>=ot.getTime()?j:j-1}function startOfWeekYear(_,a){var nt,it,ot,st;const $=getDefaultOptions(),j=(a==null?void 0:a.firstWeekContainsDate)??((it=(nt=a==null?void 0:a.locale)==null?void 0:nt.options)==null?void 0:it.firstWeekContainsDate)??$.firstWeekContainsDate??((st=(ot=$.locale)==null?void 0:ot.options)==null?void 0:st.firstWeekContainsDate)??1,et=getWeekYear(_,a),tt=constructFrom(_,0);return tt.setFullYear(et,0,j),tt.setHours(0,0,0,0),startOfWeek(tt,a)}function getWeek(_,a){const $=toDate(_),j=+startOfWeek($,a)-+startOfWeekYear($,a);return Math.round(j/millisecondsInWeek)+1}function addLeadingZeros(_,a){const $=_<0?"-":"",j=Math.abs(_).toString().padStart(a,"0");return $+j}const lightFormatters={y(_,a){const $=_.getFullYear(),j=$>0?$:1-$;return addLeadingZeros(a==="yy"?j%100:j,a.length)},M(_,a){const $=_.getMonth();return a==="M"?String($+1):addLeadingZeros($+1,2)},d(_,a){return addLeadingZeros(_.getDate(),a.length)},a(_,a){const $=_.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return $.toUpperCase();case"aaa":return $;case"aaaaa":return $[0];case"aaaa":default:return $==="am"?"a.m.":"p.m."}},h(_,a){return addLeadingZeros(_.getHours()%12||12,a.length)},H(_,a){return addLeadingZeros(_.getHours(),a.length)},m(_,a){return addLeadingZeros(_.getMinutes(),a.length)},s(_,a){return addLeadingZeros(_.getSeconds(),a.length)},S(_,a){const $=a.length,j=_.getMilliseconds(),et=Math.trunc(j*Math.pow(10,$-3));return addLeadingZeros(et,a.length)}},dayPeriodEnum={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},formatters={G:function(_,a,$){const j=_.getFullYear()>0?1:0;switch(a){case"G":case"GG":case"GGG":return $.era(j,{width:"abbreviated"});case"GGGGG":return $.era(j,{width:"narrow"});case"GGGG":default:return $.era(j,{width:"wide"})}},y:function(_,a,$){if(a==="yo"){const j=_.getFullYear(),et=j>0?j:1-j;return $.ordinalNumber(et,{unit:"year"})}return lightFormatters.y(_,a)},Y:function(_,a,$,j){const et=getWeekYear(_,j),tt=et>0?et:1-et;if(a==="YY"){const rt=tt%100;return addLeadingZeros(rt,2)}return a==="Yo"?$.ordinalNumber(tt,{unit:"year"}):addLeadingZeros(tt,a.length)},R:function(_,a){const $=getISOWeekYear(_);return addLeadingZeros($,a.length)},u:function(_,a){const $=_.getFullYear();return addLeadingZeros($,a.length)},Q:function(_,a,$){const j=Math.ceil((_.getMonth()+1)/3);switch(a){case"Q":return String(j);case"QQ":return addLeadingZeros(j,2);case"Qo":return $.ordinalNumber(j,{unit:"quarter"});case"QQQ":return $.quarter(j,{width:"abbreviated",context:"formatting"});case"QQQQQ":return $.quarter(j,{width:"narrow",context:"formatting"});case"QQQQ":default:return $.quarter(j,{width:"wide",context:"formatting"})}},q:function(_,a,$){const j=Math.ceil((_.getMonth()+1)/3);switch(a){case"q":return String(j);case"qq":return addLeadingZeros(j,2);case"qo":return $.ordinalNumber(j,{unit:"quarter"});case"qqq":return $.quarter(j,{width:"abbreviated",context:"standalone"});case"qqqqq":return $.quarter(j,{width:"narrow",context:"standalone"});case"qqqq":default:return $.quarter(j,{width:"wide",context:"standalone"})}},M:function(_,a,$){const j=_.getMonth();switch(a){case"M":case"MM":return lightFormatters.M(_,a);case"Mo":return $.ordinalNumber(j+1,{unit:"month"});case"MMM":return $.month(j,{width:"abbreviated",context:"formatting"});case"MMMMM":return $.month(j,{width:"narrow",context:"formatting"});case"MMMM":default:return $.month(j,{width:"wide",context:"formatting"})}},L:function(_,a,$){const j=_.getMonth();switch(a){case"L":return String(j+1);case"LL":return addLeadingZeros(j+1,2);case"Lo":return $.ordinalNumber(j+1,{unit:"month"});case"LLL":return $.month(j,{width:"abbreviated",context:"standalone"});case"LLLLL":return $.month(j,{width:"narrow",context:"standalone"});case"LLLL":default:return $.month(j,{width:"wide",context:"standalone"})}},w:function(_,a,$,j){const et=getWeek(_,j);return a==="wo"?$.ordinalNumber(et,{unit:"week"}):addLeadingZeros(et,a.length)},I:function(_,a,$){const j=getISOWeek(_);return a==="Io"?$.ordinalNumber(j,{unit:"week"}):addLeadingZeros(j,a.length)},d:function(_,a,$){return a==="do"?$.ordinalNumber(_.getDate(),{unit:"date"}):lightFormatters.d(_,a)},D:function(_,a,$){const j=getDayOfYear(_);return a==="Do"?$.ordinalNumber(j,{unit:"dayOfYear"}):addLeadingZeros(j,a.length)},E:function(_,a,$){const j=_.getDay();switch(a){case"E":case"EE":case"EEE":return $.day(j,{width:"abbreviated",context:"formatting"});case"EEEEE":return $.day(j,{width:"narrow",context:"formatting"});case"EEEEEE":return $.day(j,{width:"short",context:"formatting"});case"EEEE":default:return $.day(j,{width:"wide",context:"formatting"})}},e:function(_,a,$,j){const et=_.getDay(),tt=(et-j.weekStartsOn+8)%7||7;switch(a){case"e":return String(tt);case"ee":return addLeadingZeros(tt,2);case"eo":return $.ordinalNumber(tt,{unit:"day"});case"eee":return $.day(et,{width:"abbreviated",context:"formatting"});case"eeeee":return $.day(et,{width:"narrow",context:"formatting"});case"eeeeee":return $.day(et,{width:"short",context:"formatting"});case"eeee":default:return $.day(et,{width:"wide",context:"formatting"})}},c:function(_,a,$,j){const et=_.getDay(),tt=(et-j.weekStartsOn+8)%7||7;switch(a){case"c":return String(tt);case"cc":return addLeadingZeros(tt,a.length);case"co":return $.ordinalNumber(tt,{unit:"day"});case"ccc":return $.day(et,{width:"abbreviated",context:"standalone"});case"ccccc":return $.day(et,{width:"narrow",context:"standalone"});case"cccccc":return $.day(et,{width:"short",context:"standalone"});case"cccc":default:return $.day(et,{width:"wide",context:"standalone"})}},i:function(_,a,$){const j=_.getDay(),et=j===0?7:j;switch(a){case"i":return String(et);case"ii":return addLeadingZeros(et,a.length);case"io":return $.ordinalNumber(et,{unit:"day"});case"iii":return $.day(j,{width:"abbreviated",context:"formatting"});case"iiiii":return $.day(j,{width:"narrow",context:"formatting"});case"iiiiii":return $.day(j,{width:"short",context:"formatting"});case"iiii":default:return $.day(j,{width:"wide",context:"formatting"})}},a:function(_,a,$){const et=_.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return $.dayPeriod(et,{width:"abbreviated",context:"formatting"});case"aaa":return $.dayPeriod(et,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return $.dayPeriod(et,{width:"narrow",context:"formatting"});case"aaaa":default:return $.dayPeriod(et,{width:"wide",context:"formatting"})}},b:function(_,a,$){const j=_.getHours();let et;switch(j===12?et=dayPeriodEnum.noon:j===0?et=dayPeriodEnum.midnight:et=j/12>=1?"pm":"am",a){case"b":case"bb":return $.dayPeriod(et,{width:"abbreviated",context:"formatting"});case"bbb":return $.dayPeriod(et,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return $.dayPeriod(et,{width:"narrow",context:"formatting"});case"bbbb":default:return $.dayPeriod(et,{width:"wide",context:"formatting"})}},B:function(_,a,$){const j=_.getHours();let et;switch(j>=17?et=dayPeriodEnum.evening:j>=12?et=dayPeriodEnum.afternoon:j>=4?et=dayPeriodEnum.morning:et=dayPeriodEnum.night,a){case"B":case"BB":case"BBB":return $.dayPeriod(et,{width:"abbreviated",context:"formatting"});case"BBBBB":return $.dayPeriod(et,{width:"narrow",context:"formatting"});case"BBBB":default:return $.dayPeriod(et,{width:"wide",context:"formatting"})}},h:function(_,a,$){if(a==="ho"){let j=_.getHours()%12;return j===0&&(j=12),$.ordinalNumber(j,{unit:"hour"})}return lightFormatters.h(_,a)},H:function(_,a,$){return a==="Ho"?$.ordinalNumber(_.getHours(),{unit:"hour"}):lightFormatters.H(_,a)},K:function(_,a,$){const j=_.getHours()%12;return a==="Ko"?$.ordinalNumber(j,{unit:"hour"}):addLeadingZeros(j,a.length)},k:function(_,a,$){let j=_.getHours();return j===0&&(j=24),a==="ko"?$.ordinalNumber(j,{unit:"hour"}):addLeadingZeros(j,a.length)},m:function(_,a,$){return a==="mo"?$.ordinalNumber(_.getMinutes(),{unit:"minute"}):lightFormatters.m(_,a)},s:function(_,a,$){return a==="so"?$.ordinalNumber(_.getSeconds(),{unit:"second"}):lightFormatters.s(_,a)},S:function(_,a){return lightFormatters.S(_,a)},X:function(_,a,$){const j=_.getTimezoneOffset();if(j===0)return"Z";switch(a){case"X":return formatTimezoneWithOptionalMinutes(j);case"XXXX":case"XX":return formatTimezone(j);case"XXXXX":case"XXX":default:return formatTimezone(j,":")}},x:function(_,a,$){const j=_.getTimezoneOffset();switch(a){case"x":return formatTimezoneWithOptionalMinutes(j);case"xxxx":case"xx":return formatTimezone(j);case"xxxxx":case"xxx":default:return formatTimezone(j,":")}},O:function(_,a,$){const j=_.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+formatTimezoneShort(j,":");case"OOOO":default:return"GMT"+formatTimezone(j,":")}},z:function(_,a,$){const j=_.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+formatTimezoneShort(j,":");case"zzzz":default:return"GMT"+formatTimezone(j,":")}},t:function(_,a,$){const j=Math.trunc(_.getTime()/1e3);return addLeadingZeros(j,a.length)},T:function(_,a,$){const j=_.getTime();return addLeadingZeros(j,a.length)}};function formatTimezoneShort(_,a=""){const $=_>0?"-":"+",j=Math.abs(_),et=Math.trunc(j/60),tt=j%60;return tt===0?$+String(et):$+String(et)+a+addLeadingZeros(tt,2)}function formatTimezoneWithOptionalMinutes(_,a){return _%60===0?(_>0?"-":"+")+addLeadingZeros(Math.abs(_)/60,2):formatTimezone(_,a)}function formatTimezone(_,a=""){const $=_>0?"-":"+",j=Math.abs(_),et=addLeadingZeros(Math.trunc(j/60),2),tt=addLeadingZeros(j%60,2);return $+et+a+tt}const dateLongFormatter=(_,a)=>{switch(_){case"P":return a.date({width:"short"});case"PP":return a.date({width:"medium"});case"PPP":return a.date({width:"long"});case"PPPP":default:return a.date({width:"full"})}},timeLongFormatter=(_,a)=>{switch(_){case"p":return a.time({width:"short"});case"pp":return a.time({width:"medium"});case"ppp":return a.time({width:"long"});case"pppp":default:return a.time({width:"full"})}},dateTimeLongFormatter=(_,a)=>{const $=_.match(/(P+)(p+)?/)||[],j=$[1],et=$[2];if(!et)return dateLongFormatter(_,a);let tt;switch(j){case"P":tt=a.dateTime({width:"short"});break;case"PP":tt=a.dateTime({width:"medium"});break;case"PPP":tt=a.dateTime({width:"long"});break;case"PPPP":default:tt=a.dateTime({width:"full"});break}return tt.replace("{{date}}",dateLongFormatter(j,a)).replace("{{time}}",timeLongFormatter(et,a))},longFormatters={p:timeLongFormatter,P:dateTimeLongFormatter},dayOfYearTokenRE=/^D+$/,weekYearTokenRE=/^Y+$/,throwTokens=["D","DD","YY","YYYY"];function isProtectedDayOfYearToken(_){return dayOfYearTokenRE.test(_)}function isProtectedWeekYearToken(_){return weekYearTokenRE.test(_)}function warnOrThrowProtectedError(_,a,$){const j=message(_,a,$);if(console.warn(j),throwTokens.includes(_))throw new RangeError(j)}function message(_,a,$){const j=_[0]==="Y"?"years":"days of the month";return`Use \`${_.toLowerCase()}\` instead of \`${_}\` (in \`${a}\`) for formatting ${j} to the input \`${$}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const formattingTokensRegExp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,longFormattingTokensRegExp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,escapedStringRegExp=/^'([^]*?)'?$/,doubleQuoteRegExp=/''/g,unescapedLatinCharacterRegExp=/[a-zA-Z]/;function format(_,a,$){var st,ct,ut,ht,Et,St,Mt,kt;const j=getDefaultOptions(),et=($==null?void 0:$.locale)??j.locale??enUS,tt=($==null?void 0:$.firstWeekContainsDate)??((ct=(st=$==null?void 0:$.locale)==null?void 0:st.options)==null?void 0:ct.firstWeekContainsDate)??j.firstWeekContainsDate??((ht=(ut=j.locale)==null?void 0:ut.options)==null?void 0:ht.firstWeekContainsDate)??1,rt=($==null?void 0:$.weekStartsOn)??((St=(Et=$==null?void 0:$.locale)==null?void 0:Et.options)==null?void 0:St.weekStartsOn)??j.weekStartsOn??((kt=(Mt=j.locale)==null?void 0:Mt.options)==null?void 0:kt.weekStartsOn)??0,nt=toDate(_);if(!isValid(nt))throw new RangeError("Invalid time value");let it=a.match(longFormattingTokensRegExp).map(Ct=>{const Ot=Ct[0];if(Ot==="p"||Ot==="P"){const zt=longFormatters[Ot];return zt(Ct,et.formatLong)}return Ct}).join("").match(formattingTokensRegExp).map(Ct=>{if(Ct==="''")return{isToken:!1,value:"'"};const Ot=Ct[0];if(Ot==="'")return{isToken:!1,value:cleanEscapedString(Ct)};if(formatters[Ot])return{isToken:!0,value:Ct};if(Ot.match(unescapedLatinCharacterRegExp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+Ot+"`");return{isToken:!1,value:Ct}});et.localize.preprocessor&&(it=et.localize.preprocessor(nt,it));const ot={firstWeekContainsDate:tt,weekStartsOn:rt,locale:et};return it.map(Ct=>{if(!Ct.isToken)return Ct.value;const Ot=Ct.value;(!($!=null&&$.useAdditionalWeekYearTokens)&&isProtectedWeekYearToken(Ot)||!($!=null&&$.useAdditionalDayOfYearTokens)&&isProtectedDayOfYearToken(Ot))&&warnOrThrowProtectedError(Ot,a,String(_));const zt=formatters[Ot[0]];return zt(nt,Ot,et.localize,ot)}).join("")}function cleanEscapedString(_){const a=_.match(escapedStringRegExp);return a?a[1].replace(doubleQuoteRegExp,"'"):_}function formatDistance(_,a,$){const j=getDefaultOptions(),et=($==null?void 0:$.locale)??j.locale??enUS,tt=2520,rt=compareAsc(_,a);if(isNaN(rt))throw new RangeError("Invalid time value");const nt=Object.assign({},$,{addSuffix:$==null?void 0:$.addSuffix,comparison:rt});let it,ot;rt>0?(it=toDate(a),ot=toDate(_)):(it=toDate(_),ot=toDate(a));const st=differenceInSeconds(ot,it),ct=(getTimezoneOffsetInMilliseconds(ot)-getTimezoneOffsetInMilliseconds(it))/1e3,ut=Math.round((st-ct)/60);let ht;if(ut<2)return $!=null&&$.includeSeconds?st<5?et.formatDistance("lessThanXSeconds",5,nt):st<10?et.formatDistance("lessThanXSeconds",10,nt):st<20?et.formatDistance("lessThanXSeconds",20,nt):st<40?et.formatDistance("halfAMinute",0,nt):st<60?et.formatDistance("lessThanXMinutes",1,nt):et.formatDistance("xMinutes",1,nt):ut===0?et.formatDistance("lessThanXMinutes",1,nt):et.formatDistance("xMinutes",ut,nt);if(ut<45)return et.formatDistance("xMinutes",ut,nt);if(ut<90)return et.formatDistance("aboutXHours",1,nt);if(ut{const _=useAppDispatch(),a=useToast();return reactExports.useCallback(j=>{j&&(_(errorsSlice.actions.add(getErrorContext(j))),a({description:`Data fetching error: ${j.message}`,status:"error",isClosable:!0}))},[_,a])},BAKERS_REFRESH_RATE=hoursToMilliseconds(2),usePollBakers=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useQuery({queryKey:["bakers",_,$],queryFn:()=>getBakers($),retry:!1,refetchInterval:BAKERS_REFRESH_RATE,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),et=j.data;return reactExports.useEffect(()=>{et&&_(assetsActions.updateBakers(et))},[_,et]),a(j.error),j},BLOCK_TIME=secondsToMilliseconds(15),usePollBlockLevel=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useQuery({queryKey:["blockLevel",_,$],queryFn:()=>getLatestBlockLevel($),retry:!1,refetchInterval:BLOCK_TIME,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),et=j.data;return reactExports.useEffect(()=>{et&&_(assetsActions.updateBlockLevel(et))},[_,et]),a(j.error),j},CONVERSION_RATE_REFRESH_RATE=minutesToMilliseconds(5),usePollConversionRate=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useQuery({queryKey:["conversionRate",_],queryFn:getTezosPriceInUSD,refetchInterval:CONVERSION_RATE_REFRESH_RATE,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),j=$.data;return reactExports.useEffect(()=>{_(assetsActions.updateConversionRate(j))},[_,j]),a($.error),$},usePollMultisigs=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useRefetchTrigger(),j=useSelectedNetwork(),et=useImplicitAccounts().map(nt=>nt.address.pkh),tt=useQuery({queryKey:["multisigs",j,et,$],queryFn:()=>getRelevantMultisigContracts(new Set(et),j),retry:!1,refetchInterval:BLOCK_TIME,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),rt=tt.data;return reactExports.useEffect(()=>{rt&&_(multisigActions.setMultisigs(rt))},[rt,_]),a(tt.error),tt},usePollPendingOperations=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useRefetchTrigger(),et=useMultisigAccounts(),tt=useQuery({queryKey:["pendingOperations",$,et,j],queryFn:()=>getPendingOperationsForMultisigs(et,$),retry:!1,refetchInterval:BLOCK_TIME,select:nt=>nt.flat(),refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),rt=tt.data;return reactExports.useEffect(()=>{rt&&_(multisigActions.setPendingOperations(rt))},[_,rt]),a(tt.error),tt},usePollTezBalances=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useRefetchTrigger(),et=useAllAccounts().map(nt=>nt.address.pkh),tt=useQuery({queryKey:["accountInformation",$,et,j],queryFn:()=>getAccounts(et,$),retry:!1,refetchInterval:BLOCK_TIME,select:nt=>nt.flat(),refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),rt=tt.data;return reactExports.useEffect(()=>{rt&&_(assetsActions.updateTezBalance(rt))},[_,rt]),a(tt.error),tt},usePollTokenBalances=()=>{const _=useAppDispatch(),a=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useRefetchTrigger(),et=useAllAccounts().map(nt=>nt.address.pkh),tt=useQuery({queryKey:["tokenBalances",$,et,j],queryFn:()=>getTokenBalances(et,$),retry:!1,refetchInterval:BLOCK_TIME,select:nt=>nt.flat(),refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),rt=tt.data;return reactExports.useEffect(()=>{if(!rt)return;const nt=rt.map(({token:it,lastLevel:ot})=>({...it,lastLevel:ot}));_(tokensActions.addTokens({network:$,tokens:nt})),_(assetsActions.updateTokenBalance(rt))},[_,rt,$]),a(tt.error),tt},useDataPolling=()=>{const _=useAppDispatch(),{dataUpdatedAt:a,isFetching:$}=usePollMultisigs(),{dataUpdatedAt:j,isFetching:et}=usePollPendingOperations(),{dataUpdatedAt:tt,isFetching:rt}=usePollTezBalances(),{dataUpdatedAt:nt,isFetching:it}=usePollTokenBalances();usePollConversionRate(),usePollBlockLevel(),usePollBakers();const ot=$||et||rt||it,st=Math.max(a,j,tt,nt);reactExports.useEffect(()=>{_(assetsActions.setIsLoading(ot)),!ot&&st&&_(assetsActions.setLastTimeUpdated(fromUnixTime(Math.round(st/1e3)).toUTCString()))},[_,ot,st])},useDeeplinkHandler=()=>{const _=useToast(),a=useAddPeer(),$=reactExports.useRef(a),j=reactExports.useRef(_),et=(tt,rt)=>{const nt=rt.replace(":///","://");if(nt.startsWith("umami://auth/")){const it=parseTorusRedirectParams(nt);window.postMessage(it)}else if(nt.startsWith("umami://?type=tzip10&data=")){const ot=new URL(nt).searchParams.get("data");ot?$.current(ot):j.current({title:"Linkhandler",description:"Data Payload missing"})}else j.current({title:"Linkhandler",description:"Unsupported link type"})};reactExports.useEffect(()=>{const tt=window;return tt&&tt.electronAPI&&tt.electronAPI.onDeeplink(et),()=>{}},[])},TOAST_ID="TOAST_ID",CopyableAddress=({pkh:_,formatAddress:a=!0,copyable:$=!0,iconColor:j=colors.gray[600],...et})=>jsxRuntimeExports.jsx(CopyableText,{copyValue:$?_:void 0,displayText:a?formatPkh(_):_,iconColor:j,toastMessage:"Address copied to clipboard",...et}),CopyableText=({displayText:_,copyValue:a,toastMessage:$,iconColor:j,...et})=>{const tt=useToast(),rt=async()=>{a&&(await navigator.clipboard.writeText(a),!(!$||tt.isActive(TOAST_ID))&&tt({status:"success",description:$,id:TOAST_ID,isClosable:!0}))};return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",...et,children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[400],size:"sm",children:_}),a&&jsxRuntimeExports.jsx(FileCopyIcon,{stroke:colors.gray[450],_hover:{stroke:colors.green},cursor:"pointer",onClick:()=>rt()})]})},UpsertContactModal=({contact:_})=>{const{handleAsyncAction:a}=useAsyncActionHandler(),$=useAppDispatch(),{isOpen:j,onClose:et}=reactExports.useContext(DynamicModalContext),tt=useAvailableNetworks(),rt=!!(_!=null&&_.pkh&&_.name),nt=async kt=>{isValidContractPkh(kt.pkh)?await a(async()=>{const Ct=await getNetworksForContracts(tt,[kt.pkh]);if(!Ct.has(kt.pkh))throw new Error(`Network not found for contract ${kt.pkh}`);$(contactsActions.upsert({...kt,network:Ct.get(kt.pkh)}))}):$(contactsActions.upsert({...kt,network:void 0})),et(),ut()},{handleSubmit:it,formState:{isValid:ot,errors:st},register:ct,reset:ut}=useForm({mode:"onBlur",defaultValues:_}),ht=({name:kt,pkh:Ct})=>{nt({name:kt.trim(),pkh:Ct})},Et=reactExports.useRef(ut);reactExports.useEffect(()=>{j&&Et.current(_)},[j,_]);const St=useValidateNewContactPkh(),Mt=useValidateName(_==null?void 0:_.name);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:it(ht),children:[jsxRuntimeExports.jsx(ModalHeader,{textAlign:"center",children:rt?"Edit Contact":"Add Contact"}),jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!st.name,marginY:5,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Name"}),jsxRuntimeExports.jsx(Input,{type:"text",...ct("name",{required:"Name is required",validate:Mt}),placeholder:"Enter contact's name"}),st.name&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"name-error",children:st.name.message})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!st.pkh,marginY:5,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Address"}),jsxRuntimeExports.jsx(Input,{type:"text",...ct("pkh",{required:"Address is required",validate:rt?()=>!0:St}),disabled:rt,placeholder:"Enter contact's tz address",variant:rt?"filled":void 0}),st.pkh&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"address-error",children:st.pkh.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:2,"data-testid":"confirmation-button",isDisabled:!ot,size:"lg",type:"submit",children:rt?"Update":"Add to Address Book"})})})]})})},DeleteContactModal=({contact:_})=>{const a=useAppDispatch(),{onClose:$}=reactExports.useContext(DynamicModalContext),j=()=>{a(contactsActions.remove(_.pkh)),$()};return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"10px",textAlign:"center",children:"Delete Contact"}),jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flexDirection:"column",children:[jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:"Are you sure you want to delete this contact?"}),jsxRuntimeExports.jsxs(Box,{marginTop:5,children:[jsxRuntimeExports.jsx(Heading,{marginBottom:3,textAlign:"center",size:"md",children:_.name}),jsxRuntimeExports.jsx(CopyableAddress,{pkh:_.pkh})]})]})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:2,onClick:j,variant:"warning",children:"Delete Contact"})})})]})},PopoverMenu=_=>{const{onOpen:a,onClose:$,isOpen:j}=useDisclosure$1();return jsxRuntimeExports.jsxs(Popover,{isOpen:j,onClose:$,onOpen:a,placement:"bottom-start",children:[jsxRuntimeExports.jsx(PopoverTrigger,{children:jsxRuntimeExports.jsx(Button,{minWidth:"24px",height:"24px",padding:"0",background:j?colors.green:colors.gray[500],border:"none",borderRadius:"full",_hover:{bg:j?colors.green:colors.gray[450]},"data-testid":"popover-cta",variant:"unstyled",children:jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsx(ThreeDotsIcon,{})})})}),jsxRuntimeExports.jsx(PopoverContent,{width:"100px",background:colors.gray[700],children:jsxRuntimeExports.jsx(PopoverBody,{borderRadius:"lg",children:_.children})})]})},RenameRemoveMenu=({onRename:_,onRemove:a})=>jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(PopoverMenu,{children:jsxRuntimeExports.jsxs(Box,{paddingY:"0",children:[jsxRuntimeExports.jsx(Button,{height:a?"24px":"28px",onClick:_,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Rename"}),jsxRuntimeExports.jsx(PenIcon,{stroke:"inherit"})]})}),a&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:"4px"}),jsxRuntimeExports.jsx(Button,{"data-testid":"popover-remove",onClick:a,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Remove"}),jsxRuntimeExports.jsx(TrashIcon,{stroke:"inherit"})]})})]})]})})}),SendButton=({onClick:_,...a})=>jsxRuntimeExports.jsxs(Button,{width:"60px",onClick:_,variant:"specialCTA",...a,children:[jsxRuntimeExports.jsx(OutgoingArrow,{stroke:"currentcolor"}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",children:"Send"})]}),OperationSignerSelector=({sender:_,operationType:a,isLoading:$,reEstimate:j})=>{switch(a){case"proposal":return jsxRuntimeExports.jsx(FormControl,{marginTop:"24px","data-testid":"signer-selector",children:jsxRuntimeExports.jsx(AvailableSignersAutocomplete,{account:_,inputName:"signer",isLoading:$,keepValid:!0,label:"Select Proposer",onUpdate:j})});case"implicit":return null}},SignPage$6=_=>{const{mode:a,operations:$}=_,{fee:j,operations:et,estimationFailed:tt,isLoading:rt,form:nt,signer:it,reEstimate:ot,onSign:st}=useSignPageHelpers($,a),{amount:ct,recipient:ut}=et.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:et.type,signer:et.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:ct}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:j})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:et.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:ut}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:rt,operationType:et.type,reEstimate:ot,sender:et.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:tt,isLoading:rt,onSubmit:st,signer:it,text:headerText(et.type,a)})})]})})})},estimateAndUpdateBatch=(_,a)=>async $=>{await estimate(_,a),$(batchesActions.add({operations:_,network:a}))},useOpenSignPageFormAction=({SignPage:_,signPageExtraData:a,FormPage:$,defaultFormPageProps:j,toOperation:et})=>{const{openWith:tt}=reactExports.useContext(DynamicModalContext),rt=useMakeFormOperations(et),nt=useSelectedNetwork();return async it=>{const ot=rt(it),st=await estimate(ot,nt);return tt(jsxRuntimeExports.jsx(_,{data:a,goBack:()=>tt(jsxRuntimeExports.jsx($,{...j,form:it})),mode:"single",operations:st}))}},useAddToBatchFormAction=_=>{const{onClose:a}=reactExports.useContext(DynamicModalContext),$=useSelectedNetwork(),j=useMakeFormOperations(_),et=useAppDispatch(),tt=useToast();return async nt=>{const it=j(nt);await et(estimateAndUpdateBatch(it,$)),tt({description:"Transaction added to batch!",status:"success"}),a()}},useHandleOnSubmitFormActions=_=>{const{handleAsyncAction:a,isLoading:$}=useAsyncActionHandler();return{onFormSubmitActionHandlers:_.map(et=>async tt=>a(()=>et(tt))),isLoading:$}},FormPage$4=({showPreview:_=!0,...a})=>{const $=useOpenSignPageFormAction({SignPage:SignPage$6,signPageExtraData:void 0,FormPage:FormPage$4,defaultFormPageProps:a,toOperation:toOperation$5}),j=useAddToBatchFormAction(toOperation$5),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(a)}),{formState:{isValid:it,errors:ot},register:st,handleSubmit:ct}=nt;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(FormPageHeader,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!ot.prettyAmount,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Amount"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{isDisabled:rt,step:getSmallestUnit(TEZ_DECIMALS),type:"number",...st("prettyAmount",{required:"Amount is required",validate:makeValidateDecimals(TEZ_DECIMALS)}),placeholder:"0.000000"}),jsxRuntimeExports.jsx(InputRightElement,{children:TEZ})]}),ot.prettyAmount&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"amount-error",children:ot.prettyAmount.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!!a.sender,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),ot.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:ot.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ct(tt),onSingleSubmit:ct(et),showPreview:_})})]})})})},toOperation$5=_=>({type:"tez",amount:tezToMutez(_.prettyAmount).toFixed(),recipient:parsePkh(_.recipient)}),ContactTable=({contacts:_})=>{const{openWith:a}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsx(Box,{overflow:"auto",background:colors.gray[900],borderRadius:"8px",paddingX:"30px",children:jsxRuntimeExports.jsx(TableContainer,{overflowX:"unset",overflowY:"unset",children:jsxRuntimeExports.jsx(Table,{children:jsxRuntimeExports.jsx(Tbody,{children:_.map(($,j)=>{const et=j===_.length-1?"transparent":colors.gray[700];return jsxRuntimeExports.jsxs(Tr,{"data-testid":"contact-row",children:[jsxRuntimeExports.jsx(Td,{borderColor:et,"data-testid":"contact-row-name",paddingX:"0",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Box,{width:"150px",marginRight:"40px",children:jsxRuntimeExports.jsx(Text,{overflow:"hidden",fontWeight:600,whiteSpace:"nowrap",textOverflow:"ellipsis",children:$.name})}),jsxRuntimeExports.jsx(CopyableAddress,{justifyContent:"space-between","data-testid":"contact-row-pkh",formatAddress:!1,iconColor:colors.gray[400],pkh:$.pkh})]})}),jsxRuntimeExports.jsx(Td,{borderColor:et,paddingX:"0",children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"end",children:[jsxRuntimeExports.jsx(SendButton,{marginRight:"20px",onClick:()=>a(jsxRuntimeExports.jsx(FormPage$4,{form:{sender:"",recipient:$.pkh,prettyAmount:""}}))}),jsxRuntimeExports.jsx(RenameRemoveMenu,{onRemove:()=>a(jsxRuntimeExports.jsx(DeleteContactModal,{contact:$})),onRename:()=>a(jsxRuntimeExports.jsx(UpsertContactModal,{contact:$}))})]})})]},$.pkh)})})})})})},ExternalLink=({href:_,children:a,...$})=>jsxRuntimeExports.jsx(Link$1,{alignItems:"center",display:"flex",_hover:{textDecoration:"none"},href:_,rel:"noopener noreferrer",role:"link",target:"_blank",...$,children:a}),SIZES={md:{heading:"xl",description:"md",button:"md"},lg:{heading:"3xl",description:"xl",button:"lg"}},NoItems=({title:_,description:a,children:$,size:j})=>jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"center",width:"100%",height:"100%",children:jsxRuntimeExports.jsxs(Box,{padding:"30px","data-testid":"empty-state-message",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"10px",textAlign:"center",size:SIZES[j].heading,children:_}),jsxRuntimeExports.jsx(Text,{marginBottom:"30px",color:colors.gray[400],textAlign:"center",size:SIZES[j].description,children:a}),jsxRuntimeExports.jsx(Center,{children:$})]})}),NoOperations=({size:_})=>jsxRuntimeExports.jsx(NoItems,{description:"Your operations history will appear here...",size:_,title:"No operations to show"}),NoNFTs=({size:_})=>jsxRuntimeExports.jsx(NoItems,{description:"Your NFT collection will appear here...",size:_,title:"No NFTs to show",children:jsxRuntimeExports.jsx(ExternalLink,{"data-testid":"buy-nft-button",href:"https://objkt.com",children:jsxRuntimeExports.jsx(Button,{size:SIZES[_].button,children:"Buy your first NFT"})})}),NoTokens=({size:_})=>jsxRuntimeExports.jsx(NoItems,{description:"All of your tokens will appear here...",size:_,title:"No tokens to show"}),NoDelegations=({size:_="lg",onDelegate:a})=>jsxRuntimeExports.jsx(NoItems,{description:"Your delegation history will appear here...",size:_,title:"No delegations to show",children:jsxRuntimeExports.jsx(Button,{"data-testid":"delegation-empty-state-button",onClick:a,size:SIZES[_].button,children:"Delegate"})}),BuyTezForm=({recipient:_=""})=>{const a=useSelectedNetwork(),$=a.name==="mainnet",j=$?"Buy Tez":"Request Tez from faucet",et=useForm({mode:"onBlur",defaultValues:{address:_}}),{formState:{isValid:tt,errors:rt}}=et;let nt=a.buyTezUrl;return a.buyTezUrl&&$&&(nt+="/default/widget/"),jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{action:nt,rel:"noreferrer noopener",target:"_blank",children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"10px",textAlign:"center",children:"Buy Tez"}),$&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("input",{name:"commodity",type:"hidden",value:"XTZ:Tezos"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],textAlign:"center",size:"sm",children:"Please select the recipient account."}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsxs(FormControl,{"data-testid":"buy-tez-selector",isInvalid:!!rt.address,paddingY:5,children:[jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!1,inputName:"address",isDisabled:!!_,label:"Recipient Account"}),rt.address&&jsxRuntimeExports.jsx(FormErrorMessage,{children:rt.address.message})]})})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Box,{width:"100%","data-testid":"buy-tez-button",children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:2,isDisabled:!tt,size:"lg",type:"submit",children:j})})})]})})})},CheckIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"15px",height:"11px",fill:"none",stroke:"white",viewBox:"0 0 15 11",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M1.16602 5.98371L5.06345 9.85408L13.8327 1.14575",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),UpdateButton=()=>{const _=useAppDispatch(),a=useIsLoading(),$=useLastTimeUpdated(),[j,et]=reactExports.useState(!1),[tt,rt]=reactExports.useState(!1),[nt]=useMediaQuery("(max-width: 1200px)");if(reactExports.useEffect(()=>{if(!$||differenceInSeconds(new Date,new Date($))>1)return;et(!0),rt(!0);const ct=setTimeout(()=>et(!1),2e3),ut=setTimeout(()=>rt(!1),3500);return()=>{clearTimeout(ct),clearTimeout(ut)}},[$]),nt||$===null)return null;const it=()=>{_(assetsActions.refetch())},ot=differenceInMinutes(new Date,new Date($))>=2,st={opacity:j?1:0,transition:"opacity 2s ease-in-out"};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Text,{display:"inline",color:colors.gray[400],size:"sm",style:tt?st:void 0,children:[tt&&"Updated just now",ot&&`Updated ${formatDistance(new Date($),new Date)} ago`]}),jsxRuntimeExports.jsx(IconButton,{marginRight:"36px",marginLeft:"8px",_active:{color:"white",bg:colors.green},"aria-label":"refetch",backgroundColor:tt?colors.green:colors.gray[500],"data-testid":"refetch-button",icon:tt?jsxRuntimeExports.jsx(CheckIcon,{style:st}):jsxRuntimeExports.jsx(FetchingIcon,{color:"white"}),isLoading:a,onClick:it,variant:"circle_without_hover_color"})]})},TopBar=({title:_,subtitle:a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",height:"88px",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"end",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"6px",size:"xl",children:_}),jsxRuntimeExports.jsx(Text,{color:colors.gray[450],"data-testid":"nft-total-amount",size:"xs",children:a})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(UpdateButton,{}),jsxRuntimeExports.jsx(Button,{onClick:()=>$(jsxRuntimeExports.jsx(BuyTezForm,{})),variant:"tertiary",children:"Buy Tez"}),jsxRuntimeExports.jsx(Button,{marginLeft:4,onClick:()=>$(jsxRuntimeExports.jsx(FormPage$4,{})),children:"Send"})]})]}),jsxRuntimeExports.jsx(Divider,{})]})},AddContact=()=>{const{openWith:_}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Button,{alignItems:"center",justifyContent:"end",marginTop:"16px",marginBottom:"16px",cursor:"pointer",onClick:()=>_(jsxRuntimeExports.jsx(UpsertContactModal,{})),variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(AddContactIcon,{stroke:"currentcolor"}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Add contact"})]})},AddressBookView=()=>{const _=useSortedContacts();return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Address Book"}),jsxRuntimeExports.jsx(Flex,{flexDirection:"row-reverse",children:jsxRuntimeExports.jsx(AddContact,{})}),_.length>0?jsxRuntimeExports.jsx(ContactTable,{contacts:_}):jsxRuntimeExports.jsx(NoItems,{description:"Your contacts will appear here...",size:"lg",title:"Your address book is empty"})]})};var pluralize$1={exports:{}};(function(_,a){(function($,j){typeof commonjsRequire=="function"?_.exports=j():$.pluralize=j()})(commonjsGlobal,function(){var $=[],j=[],et={},tt={},rt={};function nt(St){return typeof St=="string"?new RegExp("^"+St+"$","i"):St}function it(St,Mt){return St===Mt?Mt:St===St.toLowerCase()?Mt.toLowerCase():St===St.toUpperCase()?Mt.toUpperCase():St[0]===St[0].toUpperCase()?Mt.charAt(0).toUpperCase()+Mt.substr(1).toLowerCase():Mt.toLowerCase()}function ot(St,Mt){return St.replace(/\$(\d{1,2})/g,function(kt,Ct){return Mt[Ct]||""})}function st(St,Mt){return St.replace(Mt[0],function(kt,Ct){var Ot=ot(Mt[1],arguments);return it(kt===""?St[Ct-1]:kt,Ot)})}function ct(St,Mt,kt){if(!St.length||et.hasOwnProperty(St))return Mt;for(var Ct=kt.length;Ct--;){var Ot=kt[Ct];if(Ot[0].test(Mt))return st(Mt,Ot)}return Mt}function ut(St,Mt,kt){return function(Ct){var Ot=Ct.toLowerCase();return Mt.hasOwnProperty(Ot)?it(Ct,Ot):St.hasOwnProperty(Ot)?it(Ct,St[Ot]):ct(Ot,Ct,kt)}}function ht(St,Mt,kt,Ct){return function(Ot){var zt=Ot.toLowerCase();return Mt.hasOwnProperty(zt)?!0:St.hasOwnProperty(zt)?!1:ct(zt,zt,kt)===zt}}function Et(St,Mt,kt){var Ct=Mt===1?Et.singular(St):Et.plural(St);return(kt?Mt+" ":"")+Ct}return Et.plural=ut(rt,tt,$),Et.isPlural=ht(rt,tt,$),Et.singular=ut(tt,rt,j),Et.isSingular=ht(tt,rt,j),Et.addPluralRule=function(St,Mt){$.push([nt(St),Mt])},Et.addSingularRule=function(St,Mt){j.push([nt(St),Mt])},Et.addUncountableRule=function(St){if(typeof St=="string"){et[St.toLowerCase()]=!0;return}Et.addPluralRule(St,"$0"),Et.addSingularRule(St,"$0")},Et.addIrregularRule=function(St,Mt){Mt=Mt.toLowerCase(),St=St.toLowerCase(),rt[St]=Mt,tt[Mt]=St},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(St){return Et.addIrregularRule(St[0],St[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(St){return Et.addPluralRule(St[0],St[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(St){return Et.addSingularRule(St[0],St[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(Et.addUncountableRule),Et})})(pluralize$1);var pluralizeExports=pluralize$1.exports;const pluralize=getDefaultExportFromCjs$1(pluralizeExports),AccountSmallTile=({account:_,...a})=>{const $=useGetAccountBalance()(_.address.pkh);return jsxRuntimeExports.jsxs(Flex,{alignItems:"space-between",cursor:"pointer","data-testid":"account-small-tile",...a,children:[jsxRuntimeExports.jsx(AccountTileIcon,{account:_,size:"sm"}),jsxRuntimeExports.jsxs(Flex,{alignSelf:"center",height:"20px",marginLeft:"12px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"10px","data-testid":"account-small-tile-label",size:"sm",children:_.label}),jsxRuntimeExports.jsx(Text,{marginRight:"35px",color:colors.gray[300],"data-testid":"account-small-tile-pkh",size:"xs",children:formatPkh(_.address.pkh)}),$&&jsxRuntimeExports.jsx(Heading,{"data-testid":"account-small-tile-balance",size:"sm",children:prettyTezAmount($)})]})]})},OperationEstimationStatus=({estimationResult:_})=>{if(!_)return null;const a=lodashExports.get(_,"metadata.operation_result.status");if(!a)return null;let $,j,et;switch(a){case"applied":case"backtracked":j=colors.green,et="Estimated",$=jsxRuntimeExports.jsx(CheckmarkIcon,{height:"14.5px"});break;case"failed":j=colors.orange,et="Failed",$=jsxRuntimeExports.jsx(WarningIcon,{width:"12px",height:"13px",stroke:"currentcolor",marginX:"3px"});break;case"skipped":j=colors.orangeL,et="Not Estimated",$=jsxRuntimeExports.jsx(ExclamationIcon,{stroke:"currentcolor",marginX:"3px"})}return jsxRuntimeExports.jsx(Flex,{marginTop:"8px",color:j,"data-testid":"estimation-status",children:jsxRuntimeExports.jsxs(Center,{children:[$,jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"xs",children:et})]})})},LeftIcon=({addressKind:{type:_},...a})=>{switch(_){case"multisig":return jsxRuntimeExports.jsx(KeyIcon,{"data-testid":`${_}-icon`,...a});case"fa1.2":return jsxRuntimeExports.jsx(FA12Icon,{"data-testid":`${_}-icon`,...a,fill:a.stroke,stroke:"none"});case"fa2":return jsxRuntimeExports.jsx(FA2Icon,{"data-testid":`${_}-icon`,...a,fill:a.stroke,stroke:"none"});case"baker":return jsxRuntimeExports.jsx(BakerIcon,{"data-testid":`${_}-icon`,...a});case"contact":return jsxRuntimeExports.jsx(ContactIcon,{"data-testid":`${_}-icon`,...a});case"unknown":case"implicit":return null}},RightIcon=({addressKind:{type:_,pkh:a},addressPillMode:$,...j})=>{const et=useAddressExistsInContacts(),{openWith:tt}=reactExports.useContext(DynamicModalContext);return $.type==="removable"?jsxRuntimeExports.jsx(XMark,{cursor:"pointer",onClick:$.onRemove,...j}):["implicit","multisig","baker"].includes(_)||et(a)?null:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(AddContactIcon,{"data-testid":"add-contact-icon",onClick:()=>tt(jsxRuntimeExports.jsx(UpsertContactModal,{contact:{name:"",pkh:a}})),...j})})},AddressPillText=({addressKind:{pkh:_,label:a},showPkh:$,alias:j,...et})=>{const tt=useGetContactName(),rt=formatPkh(_),nt=tt(_)||a||j;return $?jsxRuntimeExports.jsx(Text,{...et,children:rt}):jsxRuntimeExports.jsx(Text,{...et,children:nt?truncate(nt,21):rt})},useAddressKind=_=>{const a=useOwnedAccountAddressKind(_),$=useTokenAddressKind(_),j=useBakerAddressKind(_),et=useContactAddressKind(_);return a||$||j||et||{pkh:_.pkh,type:"unknown",label:null}},useOwnedAccountAddressKind=_=>{const a=useOwnedAccountAddressKind$1(_);if(!a)return null;const{pkh:$,label:j}=a;return{type:a.type==="multisig"?"multisig":"implicit",pkh:$,label:j}},useTokenAddressKind=({pkh:_})=>{const a=useSelectedNetwork(),j=useGetTokenType(a)(_);if(!j)return null;switch(j){case"fa1.2":return{pkh:_,type:"fa1.2",label:null};case"fa2":case"nft":return{pkh:_,type:"fa2",label:null}}},AddressPill=({address:_,mode:a={type:"default"},...$})=>{const j=!("pkh"in _&&"type"in _),et=j?parsePkh(_.address):_,tt=useAddressKind(et),rt=a.type!=="no_icons",{onOpen:nt,onClose:it,isOpen:ot}=useDisclosure$1(),[st,ct]=reactExports.useState(!1),ut=async()=>{await navigator.clipboard.writeText(et.pkh),nt(),setTimeout(it,1e3)},ht=reactExports.useRef(null);useOutsideClick$1({ref:ht,handler:()=>{ct(!1)}});let Et,St,Mt;return ot?(Et=colors.green,St=colors.gray[300],Mt="white"):st?(Et=colors.gray[450],St=colors.gray[400],Mt=colors.gray[200]):(Et=colors.gray[500],St=colors.gray[450],Mt=colors.gray[300]),jsxRuntimeExports.jsx(Box,{maxWidth:"max-content","data-testid":"address-pill",...$,children:jsxRuntimeExports.jsxs(Flex,{ref:ht,alignItems:"center",background:Et,borderRadius:"full",onMouseEnter:()=>{ct(!0)},onMouseLeave:()=>{ct(!1)},paddingX:"4px",children:[rt&&jsxRuntimeExports.jsx(LeftIcon,{marginLeft:"4px",stroke:St,addressKind:tt,"data-testid":"address-pill-left-icon"}),jsxRuntimeExports.jsxs(Popover,{autoFocus:!1,isOpen:ot,onOpen:ut,children:[jsxRuntimeExports.jsx(PopoverTrigger,{children:jsxRuntimeExports.jsx(Button,{height:"24px",_focus:{boxShadow:"none"},onClick:kt=>kt.stopPropagation(),variant:"unstyled",children:jsxRuntimeExports.jsx(AddressPillText,{color:Mt,cursor:"pointer",addressKind:tt,alias:j&&_.alias?_.alias:void 0,"data-testid":"address-pill-text",marginX:"4px",showPkh:!rt,size:"sm"})})}),jsxRuntimeExports.jsxs(PopoverContent,{maxWidth:"max-content",background:"white",children:[jsxRuntimeExports.jsx(PopoverArrow,{background:"white !important"}),jsxRuntimeExports.jsx(PopoverBody,{children:jsxRuntimeExports.jsx(Text,{color:"black",size:"sm",children:"Copied!"})})]})]}),rt&&jsxRuntimeExports.jsx(RightIcon,{marginRight:"4px",stroke:colors.gray[300],cursor:"pointer",addressKind:tt,addressPillMode:a,"data-testid":"address-pill-right-icon"})]})})},OperationRecipient=({operation:_})=>{let a;switch(_.type){case"undelegation":case"contract_origination":a=void 0;break;case"tez":case"fa1.2":case"fa2":case"delegation":a=_.recipient;break;case"contract_call":a=_.contract;break}return a?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:a,"data-testid":"recipient"})]}):jsxRuntimeExports.jsx(Text,{color:colors.gray[500],"data-testid":"recipient",children:"N/A"})},tokenTitle=(_,a)=>{if(!_)return`${a} Unknown Token`;const $=tokenName(_),j=tokenPrettyAmount(a,_,{showSymbol:!1}),et=$?void 0:tokenSymbol(_);return lodashExports.compact([j,et,$]).join(" ")},getIPFSurl=_=>_==null?void 0:_.replace("ipfs://","https://ipfs.io/ipfs/"),sortedByLastUpdate=_=>lodashExports.orderBy(_,["lastLevel","id","owner"],["desc"]),OperationView=({operation:_})=>{const a=useGetToken(),$=useSelectedNetwork();switch(_.type){case"tez":return jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutgoingArrow,{marginRight:"8px"}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:prettyTezAmount(_.amount)})]});case"fa1.2":case"fa2":{const j=a(_.contract.pkh,_.tokenId);return(j==null?void 0:j.type)==="nft"?jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutgoingArrow,{marginRight:"8px"}),Number(_.amount)>1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Heading,{color:colors.gray[450],size:"sm",children:["x",_.amount]})," "]}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:jsxRuntimeExports.jsx(Tooltip,{padding:"8px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px",label:jsxRuntimeExports.jsx(AspectRatio,{width:"170px",height:"170px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{src:getIPFSurl(thumbnailUri(j))})}),openDelay:300,children:jsxRuntimeExports.jsx(Link$1,{"data-testid":"link",href:tokenUri(j,$),children:tokenNameSafe(j)})})})]}):jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutgoingArrow,{marginRight:"8px"}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:jsxRuntimeExports.jsx(Link$1,{"data-testid":"link",href:j?tokenUri(j,$):void 0,children:tokenTitle(j,_.amount)})})]})}case"delegation":return jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(BakerIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:"Delegate"})]});case"undelegation":return jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(BakerIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:"End Delegation"})]});case"contract_origination":case"contract_call":throw new Error(`${_.type} is not supported yet`)}},SelectedAccountContext=reactExports.createContext({selectedAccount:null,selectAccount:()=>{}}),AccountTileBase=({icon:_,leftElement:a,rightElement:$,...j})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"90px",marginBottom:"16px",padding:"16px",border:`1px solid ${colors.gray[800]}`,borderRadius:"16px","data-testid":"account-tile-base",...j,children:[_,jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flex:1,children:[a,$]})]}),LabelAndAddress=({label:_,pkh:a})=>jsxRuntimeExports.jsxs(Box,{margin:4,"data-testid":"account-identifier",children:[_&&jsxRuntimeExports.jsx(Heading,{size:"md",children:_}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(Text,{color:"text.dark","data-testid":"short-address",size:"sm",children:formatPkh(a)})})]}),MAX_NFT_COUNT=7,accountIconGradientColor=_=>{switch(_.type){case"mnemonic":case"secret_key":return color(_.address.pkh);case"ledger":case"multisig":return colors.gray[450];case"social":switch(_.idp){case"facebook":return"#1977F2";case"google":case"reddit":return"#EA4335";case"email":case"twitter":return colors.gray[450]}}},accountIconGradient=({account:_,radius:a,left:$="0px",top:j="0px",mainBackgroundColor:et=colors.gray[900],opacity:tt="60"})=>{let rt=accountIconGradientColor(_);return rt+=tt,`radial-gradient(circle farthest-side at ${$} ${j}, ${rt} 0%, ${rt} ${parseInt(a)/4}px, transparent ${a}), ${et}`},AccountTile=({account:_,balance:a})=>{const{selectedAccount:$,selectAccount:j}=reactExports.useContext(SelectedAccountContext),et=($==null?void 0:$.address.pkh)===_.address.pkh,tt=useAddressKind$1(_.address),{address:{pkh:rt}}=_,nt=!!useAppSelector(st=>st.assets.delegationLevels)[rt],it=useGetAccountNFTs(),ot=sortedByLastUpdate(it(rt));return jsxRuntimeExports.jsxs(Box,{zIndex:2,background:accountIconGradient({left:"-10px",top:"-10px",account:_,radius:ot.length>0?"120px":"100px"}),borderWidth:"1px",borderStyle:"solid",borderColor:et?colors.orangeL:colors.gray[900],borderRadius:"8px",_hover:{borderColor:et?colors.orangeL:colors.gray[700]},cursor:"pointer","data-testid":"account-tile-container",onClick:()=>j(_),paddingX:"21px",children:[jsxRuntimeExports.jsx(AccountTileBase,{align:"bottom",marginBottom:0,padding:0,border:"none","data-testid":`account-tile-${rt}`+(et?"-selected":""),icon:jsxRuntimeExports.jsx(AccountTileIcon,{account:_,size:"lg"}),leftElement:jsxRuntimeExports.jsx(LabelAndAddress,{label:tt.label,pkh:rt}),rightElement:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[a&&jsxRuntimeExports.jsx(Heading,{alignSelf:"flex-end","data-testid":"balance",size:"md",children:prettyTezAmount(a)}),jsxRuntimeExports.jsx(Text,{align:"right",color:colors.gray[450],fontWeight:700,"data-testid":"is-delegated",size:"sm",children:nt?"Delegated":jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:" "})})]})}),ot.length>0&&jsxRuntimeExports.jsxs(Flex,{flexDirection:"column","data-testid":"nfts-list",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Flex,{marginY:"21px",children:ot.slice(0,MAX_NFT_COUNT).map((st,ct)=>{const ut=getIPFSurl(thumbnailUri(st));return ct===MAX_NFT_COUNT-1?jsxRuntimeExports.jsx(Link,{"data-testid":"show-more-nfts-link",to:`/nfts?accounts=${rt}`,children:jsxRuntimeExports.jsx(Box,{height:"32px",marginLeft:"4px",background:colors.gray[600],borderRadius:"4px",children:jsxRuntimeExports.jsx(Text,{align:"center",width:"32px",color:colors.gray[450],fontWeight:700,children:"..."})})},"last"):jsxRuntimeExports.jsx(Link,{"data-testid":"nft-link",to:`/home/${rt}/${fullId(st)}`,children:jsxRuntimeExports.jsx(AspectRatio,{width:"32px",height:"32px",marginLeft:ct>0?"4px":0,ratio:1,children:jsxRuntimeExports.jsx(Image$1,{borderRadius:"4px",src:ut})})},fullId(st))})})]})]})},ConfirmationModal=({title:_,description:a,buttonLabel:$,onSubmit:j})=>{const{onClose:et}=reactExports.useContext(DynamicModalContext),tt=()=>{j(),et()};return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalHeader,{marginBottom:"10px",textAlign:"center",children:[jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(WarningIcon,{width:"40px",height:"40px",marginBottom:"16px"})}),jsxRuntimeExports.jsx(Heading,{children:_}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),a&&jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(Text,{align:"center",color:colors.gray[400],"data-testid":"description",children:a})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",onClick:tt,size:"lg",variant:"warning",children:$})})]})},BatchModalBody=({title:_,operation:a,transactionCount:$,children:j})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:subTitle(a.signer),title:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:a.signer.address}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",marginY:"12px",paddingX:"4px",children:[jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Transactions:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"transaction-length",size:"sm",children:$})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:totalFee(a.estimates)})]}),j]})]}),SignPage$5=({initialOperations:_})=>{const{operations:a,estimationFailed:$,isLoading:j,signer:et,form:tt,reEstimate:rt,onSign:nt}=useSignPageHelpers(_,"batch"),it=headerText(a.type,"batch");return jsxRuntimeExports.jsx(FormProvider,{...tt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(BatchModalBody,{operation:a,title:it,transactionCount:a.operations.length}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:j,operationType:a.type,reEstimate:rt,sender:a.sender}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:$,isLoading:j,onSubmit:nt,signer:et,text:it})})]})})})},RightHeader=({operations:_,onSubmit:a,isLoading:$})=>{const{type:j,sender:et,operations:tt}=_,{openWith:rt}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Box,{alignItems:"center",justifyContent:"space-between","data-testid":"right-header",children:[jsxRuntimeExports.jsx(Text,{display:"inline-block",color:colors.gray[400],size:"sm",children:pluralize("transaction",tt.length,!0)}),jsxRuntimeExports.jsx(Button,{marginLeft:"30px",isLoading:$,onClick:a,variant:"primary",children:headerText(j,"batch")}),jsxRuntimeExports.jsx(IconButton,{marginLeft:"16px",borderRadius:"4px","aria-label":"remove-batch","data-testid":"remove-batch",icon:jsxRuntimeExports.jsx(TrashIcon,{stroke:colors.gray[300]}),onClick:()=>rt(jsxRuntimeExports.jsx(ClearBatchConfirmationModal,{sender:et}),"sm"),variant:"circle"})]})},prettyOperationType=_=>{switch(_.type){case"fa1.2":case"fa2":return"Token Transfer";case"undelegation":case"delegation":return"Delegation";case"tez":return`${TEZ} Transfer`;case"contract_origination":case"contract_call":throw new Error(`${_.type} is not supported yet`)}},ClearBatchConfirmationModal=({sender:_})=>{const a=useClearBatch();return jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:"Delete Batch",description:"Are you sure you want to remove all transactions from the batch?",onSubmit:()=>a(_),title:"Delete Batch"})},SUCCESSFUL_ESTIMATION_RESULT={metadata:{operation_result:{status:"applied"}}},BatchView=({operations:_})=>{const{operations:a,sender:$}=_,j=a.length>9,et=useRemoveBatchItem(),{openWith:tt}=reactExports.useContext(DynamicModalContext),rt=useSelectedNetwork(),[nt,it]=React$2.useState([]);reactExports.useEffect(()=>{it([])},[a.length]);const{isLoading:ot,handleAsyncAction:st}=useAsyncActionHandler(),ct=()=>st(async()=>{it([]);try{const ht=await estimate(_,rt);return it(a.map(Et=>SUCCESSFUL_ESTIMATION_RESULT)),tt(jsxRuntimeExports.jsx(SignPage$5,{initialOperations:ht}))}catch(ht){if(ht instanceof TezosOperationError){const Et=ht.operationsWithResults;Et.length>a.length&&Et.shift(),it(Et)}throw ht}}),ut=jsxRuntimeExports.jsx(RightHeader,{isLoading:ot,onSubmit:ct,operations:_});return jsxRuntimeExports.jsxs(Box,{width:"100%",marginBottom:"16px","data-testid":`batch-table-${$.address.pkh}`,children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",padding:"20px 23px 20px 30px",background:accountIconGradient({top:"-10px",left:"-10px",account:$,radius:"100px",opacity:"40",mainBackgroundColor:colors.gray[800]}),borderTopRadius:"8px","data-testid":"header",children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(AccountSmallTile,{paddingLeft:0,account:$})}),ut]}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column",background:colors.gray[900],borderBottomRadius:j?0:"8px",paddingX:"30px",paddingY:"20px",children:a.map((ht,Et)=>{const St=nt.at(Et);return jsxRuntimeExports.jsxs(Box,{"data-testid":"operation",children:[jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:St?"80px":"50px",children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(OperationView,{operation:ht})}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",width:"100%",marginTop:"8px",children:[jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(OperationRecipient,{operation:ht})}),jsxRuntimeExports.jsx(OperationEstimationStatus,{estimationResult:St})]}),jsxRuntimeExports.jsxs(Flex,{alignSelf:"flex-end",children:[jsxRuntimeExports.jsx(Text,{alignSelf:"flex-end",color:colors.gray[450],size:"sm",children:prettyOperationType(ht)}),jsxRuntimeExports.jsx(IconButton,{width:"24px",marginLeft:"12px",borderRadius:"full","aria-label":"Remove",icon:jsxRuntimeExports.jsx(TrashIcon,{stroke:colors.gray[300]}),onClick:()=>et($,Et),size:"xs",variant:"circle"})]})]})]}),EtjsxRuntimeExports.jsx(Link,{rel:"noopener noreferrer",target:"_blank",to:a,children:jsxRuntimeExports.jsx(ClickableCard,{cursor:"pointer",isSelected:!1,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{size:"sm",children:_}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[$&&jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[400],size:"sm",children:$}),jsxRuntimeExports.jsx(ExternalLinkIcon,{})]})]})})}),HelpCard=({title:_,children:a})=>jsxRuntimeExports.jsx(Box,{"data-testid":"help-card",marginY:"10px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsxs(Box,{width:"550px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"16px",size:"lg",children:_}),a]})})}),ConnectOptions=({goToStep:_})=>{const a=useImplicitAccounts().length>0;return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(LinkIcon,{}),title:"Connect or Import Account",children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:"16px",children:[jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"restoreMnemonic"}),size:"lg",children:"Import with Seed Phrase"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"restoreSecretKey"}),size:"lg",variant:"tertiary",children:"Import with Secret Key"}),!a&&jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"restoreBackup"}),size:"lg",variant:"tertiary",children:"Restore from Backup"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"nameAccount",account:{type:"ledger"}}),size:"lg",variant:"tertiary",children:"Connect ledger"})]})})},withTimeout=(_,a,$)=>Promise.race([_(),new Promise((j,et)=>setTimeout(()=>{et(new Error("The operation has timed out"))},a))]),LOGIN_TIMEOUT=minutesToMilliseconds(1),useOnboardWithSocial=(_,a)=>{const $=useToast(),{isLoading:j,handleAsyncAction:et}=useAsyncActionHandler(),tt=useRestoreSocial(),rt=reactExports.useCallback(()=>et(async()=>{const{secretKey:nt,name:it}=await withTimeout(()=>forIDP(_).getCredentials(),LOGIN_TIMEOUT),{pk:ot,pkh:st}=await getPublicKeyPairFromSk(nt);tt(ot,st,it,_),$({description:`Successfully added ${it} account`,status:"success"}),a()},{title:"Social login failed"}),[_,$,et,tt,a]);return{isLoading:j,onboard:rt}},OnboardWithFacebookButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("facebook",_);return jsxRuntimeExports.jsx(IconButton,{"aria-label":"Facebook SSO","data-testid":"login-button-facebook",icon:jsxRuntimeExports.jsx(FacebookIcon,{}),isLoading:a,onClick:$,variant:"socialLogin"})},OnboardWithGoogleButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("google",_);return jsxRuntimeExports.jsx(IconButton,{"aria-label":"Google SSO","data-testid":"login-button-google",icon:jsxRuntimeExports.jsx(GoogleIcon,{}),isLoading:a,onClick:$,variant:"socialLogin"})},OnboardWithRedditButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("reddit",_);return jsxRuntimeExports.jsx(IconButton,{"aria-label":"Reddit SSO","data-testid":"login-button-reddit",icon:jsxRuntimeExports.jsx(RedditIcon,{}),isLoading:a,onClick:$,variant:"socialLogin"})},OnboardWithTwitterButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("twitter",_);return jsxRuntimeExports.jsx(IconButton,{color:"black","aria-label":"Twitter SSO","data-testid":"login-button-twitter",icon:jsxRuntimeExports.jsx(TwitterIcon,{fill:"currentColor"}),isLoading:a,onClick:$,variant:"socialLogin"})},IS_DEV=!1,ConnectOrCreate=({goToStep:_,closeModal:a})=>jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(WalletPlusIcon,{}),title:"Connect or Create Account",children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:"16px",children:[jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"notice"}),size:"lg",children:"Create a new Account"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"connectOptions"}),size:"lg",variant:"tertiary",children:"I already have a wallet"}),IS_DEV,jsxRuntimeExports.jsxs(Flex,{width:"100%",paddingTop:"14px",paddingBottom:"6px",children:[jsxRuntimeExports.jsx(Divider,{marginTop:"11px"}),jsxRuntimeExports.jsx(Text,{minWidth:"160px",color:colors.gray[400],textAlign:"center",noOfLines:1,size:"sm",children:"Continue with social"}),jsxRuntimeExports.jsx(Divider,{marginTop:"11px"})]}),jsxRuntimeExports.jsxs(Flex,{gap:"12px",children:[jsxRuntimeExports.jsx(OnboardWithGoogleButton,{onAuth:a}),jsxRuntimeExports.jsx(OnboardWithFacebookButton,{onAuth:a}),jsxRuntimeExports.jsx(OnboardWithTwitterButton,{onAuth:a}),jsxRuntimeExports.jsx(OnboardWithRedditButton,{onAuth:a})]})]})}),Select=({selected:_,options:a,onChange:$})=>{const[j,et]=reactExports.useState(_),[tt,rt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",height:"48px",padding:"12px 15px 15px 15px",color:colors.gray[300],background:colors.gray[800],border:"1px solid",borderColor:colors.gray[500],borderRadius:"4px",_hover:{borderColor:colors.gray[450]},cursor:"pointer","data-testid":"select-input",onClick:()=>rt(nt=>!nt),children:[jsxRuntimeExports.jsx(Text,{size:"sm",children:j.label}),jsxRuntimeExports.jsx(ChevronDownIcon$1,{marginTop:"2px"})]}),tt&&jsxRuntimeExports.jsx(UnorderedList,{position:"absolute",zIndex:2,width:"100%",margin:0,marginTop:"8px",padding:"15px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px","data-testid":"select-options",listStyleType:"none",children:a.map(nt=>jsxRuntimeExports.jsx(ListItem,{marginBottom:"5px",padding:"11px",color:colors.gray[300],background:"transparent",borderRadius:"4px",_hover:{background:colors.gray[500]},cursor:"pointer",onClick:()=>{rt(!1),et(nt),$(nt.value)},children:jsxRuntimeExports.jsx(Text,{size:"sm",children:nt.label})},nt.value))})]})},DerivationPath=({goToStep:_,account:a})=>{const[$,j]=reactExports.useState(!1),{handleSubmit:et,register:tt,setValue:rt,formState:{isValid:nt,errors:it}}=useForm({mode:"onBlur",defaultValues:{derivationPathTemplate:defaultDerivationPathTemplate,derivationPath:getDefaultDerivationPath(0)}}),ot=async({derivationPathTemplate:st,derivationPath:ct})=>{switch(a.type){case"ledger":return _($?{type:"restoreLedger",account:{...a,derivationPath:normalizeDerivationPath(ct)}}:{type:"restoreLedger",account:{...a,derivationPathTemplate:normalizeDerivationPath(st)}});case"mnemonic":{if($){const ut=await deriveSecretKey(a.mnemonic,ct,"ed25519");return _({type:"masterPassword",account:{type:"secret_key",secretKey:ut,label:a.label}})}return _({type:"masterPassword",account:{...a,derivationPathTemplate:st}})}}};return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(SlashIcon,{}),subtitle:"Choose a custom derivation path or select the default derivation path and use the default key.",title:"Derivation Path",children:jsxRuntimeExports.jsxs("form",{onSubmit:et(ot),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(Center,{width:"100%",marginBottom:"12px",children:[jsxRuntimeExports.jsx(Text,{fontWeight:$?400:600,size:"sm",children:"Default Path"}),jsxRuntimeExports.jsx(Switch,{"data-testid":"custom-path-switch",marginX:"10px",onChange:()=>j(st=>!st),variant:"danger"}),jsxRuntimeExports.jsx(Text,{fontWeight:$?600:400,size:"sm",children:"Custom Path"})]}),$&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Center,{marginTop:"16px",marginBottom:"32px",children:jsxRuntimeExports.jsx(Text,{width:"340px",color:colors.orange,textAlign:"center",size:"xs",children:"Please write down to your derivation path. You may not be able to restore your data if you lose it."})}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"20px",isInvalid:!!it.derivationPath,children:[jsxRuntimeExports.jsx(Input,{fontSize:"sm",textAlign:"center","data-testid":"custom-path-input",...tt("derivationPath",{validate:validateDerivationPath})}),it.derivationPath&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"error-message",children:it.derivationPath.message})]})]}),!$&&jsxRuntimeExports.jsx(FormControl,{marginTop:"32px",marginBottom:"20px",children:jsxRuntimeExports.jsx(Select,{onChange:st=>rt("derivationPathTemplate",st),options:AVAILABLE_DERIVATION_PATH_TEMPLATES,selected:DEFAULT_DERIVATION_PATH_TEMPLATE})}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"12px",isDisabled:!nt,size:"lg",type:"submit",children:"Continue"}),jsxRuntimeExports.jsx(ExternalLink,{display:"block",width:"100%",marginTop:"32px",textAlign:"center",href:"https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki",children:jsxRuntimeExports.jsx(Tooltip,{backgroundColor:"white",defaultIsOpen:!1,hasArrow:!0,label:"Derivation path is a set of directions that helps create different secret keys; it starts from a master key or seed.",children:jsxRuntimeExports.jsx(Text,{color:colors.blue,fontWeight:600,textDecoration:"underline",_hover:{textDecoration:"underline"},size:"sm",children:"What's a Derivation Path?"})})})]})})},normalizeDerivationPath=_=>_.trim().toLowerCase().replace("m/",""),validateDerivationPath=_=>{const a=normalizeDerivationPath(_);return a.length===0?"Derivation path is required":a.startsWith("44'/1729'/")?a.match(new RegExp("^44'/1729'/([0-9]+'/)*([0-9]+')$"))?!0:"Invalid derivation path":"Derivation path must start with `44'/1729'/`"},Eula=({goToStep:_})=>{const[a,$]=React$2.useState(!1);return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(DocumentIcon,{}),title:"Accept to Continue",children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Checkbox,{paddingBottom:"24px",fontWeight:"600",onChange:j=>$(j.target.checked),children:["I confirm that I have read and agreed with the"," ",jsxRuntimeExports.jsx(Link$1,{textDecoration:"underline",_hover:{color:colors.green},href:"https://umamiwallet.com/tos.html",rel:"noopener noreferrer",target:"_blank",children:"Terms of Service"})," ","and the"," ",jsxRuntimeExports.jsx(Link$1,{textDecoration:"underline",_hover:{color:colors.green},href:"https://umamiwallet.com/privacypolicy.html",rel:"noopener noreferrer",target:"_blank",children:"Privacy Policy"})]}),jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!a,onClick:()=>{_({type:"connectOrCreate"})},size:"lg",children:"Continue"})]})})},FakeAccount=({onClose:_})=>{const{register:a,handleSubmit:$,formState:{errors:j}}=useForm({mode:"onBlur"}),et=useRestoreLedger(),tt=useRestoreSocial(),rt=async({pkh:nt,name:it,idp:ot})=>{if(ot&&ot.length>0&&!["google","facebook","twitter","reddit","email"].includes(ot))throw new Error("Invalid IDP");const ct=await new RpcClient(GHOSTNET.rpcUrl).getManagerKey(nt),ut=typeof ct=="string"?ct:ct.key;ot?tt(ut,nt,it,ot):et(defaultDerivationPathTemplate,makeDerivationPath(defaultDerivationPathTemplate,0),ut,nt,it),_()};return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(WalletPlusIcon,{}),title:"Add a Fake Account",children:jsxRuntimeExports.jsxs("form",{onSubmit:$(rt),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!j.pkh,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Address"}),jsxRuntimeExports.jsx(Input,{...a("pkh",{required:!0}),autoComplete:"off",placeholder:"Please enter the account address"})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"12px",isInvalid:!!j.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Name"}),jsxRuntimeExports.jsx(Input,{...a("name",{required:!0}),autoComplete:"off",placeholder:"Please enter the account name"})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"12px",isInvalid:!!j.idp,children:[jsxRuntimeExports.jsx(FormLabel,{children:"IDP (For a social account)"}),jsxRuntimeExports.jsx(Input,{...a("idp"),autoComplete:"off",placeholder:"Please enter the IDP"})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"12px",size:"lg",type:"submit",children:"Add account"})]})})},EnterAndConfirmPassword=({onSubmit:_,isLoading:a})=>{const $=useForm({mode:"onBlur"}),{handleSubmit:j,formState:{errors:et,isValid:tt},getValues:rt}=$,nt=({confirm:it})=>_(it);return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(LockIcon,{}),subtitle:"Please choose a master password for Umami. You will need to use this password in order to perform any operations within Umami.",title:"Umami Master Password",children:jsxRuntimeExports.jsx(FormProvider,{...$,children:jsxRuntimeExports.jsxs("form",{onSubmit:j(nt),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!et.password,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password",placeholder:"Enter master password"}),et.password&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.password.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!et.confirm,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"confirmation",inputName:"confirm",label:"Confirm Password",placeholder:"Confirm your password",required:"Confirmation is required",validate:it=>rt("password")===it||"Your passwords do no match"}),et.confirm&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.confirm.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",isDisabled:!tt||a,isLoading:a,size:"lg",type:"submit",children:"Submit"})]})})})},EnterPassword=({onSubmit:_,isLoading:a})=>{const $=useForm({mode:"onBlur"}),{handleSubmit:j,formState:{errors:et,isValid:tt}}=$,rt=nt=>{_(nt.password)};return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(LockIcon,{}),subtitle:"Enter your master password for Umami.",title:"Umami Master Password",children:jsxRuntimeExports.jsx(FormProvider,{...$,children:jsxRuntimeExports.jsxs("form",{onSubmit:j(rt),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!et.password,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password"}),et.password&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.password.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",isDisabled:!tt,isLoading:a,size:"lg",type:"submit",children:"Submit"})]})})})},MasterPassword=({account:_,onClose:a})=>{const $=useRestoreFromMnemonic(),j=useRestoreFromSecretKey(),et=useValidateMasterPassword(),tt=et!==null,{isLoading:rt,handleAsyncAction:nt}=useAsyncActionHandler(),it=useToast(),ot=st=>nt(async()=>{switch(tt&&await et(st),_.type){case"secret_key":await j(_.secretKey,st,_.label);break;case"mnemonic":await $({..._,password:st})}it({description:"Account successfully created!",status:"success"}),a()});return tt?jsxRuntimeExports.jsx(EnterPassword,{isLoading:rt,onSubmit:ot}):jsxRuntimeExports.jsx(EnterAndConfirmPassword,{isLoading:rt,onSubmit:ot})},Notice=({goToStep:_})=>{const a=[{content:"Write down your seed phrase and store it in a safe place."},{content:"Make sure there is no one around you or looking over your shoulder."},{content:"Do not copy and paste the Seed Phrase or store it on your device."},{content:"Do not take a screenshot of your Seed Phrase."}];return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(NoticeIcon,{}),subtitle:"Please read the following before you continue to see your secret Seed Phrase.",title:"Important Notice",children:jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(OrderedList,{spacing:"16px",variant:"onboardingNotice",children:a.map(($,j)=>jsxRuntimeExports.jsx(ListItem,{fontSize:"16px",fontWeight:600,children:$.content},j))}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"28px",onClick:()=>_({type:"showSeedphrase",account:{type:"mnemonic",mnemonic:generate24WordMnemonic()}}),size:"lg",children:"I understand"}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"16px",onClick:()=>_({type:"restoreMnemonic"}),size:"lg",variant:"tertiary",children:"I already have a Seed Phrase"})]})})},RestoreBackupFile=()=>{const _=useForm({mode:"onBlur"}),{handleSubmit:a,register:$,formState:{errors:j,isValid:et}}=_,{handleAsyncAction:tt}=useAsyncActionHandler(),rt=useRestoreV1BackupFile(),nt=({password:it,file:ot})=>tt(async()=>{const st=await ot[0].text(),ct=JSON.parse(st);if(ct.recoveryPhrases&&ct.derivationPaths)await rt(ct,it);else if(ct["persist:accounts"])await restoreV2BackupFile(ct,it),reload();else throw new Error("Invalid backup file.")});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(RotateIcon,{}),subtitle:"Select a JSON backup file and enter the password you used to encrypt it.",title:"Restore from Backup",children:jsxRuntimeExports.jsx(FormProvider,{..._,children:jsxRuntimeExports.jsx("form",{onSubmit:a(nt),style:{width:"100%"},children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!j.file,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Upload File"}),jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(Input,{padding:"2px","data-testid":"file-input",...$("file",{required:"File is required"}),accept:".json",type:"file",variant:"unstyled"})}),j.file&&jsxRuntimeExports.jsx(FormErrorMessage$1,{"data-testid":"file-errors",children:j.file.message})]}),jsxRuntimeExports.jsx(FormControl,{marginTop:"24px",children:jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password-input",inputName:"password",label:"Your password (if you have one)",required:!1})}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",isDisabled:!et,size:"lg",type:"submit",children:"Import Wallet"})]})})})})},getPk=async _=>{const a=await TransportWebUSB.create(),$=new LedgerSigner(a,_,!0),j=await $.publicKey(),et=await $.publicKeyHash();return await a.close(),{pk:j,pkh:et}},LEDGER_TIMEOUT=60*1e3,RestoreLedger=({closeModal:_,account:a})=>{const $=useRestoreLedger(),j=useToast(),{isLoading:et,handleAsyncAction:tt}=useAsyncActionHandler(),rt=[{content:"Plug your Ledger into your computer using a USB cable."},{content:"Unlock your Ledger."},{content:"Make sure your Ledger has the latest firmware version."},{content:"Install and open the Tezos Wallet app on your Ledger."},{content:"Click the button below and confirm the action on your Ledger."}],nt=()=>tt(()=>withTimeout(async()=>{const it=j({description:"Please open the Tezos app on your Ledger and approve the operation",status:"info"}),ot=a.derivationPathTemplate?makeDerivationPath(a.derivationPathTemplate,0):a.derivationPath,{pk:st,pkh:ct}=await getPk(ot);$(a.derivationPathTemplate,ot,st,ct,a.label),j.close(it),j({description:"Account successfully created!",status:"success"}),_()},LEDGER_TIMEOUT),it=>it.name==="PublicKeyRetrievalError"?{description:"Request rejected. Please unlock your Ledger and open the Tezos app"}:it.name==="InvalidStateError"?{description:"Request pending. Check your ledger..."}:{description:`Ledger error. ${it.message||it.name}`});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(USBIcon,{}),subtitle:"Complete the steps to connect.",title:"Connect Ledger",children:jsxRuntimeExports.jsxs(VStack,{overflowY:"auto",spacing:"24px",children:[jsxRuntimeExports.jsx(OrderedList,{spacing:4,children:rt.map((it,ot)=>jsxRuntimeExports.jsx(ListItem,{children:it.content},ot))}),jsxRuntimeExports.jsx(Button,{width:"100%",isLoading:et,onClick:nt,size:"lg",children:"Export Public Key"})]})})},MnemonicAutocomplete=({inputName:_,validate:a,inputProps:$,listProps:j})=>{const[et,tt]=reactExports.useState(!0),{register:rt,setValue:nt,watch:it}=useFormContext(),ot=it(_),st=wordlists.EN.filter(ut=>ot&&ut.startsWith(ot)).sort(),ct=!et&&st.length>0&&(st.length>1||st[0]!==ot);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Input,{zIndex:0,autoComplete:"off","data-testid":"mnemonic-input",onFocus:()=>tt(!1),placeholder:"Type here...",...rt(_,{required:"Required",validate:a,onChange:()=>tt(!1),onBlur:()=>tt(!0)}),...$}),ct&&jsxRuntimeExports.jsx(UnorderedList,{"data-testid":"suggestions",variant:"suggestions",...j,children:st.map(ut=>jsxRuntimeExports.jsx(ListItem,{paddingTop:"2px",fontSize:"14px",fontWeight:600,"data-testid":"suggestion",onMouseDown:()=>nt(_,ut),paddingX:"7px",children:ut},ut))})]})},mnemonicSizes=[12,15,18,24],RestoreMnemonic=({goToStep:_})=>{const a=useForm({mode:"onBlur"}),{handleSubmit:$,setValue:j,trigger:et,formState:{isValid:tt}}=a,{handleAsyncAction:rt}=useAsyncActionHandler(),[nt,it]=reactExports.useState(24),ot=ut=>{const ht=Number(ut);if(mnemonicSizes.includes(ht))return it(Et=>(Et>ht&&lodashExports.range(ht,Math.max(...mnemonicSizes)).forEach(St=>{j(`word${St}`,void 0)}),ht)),et()},st=ut=>rt(async()=>{const ht=ut.split(" ");if(!mnemonicSizes.includes(ht.length))throw new Error(`the mnemonic must be ${mnemonicSizes.join(", ")} words long`);return ht.slice(0,nt).forEach((Et,St)=>{j(`word${St}`,Et)}),et()}),ct=ut=>rt(async()=>{const ht=Object.values(ut).join(" ").trim();if(!validateMnemonic_1(ht))throw new Error(`Invalid Mnemonic: "${ht}"`);return _({type:"nameAccount",account:{type:"mnemonic",mnemonic:ht}}),Promise.resolve()});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px"}),subtitle:"Please fill in the Seed Phrase in sequence.",title:"Import Seed Phrase",children:jsxRuntimeExports.jsx(Box,{overflowX:"hidden",children:jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx("form",{onSubmit:$(ct),style:{width:"100%"},children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:4,children:[jsxRuntimeExports.jsx(Select$1,{height:"48px",color:colors.gray[450],"data-testid":"select",icon:jsxRuntimeExports.jsx(ChevronDownIcon,{}),onChange:ut=>ot(ut.target.value),value:nt,children:mnemonicSizes.reverse().map(ut=>jsxRuntimeExports.jsxs("option",{value:ut,children:[ut," Words"]},ut))}),jsxRuntimeExports.jsx(Grid,{gridGap:3,gridTemplateColumns:"repeat(3, 1fr)",paddingBottom:"20px",children:lodashExports.range(nt).map(ut=>{const ht=`word${ut}`;return jsxRuntimeExports.jsxs(GridItem,{display:"flex",height:"38px",padding:"4px",fontSize:"sm",background:colors.gray[800],border:"1px solid",borderColor:colors.gray[500],borderRadius:"4px",children:[jsxRuntimeExports.jsx(Heading,{width:"19px",marginRight:"6px",paddingTop:"6px",color:colors.gray[400],textAlign:"right",size:"sm",children:ut+1}),jsxRuntimeExports.jsx(MnemonicAutocomplete,{inputName:ht,inputProps:{onPaste:async Et=>{Et.preventDefault();const St=await navigator.clipboard.readText();return st(St)},border:"none",size:"xsmall"},listProps:{width:"126px",marginTop:"38px",marginLeft:"-5px"}})]},ut)})}),jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!tt,size:"lg",type:"submit",children:"Continue"}),IS_DEV]})})})})})},RestoreSecretKey=({goToStep:_})=>{const[a,$]=reactExports.useState(!1),{handleAsyncAction:j}=useAsyncActionHandler(),et=useForm({mode:"onBlur",defaultValues:{password:""}}),{register:tt,handleSubmit:rt,formState:{errors:nt,isValid:it}}=et,ot=async({secretKey:st,password:ct})=>j(async()=>{try{const ht=await(await InMemorySigner.fromSecretKey(st.trim(),ct)).secretKey();_({type:"nameAccount",account:{type:"secret_key",secretKey:ht}})}catch(ut){const ht=ut.message||"";throw ht.includes("Cannot read properties of null")?new Error("Key-password pair is invalid"):ht.includes("Invalid checksum")?new Error("Invalid secret key: checksum doesn't match"):ut}});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px"}),title:"Insert Secret Key",children:jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsxs("form",{onSubmit:rt(ot),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!nt.secretKey,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Secret Key"}),jsxRuntimeExports.jsx(Textarea,{minHeight:"130px","data-testid":"secret-key",...tt("secretKey",{required:"Secret key is required",onChange:st=>$(isEncryptedSecretKeyPrefix(st.target.value.trim()))}),placeholder:"Your secret key"}),nt.secretKey&&jsxRuntimeExports.jsx(FormErrorMessage$1,{children:nt.secretKey.message})]}),a&&jsxRuntimeExports.jsxs(FormControl,{marginTop:"20px",isInvalid:!!nt.password,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password",minLength:0}),nt.password&&jsxRuntimeExports.jsx(FormErrorMessage$1,{children:nt.password.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px","data-testid":"restore-continue-button",isDisabled:!it,size:"lg",type:"submit",children:"Continue"})]})})})},ShowSeedphrase=({goToStep:_,account:a})=>jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px"}),subtitle:"Please record the following 24 words in sequence in order to restore it in the future.",title:"Record Seed Phrase",children:jsxRuntimeExports.jsxs(VStack,{children:[jsxRuntimeExports.jsx(SimpleGrid,{columns:3,spacing:2,children:a.mnemonic.split(" ").map(($,j)=>jsxRuntimeExports.jsxs(Flex,{width:"126px",padding:"6px",border:"1px dashed",borderColor:colors.gray[500],borderRadius:"4px",children:[jsxRuntimeExports.jsx(Heading,{width:"18px",marginRight:"10px",paddingTop:"2px",color:colors.gray[450],textAlign:"right",size:"sm",children:j+1}),jsxRuntimeExports.jsx(Text,{"data-testid":`mnemonic-word-${j}`,size:"sm",children:$})]},j))}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"20px",onClick:$=>{_({type:"verifySeedphrase",account:a})},size:"lg",children:"OK, I've recorded it"})]})}),VerifySeedphrase=({goToStep:_,account:a})=>{const $=a.mnemonic.split(" "),j=useForm({mode:"onBlur"}),{handleSubmit:et,formState:{errors:tt,isValid:rt}}=j,[nt]=reactExports.useState(selectRandomElements($,5)),it=()=>_({type:"nameAccount",account:a});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(DoubleCheckmarkIcon,{}),subtitle:"To verify, please type in the word that corresponds to each sequence number.",title:"Verify Seed Phrase",children:jsxRuntimeExports.jsx(Box,{overflowX:"hidden",overflowY:"auto",width:"100%",children:jsxRuntimeExports.jsx(FormProvider,{...j,children:jsxRuntimeExports.jsxs("form",{onSubmit:et(it),children:[nt.map((ot,st)=>{const ct=`${ot.index}`,ut=tt[ct];return jsxRuntimeExports.jsxs(FormControl,{marginBottom:"12px",isInvalid:!!ut,children:[jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:1,width:"26px",marginTop:"12px",marginLeft:"4px",textAlign:"right","data-testid":"mnemonic-index",children:ot.index+1}),jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsx(MnemonicAutocomplete,{inputName:ct,inputProps:{paddingLeft:"36px",size:"md"},listProps:{marginTop:"6px"},validate:ht=>{if(ht!==ot.value)return"Word doesn't match"}})}),(ut==null?void 0:ut.message)&&jsxRuntimeExports.jsx(FormErrorMessage,{children:ut.message})]},st)}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"20px",isDisabled:!rt,size:"lg",type:"submit",children:"Continue"}),IS_DEV]})})})})},useStepHistory=_=>{const[a,$]=reactExports.useState(_),[j,et]=reactExports.useState([a]),tt=j.length===1;return{reset:()=>{$(_),et([_])},goToStep:rt=>{$(rt),et([...j,rt])},currentStep:a,goBack:()=>{if(tt)return;j.pop();const rt=j[j.length-1];et(j),$(rt)},atInitialStep:tt,fullHistory:j}},useOnboardingModal=_=>{const{isOpen:a,onOpen:$,onClose:j}=useDisclosure$1(),et=useImplicitAccounts().length!==0,tt=useStepHistory({type:et?"connectOrCreate":"eula"}),{currentStep:rt,goToStep:nt}=tt,it=()=>{tt.reset(),_&&_(),j()},ot=()=>{switch(rt.type){case"eula":return jsxRuntimeExports.jsx(Eula,{goToStep:nt});case"connectOrCreate":return jsxRuntimeExports.jsx(ConnectOrCreate,{closeModal:it,goToStep:nt});case"connectOptions":return jsxRuntimeExports.jsx(ConnectOptions,{goToStep:nt});case"notice":return jsxRuntimeExports.jsx(Notice,{goToStep:nt});case"restoreMnemonic":return jsxRuntimeExports.jsx(RestoreMnemonic,{goToStep:nt});case"restoreBackup":return jsxRuntimeExports.jsx(RestoreBackupFile,{});case"showSeedphrase":return jsxRuntimeExports.jsx(ShowSeedphrase,{goToStep:nt,...rt});case"verifySeedphrase":return jsxRuntimeExports.jsx(VerifySeedphrase,{goToStep:nt,...rt});case"nameAccount":return jsxRuntimeExports.jsx(NameAccount,{goToStep:nt,...rt});case"derivationPath":return jsxRuntimeExports.jsx(DerivationPath,{goToStep:nt,...rt});case"restoreLedger":return jsxRuntimeExports.jsx(RestoreLedger,{closeModal:it,...rt});case"masterPassword":return jsxRuntimeExports.jsx(MasterPassword,{onClose:it,...rt});case"fakeAccount":return jsxRuntimeExports.jsx(FakeAccount,{onClose:j});case"restoreSecretKey":return jsxRuntimeExports.jsx(RestoreSecretKey,{goToStep:nt})}};return{modalElement:jsxRuntimeExports.jsxs(Modal,{autoFocus:!1,closeOnOverlayClick:!1,isCentered:!0,isOpen:a,onClose:it,children:[et&&jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsxs(ModalContent,{children:[!tt.atInitialStep&&jsxRuntimeExports.jsx(ModalBackButton,{onClick:tt.goBack}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:it}),ot()]})]}),onOpen:$}},AccountListHeader=()=>{const{onOpen:_,modalElement:a}=useOnboardingModal();return jsxRuntimeExports.jsxs(Flex,{flexDirection:"row-reverse",marginTop:"12px",marginBottom:"16px",children:[jsxRuntimeExports.jsxs(Button,{paddingRight:"0",onClick:_,variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(AddAccountIcon,{stroke:"currentcolor"}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Add Account"})]}),a]})},AccountGroupPopover=({onRemove:_,onCreate:a})=>jsxRuntimeExports.jsx(PopoverMenu,{children:jsxRuntimeExports.jsxs(Box,{paddingY:"0",children:[jsxRuntimeExports.jsx(Button,{height:a?"24px":"28px","data-testid":"popover-remove",onClick:_,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flex:1,children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Remove"}),jsxRuntimeExports.jsx(TrashIcon,{stroke:"inherit"})]})}),a&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:"4px"}),jsxRuntimeExports.jsx(Button,{onClick:a,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flex:1,children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Create"}),jsxRuntimeExports.jsx(PlusIcon,{width:"18px",height:"18px",stroke:"inherit"})]})})]})]})}),DeriveMnemonicAccountModal=({onDone:_,fingerPrint:a})=>{const[$,j]=reactExports.useState(),{isLoading:et,handleAsyncAction:tt}=useAsyncActionHandler(),rt=useToast(),nt=useDeriveMnemonicAccount(),it=({name:ot,password:st})=>tt(async()=>{await nt({fingerPrint:a,password:st,label:ot.trim()||DEFAULT_ACCOUNT_LABEL}),_(),rt({description:`New account created! Successfully derived account from ${a}`})},{title:"Failed to derive new account"});return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),$?jsxRuntimeExports.jsx(EnterPassword,{isLoading:et,onSubmit:ot=>it({name:$,password:ot})}):jsxRuntimeExports.jsx(NameAccountDisplay,{onSubmit:ot=>j(ot.accountName),subtitle:`Name the new account derived from ${a}`})]})},getAccountGroupLabel=_=>{switch(_.type){case"mnemonic":return`Seedphrase ${_.seedFingerPrint}`;case"social":return"Social Accounts";case"ledger":return"Ledger Accounts";case"secret_key":return"Secret Key Accounts";case"multisig":return"Multisig Accounts"}},AccountGroup=({groupLabel:_,accounts:a,balances:$})=>{const j=a[0],et=j.type==="multisig",tt=j.type==="mnemonic",{openWith:rt,onClose:nt}=reactExports.useContext(DynamicModalContext),it=useRemoveMnemonic(),ot=useRemoveNonMnemonic(),st=useImplicitAccounts().length===a.length,ct="Remove All Accounts";let ut,ht="Remove All";const Et=getAccountGroupLabel(j);st?(ut="Removing all your accounts will off-board you from Umami. This will remove or reset all customized settings to their defaults. Personal data (including saved contacts, password and accounts) won't be affected.",ht="Remove & Off-board"):tt?ut=`Are you sure you want to remove all accounts derived from ${Et}?`:ut=`Are you sure you want to remove all of your ${Et}?`;const St=()=>rt(jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:ht,description:ut,onSubmit:()=>{tt?it(j.seedFingerPrint):et||ot(j.type),nt()},title:ct})),Mt=()=>{if(!tt)throw new Error("Can't derive a non mnemonic account!");return rt(jsxRuntimeExports.jsx(DeriveMnemonicAccountModal,{fingerPrint:j.seedFingerPrint,onDone:nt}))};return jsxRuntimeExports.jsxs(Box,{"data-testid":`account-group-${_}`,children:[jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",marginTop:"24px",marginBottom:"16px",children:[jsxRuntimeExports.jsx(Heading,{"data-testid":"account-group-title",size:"md",children:_}),!et&&jsxRuntimeExports.jsx(AccountGroupPopover,{onCreate:tt?Mt:void 0,onRemove:St})]}),a.map(kt=>jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(AccountTile,{account:kt,balance:$[kt.address.pkh]})},kt.address.pkh))]})},NestedScroll=_=>jsxRuntimeExports.jsx(Box,{overflowY:"auto",height:"100%",children:_.children});var indicator$1=function _(a){a=Math.abs(a);var $=a%100;if($>=10&&$<=20)return"th";var j=a%10;return j===1?"st":j===2?"nd":j===3?"rd":"th"},indicator=indicator$1;function ordinal(_){if(typeof _!="number")throw new TypeError("Expected Number, got "+typeof _+" "+_);return Number.isFinite(_)?_+indicator(_):_}ordinal.indicator=indicator;var ordinal_1=ordinal;const ordinal$1=getDefaultExportFromCjs$1(ordinal_1),SignTransactionFormPage=_=>{const a=useAppDispatch(),{isLoading:$,handleAsyncAction:j}=useAsyncActionHandler(),{mode:et,operations:tt,data:{threshold:rt,signers:nt,name:it}}=_,{fee:ot,operations:st,estimationFailed:ct,isLoading:ut,form:ht,reEstimate:Et,signer:St,onSign:Mt}=useSignPageHelpers(tt,et),kt=$||ut,Ct=Ot=>j(async()=>{const zt=await Mt(Ot);if(!zt)throw new Error("An error occurred during contract origination");const Ut=(await zt.getOriginatedContractAddresses())[0];a(multisigActions.addMultisigLabel({pkh:Ut,label:it}))});return jsxRuntimeExports.jsx(FormProvider,{...ht,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,description:"Please review the details and then continue to submit contract.",operationsType:st.type,signer:St,title:"Review & Submit"}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Text,{marginBottom:"24px",padding:"14px",color:colors.gray[50],background:colors.gray[800],borderRadius:"6px","data-testid":"contract-name",children:it}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{}),jsxRuntimeExports.jsx(FormLabel,{children:"Approvers"}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column",gap:"12px",marginBottom:"12px","data-testid":"approvers",children:nt.map(Ot=>jsxRuntimeExports.jsx(AddressTile,{address:parsePkh(Ot.val),"data-testid":`approver-${Ot.val}`},Ot.val))}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(Threshold,{signersAmount:nt.length,threshold:rt})}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(FormControl,{marginTop:"24px",marginBottom:"12px",children:jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!1,inputName:"signer",isLoading:kt,keepValid:!0,label:"Creation Fee Payer",onUpdate:Et})}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(SignPageFee,{fee:ot})})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:ct,isLoading:kt,onSubmit:Ct,signer:St,text:"Submit Contract"})})]})})})},Threshold=({threshold:_,signersAmount:a})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center","data-testid":"threshold",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"No. of approvals:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:`${_} out of ${a}`})]}),contract=[{prim:"storage",args:[{prim:"pair",args:[{prim:"address",annots:["%owner"]},{prim:"pair",args:[{prim:"set",args:[{prim:"address"}],annots:["%signers"]},{prim:"pair",args:[{prim:"nat",annots:["%threshold"]},{prim:"pair",args:[{prim:"nat",annots:["%last_op_id"]},{prim:"pair",args:[{prim:"big_map",args:[{prim:"nat"},{prim:"pair",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"list",args:[{prim:"operation"}]}],annots:["%actions"]},{prim:"set",args:[{prim:"address"}],annots:["%approvals"]}]}],annots:["%pending_ops"]},{prim:"big_map",args:[{prim:"string"},{prim:"bytes"}],annots:["%metadata"]}]}]}]}]}]}]},{prim:"parameter",args:[{prim:"or",args:[{prim:"or",args:[{prim:"or",args:[{prim:"bytes",annots:["%set_metadata_uri"]},{prim:"unit",annots:["%default"]}]},{prim:"or",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"list",args:[{prim:"operation"}]}],annots:["%propose"]},{prim:"nat",annots:["%approve"]}]}]},{prim:"nat",annots:["%execute"]}]}]},{prim:"code",args:[[{prim:"NIL",args:[{prim:"operation"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"UNPAIR"},{prim:"DIP",args:[{int:"1"},[{prim:"UNPAIR",args:[{int:"6"}]}]]},{prim:"IF_LEFT",args:[[{prim:"IF_LEFT",args:[[{prim:"IF_LEFT",args:[[{prim:"DUP",args:[{int:"2"}]},{prim:"SENDER"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"INVALID_CALLER"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"7"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"SOME"},{prim:"PUSH",args:[{prim:"string"},{string:""}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}],[{prim:"DROP",args:[{int:"1"}]},{prim:"DUP",args:[{int:"3"}]},{prim:"DUP",args:[{int:"3"}]},{prim:"SIZE"},{prim:"COMPARE"},{prim:"GE"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"FUNDING BLOCKED SINCE PARAMS ARE INVALID"}]},{prim:"FAILWITH"}],[]]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}]]}],[{prim:"IF_LEFT",args:[[{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"AMOUNT"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"TO FUND CONTRACT, PLEASE USE THE DEFAULT ENTRYPOINT"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"3"}]},{prim:"SENDER"},{prim:"MEM"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ONLY FOR SIGNERS"}]},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"nat"},{int:"1"}]},{prim:"DUP",args:[{int:"6"}]},{prim:"ADD"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"4"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"4"}]},{prim:"DUP",args:[{int:"6"}]},{prim:"DUP",args:[{int:"6"}]},{prim:"MEM"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"KEY_EXISTS"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[{prim:"DUP",args:[{int:"6"}]},{prim:"EMPTY_SET",args:[{prim:"address"}]},{prim:"PUSH",args:[{prim:"bool"},{prim:"True"}]},{prim:"SENDER"},{prim:"UPDATE"},{prim:"DUP",args:[{int:"3"}]},{prim:"PAIR"},{prim:"SOME"},{prim:"DUP",args:[{int:"7"}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"5"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"5"}]}]]},{prim:"DROP",args:[{int:"1"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}],[{prim:"DUP",args:[{int:"6"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"INVALID OP ID"}]},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"AMOUNT"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"TO FUND CONTRACT, PLEASE USE THE DEFAULT ENTRYPOINT"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"4"}]},{prim:"SENDER"},{prim:"MEM"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ONLY FOR SIGNERS"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP"},{prim:"CDR"},{prim:"SENDER"},{prim:"MEM"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ALREADY APPROVED"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"7"}]},{prim:"DUP",args:[{int:"8"}]},{prim:"DUP",args:[{int:"4"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"ASSET_NOT_FOUND"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[]]},{prim:"UNPAIR"},{prim:"SWAP"},{prim:"DROP",args:[{int:"1"}]},{prim:"DUP",args:[{int:"9"}]},{prim:"DUP",args:[{int:"5"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"ASSET_NOT_FOUND"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[]]},{prim:"CDR"},{prim:"PUSH",args:[{prim:"bool"},{prim:"True"}]},{prim:"SENDER"},{prim:"UPDATE"},{prim:"SWAP"},{prim:"PAIR"},{prim:"SOME"},{prim:"DUP",args:[{int:"4"}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"2"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}]]}]]}],[{prim:"DUP",args:[{int:"6"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"INVALID OP ID"}]},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"AMOUNT"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"TO FUND CONTRACT, PLEASE USE THE DEFAULT ENTRYPOINT"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"4"}]},{prim:"SENDER"},{prim:"MEM"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ONLY FOR SIGNERS"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"5"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"CDR"},{prim:"SIZE"},{prim:"COMPARE"},{prim:"GE"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"NOT YET APPROVED"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"7"}]},{prim:"DUP",args:[{int:"3"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"ASSET_NOT_FOUND"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[]]},{prim:"CAR"},{prim:"PUSH",args:[{prim:"unit"},{prim:"Unit"}]},{prim:"EXEC"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"8"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"8"}]},{prim:"DUP",args:[{int:"7"}]},{prim:"NONE",args:[{prim:"pair",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"list",args:[{prim:"operation"}]}]},{prim:"set",args:[{prim:"address"}]}]}]},{prim:"DUP",args:[{int:"4"}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"2"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}]]}]]}],makeStorageJSON=(_,a,$)=>({owner:_,signers:a,threshold:$,last_op_id:"0",pending_ops:[],metadata:[]}),toOperation$4=_=>({type:"contract_origination",sender:parsePkh(_.sender),code:contract,storage:makeStorageJSON(_.sender,_.signers.map(a=>a.val),String(_.threshold))}),SelectApproversFormPage=_=>{const{goBack:a,sender:$,...j}=_,et=useForm({mode:"onBlur",defaultValues:{sender:$.address.pkh,signers:[{val:""}],threshold:1,...formDefaultValues(j)}}),{formState:{errors:tt,isValid:rt},control:nt,register:it,handleSubmit:ot,getValues:st,watch:ct}=et,ut=useFieldArray({control:nt,name:"signers",rules:{minLength:1}}),ht=ct("signers").length,Et=useOpenSignPageFormAction({SignPage:SignTransactionFormPage,signPageExtraData:ct(),FormPage:SelectApproversFormPage,defaultFormPageProps:_,toOperation:toOperation$4}),{onFormSubmitActionHandlers:[St],isLoading:Mt}=useHandleOnSubmitFormActions([Et]);return jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalBackButton,{onClick:a}),jsxRuntimeExports.jsxs("form",{onSubmit:ot(St),children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Select the participants of the contract and choose the minimum number of approvals.",title:"Select Approvers"}),jsxRuntimeExports.jsxs(ModalBody,{children:[ut.fields.map((kt,Ct)=>{var jt;const Ot=tt.signers&&tt.signers[Ct],zt=`${Ct===0?"Select ":""}${ordinal$1(Ct+1)} approver`,Ut=ht>1?"short":"default",Vt=Ut==="short"?"368px":"100%";return jsxRuntimeExports.jsxs(FormControl,{display:"inline-block",width:Vt,marginBottom:"8px","data-testid":`signer-input-${Ct}`,isInvalid:!!Ot,children:[jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!0,inputName:`signers.${Ct}.val`,label:zt,size:Ut,style:{width:Vt},validate:$t=>{if(!isValidImplicitPkh($t))return"Signer must be valid TZ address";const Bt=st("signers").map(Nt=>Nt.val);if(Bt.length>new Set(Bt).size)return"Duplicate approver"}}),ht>1&&jsxRuntimeExports.jsx(IconButton,{position:"absolute",height:"24px",marginTop:"-36px",marginLeft:"374px",background:colors.gray[500],"aria-label":"Remove","data-testid":`remove-signer-${Ct}`,icon:jsxRuntimeExports.jsx(TrashIcon,{width:"12px",height:"14px",stroke:colors.gray[300]}),isRound:!0,onClick:()=>ut.remove(Ct),size:"xs",variant:"tertiary"}),Ot&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":`signer-${Ct}-error`,children:(jt=Ot.val)==null?void 0:jt.message})]},kt.id)}),jsxRuntimeExports.jsx(Button,{paddingLeft:0,onClick:()=>ut.append({val:""}),variant:"specialCTA",children:"+ Add Approver"}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!tt.threshold,children:[jsxRuntimeExports.jsxs(FormLabel,{display:"inline",children:["Min No. of approvals:",jsxRuntimeExports.jsx(InputGroup,{display:"inline",marginLeft:"10px",children:jsxRuntimeExports.jsx(Input,{width:"60px",color:"white","data-testid":"threshold-input",step:1,type:"number",...it("threshold",{valueAsNumber:!0,required:"No. of approvals is required",max:{value:ht,message:`Max no. of approvals is ${ht}`},min:{value:1,message:"Min no. of approvals is 1"}})})})]}),jsxRuntimeExports.jsxs(Text,{display:"inline","data-testid":"max-signers",children:["out of ",ht]}),tt.threshold&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"threshold-error",children:tt.threshold.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!rt,isLoading:Mt,size:"lg",type:"submit",children:"Review"})})]})]})})},NameMultisigFormPage=({name:_})=>{const a=useForm({mode:"onBlur",defaultValues:{name:_||""}}),{formState:{errors:$,isValid:j},register:et,handleSubmit:tt}=a,rt=useImplicitAccounts(),nt=useGetMostFundedImplicitAccount(),{openWith:it}=reactExports.useContext(DynamicModalContext),ot=({name:ct})=>it(jsxRuntimeExports.jsx(SelectApproversFormPage,{form:{name:ct.trim()},goBack:()=>it(jsxRuntimeExports.jsx(NameMultisigFormPage,{name:ct})),sender:nt(rt)})),st=useValidateName();return jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:tt(ot),children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Name your account. The account name will only appear in your local Umami app.",title:"Account Name"}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!$.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Account Name"}),jsxRuntimeExports.jsx(InputGroup,{children:jsxRuntimeExports.jsx(Input,{"data-testid":"multisig-account-name",type:"text",...et("name",{validate:st}),placeholder:"Account Name"})}),$.name&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"name-error",children:$.name.message})]})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!j,size:"lg",type:"submit",children:"Continue"})})]})})})},AccountsList=()=>{const _=useAllAccounts(),a=useAppSelector(tt=>tt.assets.balances.mutez),$=lodashExports.groupBy(_,getAccountGroupLabel),{openWith:j}=reactExports.useContext(DynamicModalContext),et=Object.entries($).map(([tt,rt])=>jsxRuntimeExports.jsx(AccountGroup,{accounts:rt,balances:a,groupLabel:tt},tt));return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Box,{height:"100%",marginRight:0,children:jsxRuntimeExports.jsxs(NestedScroll,{children:[lodashExports.compact(et),jsxRuntimeExports.jsx(Button,{width:"100%",height:"90px",background:colors.black,border:"1px dashed",borderColor:colors.gray[500],onClick:()=>j(jsxRuntimeExports.jsx(NameMultisigFormPage,{})),variant:"outline",children:jsxRuntimeExports.jsxs(Text,{display:"block",width:"100%",margin:"20px",color:colors.gray[400],textAlign:"center",children:[jsxRuntimeExports.jsx(KeyIcon,{marginRight:"4px"}),"Create New Multisig"]})})]})})})},useGetDelegationPrettyDisplayValues=()=>{const _=useGetAccountBalance();return a=>{const $=_(a.sender),j=new Date,et=prettyTezAmount(a.amount),tt=$&&prettyTezAmount($),rt=`Since ${formatRelative(new Date(a.timestamp),j)}`;return{initialBalance:et,currentBalance:tt,duration:rt}}},SignPage$4=_=>{const{mode:a,operations:$}=_,{fee:j,operations:et,estimationFailed:tt,isLoading:rt,form:nt,signer:it,reEstimate:ot,onSign:st}=useSignPageHelpers($,a),ct=et.operations[0].recipient;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:et.type,signer:et.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:it.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(SignPageFee,{fee:j})})}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ct}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:rt,operationType:et.type,reEstimate:ot,sender:et.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:tt,isLoading:rt,onSubmit:st,signer:it,text:headerText(et.type,a)})})]})})})},FormPage$3=_=>{var ct;const a=(ct=_.form)==null?void 0:ct.baker,$=useOpenSignPageFormAction({SignPage:SignPage$4,signPageExtraData:void 0,FormPage:FormPage$3,defaultFormPageProps:_,toOperation:toOperation$3}),j=useAddToBatchFormAction(toOperation$3),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(_)}),{formState:{isValid:it,errors:ot},handleSubmit:st}=nt;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{"data-testid":"delegate-form",children:[jsxRuntimeExports.jsxs(HeaderWrapper,{children:[jsxRuntimeExports.jsx(Text,{fontWeight:"600",size:"2xl",children:a?"Change Baker":"Delegate"}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!!_.sender,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px","data-testid":"baker",isInvalid:!!ot.baker,children:[jsxRuntimeExports.jsx(BakersAutocomplete,{allowUnknown:!0,inputName:"baker",label:"Baker"}),ot.baker&&jsxRuntimeExports.jsx(FormErrorMessage,{children:ot.baker.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:st(tt),onSingleSubmit:st(et)})})]})})})},toOperation$3=_=>({type:"delegation",sender:parsePkh(_.sender),recipient:parseImplicitPkh(_.baker)}),SignPage$3=_=>{const{mode:a,operations:$}=_,{fee:j,operations:et,estimationFailed:tt,isLoading:rt,form:nt,signer:it,reEstimate:ot,onSign:st}=useSignPageHelpers($,a);return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:et.type,signer:et.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:it.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",paddingX:"4px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:j})}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:rt,operationType:et.type,reEstimate:ot,sender:et.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:tt,isLoading:rt,onSubmit:st,signer:it,text:headerText(et.type,a)})})]})})})},FormPage$2=_=>{var st;const{sender:a}=_,$=(st=_.form)==null?void 0:st.baker,j=useOpenSignPageFormAction({SignPage:SignPage$3,signPageExtraData:void 0,FormPage:FormPage$2,defaultFormPageProps:{sender:a},toOperation:toOperation$2}),et=useAddToBatchFormAction(toOperation$2),{onFormSubmitActionHandlers:[tt,rt],isLoading:nt}=useHandleOnSubmitFormActions([j,et]),it=useForm({mode:"onBlur",defaultValues:formDefaultValues({sender:a})}),{handleSubmit:ot}=it;return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{"data-testid":"undelegate-form",children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Select preview to end delegation or insert this transaction into a Batch.",title:"End Delegation"}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormControl,{children:jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"Baker"}),$&&jsxRuntimeExports.jsx(AddressTile,{address:parsePkh($)})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:nt,isValid:!0,onAddToBatch:ot(rt),onSingleSubmit:ot(tt)})})]})})})},toOperation$2=_=>({type:"undelegation",sender:parsePkh(_.sender)}),Row=({label:_,value:a,...$})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"50px",padding:"16px","data-testid":_,...$,children:[jsxRuntimeExports.jsx(Box,{flex:1,children:jsxRuntimeExports.jsx(Heading,{color:colors.gray[400],size:"sm",children:_})}),jsxRuntimeExports.jsx(Box,{flex:1,children:typeof a=="string"?jsxRuntimeExports.jsx(Text,{size:"sm",children:a}):a})]}),DelegationDisplay=({delegation:_,account:a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext),j=useGetOwnedAccount(),et=useGetDelegationPrettyDisplayValues();if(!_)return jsxRuntimeExports.jsx(NoDelegations,{onDelegate:()=>$(jsxRuntimeExports.jsx(FormPage$3,{sender:a})),size:"md"});const{currentBalance:tt,duration:rt,initialBalance:nt}=et(_),{sender:it,delegate:{address:ot}}=_,st=j(it);return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Row,{borderBottom:`1px solid ${colors.gray[700]}`,borderTopRadius:"8px",_odd:{bg:colors.gray[800]},label:"Initial Balance:",value:nt}),tt&&jsxRuntimeExports.jsx(Row,{_odd:{bg:colors.gray[800]},label:"Current Balance:",value:tt}),jsxRuntimeExports.jsx(Row,{borderBottom:`1px solid ${colors.gray[700]}`,_odd:{bg:colors.gray[800]},label:"Duration:",value:rt}),jsxRuntimeExports.jsx(Row,{borderBottomRadius:"8px",_odd:{bg:colors.gray[800]},label:"Baker:",value:jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.delegate.address)})}),jsxRuntimeExports.jsxs(Flex,{marginTop:"24px",children:[jsxRuntimeExports.jsx(Button,{flex:1,marginRight:"16px",onClick:()=>$(jsxRuntimeExports.jsx(FormPage$2,{form:{sender:it,baker:ot},sender:st})),variant:"warning",children:"End Delegation"}),jsxRuntimeExports.jsx(Button,{flex:1,onClick:()=>$(jsxRuntimeExports.jsx(FormPage$3,{form:{sender:it,baker:ot},sender:st})),variant:"tertiary",children:"Change Baker"})]})]})},MultisigDecodedOperation=({operation:_})=>{switch(_.type){case"delegation":return jsxRuntimeExports.jsxs(Box,{"data-testid":"decoded-item-delegate",marginY:6,children:[jsxRuntimeExports.jsx(Text,{marginRight:"3px",color:colors.gray[450],fontSize:"14px",children:"Delegate to:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.recipient})]});case"undelegation":return jsxRuntimeExports.jsx(Box,{"data-testid":"decoded-item-undelegate",marginY:6,children:jsxRuntimeExports.jsx(Text,{color:colors.gray[450],fontSize:"14px",children:"End Delegation"})});case"tez":case"fa1.2":case"fa2":return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(MultisigOperationAmount,{operation:_}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"8px",children:[jsxRuntimeExports.jsx(Text,{marginRight:"3px",color:colors.gray[450],fontSize:"14px",children:"Send to:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.recipient})]})]});case"contract_origination":case"contract_call":throw new Error(`${_.type} is not supported yet`)}},MultisigOperationAmount=({operation:_})=>{const a=useGetToken();switch(_.type){case"tez":return jsxRuntimeExports.jsxs(Flex,{alignItems:"center","data-testid":"decoded-tez-amount",children:[jsxRuntimeExports.jsx(OutgoingArrow,{}),jsxRuntimeExports.jsxs(Text,{marginLeft:"8px",color:colors.orange,fontSize:"14px",fontWeight:600,textAlign:"center",children:["-",prettyTezAmount(_.amount)]})]});case"fa1.2":case"fa2":{const $=a(_.contract.pkh,_.tokenId);if(!$)return null;const j=tokenNameSafe($),et=$.type==="nft";return jsxRuntimeExports.jsxs(Flex,{alignItems:"center","data-testid":"decoded-fa-amount",children:[jsxRuntimeExports.jsx(OutgoingArrow,{}),jsxRuntimeExports.jsx(Box,{marginLeft:"8px",color:colors.orange,textAlign:"center",children:et?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{display:"inline",marginRight:"3px",fontSize:"14px",fontWeight:600,children:_.amount}),jsxRuntimeExports.jsx(Text,{display:"inline",color:"white",fontSize:"14px",fontWeight:600,children:j})]}):jsxRuntimeExports.jsxs(Text,{fontSize:"14px",fontWeight:600,children:["-",tokenPrettyAmount(_.amount,$,{showSymbol:!0})]})})]})}case"delegation":case"undelegation":case"contract_origination":case"contract_call":return null}},caseInsensitiveLiteral=_=>z.string().regex(new RegExp(`^${_}$`,"i")),prim=_=>z.object({prim:caseInsensitiveLiteral(_)}),pushKeyHashSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("key_hash")}),z.object({bytes:z.string()})])}),pushAddressSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("address")}),z.object({bytes:z.string()})])}),pair=(_,a)=>z.object({prim:z.literal("Pair"),args:z.tuple([_,a])}),contractZeroTezSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("mutez")}),z.object({int:z.literal("0")})])}),lambdaEndSchema=[prim("TRANSFER_TOKENS"),prim("CONS")],contractHeadSchema=z.object({prim:z.literal("CONTRACT")}),batchHeadSchema=z.tuple([z.object({prim:z.literal("DROP")}),z.object({prim:z.literal("NIL"),args:z.array(z.object({prim:z.literal("operation")}))})]),pushMutezSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("mutez")}),z.object({int:z.string()})])}),tezSchema=z.tuple([pushKeyHashSchema,prim("IMPLICIT_ACCOUNT"),pushMutezSchema,prim("UNIT"),...lambdaEndSchema]),contractTezSchema=z.tuple([pushAddressSchema,contractHeadSchema,prim("IF_NONE"),pushMutezSchema,prim("UNIT"),...lambdaEndSchema]),setDelegateSchema=z.tuple([pushKeyHashSchema,prim("SOME"),prim("SET_DELEGATE"),prim("CONS")]),removeDelegateSchema=z.tuple([z.object({prim:z.literal("NONE"),args:z.tuple([z.object({prim:z.literal("key_hash")})])}),prim("SET_DELEGATE"),prim("CONS")]),fa2Schema=z.tuple([pushAddressSchema,contractHeadSchema,z.tuple([prim("IF_NONE")]),contractZeroTezSchema,z.object({prim:z.literal("PUSH"),args:z.tuple([prim("list"),z.array(pair(z.object({bytes:z.string({description:"from"})}),z.array(pair(z.object({bytes:z.string({description:"to"})}),pair(z.object({int:z.string({description:"token_id"})}),z.object({int:z.string({description:"amount"})}))))))])}),...lambdaEndSchema]),fa1Schema=z.tuple([pushAddressSchema,contractHeadSchema,z.tuple([prim("IF_NONE")]),contractZeroTezSchema,z.object({prim:z.literal("PUSH"),args:z.tuple([prim("Pair"),pair(z.object({bytes:z.string({description:"from"})}),pair(z.object({bytes:z.string({description:"to"})}),z.object({int:z.string({description:"amount"})})))])}),...lambdaEndSchema]);class UnrecognizedMichelsonError extends Error{}const convertToPkh=_=>(_.length===42&&(_="00"+_),encodeAddress(_)),parseTez=_=>{const a=tezSchema.parse(_),$=a[0].args[1].bytes,j=a[2].args[1].int;return{type:"tez",recipient:parseImplicitPkh(convertToPkh($)),amount:j}},parseTezContract=_=>{const a=contractTezSchema.parse(_),$=a[0].args[1].bytes,j=a[3].args[1].int;return{type:"tez",recipient:parseContractPkh(convertToPkh($)),amount:j}},parseFa2=_=>{const a=fa2Schema.parse(_),$=parseContractPkh(convertToPkh(a[0].args[1].bytes));return a[4].args[1].flatMap(et=>{const tt=et.args[0].bytes;return et.args[1].map(rt=>{const nt=rt.args[0].bytes,it=rt.args[1].args[0].int,ot=rt.args[1].args[1].int;return{type:"fa2",contract:$,sender:parsePkh(convertToPkh(tt)),recipient:parsePkh(convertToPkh(nt)),tokenId:it,amount:ot}})})},parseFa1=_=>{const a=fa1Schema.parse(_),$=a[0],j=a[4].args[1],et=j.args[0].bytes,tt=j.args[1].args[0].bytes;return{type:"fa1.2",amount:j.args[1].args[1].int,contract:parseContractPkh(convertToPkh($.args[1].bytes)),recipient:parsePkh(convertToPkh(tt)),sender:parsePkh(convertToPkh(et)),tokenId:"0"}},parseSetDelegate=(_,a)=>{const $=setDelegateSchema.parse(_);return{type:"delegation",sender:a.address,recipient:parseImplicitPkh(convertToPkh($[0].args[1].bytes))}},parseRemoveDelegate=(_,a)=>({type:"undelegation",sender:a.address}),parsings=[{schema:tezSchema,parsingFn:parseTez},{schema:contractTezSchema,parsingFn:parseTezContract},{schema:fa2Schema,parsingFn:parseFa2},{schema:fa1Schema,parsingFn:parseFa1},{schema:setDelegateSchema,parsingFn:parseSetDelegate},{schema:removeDelegateSchema,parsingFn:parseRemoveDelegate}],parse=(_,a,$=[])=>{if(_.length===0)return $;for(let j=0;j{batchHeadSchema.parse(_.slice(0,2))},decode=(_,a)=>(assertHead(_),parse(_.slice(2),a)),parseRawMichelson=(_,a)=>{const $=JSON.parse(_);return decode($,a)},MultisigDecodedOperations=({rawMichelson:_,sender:a})=>{try{const $=parseRawMichelson(_,a);return jsxRuntimeExports.jsx(Box,{borderRadius:"8px",backgroundColor:colors.gray[900],children:$.map((j,et)=>jsxRuntimeExports.jsxs(Box,{width:"100%",paddingTop:"10px",paddingBottom:et<$.length-1?0:"15px",paddingX:"15px",children:[jsxRuntimeExports.jsx(MultisigDecodedOperation,{operation:j}),et<$.length-1&&jsxRuntimeExports.jsx(Divider,{marginTop:"15px"})]},et))})}catch($){return $ instanceof UnrecognizedMichelsonError?jsxRuntimeExports.jsx(UnrecognizedOperation,{rawMichelson:_}):jsxRuntimeExports.jsxs(Box,{height:"50px",padding:"10px",background:colors.gray[900],borderRadius:"8px",children:["Invalid michelson code: ",$.message]})}},UnrecognizedOperation=({rawMichelson:_})=>jsxRuntimeExports.jsx(Accordion,{width:"100%",marginBottom:"8px",background:colors.gray[900],borderColor:colors.gray[900],borderRadius:"8px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",height:"30px",marginTop:"6px",textAlign:"left",size:"md",children:"Unrecognized operation"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{overflowY:"scroll",height:"400px",paddingBottom:"12px",children:jsxRuntimeExports.jsx(JsValueWrap,{space:1,value:JSON.parse(_)})})]})}),MultisigActionButton=({approveOrExecute:_,isLoading:a,signerState:$})=>{switch($){case"awaitingApprovalByExternalSigner":return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",alignSelf:"flex-end","data-testid":"multisig-signer-awaiting-approval",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[300],children:"Awaiting Approval"}),jsxRuntimeExports.jsx(HourglassIcon,{marginTop:"2px"})]});case"approved":return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",alignSelf:"flex-end",marginBottom:"8px","data-testid":"multisig-signer-approved",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[300],children:"Approved"}),jsxRuntimeExports.jsx(CheckmarkIcon,{marginTop:"2px"})]});case"executable":return jsxRuntimeExports.jsx(Button,{"data-testid":"multisig-signer-button",isLoading:a,onClick:_,children:"Execute"});case"approvable":return jsxRuntimeExports.jsx(Button,{"data-testid":"multisig-signer-button",isLoading:a,onClick:_,children:"Approve"})}},SignPage$2=({signer:_,operation:a,actionType:$,transactionCount:j})=>{const{handleAsyncAction:et}=useAsyncActionHandler(),{openWith:tt}=reactExports.useContext(DynamicModalContext),rt=useForm({defaultValues:{executeParams:a.estimates}}),nt=ot=>et(async()=>{const{opHash:st}=await executeOperations({...a,estimates:rt.watch("executeParams")},ot);return tt(jsxRuntimeExports.jsx(SuccessStep,{hash:st}))},{title:`Failed ${$}`}),it=`${lodashExports.capitalize($)} transaction`;return jsxRuntimeExports.jsx(FormProvider,{...rt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(BatchModalBody,{operation:a,title:it,transactionCount:j}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{onSubmit:nt,signer:_,text:it})})]})})})},MultisigSignerTile=({pendingApprovals:_,sender:a,operation:$,signerAddress:j})=>{const et=useAddressKind$1(j),tt=useGetImplicitAccountSafe(),{isLoading:rt,handleAsyncAction:nt}=useAsyncActionHandler(),{openWith:it}=reactExports.useContext(DynamicModalContext),ot=useSelectedNetwork(),st=tt(j.pkh),ct=_===0,ut=()=>nt(async()=>{if(!st)throw new Error("Can't approve or execute with an account you don't own");const Et=ct?"execute":"approve",St=makeAccountOperations(st,st,[makeMultisigApproveOrExecuteOperation(a.address,Et,$.id)]),Mt=await estimate(St,ot);let kt;try{kt=parseRawMichelson($.rawActions,a).length}catch{kt=1}return it(jsxRuntimeExports.jsx(SignPage$2,{actionType:Et,operation:Mt,signer:st,transactionCount:kt}))}),ht=getMultisigSignerState({approvals:$.approvals,signerAddress:j,operationIsExecutable:ct,signerAccount:st});return jsxRuntimeExports.jsx(AccountTileBase,{height:"80px",marginTop:"10px",marginBottom:"0",padding:"15px",borderRadius:"8px",backgroundColor:colors.gray[700],icon:jsxRuntimeExports.jsx(AddressTileIcon,{addressKind:et,size:"lg"}),leftElement:jsxRuntimeExports.jsx(LabelAndAddress,{label:et.label,pkh:et.pkh}),rightElement:jsxRuntimeExports.jsx(MultisigActionButton,{approveOrExecute:ut,"data-testid":"multisig-signer-button",isLoading:rt,signerState:ht})})},getMultisigSignerState=({signerAccount:_,operationIsExecutable:a,approvals:$,signerAddress:j})=>{const et=!!$.find(tt=>tt.pkh===j.pkh);return _?et&&!a?"approved":a?"executable":"approvable":et?"approved":"awaitingApprovalByExternalSigner"},MultisigPendingOperation=({operation:_,sender:a})=>{const{signers:$,threshold:j}=a,et=Math.max(j-_.approvals.length,0);return jsxRuntimeExports.jsxs(Box,{marginBottom:"24px",background:colors.gray[800],border:"none",borderRadius:"8px","data-testid":"multisig-pending-operation-"+_.id,paddingX:"16px",paddingY:"15px",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"6px",padding:0,textAlign:"left",children:[jsxRuntimeExports.jsxs(Heading,{size:"md",children:["Pending #",_.id]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginBottom:"6px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Pending Approvals:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"pending-approvals-count",children:et})]})]}),jsxRuntimeExports.jsxs(Box,{padding:"0",children:[jsxRuntimeExports.jsx(MultisigDecodedOperations,{rawMichelson:_.rawActions,sender:a}),$.map(tt=>jsxRuntimeExports.jsx(MultisigSignerTile,{operation:_,pendingApprovals:et,sender:a,signerAddress:tt},tt.pkh))]})]})},MultisigPendingOperations=({account:_})=>{const $=useGetPendingMultisigOperations()(_);return jsxRuntimeExports.jsx(Box,{margin:"0",padding:"0",children:$.map(j=>jsxRuntimeExports.jsx(MultisigPendingOperation,{operation:j,sender:_},j.id))})},ViewAllLink=({to:_,owner:a,...$})=>jsxRuntimeExports.jsx(Center,{...$,children:jsxRuntimeExports.jsxs(Link$1,{as:Link,color:colors.gray[300],stroke:colors.gray[450],_hover:{color:colors.green,stroke:colors.green},to:`${_}?accounts=${a}`,children:[jsxRuntimeExports.jsx(RefreshClockIcon,{display:"inline",stroke:"inherit"}),jsxRuntimeExports.jsx(Text,{display:"inline",size:"sm",children:" View All"})]})}),MAX_NFTS_SIZE=18,NFTsGrid=({owner:_,nfts:a,...$})=>{if(a.length===0)return jsxRuntimeExports.jsx(NoNFTs,{size:"md"});const j=sortedByLastUpdate(a).slice(0,MAX_NFTS_SIZE);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SimpleGrid,{marginBottom:"35px",spacing:"12px",...$,children:j.map(et=>{const tt=getIPFSurl(thumbnailUri(et)),nt={width:"100%",height:40,fallbackSrc:getIPFSurl(et.displayUri),src:tt};return jsxRuntimeExports.jsx(Link,{"data-testid":"nft-link",to:`/home/${_}/${fullId(et)}`,children:jsxRuntimeExports.jsx(Card,{background:colors.gray[800],border:"1px solid transparent",_hover:{background:colors.gray[700],borderColor:colors.gray[500]},children:jsxRuntimeExports.jsxs(CardBody,{overflow:"hidden",padding:"8px",borderRadius:"6px",children:[jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsxs(Box,{position:"relative",width:"100%",height:"100%",children:[jsxRuntimeExports.jsx(AspectRatio,{zIndex:2,width:"100%",opacity:"0",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{...nt,width:"100%",height:40})}),jsxRuntimeExports.jsx(AspectRatio,{position:"absolute",zIndex:0,top:"0",width:"100%",filter:"blur(20px)",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{...nt,width:"100%",height:40})}),jsxRuntimeExports.jsx(AspectRatio,{position:"absolute",zIndex:1,top:"0",width:"100%",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{...nt,width:"100%",height:40})})]})}),Number(et.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"20px",marginTop:"-24px",marginLeft:"4px",padding:"0 8px",borderRadius:"100px",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",size:"xs",children:"x"+et.balance})]})})},`${_}:${fullId(et)}`)})}),a.length>MAX_NFTS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{marginBottom:"40px",owner:_,to:"/nfts"})]})},OperationTileContext=React$2.createContext({mode:"page"}),FEE_FIELDS=["bakerFee","storageFee","allocationFee"],Fee=({operation:_})=>{const a=reactExports.useContext(OperationTileContext),j=useIsOwnedAddress()(_.sender.address);if(a.mode==="drawer"||!j)return null;const et=FEE_FIELDS.reduce((tt,rt)=>rt in _?tt.plus(lodashExports.get(_,rt)||0):tt,BigNumber(0));return et.eq(0)?null:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"md",children:"Fee:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"fee",children:prettyTezAmount(et)})]})},useGetOperationDestination=(_,a)=>{const $=useIsOwnedAddress(),j=$(_),et=$(a);return!j&&!et?"unrelated":j?"outgoing":"incoming"},operationSign=_=>{switch(_){case"incoming":return"+";case"outgoing":return"-";case"unrelated":return""}},operationColor=_=>{switch(_){case"incoming":return colors.green;case"outgoing":return colors.orange;case"unrelated":return"white"}},InternalPrefix=({operation:_})=>{var et,tt,rt;let a,$;switch(_.type){case"transaction":a=(et=_.target)==null?void 0:et.address,$=_.sender.address;break;case"origination":case"delegation":a=null,$=_.sender.address;break;case"token_transfer":a=(tt=_.to)==null?void 0:tt.address,$=(rt=_.from)==null?void 0:rt.address;break}return useGetOperationDestination($,a)!=="unrelated"?null:jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],"data-testid":"internal-prefix",size:"md",children:"Internal:"})},OperationStatus=({level:_,status:a})=>{const $=useIsBlockFinalised(_);return a===void 0||a==="applied"?$?jsxRuntimeExports.jsx(CheckmarkIcon,{"data-testid":"checkmark"}):jsxRuntimeExports.jsx(HourglassIcon,{"data-testid":"hourglass"}):jsxRuntimeExports.jsx(CrossedCircleIcon,{"data-testid":"crossed-circle"})},OperationTypeWrapper=({children:_})=>reactExports.useContext(OperationTileContext).mode==="drawer"?null:jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[300],"data-testid":"operation-type",size:"sm",children:_}),Timestamp=({timestamp:_})=>_?jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"timestamp",size:"sm",children:getDisplayTimestamp(_)}):null,getDisplayTimestamp=_=>{const a=new Date,$=new Date(_);return differenceInDays(a,$)<2?formatDistance($,a,{addSuffix:!0}):format($,"dd MMM yyyy")},TzktLink$1=({hash:_,counter:a,transactionId:$,originationId:j,migrationId:et,children:tt,...rt})=>{const{tzktExplorerUrl:nt}=useSelectedNetwork();let it=nt;return _?it=lodashExports.compact([nt,_,a]).join("/"):et?it=`${it}/migrations/${et}`:j?it=`${it}/originations/${j}`:$?it=`${it}/transactions/${$}`:console.warn("No id provided to TzktLink"),jsxRuntimeExports.jsx(Link$1,{"data-testid":"tzkt-link",href:it,isExternal:!0,...rt,children:tt})},ContractCallTile=({operation:_})=>{var a;return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-contract-call",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(ContractIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsxs(Heading,{size:"md",children:["Contract Call: ",(a=_.parameter)==null?void 0:a.entrypoint]})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[_.target&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.target})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.sender})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Contract Call"}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},DelegationTile=({operation:_})=>{const a=_.newDelegate?"Delegate":"Delegation Ended";return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-delegation",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(BakerIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsx(Heading,{size:"md",children:a})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[_.newDelegate&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.newDelegate})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.sender})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:a}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},OriginationTile=({operation:_})=>{var j;const $=((j=_.originatedContract)==null?void 0:j.codeHash)===CODE_HASH&&_.originatedContract.typeHash===TYPE_HASH?"Multisig Account Created":"Contract Origination";return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-origination",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(ContractIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsx(Heading,{size:"md",children:$})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.sender})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Contract Origination"}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},TransactionDirectionIcon=({destination:_,...a})=>_==="outgoing"?jsxRuntimeExports.jsx(OutgoingArrow,{"data-testid":"outgoing-arrow",...a}):_==="incoming"?jsxRuntimeExports.jsx(IncomingArrow,{"data-testid":"incoming-arrow",...a}):jsxRuntimeExports.jsx(ContractIcon,{"data-testid":"unrelated-operation-icon",...a}),TokenTransferTile=({operation:_,tokenTransfer:a,token:$})=>{var ct,ut;const j=a.amount,et=useGetOperationDestination((ct=a.from)==null?void 0:ct.address,(ut=a.to)==null?void 0:ut.address),tt=$.type==="nft",rt=tokenPrettyAmount(j,$,{showSymbol:!0}),nt=operationColor(et),it=tt?"white":nt,ot=operationSign(et),st=tt?jsxRuntimeExports.jsx(Tooltip,{padding:"8px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px","data-testid":"nft-tooltip",label:jsxRuntimeExports.jsx(AspectRatio,{width:"170px",height:"170px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{src:getIPFSurl(thumbnailUri($))})}),openDelay:300,children:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(InternalPrefix,{operation:_||a}),jsxRuntimeExports.jsxs(TzktLink$1,{marginRight:"8px",color:it,"data-testid":"title",migrationId:a.migrationId,originationId:a.originationId,transactionId:a.transactionId,children:[jsxRuntimeExports.jsxs(Text,{display:"inline",color:nt,fontWeight:"600",children:[ot,rt]}),jsxRuntimeExports.jsxs(Text,{display:"inline",fontWeight:"600",children:[" ",tokenNameSafe($)]})]})]})}):jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(InternalPrefix,{operation:_||a}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",color:it,"data-testid":"title",migrationId:a.migrationId,originationId:a.originationId,transactionId:a.transactionId,children:jsxRuntimeExports.jsxs(Text,{display:"inline",color:nt,fontWeight:"600",children:[ot,rt]})})]});return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-token-transfer",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(TransactionDirectionIcon,{marginRight:"8px",destination:et}),st,_&&jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:a.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[a.to&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:a.to})]}),a.from&&jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:a.from})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Token Transfer"}),jsxRuntimeExports.jsx(OperationStatus,{level:a.level})]})]})})]})},TransactionTile=({operation:_})=>{var tt;const a=useGetOperationDestination(_.sender.address,(tt=_.target)==null?void 0:tt.address),$=prettyTezAmount(String(_.amount)),j=operationColor(a),et=operationSign(a);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-transaction",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(TransactionDirectionIcon,{marginRight:"8px",destination:a}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",color:j,counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsxs(Text,{color:j,fontWeight:"600",children:[et," ",$]})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[_.target&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.target.address)})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.sender.address)})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Transaction"}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},OperationTile=({operation:_})=>{const a=useGetTokenTransfer();switch(_.type){case"token_transfer":{const $=fromRaw$1(_.token);return $?jsxRuntimeExports.jsx(TokenTransferTile,{token:$,tokenTransfer:_}):(console.warn(`Could not parse token transfer ${_.id}`),null)}case"transaction":{const $=!!_.parameter,j=a(_.id);if(j){const et=fromRaw$1(j.token);return et?jsxRuntimeExports.jsx(TokenTransferTile,{operation:_,token:et,tokenTransfer:j}):jsxRuntimeExports.jsx(TransactionTile,{operation:_})}else return $?jsxRuntimeExports.jsx(ContractCallTile,{operation:_}):jsxRuntimeExports.jsx(TransactionTile,{operation:_})}case"delegation":return jsxRuntimeExports.jsx(DelegationTile,{operation:_});case"origination":return jsxRuntimeExports.jsx(OriginationTile,{operation:_})}},MAX_OPERATIONS_SIZE=20,OperationListDisplay=({owner:_,operations:a})=>{if(a.length===0)return jsxRuntimeExports.jsx(NoOperations,{size:"md"});const $=a.slice(0,MAX_OPERATIONS_SIZE);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[$.map((j,et)=>jsxRuntimeExports.jsxs(Box,{height:"90px",children:[jsxRuntimeExports.jsx(OperationTile,{operation:j}),et<$.length-1&&jsxRuntimeExports.jsx(Divider,{marginY:"20px"})]},j.id)),a.length>MAX_OPERATIONS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{owner:_,to:"/operations"})]})},verifiedTokens=["KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o","KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn","KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW","KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW","KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW","KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV","KT1Ha4yFVeyzw6KRAdkzq6TxDHB97KG4pZe8","KT1JBNFcB5tiycHNdYGYCtR3kk6JaJysUCi8","KT1Xobej4mc6XgEjDoJoHtTKgbD1ELMvcQuL","KT1JVjgXPMMSaa6FkzeJcgb8q9cUaLmwaJUX","KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb","KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9","KT1914CUZ7EegAFPbfgQMRkw8Uz5mYkEz2ui","KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY","KT19ovJhcsUn4YU8Q5L3BGovKSixfbWcecEA","KT1TgmD7kXQzofpuc9VbTRMdZCS2e6JDuTtc","KT1F1mn2jbqQCJcsNgYKVAQjvenecNMY2oPK","KT1ErKVqEhG9jxXgUG2KGLW3bNM7zXHX8SDF","KT1A5P4ejnLix13jtadsfV9GCnXLMNnab8UT","KT1AM3PV1cwmGRw28DVTgsjjsjHvmL6z4rGh","KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY","KT1SjXiUX63QvdNMcM2m492f7kuf8JxXRLp4","KT1MZg99PxMDEENwB4Fi64xkqAVh5d1rv8Z9","KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY","KT1XTxpQvo7oRCqp85LikEZgAZ22uDxhbWJv","KT1VaEsVNiBoA56eToEK6n6BcPgh1tdx9eXi"],TokenNameWithIcon=({token:_,...a})=>{const $=verifiedTokens.includes(_.contract);return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Text,{...a,marginRight:"4px",children:tokenNameSafe(_)}),$&&jsxRuntimeExports.jsx(VerifiedIcon,{})]})},MAX_TOKENS_SIZE=20,TokenList=({owner:_,tokens:a})=>{if(a.length===0)return jsxRuntimeExports.jsx(NoTokens,{size:"md"});const $=a.slice(0,MAX_TOKENS_SIZE);return jsxRuntimeExports.jsxs(Box,{children:[$.map(j=>jsxRuntimeExports.jsx(TokenTile$1,{token:j},fullId(j))),a.length>MAX_TOKENS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{owner:_,to:"/tokens"})]})},TokenTile$1=({token:_})=>{const a=tokenPrettyAmount(_.balance,_,{showSymbol:!1});return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-around",height:20,borderBottom:`1px solid ${colors.gray[800]}`,"data-testid":"token-tile",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",flex:1,children:[jsxRuntimeExports.jsx(TokenIcon,{width:"38px",background:colors.gray[500],borderRadius:"4px",contract:_.contract}),jsxRuntimeExports.jsx(Box,{marginLeft:"16px",children:jsxRuntimeExports.jsx(TokenNameWithIcon,{fontWeight:600,"data-testid":"token-name",token:_})})]}),jsxRuntimeExports.jsx(Heading,{"data-testid":"token-balance",size:"lg",children:a})]})},buildTzktAddressUrl=(_,a)=>`${_.tzktExplorerUrl}/${a}`,useGetOperations=_=>{const a=useSelectedNetwork(),$=useAppDispatch(),j=useRefetchTrigger(),et=useReactQueryErrorHandler(),{isFetching:tt,data:rt,hasNextPage:nt,isLoading:it,fetchNextPage:ot,fetchPreviousPage:st,error:ct}=useInfiniteQuery({queryFn:({pageParam:ut})=>fetchOperationsAndUpdateTokensInfo($,a,_,ut),queryKey:["operations",_,$,a],initialPageParam:{},retry:3,retryDelay:ut=>ut*2e3,gcTime:0,refetchOnWindowFocus:!1,getNextPageParam:ut=>ut.length===0?null:{lastId:ut[ut.length-1].id},getPreviousPageParam:(ut,ht)=>{var St;const Et=(St=lodashExports.maxBy(ht.flat(),"id"))==null?void 0:St.id;return Et?{lastId:Et,sort:"asc"}:{}},select:({pages:ut})=>filterDuplicatedTokenTransfers([[...ut[0]].sort((ht,Et)=>ht.id{const ut=setInterval(()=>void st(),BLOCK_TIME);return()=>clearInterval(ut)},[st]),reactExports.useEffect(()=>{st()},[j,st]),{operations:rt||[],isFirstLoad:it,isLoading:tt,hasMore:nt,loadMore:ot}},fetchOperationsAndUpdateTokensInfo=async(_,a,$,j)=>{const et=await getCombinedOperations($.map(ot=>ot.address.pkh),a,j),tt=et.filter(ot=>ot.type==="transaction").map(ot=>ot.id),rt=await getRelatedTokenTransfers(tt,a),nt=et.filter(ot=>ot.type==="token_transfer"),it=[...rt,...nt];return _(assetsActions.updateTokenTransfers(it)),_(tokensActions.addTokens({network:a,tokens:it.map(ot=>ot.token)})),et},filterDuplicatedTokenTransfers=_=>{const a=new Set(_.filter($=>$.type!=="token_transfer").map($=>$.id));return _.filter($=>$.type!=="token_transfer"||!a.has($.transactionId))},SmallTab=({children:_,...a})=>jsxRuntimeExports.jsx(Tab,{...a,fontSize:"sm",paddingX:3,children:_}),AssetsPanel=({tokens:_,nfts:a,account:$,delegation:j})=>{const et=useGetPendingMultisigOperations(),tt=$.type==="multisig"&&et($).length>0,rt=useSelectedNetwork(),{operations:nt,isFirstLoad:it}=useGetOperations([$]);return jsxRuntimeExports.jsxs(Tabs,{flexDirection:"column",display:"flex",width:"100%",marginTop:"60px","data-testid":"asset-panel",children:[jsxRuntimeExports.jsxs(TabList,{justifyContent:"space-between","data-testid":"asset-panel-tablist",children:[jsxRuntimeExports.jsxs(Flex,{children:[tt&&jsxRuntimeExports.jsxs(SmallTab,{"data-testid":"account-card-pending-tab",children:[jsxRuntimeExports.jsx(Text,{children:"Pending"}),jsxRuntimeExports.jsx(Box,{width:"6px",height:"6px",marginTop:"-7px",marginRight:"-3px",marginLeft:"3px",borderRadius:"100%",backgroundColor:colors.orangeL})]}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-operations-tab",children:"Operations"}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-delegation-tab",children:"Delegation"}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-nfts-tab",children:"NFTs"}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-tokens-tab",children:"Tokens"})]}),jsxRuntimeExports.jsx(ExternalLink,{href:buildTzktAddressUrl(rt,$.address.pkh),children:jsxRuntimeExports.jsxs(Button,{paddingRight:0,variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{marginRight:"7px",size:"sm",children:"View on Tzkt"}),jsxRuntimeExports.jsx(ExternalLinkIcon,{stroke:"currentcolor"})]})})]}),jsxRuntimeExports.jsxs(TabPanels,{height:"100%",children:[tt&&jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px",paddingBottom:"60px","data-testid":"account-card-pending-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(MultisigPendingOperations,{account:$})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px",paddingBottom:"60px","data-testid":"account-card-operations-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsxs(OperationTileContext.Provider,{value:{mode:"drawer",selectedAddress:$.address},children:[jsxRuntimeExports.jsx(Center,{display:it?"flex":"none",height:"50px",children:jsxRuntimeExports.jsx(Image$1,{width:"150px",height:"75px",src:"./static/media/loading-wheel.gif"})}),!it&&jsxRuntimeExports.jsx(OperationListDisplay,{operations:nt,owner:$.address.pkh})]})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",paddingTop:"24px","data-testid":"account-card-delegation-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(DelegationDisplay,{account:$,delegation:j})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px",paddingBottom:0,"data-testid":"account-card-nfts-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(NFTsGrid,{columns:3,nfts:a,owner:$.address.pkh})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px","data-testid":"account-card-tokens-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(TokenList,{owner:$.address.pkh,tokens:_})})]})]})},MultisigApprovers=({signers:_})=>jsxRuntimeExports.jsx(Box,{width:"100%",marginTop:"40px",marginBottom:"-20px",background:colors.gray[800],borderRadius:"8px",children:jsxRuntimeExports.jsx(Accordion,{padding:"15px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{as:"span",flex:"1",padding:"0",textAlign:"left",cursor:"pointer",children:[jsxRuntimeExports.jsx(Heading,{width:"100%",size:"md",children:"Approvers"}),jsxRuntimeExports.jsx(AccordionIcon,{cursor:"pointer"})]}),jsxRuntimeExports.jsx(AccordionPanel,{padding:"0",children:jsxRuntimeExports.jsx(Wrap,{marginTop:"20px","data-testid":"multisig-tag-section",spacingX:"0",spacingY:"12px",children:_.map(a=>jsxRuntimeExports.jsx(AddressPill,{marginRight:"12px",address:a},a.pkh))})})]})})}),renameAccount=(_,a)=>($,j)=>{const{accounts:et,multisigs:tt,contacts:rt}=j(),nt=_.type==="multisig",it=et.items.map(ct=>ct.label),ot=tt.items.map(ct=>ct.label),st=Object.values(rt).map(ct=>ct.name);[it,ot,st].flat().includes(a)||$(nt?multisigsSlice.actions.setName({newName:a,account:_}):accountsSlice.actions.renameAccount({newName:a,account:_}))},RenameAccountModal=({account:_})=>{const a=useAppDispatch(),{onClose:$}=reactExports.useContext(DynamicModalContext),j=({name:ct})=>{a(renameAccount(_,ct)),$()},{handleSubmit:et,formState:{isValid:tt,errors:rt},register:nt,reset:it}=useForm({mode:"onBlur",defaultValues:{name:_.label}}),ot=({name:ct})=>{j({name:ct.trim()}),it()},st=useValidateName(_.label);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:et(ot),children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Edit your account name here.",title:"Edit Name"}),jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!rt.name,marginY:"20px",children:[jsxRuntimeExports.jsx(FormLabel,{children:"Account name"}),jsxRuntimeExports.jsx(Input,{type:"text",...nt("name",{required:"Name is required",validate:st}),placeholder:"Enter contact's name"}),rt.name&&jsxRuntimeExports.jsx(FormErrorMessage$1,{"data-testid":"name-error",children:rt.name.message})]})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"8px",isDisabled:!tt,size:"lg",type:"submit",children:"Save"})})]})})},RenameRemoveMenuSwitch=({account:_})=>{const{openWith:a,onClose:$}=reactExports.useContext(DynamicModalContext),j=useNavigate(),et=useImplicitAccounts().length===1,tt=useRemoveAccount();let rt;switch(_.type){case"secret_key":case"ledger":case"social":rt=()=>a(jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:ot,description:it,onSubmit:()=>{tt(_),$(),j("/")},title:nt}));break}const nt="Remove Account";let it="Are you sure you want to remove this account?",ot="Remove Account";return et&&(it="Removing your last account will off-board you from Umami. This will remove or reset all customized settings to their defaults. Personal data (including saved contacts, password and accounts) won't be affected.",ot="Remove & Off-board"),jsxRuntimeExports.jsx(RenameRemoveMenu,{onRemove:rt,onRename:()=>a(jsxRuntimeExports.jsx(RenameAccountModal,{account:_}))})},makeDelegation=_=>_.newDelegate?{sender:_.sender.address,timestamp:_.timestamp,id:_.id,amount:new BigNumber(_.amount),delegate:{address:_.newDelegate.address,alias:_.newDelegate.alias??void 0}}:null,TezRecapDisplay=_=>jsxRuntimeExports.jsxs(Box,{textAlign:_.center?"center":"initial",children:[jsxRuntimeExports.jsx(Heading,{size:"md",children:prettyTezAmount(_.balance)}),_.dollarBalance!==void 0&&jsxRuntimeExports.jsxs(Text,{marginTop:"6px",color:colors.gray[400],size:"sm",children:["$",_.dollarBalance.toFixed(2)]})]}),RoundButton=({icon:_,label:a,onClick:$=()=>{}})=>jsxRuntimeExports.jsxs(Box,{className:"account-drawer-cta-button",color:colors.gray[300],textAlign:"center",_hover:{color:colors.green},cursor:"pointer",marginX:"24px",onClick:$,children:[jsxRuntimeExports.jsx(IconButton,{className:"account-drawer-cta-button-icon",marginBottom:"8px","aria-label":"button",icon:_,size:"lg",variant:"circle_without_color"}),jsxRuntimeExports.jsx(Text,{cursor:"pointer",size:"sm",children:a})]}),AccountDrawerDisplay=({onSend:_,onReceive:a=()=>{},balance:$,dollarBalance:j,tokens:et,nfts:tt,account:rt})=>{const nt=rt.type==="multisig",{openWith:it}=reactExports.useContext(DynamicModalContext),ot=useSelectedNetwork(),[st,ct]=reactExports.useState(null),{handleAsyncAction:ut}=useAsyncActionHandler();return reactExports.useEffect(()=>{ut(async()=>{const ht=await getLastDelegation(rt.address.pkh,ot);ht&&ct(makeDelegation(ht))}).catch(lodashExports.noop)},[rt.address.pkh,ut,ot]),jsxRuntimeExports.jsxs(Flex,{zIndex:2,alignItems:"center",flexDirection:"column",height:"100%",marginTop:"-86px",paddingTop:"86px",paddingRight:"30px",background:accountIconGradient({account:rt,radius:"350px",opacity:"35",mainBackgroundColor:"transparent",left:"300px",top:"-125px"}),"data-testid":`account-card-${rt.address.pkh}`,children:[jsxRuntimeExports.jsx(AccountTileIcon,{account:rt,size:"lg"}),jsxRuntimeExports.jsx(Heading,{marginTop:"24px",size:"md",children:rt.label}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"8px",marginBottom:"30px",children:[jsxRuntimeExports.jsx(AddressPill,{marginRight:"4px",address:rt.address,mode:{type:"no_icons"}}),jsxRuntimeExports.jsx(RenameRemoveMenuSwitch,{account:rt})]}),$&&jsxRuntimeExports.jsx(TezRecapDisplay,{balance:$,center:!0,dollarBalance:j}),jsxRuntimeExports.jsxs(Center,{marginTop:"34px",children:[jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(OutgoingArrow,{width:"24px",height:"24px",stroke:"currentcolor"}),label:"Send",onClick:_}),jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(IncomingArrow,{width:"24px",height:"24px",stroke:"currentcolor"}),label:"Receive",onClick:a}),!nt&&jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(PlusIcon,{stroke:"currentcolor"}),label:"Buy Tez",onClick:()=>it(jsxRuntimeExports.jsx(BuyTezForm,{recipient:rt.address.pkh}))}),jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(BakerIcon,{width:"24px",height:"24px",stroke:"currentcolor"}),label:"Delegate",onClick:()=>it(jsxRuntimeExports.jsx(FormPage$3,{form:st?{baker:st.delegate.address,sender:rt.address.pkh}:void 0,sender:rt}))})]}),nt&&jsxRuntimeExports.jsx(MultisigApprovers,{signers:rt.signers}),jsxRuntimeExports.jsx(AssetsPanel,{account:rt,delegation:st,nfts:tt,tokens:et})]})};var dist={},lodash_isequal={exports:{}};lodash_isequal.exports;(function(_,a){var $=200,j="__lodash_hash_undefined__",et=1,tt=2,rt=9007199254740991,nt="[object Arguments]",it="[object Array]",ot="[object AsyncFunction]",st="[object Boolean]",ct="[object Date]",ut="[object Error]",ht="[object Function]",Et="[object GeneratorFunction]",St="[object Map]",Mt="[object Number]",kt="[object Null]",Ct="[object Object]",Ot="[object Promise]",zt="[object Proxy]",Ut="[object RegExp]",Vt="[object Set]",jt="[object String]",$t="[object Symbol]",Bt="[object Undefined]",Nt="[object WeakMap]",Lt="[object ArrayBuffer]",Pt="[object DataView]",bt="[object Float32Array]",at="[object Float64Array]",dt="[object Int8Array]",vt="[object Int16Array]",xt="[object Int32Array]",wt="[object Uint8Array]",_t="[object Uint8ClampedArray]",At="[object Uint16Array]",Tt="[object Uint32Array]",yt=/[\\^$.*+?()[\]{}|]/g,It=/^\[object .+?Constructor\]$/,rr=/^(?:0|[1-9]\d*)$/,ir={};ir[bt]=ir[at]=ir[dt]=ir[vt]=ir[xt]=ir[wt]=ir[_t]=ir[At]=ir[Tt]=!0,ir[nt]=ir[it]=ir[Lt]=ir[st]=ir[Pt]=ir[ct]=ir[ut]=ir[ht]=ir[St]=ir[Mt]=ir[Ct]=ir[Ut]=ir[Vt]=ir[jt]=ir[Nt]=!1;var nr=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Gt=typeof self=="object"&&self&&self.Object===Object&&self,qt=nr||Gt||Function("return this")(),Jt=a&&!a.nodeType&&a,Ft=Jt&&!0&&_&&!_.nodeType&&_,Kt=Ft&&Ft.exports===Jt,Qt=Kt&&nr.process,dr=function(){try{return Qt&&Qt.binding&&Qt.binding("util")}catch{}}(),xr=dr&&dr.isTypedArray;function pr(_r,Yt){for(var cr=-1,gr=_r==null?0:_r.length,Dr=0,Zr=[];++cr-1}function vs(_r,Yt){var cr=this.__data__,gr=wo(cr,_r);return gr<0?(++this.size,cr.push([_r,Yt])):cr[gr][1]=Yt,this}hn.prototype.clear=yn,hn.prototype.delete=ps,hn.prototype.get=ms,hn.prototype.has=gs,hn.prototype.set=vs;function Zn(_r){var Yt=-1,cr=_r==null?0:_r.length;for(this.clear();++Ytwn))return!1;var mn=Zr.get(_r);if(mn&&Zr.get(Yt))return mn==Yt;var Bn=-1,Fn=!0,Xn=cr&tt?new as:void 0;for(Zr.set(_r,Yt),Zr.set(Yt,_r);++Bn-1&&_r%1==0&&_r-1&&_r%1==0&&_r<=rt}function Lo(_r){var Yt=typeof _r;return _r!=null&&(Yt=="object"||Yt=="function")}function Co(_r){return _r!=null&&typeof _r=="object"}var Bo=xr?fr(xr):xl;function Xl(_r){return To(_r)?yl(_r):El(_r)}function Qn(){return[]}function Gn(){return!1}_.exports=Cs})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports,qrcode={exports:{}};(function(_,a){var $=function(){var j=function(Ut,Vt){var jt=236,$t=17,Bt=Ut,Nt=tt[Vt],Lt=null,Pt=0,bt=null,at=[],dt={},vt=function(qt,Jt){Pt=Bt*4+17,Lt=function(Ft){for(var Kt=new Array(Ft),Qt=0;Qt=7&&Tt(qt),bt==null&&(bt=ir(Bt,Nt,at)),It(bt,Jt)},xt=function(qt,Jt){for(var Ft=-1;Ft<=7;Ft+=1)if(!(qt+Ft<=-1||Pt<=qt+Ft))for(var Kt=-1;Kt<=7;Kt+=1)Jt+Kt<=-1||Pt<=Jt+Kt||(0<=Ft&&Ft<=6&&(Kt==0||Kt==6)||0<=Kt&&Kt<=6&&(Ft==0||Ft==6)||2<=Ft&&Ft<=4&&2<=Kt&&Kt<=4?Lt[qt+Ft][Jt+Kt]=!0:Lt[qt+Ft][Jt+Kt]=!1)},wt=function(){for(var qt=0,Jt=0,Ft=0;Ft<8;Ft+=1){vt(!0,Ft);var Kt=nt.getLostPoint(dt);(Ft==0||qt>Kt)&&(qt=Kt,Jt=Ft)}return Jt},_t=function(){for(var qt=8;qt>Ft&1)==1;Lt[Math.floor(Ft/3)][Ft%3+Pt-8-3]=Kt}for(var Ft=0;Ft<18;Ft+=1){var Kt=!qt&&(Jt>>Ft&1)==1;Lt[Ft%3+Pt-8-3][Math.floor(Ft/3)]=Kt}},yt=function(qt,Jt){for(var Ft=Nt<<3|Jt,Kt=nt.getBCHTypeInfo(Ft),Qt=0;Qt<15;Qt+=1){var dr=!qt&&(Kt>>Qt&1)==1;Qt<6?Lt[Qt][8]=dr:Qt<8?Lt[Qt+1][8]=dr:Lt[Pt-15+Qt][8]=dr}for(var Qt=0;Qt<15;Qt+=1){var dr=!qt&&(Kt>>Qt&1)==1;Qt<8?Lt[8][Pt-Qt-1]=dr:Qt<9?Lt[8][15-Qt-1+1]=dr:Lt[8][15-Qt-1]=dr}Lt[Pt-8][8]=!qt},It=function(qt,Jt){for(var Ft=-1,Kt=Pt-1,Qt=7,dr=0,xr=nt.getMaskFunction(Jt),pr=Pt-1;pr>0;pr-=2)for(pr==6&&(pr-=1);;){for(var Ir=0;Ir<2;Ir+=1)if(Lt[Kt][pr-Ir]==null){var Cr=!1;dr>>Qt&1)==1);var lr=xr(Kt,pr-Ir);lr&&(Cr=!Cr),Lt[Kt][pr-Ir]=Cr,Qt-=1,Qt==-1&&(dr+=1,Qt=7)}if(Kt+=Ft,Kt<0||Pt<=Kt){Kt-=Ft,Ft=-Ft;break}}},rr=function(qt,Jt){for(var Ft=0,Kt=0,Qt=0,dr=new Array(Jt.length),xr=new Array(Jt.length),pr=0;pr=0?Ar.getAt(kr):0}}for(var Sr=0,lr=0;lrpr*8)throw"code length overflow. ("+Qt.getLengthInBits()+">"+pr*8+")";for(Qt.getLengthInBits()+4<=pr*8&&Qt.put(0,4);Qt.getLengthInBits()%8!=0;)Qt.putBit(!1);for(;!(Qt.getLengthInBits()>=pr*8||(Qt.put(jt,8),Qt.getLengthInBits()>=pr*8));)Qt.put($t,8);return rr(Qt,Kt)};dt.addData=function(qt,Jt){Jt=Jt||"Byte";var Ft=null;switch(Jt){case"Numeric":Ft=ut(qt);break;case"Alphanumeric":Ft=ht(qt);break;case"Byte":Ft=Et(qt);break;case"Kanji":Ft=St(qt);break;default:throw"mode:"+Jt}at.push(Ft),bt=null},dt.isDark=function(qt,Jt){if(qt<0||Pt<=qt||Jt<0||Pt<=Jt)throw qt+","+Jt;return Lt[qt][Jt]},dt.getModuleCount=function(){return Pt},dt.make=function(){if(Bt<1){for(var qt=1;qt<40;qt++){for(var Jt=st.getRSBlocks(qt,Nt),Ft=ct(),Kt=0;Kt"u"?qt*4:Jt;var Ft="";Ft+='";for(var Qt=0;Qt';Ft+=""}return Ft+="",Ft+="
",Ft},dt.createSvgTag=function(qt,Jt,Ft,Kt){var Qt={};typeof arguments[0]=="object"&&(Qt=arguments[0],qt=Qt.cellSize,Jt=Qt.margin,Ft=Qt.alt,Kt=Qt.title),qt=qt||2,Jt=typeof Jt>"u"?qt*4:Jt,Ft=typeof Ft=="string"?{text:Ft}:Ft||{},Ft.text=Ft.text||null,Ft.id=Ft.text?Ft.id||"qrcode-description":null,Kt=typeof Kt=="string"?{text:Kt}:Kt||{},Kt.text=Kt.text||null,Kt.id=Kt.text?Kt.id||"qrcode-title":null;var dr=dt.getModuleCount()*qt+Jt*2,xr,pr,Ir,Cr,lr="",fr;for(fr="l"+qt+",0 0,"+qt+" -"+qt+",0 0,-"+qt+"z ",lr+=''+nr(Kt.text)+"":"",lr+=Ft.text?''+nr(Ft.text)+"":"",lr+='',lr+='"u"?qt*4:Jt;var Ft=dt.getModuleCount()*qt+Jt*2,Kt=Jt,Qt=Ft-Jt;return zt(Ft,Ft,function(dr,xr){if(Kt<=dr&&dr"u"?qt*4:Jt;var Kt=dt.getModuleCount()*qt+Jt*2,Qt="";return Qt+="",Qt};var nr=function(qt){for(var Jt="",Ft=0;Ft":Jt+=">";break;case"&":Jt+="&";break;case'"':Jt+=""";break;default:Jt+=Kt;break}}return Jt},Gt=function(qt){var Jt=1;qt=typeof qt>"u"?Jt*2:qt;var Ft=dt.getModuleCount()*Jt+qt*2,Kt=qt,Qt=Ft-qt,dr,xr,pr,Ir,Cr,lr={"██":"█","█ ":"▀"," █":"▄"," ":" "},fr={"██":"▀","█ ":"▀"," █":" "," ":" "},Er="";for(dr=0;dr=Qt?fr[Cr]:lr[Cr];Er+=` + `,height:"100%",children:[jsxRuntimeExports.jsx(GridItem,{gridArea:"header",children:jsxRuntimeExports.jsx(TopBar,{title:"Help"})}),jsxRuntimeExports.jsxs(GridItem,{gridArea:"main",marginTop:1,children:[jsxRuntimeExports.jsx(HelpCard,{title:"Learn More",children:jsxRuntimeExports.jsx(HelpLinkRow,{about:"Browse Articles",externalLink:"https://medium.com/umamiwallet"})}),jsxRuntimeExports.jsxs(HelpCard,{title:"Need Help?",children:[jsxRuntimeExports.jsx(HelpLinkRow,{about:"Contact our Support Team",externalLink:"mailto:umami-support@trili.tech",linkDescription:"umami-support@trili.tech"}),jsxRuntimeExports.jsx(HelpLinkRow,{about:"Get in touch with the Community",externalLink:"https://join.slack.com/t/tezos-dev/shared_invite/zt-1ur1ymxrp-G_X_bFHrvWXwoeiy53J8lg",linkDescription:"Slack #Umami"})]}),jsxRuntimeExports.jsxs(HelpCard,{title:"Terms",children:[jsxRuntimeExports.jsx(HelpLinkRow,{about:"Read Terms of Service",externalLink:"https://umamiwallet.com/tos.html"}),jsxRuntimeExports.jsx(HelpLinkRow,{about:"Read Privacy Policy",externalLink:"https://umamiwallet.com/privacypolicy.html"})]})]})]}),HelpLinkRow=({about:_,externalLink:a,linkDescription:$})=>jsxRuntimeExports.jsx(Link,{rel:"noopener noreferrer",target:"_blank",to:a,children:jsxRuntimeExports.jsx(ClickableCard,{cursor:"pointer",isSelected:!1,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{size:"sm",children:_}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[$&&jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[400],size:"sm",children:$}),jsxRuntimeExports.jsx(ExternalLinkIcon,{})]})]})})}),HelpCard=({title:_,children:a})=>jsxRuntimeExports.jsx(Box,{"data-testid":"help-card",marginY:"10px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsxs(Box,{width:"550px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"16px",size:"lg",children:_}),a]})})}),ConnectOptions=({goToStep:_})=>{const a=useImplicitAccounts().length>0;return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(LinkIcon,{}),title:"Connect or Import Account",children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:"16px",children:[jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"restoreMnemonic"}),size:"lg",children:"Import with Seed Phrase"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"restoreSecretKey"}),size:"lg",variant:"tertiary",children:"Import with Secret Key"}),!a&&jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"restoreBackup"}),size:"lg",variant:"tertiary",children:"Restore from Backup"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"nameAccount",account:{type:"ledger"}}),size:"lg",variant:"tertiary",children:"Connect ledger"})]})})},withTimeout=(_,a,$)=>Promise.race([_(),new Promise((j,et)=>setTimeout(()=>{et(new Error("The operation has timed out"))},a))]),LOGIN_TIMEOUT=minutesToMilliseconds(1),useOnboardWithSocial=(_,a)=>{const $=useToast(),{isLoading:j,handleAsyncAction:et}=useAsyncActionHandler(),tt=useRestoreSocial(),rt=reactExports.useCallback(()=>et(async()=>{const{secretKey:nt,name:it}=await withTimeout(()=>forIDP(_).getCredentials(),LOGIN_TIMEOUT),{pk:ot,pkh:st}=await getPublicKeyPairFromSk(nt);tt(ot,st,it,_),$({description:`Successfully added ${it} account`,status:"success"}),a()},{title:"Social login failed"}),[_,$,et,tt,a]);return{isLoading:j,onboard:rt}},OnboardWithFacebookButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("facebook",_);return jsxRuntimeExports.jsx(IconButton,{"aria-label":"Facebook SSO","data-testid":"login-button-facebook",icon:jsxRuntimeExports.jsx(FacebookIcon,{}),isLoading:a,onClick:$,variant:"socialLogin"})},OnboardWithGoogleButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("google",_);return jsxRuntimeExports.jsx(IconButton,{"aria-label":"Google SSO","data-testid":"login-button-google",icon:jsxRuntimeExports.jsx(GoogleIcon,{}),isLoading:a,onClick:$,variant:"socialLogin"})},OnboardWithRedditButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("reddit",_);return jsxRuntimeExports.jsx(IconButton,{"aria-label":"Reddit SSO","data-testid":"login-button-reddit",icon:jsxRuntimeExports.jsx(RedditIcon,{}),isLoading:a,onClick:$,variant:"socialLogin"})},OnboardWithTwitterButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("twitter",_);return jsxRuntimeExports.jsx(IconButton,{color:"black","aria-label":"Twitter SSO","data-testid":"login-button-twitter",icon:jsxRuntimeExports.jsx(TwitterIcon,{fill:"currentColor"}),isLoading:a,onClick:$,variant:"socialLogin"})},IS_DEV=!1,ConnectOrCreate=({goToStep:_,closeModal:a})=>jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(WalletPlusIcon,{}),title:"Connect or Create Account",children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:"16px",children:[jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"notice"}),size:"lg",children:"Create a new Account"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>_({type:"connectOptions"}),size:"lg",variant:"tertiary",children:"I already have a wallet"}),IS_DEV,jsxRuntimeExports.jsxs(Flex,{width:"100%",paddingTop:"14px",paddingBottom:"6px",children:[jsxRuntimeExports.jsx(Divider,{marginTop:"11px"}),jsxRuntimeExports.jsx(Text,{minWidth:"160px",color:colors.gray[400],textAlign:"center",noOfLines:1,size:"sm",children:"Continue with social"}),jsxRuntimeExports.jsx(Divider,{marginTop:"11px"})]}),jsxRuntimeExports.jsxs(Flex,{gap:"12px",children:[jsxRuntimeExports.jsx(OnboardWithGoogleButton,{onAuth:a}),jsxRuntimeExports.jsx(OnboardWithFacebookButton,{onAuth:a}),jsxRuntimeExports.jsx(OnboardWithTwitterButton,{onAuth:a}),jsxRuntimeExports.jsx(OnboardWithRedditButton,{onAuth:a})]})]})}),Select=({selected:_,options:a,onChange:$})=>{const[j,et]=reactExports.useState(_),[tt,rt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",height:"48px",padding:"12px 15px 15px 15px",color:colors.gray[300],background:colors.gray[800],border:"1px solid",borderColor:colors.gray[500],borderRadius:"4px",_hover:{borderColor:colors.gray[450]},cursor:"pointer","data-testid":"select-input",onClick:()=>rt(nt=>!nt),children:[jsxRuntimeExports.jsx(Text,{size:"sm",children:j.label}),jsxRuntimeExports.jsx(ChevronDownIcon$1,{marginTop:"2px"})]}),tt&&jsxRuntimeExports.jsx(UnorderedList,{position:"absolute",zIndex:2,width:"100%",margin:0,marginTop:"8px",padding:"15px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px","data-testid":"select-options",listStyleType:"none",children:a.map(nt=>jsxRuntimeExports.jsx(ListItem,{marginBottom:"5px",padding:"11px",color:colors.gray[300],background:"transparent",borderRadius:"4px",_hover:{background:colors.gray[500]},cursor:"pointer",onClick:()=>{rt(!1),et(nt),$(nt.value)},children:jsxRuntimeExports.jsx(Text,{size:"sm",children:nt.label})},nt.value))})]})},DerivationPath=({goToStep:_,account:a})=>{const[$,j]=reactExports.useState(!1),{handleSubmit:et,register:tt,setValue:rt,formState:{isValid:nt,errors:it}}=useForm({mode:"onBlur",defaultValues:{derivationPathTemplate:defaultDerivationPathTemplate,derivationPath:getDefaultDerivationPath(0)}}),ot=async({derivationPathTemplate:st,derivationPath:ct})=>{switch(a.type){case"ledger":return _($?{type:"restoreLedger",account:{...a,derivationPath:normalizeDerivationPath(ct)}}:{type:"restoreLedger",account:{...a,derivationPathTemplate:normalizeDerivationPath(st)}});case"mnemonic":{if($){const ut=await deriveSecretKey(a.mnemonic,ct,"ed25519");return _({type:"masterPassword",account:{type:"secret_key",secretKey:ut,label:a.label}})}return _({type:"masterPassword",account:{...a,derivationPathTemplate:st}})}}};return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(SlashIcon,{}),subtitle:"Choose a custom derivation path or select the default derivation path and use the default key.",title:"Derivation Path",children:jsxRuntimeExports.jsxs("form",{onSubmit:et(ot),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(Center,{width:"100%",marginBottom:"12px",children:[jsxRuntimeExports.jsx(Text,{fontWeight:$?400:600,size:"sm",children:"Default Path"}),jsxRuntimeExports.jsx(Switch,{"data-testid":"custom-path-switch",marginX:"10px",onChange:()=>j(st=>!st),variant:"danger"}),jsxRuntimeExports.jsx(Text,{fontWeight:$?600:400,size:"sm",children:"Custom Path"})]}),$&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Center,{marginTop:"16px",marginBottom:"32px",children:jsxRuntimeExports.jsx(Text,{width:"340px",color:colors.orange,textAlign:"center",size:"xs",children:"Please write down to your derivation path. You may not be able to restore your data if you lose it."})}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"20px",isInvalid:!!it.derivationPath,children:[jsxRuntimeExports.jsx(Input,{fontSize:"sm",textAlign:"center","data-testid":"custom-path-input",...tt("derivationPath",{validate:validateDerivationPath})}),it.derivationPath&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"error-message",children:it.derivationPath.message})]})]}),!$&&jsxRuntimeExports.jsx(FormControl,{marginTop:"32px",marginBottom:"20px",children:jsxRuntimeExports.jsx(Select,{onChange:st=>rt("derivationPathTemplate",st),options:AVAILABLE_DERIVATION_PATH_TEMPLATES,selected:DEFAULT_DERIVATION_PATH_TEMPLATE})}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"12px",isDisabled:!nt,size:"lg",type:"submit",children:"Continue"}),jsxRuntimeExports.jsx(ExternalLink,{display:"block",width:"100%",marginTop:"32px",textAlign:"center",href:"https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki",children:jsxRuntimeExports.jsx(Tooltip,{backgroundColor:"white",defaultIsOpen:!1,hasArrow:!0,label:"Derivation path is a set of directions that helps create different secret keys; it starts from a master key or seed.",children:jsxRuntimeExports.jsx(Text,{color:colors.blue,fontWeight:600,textDecoration:"underline",_hover:{textDecoration:"underline"},size:"sm",children:"What's a Derivation Path?"})})})]})})},normalizeDerivationPath=_=>_.trim().toLowerCase().replace("m/",""),validateDerivationPath=_=>{const a=normalizeDerivationPath(_);return a.length===0?"Derivation path is required":a.startsWith("44'/1729'/")?a.match(new RegExp("^44'/1729'/([0-9]+'/)*([0-9]+')$"))?!0:"Invalid derivation path":"Derivation path must start with `44'/1729'/`"},Eula=({goToStep:_})=>{const[a,$]=React$2.useState(!1);return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(DocumentIcon,{}),title:"Accept to Continue",children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Checkbox,{paddingBottom:"24px",fontWeight:"600",onChange:j=>$(j.target.checked),children:["I confirm that I have read and agreed with the"," ",jsxRuntimeExports.jsx(Link$1,{textDecoration:"underline",_hover:{color:colors.green},href:"https://umamiwallet.com/tos.html",rel:"noopener noreferrer",target:"_blank",children:"Terms of Service"})," ","and the"," ",jsxRuntimeExports.jsx(Link$1,{textDecoration:"underline",_hover:{color:colors.green},href:"https://umamiwallet.com/privacypolicy.html",rel:"noopener noreferrer",target:"_blank",children:"Privacy Policy"})]}),jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!a,onClick:()=>{_({type:"connectOrCreate"})},size:"lg",children:"Continue"})]})})},FakeAccount=({onClose:_})=>{const{register:a,handleSubmit:$,formState:{errors:j}}=useForm({mode:"onBlur"}),et=useRestoreLedger(),tt=useRestoreSocial(),rt=async({pkh:nt,name:it,idp:ot})=>{if(ot&&ot.length>0&&!["google","facebook","twitter","reddit","email"].includes(ot))throw new Error("Invalid IDP");const ct=await new RpcClient(GHOSTNET.rpcUrl).getManagerKey(nt),ut=typeof ct=="string"?ct:ct.key;ot?tt(ut,nt,it,ot):et(defaultDerivationPathTemplate,makeDerivationPath(defaultDerivationPathTemplate,0),ut,nt,it),_()};return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(WalletPlusIcon,{}),title:"Add a Fake Account",children:jsxRuntimeExports.jsxs("form",{onSubmit:$(rt),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!j.pkh,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Address"}),jsxRuntimeExports.jsx(Input,{...a("pkh",{required:!0}),autoComplete:"off",placeholder:"Please enter the account address"})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"12px",isInvalid:!!j.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Name"}),jsxRuntimeExports.jsx(Input,{...a("name",{required:!0}),autoComplete:"off",placeholder:"Please enter the account name"})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"12px",isInvalid:!!j.idp,children:[jsxRuntimeExports.jsx(FormLabel,{children:"IDP (For a social account)"}),jsxRuntimeExports.jsx(Input,{...a("idp"),autoComplete:"off",placeholder:"Please enter the IDP"})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"12px",size:"lg",type:"submit",children:"Add account"})]})})},EnterAndConfirmPassword=({onSubmit:_,isLoading:a})=>{const $=useForm({mode:"onBlur"}),{handleSubmit:j,formState:{errors:et,isValid:tt},getValues:rt}=$,nt=({confirm:it})=>_(it);return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(LockIcon,{}),subtitle:"Please choose a master password for Umami. You will need to use this password in order to perform any operations within Umami.",title:"Umami Master Password",children:jsxRuntimeExports.jsx(FormProvider,{...$,children:jsxRuntimeExports.jsxs("form",{onSubmit:j(nt),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!et.password,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password",placeholder:"Enter master password"}),et.password&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.password.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!et.confirm,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"confirmation",inputName:"confirm",label:"Confirm Password",placeholder:"Confirm your password",required:"Confirmation is required",validate:it=>rt("password")===it||"Your passwords do no match"}),et.confirm&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.confirm.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",isDisabled:!tt||a,isLoading:a,size:"lg",type:"submit",children:"Submit"})]})})})},EnterPassword=({onSubmit:_,isLoading:a})=>{const $=useForm({mode:"onBlur"}),{handleSubmit:j,formState:{errors:et,isValid:tt}}=$,rt=nt=>{_(nt.password)};return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(LockIcon,{}),subtitle:"Enter your master password for Umami.",title:"Umami Master Password",children:jsxRuntimeExports.jsx(FormProvider,{...$,children:jsxRuntimeExports.jsxs("form",{onSubmit:j(rt),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!et.password,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password"}),et.password&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.password.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",isDisabled:!tt,isLoading:a,size:"lg",type:"submit",children:"Submit"})]})})})},MasterPassword=({account:_,onClose:a})=>{const $=useRestoreFromMnemonic(),j=useRestoreFromSecretKey(),et=useValidateMasterPassword(),tt=et!==null,{isLoading:rt,handleAsyncAction:nt}=useAsyncActionHandler(),it=useToast(),ot=st=>nt(async()=>{switch(tt&&await et(st),_.type){case"secret_key":await j(_.secretKey,st,_.label);break;case"mnemonic":await $({..._,password:st})}it({description:"Account successfully created!",status:"success"}),a()});return tt?jsxRuntimeExports.jsx(EnterPassword,{isLoading:rt,onSubmit:ot}):jsxRuntimeExports.jsx(EnterAndConfirmPassword,{isLoading:rt,onSubmit:ot})},Notice=({goToStep:_})=>{const a=[{content:"Write down your seed phrase and store it in a safe place."},{content:"Make sure there is no one around you or looking over your shoulder."},{content:"Do not copy and paste the Seed Phrase or store it on your device."},{content:"Do not take a screenshot of your Seed Phrase."}];return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(NoticeIcon,{}),subtitle:"Please read the following before you continue to see your secret Seed Phrase.",title:"Important Notice",children:jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(OrderedList,{spacing:"16px",variant:"onboardingNotice",children:a.map(($,j)=>jsxRuntimeExports.jsx(ListItem,{fontSize:"16px",fontWeight:600,children:$.content},j))}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"28px",onClick:()=>_({type:"showSeedphrase",account:{type:"mnemonic",mnemonic:generate24WordMnemonic()}}),size:"lg",children:"I understand"}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"16px",onClick:()=>_({type:"restoreMnemonic"}),size:"lg",variant:"tertiary",children:"I already have a Seed Phrase"})]})})},RestoreBackupFile=()=>{const _=useForm({mode:"onBlur"}),{handleSubmit:a,register:$,formState:{errors:j,isValid:et}}=_,{handleAsyncAction:tt}=useAsyncActionHandler(),rt=useRestoreV1BackupFile(),nt=({password:it,file:ot})=>tt(async()=>{const st=await ot[0].text(),ct=JSON.parse(st);if(ct.recoveryPhrases&&ct.derivationPaths)await rt(ct,it);else if(ct["persist:accounts"])await restoreV2BackupFile(ct,it),reload();else throw new Error("Invalid backup file.")});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(RotateIcon,{}),subtitle:"Select a JSON backup file and enter the password you used to encrypt it.",title:"Restore from Backup",children:jsxRuntimeExports.jsx(FormProvider,{..._,children:jsxRuntimeExports.jsx("form",{onSubmit:a(nt),style:{width:"100%"},children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!j.file,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Upload File"}),jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(Input,{padding:"2px","data-testid":"file-input",...$("file",{required:"File is required"}),accept:".json",type:"file",variant:"unstyled"})}),j.file&&jsxRuntimeExports.jsx(FormErrorMessage$1,{"data-testid":"file-errors",children:j.file.message})]}),jsxRuntimeExports.jsx(FormControl,{marginTop:"24px",children:jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password-input",inputName:"password",label:"Your password (if you have one)",required:!1})}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",isDisabled:!et,size:"lg",type:"submit",children:"Import Wallet"})]})})})})},getPk=async _=>{const a=await TransportWebUSB.create(),$=new LedgerSigner(a,_,!0),j=await $.publicKey(),et=await $.publicKeyHash();return await a.close(),{pk:j,pkh:et}},LEDGER_TIMEOUT=60*1e3,RestoreLedger=({closeModal:_,account:a})=>{const $=useRestoreLedger(),j=useToast(),{isLoading:et,handleAsyncAction:tt}=useAsyncActionHandler(),rt=[{content:"Plug your Ledger into your computer using a USB cable."},{content:"Unlock your Ledger."},{content:"Make sure your Ledger has the latest firmware version."},{content:"Install and open the Tezos Wallet app on your Ledger."},{content:"Click the button below and confirm the action on your Ledger."}],nt=()=>tt(()=>withTimeout(async()=>{const it=j({description:"Please open the Tezos app on your Ledger and approve the operation",status:"info"}),ot=a.derivationPathTemplate?makeDerivationPath(a.derivationPathTemplate,0):a.derivationPath,{pk:st,pkh:ct}=await getPk(ot);$(a.derivationPathTemplate,ot,st,ct,a.label),j.close(it),j({description:"Account successfully created!",status:"success"}),_()},LEDGER_TIMEOUT),it=>it.name==="PublicKeyRetrievalError"?{description:"Request rejected. Please unlock your Ledger and open the Tezos app"}:it.name==="InvalidStateError"?{description:"Request pending. Check your ledger..."}:{description:`Ledger error. ${it.message||it.name}`});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(USBIcon,{}),subtitle:"Complete the steps to connect.",title:"Connect Ledger",children:jsxRuntimeExports.jsxs(VStack,{overflowY:"auto",spacing:"24px",children:[jsxRuntimeExports.jsx(OrderedList,{spacing:4,children:rt.map((it,ot)=>jsxRuntimeExports.jsx(ListItem,{children:it.content},ot))}),jsxRuntimeExports.jsx(Button,{width:"100%",isLoading:et,onClick:nt,size:"lg",children:"Export Public Key"})]})})},MnemonicAutocomplete=({inputName:_,validate:a,inputProps:$,listProps:j})=>{const[et,tt]=reactExports.useState(!0),{register:rt,setValue:nt,watch:it}=useFormContext(),ot=it(_),st=wordlists.EN.filter(ut=>ot&&ut.startsWith(ot)).sort(),ct=!et&&st.length>0&&(st.length>1||st[0]!==ot);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Input,{zIndex:0,autoComplete:"off","data-testid":"mnemonic-input",onFocus:()=>tt(!1),placeholder:"Type here...",...rt(_,{required:"Required",validate:a,onChange:()=>tt(!1),onBlur:()=>tt(!0)}),...$}),ct&&jsxRuntimeExports.jsx(UnorderedList,{"data-testid":"suggestions",variant:"suggestions",...j,children:st.map(ut=>jsxRuntimeExports.jsx(ListItem,{paddingTop:"2px",fontSize:"14px",fontWeight:600,"data-testid":"suggestion",onMouseDown:()=>nt(_,ut),paddingX:"7px",children:ut},ut))})]})},mnemonicSizes=[12,15,18,24],RestoreMnemonic=({goToStep:_})=>{const a=useForm({mode:"onBlur"}),{handleSubmit:$,setValue:j,trigger:et,formState:{isValid:tt}}=a,{handleAsyncAction:rt}=useAsyncActionHandler(),[nt,it]=reactExports.useState(24),ot=ut=>{const ht=Number(ut);if(mnemonicSizes.includes(ht))return it(Et=>(Et>ht&&lodashExports.range(ht,Math.max(...mnemonicSizes)).forEach(St=>{j(`word${St}`,void 0)}),ht)),et()},st=ut=>rt(async()=>{const ht=ut.split(" ");if(!mnemonicSizes.includes(ht.length))throw new Error(`the mnemonic must be ${mnemonicSizes.join(", ")} words long`);return ht.slice(0,nt).forEach((Et,St)=>{j(`word${St}`,Et)}),et()}),ct=ut=>rt(async()=>{const ht=Object.values(ut).join(" ").trim();if(!validateMnemonic_1(ht))throw new Error(`Invalid Mnemonic: "${ht}"`);return _({type:"nameAccount",account:{type:"mnemonic",mnemonic:ht}}),Promise.resolve()});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px"}),subtitle:"Please fill in the Seed Phrase in sequence.",title:"Import Seed Phrase",children:jsxRuntimeExports.jsx(Box,{overflowX:"hidden",children:jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx("form",{onSubmit:$(ct),style:{width:"100%"},children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:4,children:[jsxRuntimeExports.jsx(Select$1,{height:"48px",color:colors.gray[450],"data-testid":"select",icon:jsxRuntimeExports.jsx(ChevronDownIcon,{}),onChange:ut=>ot(ut.target.value),value:nt,children:mnemonicSizes.reverse().map(ut=>jsxRuntimeExports.jsxs("option",{value:ut,children:[ut," Words"]},ut))}),jsxRuntimeExports.jsx(Grid,{gridGap:3,gridTemplateColumns:"repeat(3, 1fr)",paddingBottom:"20px",children:lodashExports.range(nt).map(ut=>{const ht=`word${ut}`;return jsxRuntimeExports.jsxs(GridItem,{display:"flex",height:"38px",padding:"4px",fontSize:"sm",background:colors.gray[800],border:"1px solid",borderColor:colors.gray[500],borderRadius:"4px",children:[jsxRuntimeExports.jsx(Heading,{width:"19px",marginRight:"6px",paddingTop:"6px",color:colors.gray[400],textAlign:"right",size:"sm",children:ut+1}),jsxRuntimeExports.jsx(MnemonicAutocomplete,{inputName:ht,inputProps:{onPaste:async Et=>{Et.preventDefault();const St=await navigator.clipboard.readText();return st(St)},border:"none",size:"xsmall"},listProps:{width:"126px",marginTop:"38px",marginLeft:"-5px"}})]},ut)})}),jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!tt,size:"lg",type:"submit",children:"Continue"}),IS_DEV]})})})})})},RestoreSecretKey=({goToStep:_})=>{const[a,$]=reactExports.useState(!1),{handleAsyncAction:j}=useAsyncActionHandler(),et=useForm({mode:"onBlur",defaultValues:{password:""}}),{register:tt,handleSubmit:rt,formState:{errors:nt,isValid:it}}=et,ot=async({secretKey:st,password:ct})=>j(async()=>{try{const ht=await(await InMemorySigner.fromSecretKey(st.trim(),ct)).secretKey();_({type:"nameAccount",account:{type:"secret_key",secretKey:ht}})}catch(ut){const ht=ut.message||"";throw ht.includes("Cannot read properties of null")?new Error("Key-password pair is invalid"):ht.includes("Invalid checksum")?new Error("Invalid secret key: checksum doesn't match"):ut}});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px"}),title:"Insert Secret Key",children:jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsxs("form",{onSubmit:rt(ot),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!nt.secretKey,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Secret Key"}),jsxRuntimeExports.jsx(Textarea,{minHeight:"130px","data-testid":"secret-key",...tt("secretKey",{required:"Secret key is required",onChange:st=>$(isEncryptedSecretKeyPrefix(st.target.value.trim()))}),placeholder:"Your secret key"}),nt.secretKey&&jsxRuntimeExports.jsx(FormErrorMessage$1,{children:nt.secretKey.message})]}),a&&jsxRuntimeExports.jsxs(FormControl,{marginTop:"20px",isInvalid:!!nt.password,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"password",inputName:"password",minLength:0}),nt.password&&jsxRuntimeExports.jsx(FormErrorMessage$1,{children:nt.password.message})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px","data-testid":"restore-continue-button",isDisabled:!it,size:"lg",type:"submit",children:"Continue"})]})})})},ShowSeedphrase=({goToStep:_,account:a})=>jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px"}),subtitle:"Please record the following 24 words in sequence in order to restore it in the future.",title:"Record Seed Phrase",children:jsxRuntimeExports.jsxs(VStack,{children:[jsxRuntimeExports.jsx(SimpleGrid,{columns:3,spacing:2,children:a.mnemonic.split(" ").map(($,j)=>jsxRuntimeExports.jsxs(Flex,{width:"126px",padding:"6px",border:"1px dashed",borderColor:colors.gray[500],borderRadius:"4px",children:[jsxRuntimeExports.jsx(Heading,{width:"18px",marginRight:"10px",paddingTop:"2px",color:colors.gray[450],textAlign:"right",size:"sm",children:j+1}),jsxRuntimeExports.jsx(Text,{"data-testid":`mnemonic-word-${j}`,size:"sm",children:$})]},j))}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"20px",onClick:$=>{_({type:"verifySeedphrase",account:a})},size:"lg",children:"OK, I've recorded it"})]})}),VerifySeedphrase=({goToStep:_,account:a})=>{const $=a.mnemonic.split(" "),j=useForm({mode:"onBlur"}),{handleSubmit:et,formState:{errors:tt,isValid:rt}}=j,[nt]=reactExports.useState(selectRandomElements($,5)),it=()=>_({type:"nameAccount",account:a});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(DoubleCheckmarkIcon,{}),subtitle:"To verify, please type in the word that corresponds to each sequence number.",title:"Verify Seed Phrase",children:jsxRuntimeExports.jsx(Box,{overflowX:"hidden",overflowY:"auto",width:"100%",children:jsxRuntimeExports.jsx(FormProvider,{...j,children:jsxRuntimeExports.jsxs("form",{onSubmit:et(it),children:[nt.map((ot,st)=>{const ct=`${ot.index}`,ut=tt[ct];return jsxRuntimeExports.jsxs(FormControl,{marginBottom:"12px",isInvalid:!!ut,children:[jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:1,width:"26px",marginTop:"12px",marginLeft:"4px",textAlign:"right","data-testid":"mnemonic-index",children:ot.index+1}),jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsx(MnemonicAutocomplete,{inputName:ct,inputProps:{paddingLeft:"36px",size:"md"},listProps:{marginTop:"6px"},validate:ht=>{if(ht!==ot.value)return"Word doesn't match"}})}),(ut==null?void 0:ut.message)&&jsxRuntimeExports.jsx(FormErrorMessage,{children:ut.message})]},st)}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"20px",isDisabled:!rt,size:"lg",type:"submit",children:"Continue"}),IS_DEV]})})})})},useStepHistory=_=>{const[a,$]=reactExports.useState(_),[j,et]=reactExports.useState([a]),tt=j.length===1;return{reset:()=>{$(_),et([_])},goToStep:rt=>{$(rt),et([...j,rt])},currentStep:a,goBack:()=>{if(tt)return;j.pop();const rt=j[j.length-1];et(j),$(rt)},atInitialStep:tt,fullHistory:j}},useOnboardingModal=_=>{const{isOpen:a,onOpen:$,onClose:j}=useDisclosure$1(),et=useImplicitAccounts().length!==0,tt=useStepHistory({type:et?"connectOrCreate":"eula"}),{currentStep:rt,goToStep:nt}=tt,it=()=>{tt.reset(),_&&_(),j()},ot=()=>{switch(rt.type){case"eula":return jsxRuntimeExports.jsx(Eula,{goToStep:nt});case"connectOrCreate":return jsxRuntimeExports.jsx(ConnectOrCreate,{closeModal:it,goToStep:nt});case"connectOptions":return jsxRuntimeExports.jsx(ConnectOptions,{goToStep:nt});case"notice":return jsxRuntimeExports.jsx(Notice,{goToStep:nt});case"restoreMnemonic":return jsxRuntimeExports.jsx(RestoreMnemonic,{goToStep:nt});case"restoreBackup":return jsxRuntimeExports.jsx(RestoreBackupFile,{});case"showSeedphrase":return jsxRuntimeExports.jsx(ShowSeedphrase,{goToStep:nt,...rt});case"verifySeedphrase":return jsxRuntimeExports.jsx(VerifySeedphrase,{goToStep:nt,...rt});case"nameAccount":return jsxRuntimeExports.jsx(NameAccount,{goToStep:nt,...rt});case"derivationPath":return jsxRuntimeExports.jsx(DerivationPath,{goToStep:nt,...rt});case"restoreLedger":return jsxRuntimeExports.jsx(RestoreLedger,{closeModal:it,...rt});case"masterPassword":return jsxRuntimeExports.jsx(MasterPassword,{onClose:it,...rt});case"fakeAccount":return jsxRuntimeExports.jsx(FakeAccount,{onClose:j});case"restoreSecretKey":return jsxRuntimeExports.jsx(RestoreSecretKey,{goToStep:nt})}};return{modalElement:jsxRuntimeExports.jsxs(Modal,{autoFocus:!1,closeOnOverlayClick:!1,isCentered:!0,isOpen:a,onClose:it,children:[et&&jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsxs(ModalContent,{children:[!tt.atInitialStep&&jsxRuntimeExports.jsx(ModalBackButton,{onClick:tt.goBack}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:it}),ot()]})]}),onOpen:$}},AccountListHeader=()=>{const{onOpen:_,modalElement:a}=useOnboardingModal();return jsxRuntimeExports.jsxs(Flex,{flexDirection:"row-reverse",marginTop:"12px",marginBottom:"16px",children:[jsxRuntimeExports.jsxs(Button,{paddingRight:"0",onClick:_,variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(AddAccountIcon,{stroke:"currentcolor"}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Add Account"})]}),a]})},AccountGroupPopover=({onRemove:_,onCreate:a})=>jsxRuntimeExports.jsx(PopoverMenu,{children:jsxRuntimeExports.jsxs(Box,{paddingY:"0",children:[jsxRuntimeExports.jsx(Button,{height:a?"24px":"28px","data-testid":"popover-remove",onClick:_,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flex:1,children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Remove"}),jsxRuntimeExports.jsx(TrashIcon,{stroke:"inherit"})]})}),a&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:"4px"}),jsxRuntimeExports.jsx(Button,{onClick:a,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flex:1,children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Create"}),jsxRuntimeExports.jsx(PlusIcon,{width:"18px",height:"18px",stroke:"inherit"})]})})]})]})}),DeriveMnemonicAccountModal=({onDone:_,fingerPrint:a})=>{const[$,j]=reactExports.useState(),{isLoading:et,handleAsyncAction:tt}=useAsyncActionHandler(),rt=useToast(),nt=useDeriveMnemonicAccount(),it=({name:ot,password:st})=>tt(async()=>{await nt({fingerPrint:a,password:st,label:ot.trim()||DEFAULT_ACCOUNT_LABEL}),_(),rt({description:`New account created! Successfully derived account from ${a}`})},{title:"Failed to derive new account"});return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),$?jsxRuntimeExports.jsx(EnterPassword,{isLoading:et,onSubmit:ot=>it({name:$,password:ot})}):jsxRuntimeExports.jsx(NameAccountDisplay,{onSubmit:ot=>j(ot.accountName),subtitle:`Name the new account derived from ${a}`})]})},getAccountGroupLabel=_=>{switch(_.type){case"mnemonic":return`Seedphrase ${_.seedFingerPrint}`;case"social":return"Social Accounts";case"ledger":return"Ledger Accounts";case"secret_key":return"Secret Key Accounts";case"multisig":return"Multisig Accounts"}},AccountGroup=({groupLabel:_,accounts:a,balances:$})=>{const j=a[0],et=j.type==="multisig",tt=j.type==="mnemonic",{openWith:rt,onClose:nt}=reactExports.useContext(DynamicModalContext),it=useRemoveMnemonic(),ot=useRemoveNonMnemonic(),st=useImplicitAccounts().length===a.length,ct="Remove All Accounts";let ut,ht="Remove All";const Et=getAccountGroupLabel(j);st?(ut="Removing all your accounts will off-board you from Umami. This will remove or reset all customized settings to their defaults. Personal data (including saved contacts, password and accounts) won't be affected.",ht="Remove & Off-board"):tt?ut=`Are you sure you want to remove all accounts derived from ${Et}?`:ut=`Are you sure you want to remove all of your ${Et}?`;const St=()=>rt(jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:ht,description:ut,onSubmit:()=>{tt?it(j.seedFingerPrint):et||ot(j.type),nt()},title:ct})),Mt=()=>{if(!tt)throw new Error("Can't derive a non mnemonic account!");return rt(jsxRuntimeExports.jsx(DeriveMnemonicAccountModal,{fingerPrint:j.seedFingerPrint,onDone:nt}))};return jsxRuntimeExports.jsxs(Box,{"data-testid":`account-group-${_}`,children:[jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",marginTop:"24px",marginBottom:"16px",children:[jsxRuntimeExports.jsx(Heading,{"data-testid":"account-group-title",size:"md",children:_}),!et&&jsxRuntimeExports.jsx(AccountGroupPopover,{onCreate:tt?Mt:void 0,onRemove:St})]}),a.map(kt=>jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(AccountTile,{account:kt,balance:$[kt.address.pkh]})},kt.address.pkh))]})},NestedScroll=_=>jsxRuntimeExports.jsx(Box,{overflowY:"auto",height:"100%",children:_.children});var indicator$1=function _(a){a=Math.abs(a);var $=a%100;if($>=10&&$<=20)return"th";var j=a%10;return j===1?"st":j===2?"nd":j===3?"rd":"th"},indicator=indicator$1;function ordinal(_){if(typeof _!="number")throw new TypeError("Expected Number, got "+typeof _+" "+_);return Number.isFinite(_)?_+indicator(_):_}ordinal.indicator=indicator;var ordinal_1=ordinal;const ordinal$1=getDefaultExportFromCjs$1(ordinal_1),SignTransactionFormPage=_=>{const a=useAppDispatch(),{isLoading:$,handleAsyncAction:j}=useAsyncActionHandler(),{mode:et,operations:tt,data:{threshold:rt,signers:nt,name:it}}=_,{fee:ot,operations:st,estimationFailed:ct,isLoading:ut,form:ht,reEstimate:Et,signer:St,onSign:Mt}=useSignPageHelpers(tt,et),kt=$||ut,Ct=Ot=>j(async()=>{const zt=await Mt(Ot);if(!zt)throw new Error("An error occurred during contract origination");const Ut=(await zt.getOriginatedContractAddresses())[0];a(multisigActions.addMultisigLabel({pkh:Ut,label:it}))});return jsxRuntimeExports.jsx(FormProvider,{...ht,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,description:"Please review the details and then continue to submit contract.",operationsType:st.type,signer:St,title:"Review & Submit"}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Text,{marginBottom:"24px",padding:"14px",color:colors.gray[50],background:colors.gray[800],borderRadius:"6px","data-testid":"contract-name",children:it}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{}),jsxRuntimeExports.jsx(FormLabel,{children:"Approvers"}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column",gap:"12px",marginBottom:"12px","data-testid":"approvers",children:nt.map(Ot=>jsxRuntimeExports.jsx(AddressTile,{address:parsePkh(Ot.val),"data-testid":`approver-${Ot.val}`},Ot.val))}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(Threshold,{signersAmount:nt.length,threshold:rt})}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(FormControl,{marginTop:"24px",marginBottom:"12px",children:jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!1,inputName:"signer",isLoading:kt,keepValid:!0,label:"Creation Fee Payer",onUpdate:Et})}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(SignPageFee,{fee:ot})})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:ct,isLoading:kt,onSubmit:Ct,signer:St,text:"Submit Contract"})})]})})})},Threshold=({threshold:_,signersAmount:a})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center","data-testid":"threshold",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"No. of approvals:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:`${_} out of ${a}`})]}),contract=[{prim:"storage",args:[{prim:"pair",args:[{prim:"address",annots:["%owner"]},{prim:"pair",args:[{prim:"set",args:[{prim:"address"}],annots:["%signers"]},{prim:"pair",args:[{prim:"nat",annots:["%threshold"]},{prim:"pair",args:[{prim:"nat",annots:["%last_op_id"]},{prim:"pair",args:[{prim:"big_map",args:[{prim:"nat"},{prim:"pair",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"list",args:[{prim:"operation"}]}],annots:["%actions"]},{prim:"set",args:[{prim:"address"}],annots:["%approvals"]}]}],annots:["%pending_ops"]},{prim:"big_map",args:[{prim:"string"},{prim:"bytes"}],annots:["%metadata"]}]}]}]}]}]}]},{prim:"parameter",args:[{prim:"or",args:[{prim:"or",args:[{prim:"or",args:[{prim:"bytes",annots:["%set_metadata_uri"]},{prim:"unit",annots:["%default"]}]},{prim:"or",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"list",args:[{prim:"operation"}]}],annots:["%propose"]},{prim:"nat",annots:["%approve"]}]}]},{prim:"nat",annots:["%execute"]}]}]},{prim:"code",args:[[{prim:"NIL",args:[{prim:"operation"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"UNPAIR"},{prim:"DIP",args:[{int:"1"},[{prim:"UNPAIR",args:[{int:"6"}]}]]},{prim:"IF_LEFT",args:[[{prim:"IF_LEFT",args:[[{prim:"IF_LEFT",args:[[{prim:"DUP",args:[{int:"2"}]},{prim:"SENDER"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"INVALID_CALLER"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"7"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"SOME"},{prim:"PUSH",args:[{prim:"string"},{string:""}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}],[{prim:"DROP",args:[{int:"1"}]},{prim:"DUP",args:[{int:"3"}]},{prim:"DUP",args:[{int:"3"}]},{prim:"SIZE"},{prim:"COMPARE"},{prim:"GE"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"FUNDING BLOCKED SINCE PARAMS ARE INVALID"}]},{prim:"FAILWITH"}],[]]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}]]}],[{prim:"IF_LEFT",args:[[{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"AMOUNT"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"TO FUND CONTRACT, PLEASE USE THE DEFAULT ENTRYPOINT"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"3"}]},{prim:"SENDER"},{prim:"MEM"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ONLY FOR SIGNERS"}]},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"nat"},{int:"1"}]},{prim:"DUP",args:[{int:"6"}]},{prim:"ADD"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"4"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"4"}]},{prim:"DUP",args:[{int:"6"}]},{prim:"DUP",args:[{int:"6"}]},{prim:"MEM"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"KEY_EXISTS"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[{prim:"DUP",args:[{int:"6"}]},{prim:"EMPTY_SET",args:[{prim:"address"}]},{prim:"PUSH",args:[{prim:"bool"},{prim:"True"}]},{prim:"SENDER"},{prim:"UPDATE"},{prim:"DUP",args:[{int:"3"}]},{prim:"PAIR"},{prim:"SOME"},{prim:"DUP",args:[{int:"7"}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"5"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"5"}]}]]},{prim:"DROP",args:[{int:"1"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}],[{prim:"DUP",args:[{int:"6"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"INVALID OP ID"}]},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"AMOUNT"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"TO FUND CONTRACT, PLEASE USE THE DEFAULT ENTRYPOINT"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"4"}]},{prim:"SENDER"},{prim:"MEM"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ONLY FOR SIGNERS"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP"},{prim:"CDR"},{prim:"SENDER"},{prim:"MEM"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ALREADY APPROVED"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"7"}]},{prim:"DUP",args:[{int:"8"}]},{prim:"DUP",args:[{int:"4"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"ASSET_NOT_FOUND"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[]]},{prim:"UNPAIR"},{prim:"SWAP"},{prim:"DROP",args:[{int:"1"}]},{prim:"DUP",args:[{int:"9"}]},{prim:"DUP",args:[{int:"5"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"ASSET_NOT_FOUND"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[]]},{prim:"CDR"},{prim:"PUSH",args:[{prim:"bool"},{prim:"True"}]},{prim:"SENDER"},{prim:"UPDATE"},{prim:"SWAP"},{prim:"PAIR"},{prim:"SOME"},{prim:"DUP",args:[{int:"4"}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"2"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}]]}]]}],[{prim:"DUP",args:[{int:"6"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"INVALID OP ID"}]},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"AMOUNT"},{prim:"COMPARE"},{prim:"EQ"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"TO FUND CONTRACT, PLEASE USE THE DEFAULT ENTRYPOINT"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"4"}]},{prim:"SENDER"},{prim:"MEM"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"ONLY FOR SIGNERS"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"5"}]},{prim:"DUP",args:[{int:"2"}]},{prim:"CDR"},{prim:"SIZE"},{prim:"COMPARE"},{prim:"GE"},{prim:"NOT"},{prim:"IF",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"NOT YET APPROVED"}]},{prim:"FAILWITH"}],[]]},{prim:"DUP",args:[{int:"7"}]},{prim:"DUP",args:[{int:"3"}]},{prim:"GET"},{prim:"IF_NONE",args:[[{prim:"PUSH",args:[{prim:"string"},{string:"pending_ops"}]},{prim:"PUSH",args:[{prim:"string"},{string:"ASSET_NOT_FOUND"}]},{prim:"PAIR"},{prim:"FAILWITH"}],[]]},{prim:"CAR"},{prim:"PUSH",args:[{prim:"unit"},{prim:"Unit"}]},{prim:"EXEC"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"8"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"8"}]},{prim:"DUP",args:[{int:"7"}]},{prim:"NONE",args:[{prim:"pair",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"list",args:[{prim:"operation"}]}]},{prim:"set",args:[{prim:"address"}]}]}]},{prim:"DUP",args:[{int:"4"}]},{prim:"UPDATE"},{prim:"DIP",args:[{int:"1"},[{prim:"DIG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"1"}]}]]},{prim:"DUG",args:[{int:"6"}]},{prim:"DROP",args:[{int:"2"}]},{prim:"PAIR",args:[{int:"6"}]},{prim:"DIG",args:[{int:"1"}]},{prim:"PAIR"}]]}]]}],makeStorageJSON=(_,a,$)=>({owner:_,signers:a,threshold:$,last_op_id:"0",pending_ops:[],metadata:[]}),toOperation$4=_=>({type:"contract_origination",sender:parsePkh(_.sender),code:contract,storage:makeStorageJSON(_.sender,_.signers.map(a=>a.val),String(_.threshold))}),SelectApproversFormPage=_=>{const{goBack:a,sender:$,...j}=_,et=useForm({mode:"onBlur",defaultValues:{sender:$.address.pkh,signers:[{val:""}],threshold:1,...formDefaultValues(j)}}),{formState:{errors:tt,isValid:rt},control:nt,register:it,handleSubmit:ot,getValues:st,watch:ct}=et,ut=useFieldArray({control:nt,name:"signers",rules:{minLength:1}}),ht=ct("signers").length,Et=useOpenSignPageFormAction({SignPage:SignTransactionFormPage,signPageExtraData:ct(),FormPage:SelectApproversFormPage,defaultFormPageProps:_,toOperation:toOperation$4}),{onFormSubmitActionHandlers:[St],isLoading:Mt}=useHandleOnSubmitFormActions([Et]);return jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalBackButton,{onClick:a}),jsxRuntimeExports.jsxs("form",{onSubmit:ot(St),children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Select the participants of the contract and choose the minimum number of approvals.",title:"Select Approvers"}),jsxRuntimeExports.jsxs(ModalBody,{children:[ut.fields.map((kt,Ct)=>{var jt;const Ot=tt.signers&&tt.signers[Ct],zt=`${Ct===0?"Select ":""}${ordinal$1(Ct+1)} approver`,Ut=ht>1?"short":"default",Vt=Ut==="short"?"368px":"100%";return jsxRuntimeExports.jsxs(FormControl,{display:"inline-block",width:Vt,marginBottom:"8px","data-testid":`signer-input-${Ct}`,isInvalid:!!Ot,children:[jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!0,inputName:`signers.${Ct}.val`,label:zt,size:Ut,style:{width:Vt},validate:$t=>{if(!isValidImplicitPkh($t))return"Signer must be valid TZ address";const Bt=st("signers").map(Nt=>Nt.val);if(Bt.length>new Set(Bt).size)return"Duplicate approver"}}),ht>1&&jsxRuntimeExports.jsx(IconButton,{position:"absolute",height:"24px",marginTop:"-36px",marginLeft:"374px",background:colors.gray[500],"aria-label":"Remove","data-testid":`remove-signer-${Ct}`,icon:jsxRuntimeExports.jsx(TrashIcon,{width:"12px",height:"14px",stroke:colors.gray[300]}),isRound:!0,onClick:()=>ut.remove(Ct),size:"xs",variant:"tertiary"}),Ot&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":`signer-${Ct}-error`,children:(jt=Ot.val)==null?void 0:jt.message})]},kt.id)}),jsxRuntimeExports.jsx(Button,{paddingLeft:0,onClick:()=>ut.append({val:""}),variant:"specialCTA",children:"+ Add Approver"}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!tt.threshold,children:[jsxRuntimeExports.jsxs(FormLabel,{display:"inline",children:["Min No. of approvals:",jsxRuntimeExports.jsx(InputGroup,{display:"inline",marginLeft:"10px",children:jsxRuntimeExports.jsx(Input,{width:"60px",color:"white","data-testid":"threshold-input",step:1,type:"number",...it("threshold",{valueAsNumber:!0,required:"No. of approvals is required",max:{value:ht,message:`Max no. of approvals is ${ht}`},min:{value:1,message:"Min no. of approvals is 1"}})})})]}),jsxRuntimeExports.jsxs(Text,{display:"inline","data-testid":"max-signers",children:["out of ",ht]}),tt.threshold&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"threshold-error",children:tt.threshold.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!rt,isLoading:Mt,size:"lg",type:"submit",children:"Review"})})]})]})})},NameMultisigFormPage=({name:_})=>{const a=useForm({mode:"onBlur",defaultValues:{name:_||""}}),{formState:{errors:$,isValid:j},register:et,handleSubmit:tt}=a,rt=useImplicitAccounts(),nt=useGetMostFundedImplicitAccount(),{openWith:it}=reactExports.useContext(DynamicModalContext),ot=({name:ct})=>it(jsxRuntimeExports.jsx(SelectApproversFormPage,{form:{name:ct.trim()},goBack:()=>it(jsxRuntimeExports.jsx(NameMultisigFormPage,{name:ct})),sender:nt(rt)})),st=useValidateName();return jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:tt(ot),children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Name your account. The account name will only appear in your local Umami app.",title:"Account Name"}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!$.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Account Name"}),jsxRuntimeExports.jsx(InputGroup,{children:jsxRuntimeExports.jsx(Input,{"data-testid":"multisig-account-name",type:"text",...et("name",{validate:st}),placeholder:"Account Name"})}),$.name&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"name-error",children:$.name.message})]})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!j,size:"lg",type:"submit",children:"Continue"})})]})})})},AccountsList=()=>{const _=useAllAccounts(),a=useAppSelector(tt=>tt.assets.balances.mutez),$=lodashExports.groupBy(_,getAccountGroupLabel),{openWith:j}=reactExports.useContext(DynamicModalContext),et=Object.entries($).map(([tt,rt])=>jsxRuntimeExports.jsx(AccountGroup,{accounts:rt,balances:a,groupLabel:tt},tt));return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Box,{height:"100%",marginRight:0,children:jsxRuntimeExports.jsxs(NestedScroll,{children:[lodashExports.compact(et),jsxRuntimeExports.jsx(Button,{width:"100%",height:"90px",background:colors.black,border:"1px dashed",borderColor:colors.gray[500],onClick:()=>j(jsxRuntimeExports.jsx(NameMultisigFormPage,{})),variant:"outline",children:jsxRuntimeExports.jsxs(Text,{display:"block",width:"100%",margin:"20px",color:colors.gray[400],textAlign:"center",children:[jsxRuntimeExports.jsx(KeyIcon,{marginRight:"4px"}),"Create New Multisig"]})})]})})})},useGetDelegationPrettyDisplayValues=()=>{const _=useGetAccountBalance();return a=>{const $=_(a.sender),j=new Date,et=prettyTezAmount(a.amount),tt=$&&prettyTezAmount($),rt=`Since ${formatRelative(new Date(a.timestamp),j)}`;return{initialBalance:et,currentBalance:tt,duration:rt}}},SignPage$4=_=>{const{mode:a,operations:$}=_,{fee:j,operations:et,estimationFailed:tt,isLoading:rt,form:nt,signer:it,reEstimate:ot,onSign:st}=useSignPageHelpers($,a),ct=et.operations[0].recipient;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:et.type,signer:et.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:it.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(SignPageFee,{fee:j})})}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ct}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:rt,operationType:et.type,reEstimate:ot,sender:et.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:tt,isLoading:rt,onSubmit:st,signer:it,text:headerText(et.type,a)})})]})})})},FormPage$3=_=>{var ct;const a=(ct=_.form)==null?void 0:ct.baker,$=useOpenSignPageFormAction({SignPage:SignPage$4,signPageExtraData:void 0,FormPage:FormPage$3,defaultFormPageProps:_,toOperation:toOperation$3}),j=useAddToBatchFormAction(toOperation$3),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(_)}),{formState:{isValid:it,errors:ot},handleSubmit:st}=nt;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{"data-testid":"delegate-form",children:[jsxRuntimeExports.jsxs(HeaderWrapper,{children:[jsxRuntimeExports.jsx(Text,{fontWeight:"600",size:"2xl",children:a?"Change Baker":"Delegate"}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!!_.sender,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px","data-testid":"baker",isInvalid:!!ot.baker,children:[jsxRuntimeExports.jsx(BakersAutocomplete,{allowUnknown:!0,inputName:"baker",label:"Baker"}),ot.baker&&jsxRuntimeExports.jsx(FormErrorMessage,{children:ot.baker.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:st(tt),onSingleSubmit:st(et)})})]})})})},toOperation$3=_=>({type:"delegation",sender:parsePkh(_.sender),recipient:parseImplicitPkh(_.baker)}),SignPage$3=_=>{const{mode:a,operations:$}=_,{fee:j,operations:et,estimationFailed:tt,isLoading:rt,form:nt,signer:it,reEstimate:ot,onSign:st}=useSignPageHelpers($,a);return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:et.type,signer:et.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:it.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",paddingX:"4px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:j})}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:rt,operationType:et.type,reEstimate:ot,sender:et.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:tt,isLoading:rt,onSubmit:st,signer:it,text:headerText(et.type,a)})})]})})})},FormPage$2=_=>{var st;const{sender:a}=_,$=(st=_.form)==null?void 0:st.baker,j=useOpenSignPageFormAction({SignPage:SignPage$3,signPageExtraData:void 0,FormPage:FormPage$2,defaultFormPageProps:{sender:a},toOperation:toOperation$2}),et=useAddToBatchFormAction(toOperation$2),{onFormSubmitActionHandlers:[tt,rt],isLoading:nt}=useHandleOnSubmitFormActions([j,et]),it=useForm({mode:"onBlur",defaultValues:formDefaultValues({sender:a})}),{handleSubmit:ot}=it;return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{"data-testid":"undelegate-form",children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Select preview to end delegation or insert this transaction into a Batch.",title:"End Delegation"}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormControl,{children:jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"Baker"}),$&&jsxRuntimeExports.jsx(AddressTile,{address:parsePkh($)})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:nt,isValid:!0,onAddToBatch:ot(rt),onSingleSubmit:ot(tt)})})]})})})},toOperation$2=_=>({type:"undelegation",sender:parsePkh(_.sender)}),Row=({label:_,value:a,...$})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"50px",padding:"16px","data-testid":_,...$,children:[jsxRuntimeExports.jsx(Box,{flex:1,children:jsxRuntimeExports.jsx(Heading,{color:colors.gray[400],size:"sm",children:_})}),jsxRuntimeExports.jsx(Box,{flex:1,children:typeof a=="string"?jsxRuntimeExports.jsx(Text,{size:"sm",children:a}):a})]}),DelegationDisplay=({delegation:_,account:a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext),j=useGetOwnedAccount(),et=useGetDelegationPrettyDisplayValues();if(!_)return jsxRuntimeExports.jsx(NoDelegations,{onDelegate:()=>$(jsxRuntimeExports.jsx(FormPage$3,{sender:a})),size:"md"});const{currentBalance:tt,duration:rt,initialBalance:nt}=et(_),{sender:it,delegate:{address:ot}}=_,st=j(it);return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Row,{borderBottom:`1px solid ${colors.gray[700]}`,borderTopRadius:"8px",_odd:{bg:colors.gray[800]},label:"Initial Balance:",value:nt}),tt&&jsxRuntimeExports.jsx(Row,{_odd:{bg:colors.gray[800]},label:"Current Balance:",value:tt}),jsxRuntimeExports.jsx(Row,{borderBottom:`1px solid ${colors.gray[700]}`,_odd:{bg:colors.gray[800]},label:"Duration:",value:rt}),jsxRuntimeExports.jsx(Row,{borderBottomRadius:"8px",_odd:{bg:colors.gray[800]},label:"Baker:",value:jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.delegate.address)})}),jsxRuntimeExports.jsxs(Flex,{marginTop:"24px",children:[jsxRuntimeExports.jsx(Button,{flex:1,marginRight:"16px",onClick:()=>$(jsxRuntimeExports.jsx(FormPage$2,{form:{sender:it,baker:ot},sender:st})),variant:"warning",children:"End Delegation"}),jsxRuntimeExports.jsx(Button,{flex:1,onClick:()=>$(jsxRuntimeExports.jsx(FormPage$3,{form:{sender:it,baker:ot},sender:st})),variant:"tertiary",children:"Change Baker"})]})]})},MultisigDecodedOperation=({operation:_})=>{switch(_.type){case"delegation":return jsxRuntimeExports.jsxs(Box,{"data-testid":"decoded-item-delegate",marginY:6,children:[jsxRuntimeExports.jsx(Text,{marginRight:"3px",color:colors.gray[450],fontSize:"14px",children:"Delegate to:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.recipient})]});case"undelegation":return jsxRuntimeExports.jsx(Box,{"data-testid":"decoded-item-undelegate",marginY:6,children:jsxRuntimeExports.jsx(Text,{color:colors.gray[450],fontSize:"14px",children:"End Delegation"})});case"tez":case"fa1.2":case"fa2":return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(MultisigOperationAmount,{operation:_}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"8px",children:[jsxRuntimeExports.jsx(Text,{marginRight:"3px",color:colors.gray[450],fontSize:"14px",children:"Send to:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.recipient})]})]});case"contract_origination":case"contract_call":throw new Error(`${_.type} is not supported yet`)}},MultisigOperationAmount=({operation:_})=>{const a=useGetToken();switch(_.type){case"tez":return jsxRuntimeExports.jsxs(Flex,{alignItems:"center","data-testid":"decoded-tez-amount",children:[jsxRuntimeExports.jsx(OutgoingArrow,{}),jsxRuntimeExports.jsxs(Text,{marginLeft:"8px",color:colors.orange,fontSize:"14px",fontWeight:600,textAlign:"center",children:["-",prettyTezAmount(_.amount)]})]});case"fa1.2":case"fa2":{const $=a(_.contract.pkh,_.tokenId);if(!$)return null;const j=tokenNameSafe($),et=$.type==="nft";return jsxRuntimeExports.jsxs(Flex,{alignItems:"center","data-testid":"decoded-fa-amount",children:[jsxRuntimeExports.jsx(OutgoingArrow,{}),jsxRuntimeExports.jsx(Box,{marginLeft:"8px",color:colors.orange,textAlign:"center",children:et?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{display:"inline",marginRight:"3px",fontSize:"14px",fontWeight:600,children:_.amount}),jsxRuntimeExports.jsx(Text,{display:"inline",color:"white",fontSize:"14px",fontWeight:600,children:j})]}):jsxRuntimeExports.jsxs(Text,{fontSize:"14px",fontWeight:600,children:["-",tokenPrettyAmount(_.amount,$,{showSymbol:!0})]})})]})}case"delegation":case"undelegation":case"contract_origination":case"contract_call":return null}},caseInsensitiveLiteral=_=>z.string().regex(new RegExp(`^${_}$`,"i")),prim=_=>z.object({prim:caseInsensitiveLiteral(_)}),pushKeyHashSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("key_hash")}),z.object({bytes:z.string()})])}),pushAddressSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("address")}),z.object({bytes:z.string()})])}),pair=(_,a)=>z.object({prim:z.literal("Pair"),args:z.tuple([_,a])}),contractZeroTezSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("mutez")}),z.object({int:z.literal("0")})])}),lambdaEndSchema=[prim("TRANSFER_TOKENS"),prim("CONS")],contractHeadSchema=z.object({prim:z.literal("CONTRACT")}),batchHeadSchema=z.tuple([z.object({prim:z.literal("DROP")}),z.object({prim:z.literal("NIL"),args:z.array(z.object({prim:z.literal("operation")}))})]),pushMutezSchema=z.object({prim:z.literal("PUSH"),args:z.tuple([z.object({prim:z.literal("mutez")}),z.object({int:z.string()})])}),tezSchema=z.tuple([pushKeyHashSchema,prim("IMPLICIT_ACCOUNT"),pushMutezSchema,prim("UNIT"),...lambdaEndSchema]),contractTezSchema=z.tuple([pushAddressSchema,contractHeadSchema,prim("IF_NONE"),pushMutezSchema,prim("UNIT"),...lambdaEndSchema]),setDelegateSchema=z.tuple([pushKeyHashSchema,prim("SOME"),prim("SET_DELEGATE"),prim("CONS")]),removeDelegateSchema=z.tuple([z.object({prim:z.literal("NONE"),args:z.tuple([z.object({prim:z.literal("key_hash")})])}),prim("SET_DELEGATE"),prim("CONS")]),fa2Schema=z.tuple([pushAddressSchema,contractHeadSchema,z.tuple([prim("IF_NONE")]),contractZeroTezSchema,z.object({prim:z.literal("PUSH"),args:z.tuple([prim("list"),z.array(pair(z.object({bytes:z.string({description:"from"})}),z.array(pair(z.object({bytes:z.string({description:"to"})}),pair(z.object({int:z.string({description:"token_id"})}),z.object({int:z.string({description:"amount"})}))))))])}),...lambdaEndSchema]),fa1Schema=z.tuple([pushAddressSchema,contractHeadSchema,z.tuple([prim("IF_NONE")]),contractZeroTezSchema,z.object({prim:z.literal("PUSH"),args:z.tuple([prim("Pair"),pair(z.object({bytes:z.string({description:"from"})}),pair(z.object({bytes:z.string({description:"to"})}),z.object({int:z.string({description:"amount"})})))])}),...lambdaEndSchema]);class UnrecognizedMichelsonError extends Error{}const convertToPkh=_=>(_.length===42&&(_="00"+_),encodeAddress(_)),parseTez=_=>{const a=tezSchema.parse(_),$=a[0].args[1].bytes,j=a[2].args[1].int;return{type:"tez",recipient:parseImplicitPkh(convertToPkh($)),amount:j}},parseTezContract=_=>{const a=contractTezSchema.parse(_),$=a[0].args[1].bytes,j=a[3].args[1].int;return{type:"tez",recipient:parseContractPkh(convertToPkh($)),amount:j}},parseFa2=_=>{const a=fa2Schema.parse(_),$=parseContractPkh(convertToPkh(a[0].args[1].bytes));return a[4].args[1].flatMap(et=>{const tt=et.args[0].bytes;return et.args[1].map(rt=>{const nt=rt.args[0].bytes,it=rt.args[1].args[0].int,ot=rt.args[1].args[1].int;return{type:"fa2",contract:$,sender:parsePkh(convertToPkh(tt)),recipient:parsePkh(convertToPkh(nt)),tokenId:it,amount:ot}})})},parseFa1=_=>{const a=fa1Schema.parse(_),$=a[0],j=a[4].args[1],et=j.args[0].bytes,tt=j.args[1].args[0].bytes;return{type:"fa1.2",amount:j.args[1].args[1].int,contract:parseContractPkh(convertToPkh($.args[1].bytes)),recipient:parsePkh(convertToPkh(tt)),sender:parsePkh(convertToPkh(et)),tokenId:"0"}},parseSetDelegate=(_,a)=>{const $=setDelegateSchema.parse(_);return{type:"delegation",sender:a.address,recipient:parseImplicitPkh(convertToPkh($[0].args[1].bytes))}},parseRemoveDelegate=(_,a)=>({type:"undelegation",sender:a.address}),parsings=[{schema:tezSchema,parsingFn:parseTez},{schema:contractTezSchema,parsingFn:parseTezContract},{schema:fa2Schema,parsingFn:parseFa2},{schema:fa1Schema,parsingFn:parseFa1},{schema:setDelegateSchema,parsingFn:parseSetDelegate},{schema:removeDelegateSchema,parsingFn:parseRemoveDelegate}],parse=(_,a,$=[])=>{if(_.length===0)return $;for(let j=0;j{batchHeadSchema.parse(_.slice(0,2))},decode=(_,a)=>(assertHead(_),parse(_.slice(2),a)),parseRawMichelson=(_,a)=>{const $=JSON.parse(_);return decode($,a)},MultisigDecodedOperations=({rawMichelson:_,sender:a})=>{try{const $=parseRawMichelson(_,a);return jsxRuntimeExports.jsx(Box,{borderRadius:"8px",backgroundColor:colors.gray[900],children:$.map((j,et)=>jsxRuntimeExports.jsxs(Box,{width:"100%",paddingTop:"10px",paddingBottom:et<$.length-1?0:"15px",paddingX:"15px",children:[jsxRuntimeExports.jsx(MultisigDecodedOperation,{operation:j}),et<$.length-1&&jsxRuntimeExports.jsx(Divider,{marginTop:"15px"})]},et))})}catch($){return $ instanceof UnrecognizedMichelsonError?jsxRuntimeExports.jsx(UnrecognizedOperation,{rawMichelson:_}):jsxRuntimeExports.jsxs(Box,{height:"50px",padding:"10px",background:colors.gray[900],borderRadius:"8px",children:["Invalid michelson code: ",$.message]})}},UnrecognizedOperation=({rawMichelson:_})=>jsxRuntimeExports.jsx(Accordion,{width:"100%",marginBottom:"8px",background:colors.gray[900],borderColor:colors.gray[900],borderRadius:"8px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{children:[jsxRuntimeExports.jsxs(AccordionButton,{children:[jsxRuntimeExports.jsx(Heading,{flex:"1",height:"30px",marginTop:"6px",textAlign:"left",size:"md",children:"Unrecognized operation"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{overflowY:"scroll",height:"400px",paddingBottom:"12px",children:jsxRuntimeExports.jsx(JsValueWrap,{space:1,value:JSON.parse(_)})})]})}),MultisigActionButton=({approveOrExecute:_,isLoading:a,signerState:$})=>{switch($){case"awaitingApprovalByExternalSigner":return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",alignSelf:"flex-end","data-testid":"multisig-signer-awaiting-approval",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[300],children:"Awaiting Approval"}),jsxRuntimeExports.jsx(HourglassIcon,{marginTop:"2px"})]});case"approved":return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",alignSelf:"flex-end",marginBottom:"8px","data-testid":"multisig-signer-approved",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[300],children:"Approved"}),jsxRuntimeExports.jsx(CheckmarkIcon,{marginTop:"2px"})]});case"executable":return jsxRuntimeExports.jsx(Button,{"data-testid":"multisig-signer-button",isLoading:a,onClick:_,children:"Execute"});case"approvable":return jsxRuntimeExports.jsx(Button,{"data-testid":"multisig-signer-button",isLoading:a,onClick:_,children:"Approve"})}},SignPage$2=({signer:_,operation:a,actionType:$,transactionCount:j})=>{const{handleAsyncAction:et}=useAsyncActionHandler(),{openWith:tt}=reactExports.useContext(DynamicModalContext),rt=useForm({defaultValues:{executeParams:a.estimates}}),nt={...a,estimates:rt.watch("executeParams")},it=st=>et(async()=>{const{opHash:ct}=await executeOperations(nt,st);return tt(jsxRuntimeExports.jsx(SuccessStep,{hash:ct}))},{title:`Failed ${$}`}),ot=`${lodashExports.capitalize($)} transaction`;return jsxRuntimeExports.jsx(FormProvider,{...rt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(BatchModalBody,{operation:nt,title:ot,transactionCount:j,children:jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{onSubmit:it,signer:_,text:ot})})]})})})},MultisigSignerTile=({pendingApprovals:_,sender:a,operation:$,signerAddress:j})=>{const et=useAddressKind$1(j),tt=useGetImplicitAccountSafe(),{isLoading:rt,handleAsyncAction:nt}=useAsyncActionHandler(),{openWith:it}=reactExports.useContext(DynamicModalContext),ot=useSelectedNetwork(),st=tt(j.pkh),ct=_===0,ut=()=>nt(async()=>{if(!st)throw new Error("Can't approve or execute with an account you don't own");const Et=ct?"execute":"approve",St=makeAccountOperations(st,st,[makeMultisigApproveOrExecuteOperation(a.address,Et,$.id)]),Mt=await estimate(St,ot);let kt;try{kt=parseRawMichelson($.rawActions,a).length}catch{kt=1}return it(jsxRuntimeExports.jsx(SignPage$2,{actionType:Et,operation:Mt,signer:st,transactionCount:kt}))}),ht=getMultisigSignerState({approvals:$.approvals,signerAddress:j,operationIsExecutable:ct,signerAccount:st});return jsxRuntimeExports.jsx(AccountTileBase,{height:"80px",marginTop:"10px",marginBottom:"0",padding:"15px",borderRadius:"8px",backgroundColor:colors.gray[700],icon:jsxRuntimeExports.jsx(AddressTileIcon,{addressKind:et,size:"lg"}),leftElement:jsxRuntimeExports.jsx(LabelAndAddress,{label:et.label,pkh:et.pkh}),rightElement:jsxRuntimeExports.jsx(MultisigActionButton,{approveOrExecute:ut,"data-testid":"multisig-signer-button",isLoading:rt,signerState:ht})})},getMultisigSignerState=({signerAccount:_,operationIsExecutable:a,approvals:$,signerAddress:j})=>{const et=!!$.find(tt=>tt.pkh===j.pkh);return _?et&&!a?"approved":a?"executable":"approvable":et?"approved":"awaitingApprovalByExternalSigner"},MultisigPendingOperation=({operation:_,sender:a})=>{const{signers:$,threshold:j}=a,et=Math.max(j-_.approvals.length,0);return jsxRuntimeExports.jsxs(Box,{marginBottom:"24px",background:colors.gray[800],border:"none",borderRadius:"8px","data-testid":"multisig-pending-operation-"+_.id,paddingX:"16px",paddingY:"15px",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"6px",padding:0,textAlign:"left",children:[jsxRuntimeExports.jsxs(Heading,{size:"md",children:["Pending #",_.id]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginBottom:"6px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Pending Approvals:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"pending-approvals-count",children:et})]})]}),jsxRuntimeExports.jsxs(Box,{padding:"0",children:[jsxRuntimeExports.jsx(MultisigDecodedOperations,{rawMichelson:_.rawActions,sender:a}),$.map(tt=>jsxRuntimeExports.jsx(MultisigSignerTile,{operation:_,pendingApprovals:et,sender:a,signerAddress:tt},tt.pkh))]})]})},MultisigPendingOperations=({account:_})=>{const $=useGetPendingMultisigOperations()(_);return jsxRuntimeExports.jsx(Box,{margin:"0",padding:"0",children:$.map(j=>jsxRuntimeExports.jsx(MultisigPendingOperation,{operation:j,sender:_},j.id))})},ViewAllLink=({to:_,owner:a,...$})=>jsxRuntimeExports.jsx(Center,{...$,children:jsxRuntimeExports.jsxs(Link$1,{as:Link,color:colors.gray[300],stroke:colors.gray[450],_hover:{color:colors.green,stroke:colors.green},to:`${_}?accounts=${a}`,children:[jsxRuntimeExports.jsx(RefreshClockIcon,{display:"inline",stroke:"inherit"}),jsxRuntimeExports.jsx(Text,{display:"inline",size:"sm",children:" View All"})]})}),MAX_NFTS_SIZE=18,NFTsGrid=({owner:_,nfts:a,...$})=>{if(a.length===0)return jsxRuntimeExports.jsx(NoNFTs,{size:"md"});const j=sortedByLastUpdate(a).slice(0,MAX_NFTS_SIZE);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SimpleGrid,{marginBottom:"35px",spacing:"12px",...$,children:j.map(et=>{const tt=getIPFSurl(thumbnailUri(et)),nt={width:"100%",height:40,fallbackSrc:getIPFSurl(et.displayUri),src:tt};return jsxRuntimeExports.jsx(Link,{"data-testid":"nft-link",to:`/home/${_}/${fullId(et)}`,children:jsxRuntimeExports.jsx(Card,{background:colors.gray[800],border:"1px solid transparent",_hover:{background:colors.gray[700],borderColor:colors.gray[500]},children:jsxRuntimeExports.jsxs(CardBody,{overflow:"hidden",padding:"8px",borderRadius:"6px",children:[jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsxs(Box,{position:"relative",width:"100%",height:"100%",children:[jsxRuntimeExports.jsx(AspectRatio,{zIndex:2,width:"100%",opacity:"0",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{...nt,width:"100%",height:40})}),jsxRuntimeExports.jsx(AspectRatio,{position:"absolute",zIndex:0,top:"0",width:"100%",filter:"blur(20px)",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{...nt,width:"100%",height:40})}),jsxRuntimeExports.jsx(AspectRatio,{position:"absolute",zIndex:1,top:"0",width:"100%",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{...nt,width:"100%",height:40})})]})}),Number(et.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"20px",marginTop:"-24px",marginLeft:"4px",padding:"0 8px",borderRadius:"100px",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",size:"xs",children:"x"+et.balance})]})})},`${_}:${fullId(et)}`)})}),a.length>MAX_NFTS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{marginBottom:"40px",owner:_,to:"/nfts"})]})},OperationTileContext=React$2.createContext({mode:"page"}),FEE_FIELDS=["bakerFee","storageFee","allocationFee"],Fee=({operation:_})=>{const a=reactExports.useContext(OperationTileContext),j=useIsOwnedAddress()(_.sender.address);if(a.mode==="drawer"||!j)return null;const et=FEE_FIELDS.reduce((tt,rt)=>rt in _?tt.plus(lodashExports.get(_,rt)||0):tt,BigNumber(0));return et.eq(0)?null:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"md",children:"Fee:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"fee",children:prettyTezAmount(et)})]})},useGetOperationDestination=(_,a)=>{const $=useIsOwnedAddress(),j=$(_),et=$(a);return!j&&!et?"unrelated":j?"outgoing":"incoming"},operationSign=_=>{switch(_){case"incoming":return"+";case"outgoing":return"-";case"unrelated":return""}},operationColor=_=>{switch(_){case"incoming":return colors.green;case"outgoing":return colors.orange;case"unrelated":return"white"}},InternalPrefix=({operation:_})=>{var et,tt,rt;let a,$;switch(_.type){case"transaction":a=(et=_.target)==null?void 0:et.address,$=_.sender.address;break;case"origination":case"delegation":a=null,$=_.sender.address;break;case"token_transfer":a=(tt=_.to)==null?void 0:tt.address,$=(rt=_.from)==null?void 0:rt.address;break}return useGetOperationDestination($,a)!=="unrelated"?null:jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],"data-testid":"internal-prefix",size:"md",children:"Internal:"})},OperationStatus=({level:_,status:a})=>{const $=useIsBlockFinalised(_);return a===void 0||a==="applied"?$?jsxRuntimeExports.jsx(CheckmarkIcon,{"data-testid":"checkmark"}):jsxRuntimeExports.jsx(HourglassIcon,{"data-testid":"hourglass"}):jsxRuntimeExports.jsx(CrossedCircleIcon,{"data-testid":"crossed-circle"})},OperationTypeWrapper=({children:_})=>reactExports.useContext(OperationTileContext).mode==="drawer"?null:jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[300],"data-testid":"operation-type",size:"sm",children:_}),Timestamp=({timestamp:_})=>_?jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"timestamp",size:"sm",children:getDisplayTimestamp(_)}):null,getDisplayTimestamp=_=>{const a=new Date,$=new Date(_);return differenceInDays(a,$)<2?formatDistance($,a,{addSuffix:!0}):format($,"dd MMM yyyy")},TzktLink$1=({hash:_,counter:a,transactionId:$,originationId:j,migrationId:et,children:tt,...rt})=>{const{tzktExplorerUrl:nt}=useSelectedNetwork();let it=nt;return _?it=lodashExports.compact([nt,_,a]).join("/"):et?it=`${it}/migrations/${et}`:j?it=`${it}/originations/${j}`:$?it=`${it}/transactions/${$}`:console.warn("No id provided to TzktLink"),jsxRuntimeExports.jsx(Link$1,{"data-testid":"tzkt-link",href:it,isExternal:!0,...rt,children:tt})},ContractCallTile=({operation:_})=>{var a;return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-contract-call",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(ContractIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsxs(Heading,{size:"md",children:["Contract Call: ",(a=_.parameter)==null?void 0:a.entrypoint]})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[_.target&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.target})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.sender})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Contract Call"}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},DelegationTile=({operation:_})=>{const a=_.newDelegate?"Delegate":"Delegation Ended";return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-delegation",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(BakerIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsx(Heading,{size:"md",children:a})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[_.newDelegate&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.newDelegate})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.sender})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:a}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},OriginationTile=({operation:_})=>{var j;const $=((j=_.originatedContract)==null?void 0:j.codeHash)===CODE_HASH&&_.originatedContract.typeHash===TYPE_HASH?"Multisig Account Created":"Contract Origination";return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-origination",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(ContractIcon,{marginRight:"8px"}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsx(Heading,{size:"md",children:$})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.sender})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Contract Origination"}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},TransactionDirectionIcon=({destination:_,...a})=>_==="outgoing"?jsxRuntimeExports.jsx(OutgoingArrow,{"data-testid":"outgoing-arrow",...a}):_==="incoming"?jsxRuntimeExports.jsx(IncomingArrow,{"data-testid":"incoming-arrow",...a}):jsxRuntimeExports.jsx(ContractIcon,{"data-testid":"unrelated-operation-icon",...a}),TokenTransferTile=({operation:_,tokenTransfer:a,token:$})=>{var ct,ut;const j=a.amount,et=useGetOperationDestination((ct=a.from)==null?void 0:ct.address,(ut=a.to)==null?void 0:ut.address),tt=$.type==="nft",rt=tokenPrettyAmount(j,$,{showSymbol:!0}),nt=operationColor(et),it=tt?"white":nt,ot=operationSign(et),st=tt?jsxRuntimeExports.jsx(Tooltip,{padding:"8px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px","data-testid":"nft-tooltip",label:jsxRuntimeExports.jsx(AspectRatio,{width:"170px",height:"170px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{src:getIPFSurl(thumbnailUri($))})}),openDelay:300,children:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(InternalPrefix,{operation:_||a}),jsxRuntimeExports.jsxs(TzktLink$1,{marginRight:"8px",color:it,"data-testid":"title",migrationId:a.migrationId,originationId:a.originationId,transactionId:a.transactionId,children:[jsxRuntimeExports.jsxs(Text,{display:"inline",color:nt,fontWeight:"600",children:[ot,rt]}),jsxRuntimeExports.jsxs(Text,{display:"inline",fontWeight:"600",children:[" ",tokenNameSafe($)]})]})]})}):jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(InternalPrefix,{operation:_||a}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",color:it,"data-testid":"title",migrationId:a.migrationId,originationId:a.originationId,transactionId:a.transactionId,children:jsxRuntimeExports.jsxs(Text,{display:"inline",color:nt,fontWeight:"600",children:[ot,rt]})})]});return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-token-transfer",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(TransactionDirectionIcon,{marginRight:"8px",destination:et}),st,_&&jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:a.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[a.to&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:a.to})]}),a.from&&jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:a.from})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Token Transfer"}),jsxRuntimeExports.jsx(OperationStatus,{level:a.level})]})]})})]})},TransactionTile=({operation:_})=>{var tt;const a=useGetOperationDestination(_.sender.address,(tt=_.target)==null?void 0:tt.address),$=prettyTezAmount(String(_.amount)),j=operationColor(a),et=operationSign(a);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",width:"100%","data-testid":"operation-tile-transaction",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",marginBottom:"10px",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(TransactionDirectionIcon,{marginRight:"8px",destination:a}),jsxRuntimeExports.jsx(InternalPrefix,{operation:_}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",color:j,counter:_.counter,"data-testid":"title",hash:_.hash,children:jsxRuntimeExports.jsxs(Text,{color:j,fontWeight:"600",children:[et," ",$]})}),jsxRuntimeExports.jsx(Fee,{operation:_})]}),jsxRuntimeExports.jsx(Flex,{alignSelf:"flex-end",children:jsxRuntimeExports.jsx(Timestamp,{timestamp:_.timestamp})})]}),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Flex,{children:[_.target&&jsxRuntimeExports.jsxs(Flex,{marginRight:"15px","data-testid":"to",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.target.address)})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.sender.address)})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Transaction"}),jsxRuntimeExports.jsx(OperationStatus,{..._})]})]})})]})},OperationTile=({operation:_})=>{const a=useGetTokenTransfer();switch(_.type){case"token_transfer":{const $=fromRaw$1(_.token);return $?jsxRuntimeExports.jsx(TokenTransferTile,{token:$,tokenTransfer:_}):(console.warn(`Could not parse token transfer ${_.id}`),null)}case"transaction":{const $=!!_.parameter,j=a(_.id);if(j){const et=fromRaw$1(j.token);return et?jsxRuntimeExports.jsx(TokenTransferTile,{operation:_,token:et,tokenTransfer:j}):jsxRuntimeExports.jsx(TransactionTile,{operation:_})}else return $?jsxRuntimeExports.jsx(ContractCallTile,{operation:_}):jsxRuntimeExports.jsx(TransactionTile,{operation:_})}case"delegation":return jsxRuntimeExports.jsx(DelegationTile,{operation:_});case"origination":return jsxRuntimeExports.jsx(OriginationTile,{operation:_})}},MAX_OPERATIONS_SIZE=20,OperationListDisplay=({owner:_,operations:a})=>{if(a.length===0)return jsxRuntimeExports.jsx(NoOperations,{size:"md"});const $=a.slice(0,MAX_OPERATIONS_SIZE);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[$.map((j,et)=>jsxRuntimeExports.jsxs(Box,{height:"90px",children:[jsxRuntimeExports.jsx(OperationTile,{operation:j}),et<$.length-1&&jsxRuntimeExports.jsx(Divider,{marginY:"20px"})]},j.id)),a.length>MAX_OPERATIONS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{owner:_,to:"/operations"})]})},verifiedTokens=["KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o","KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn","KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW","KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW","KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW","KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV","KT1Ha4yFVeyzw6KRAdkzq6TxDHB97KG4pZe8","KT1JBNFcB5tiycHNdYGYCtR3kk6JaJysUCi8","KT1Xobej4mc6XgEjDoJoHtTKgbD1ELMvcQuL","KT1JVjgXPMMSaa6FkzeJcgb8q9cUaLmwaJUX","KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb","KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9","KT1914CUZ7EegAFPbfgQMRkw8Uz5mYkEz2ui","KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY","KT19ovJhcsUn4YU8Q5L3BGovKSixfbWcecEA","KT1TgmD7kXQzofpuc9VbTRMdZCS2e6JDuTtc","KT1F1mn2jbqQCJcsNgYKVAQjvenecNMY2oPK","KT1ErKVqEhG9jxXgUG2KGLW3bNM7zXHX8SDF","KT1A5P4ejnLix13jtadsfV9GCnXLMNnab8UT","KT1AM3PV1cwmGRw28DVTgsjjsjHvmL6z4rGh","KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY","KT1SjXiUX63QvdNMcM2m492f7kuf8JxXRLp4","KT1MZg99PxMDEENwB4Fi64xkqAVh5d1rv8Z9","KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY","KT1XTxpQvo7oRCqp85LikEZgAZ22uDxhbWJv","KT1VaEsVNiBoA56eToEK6n6BcPgh1tdx9eXi"],TokenNameWithIcon=({token:_,...a})=>{const $=verifiedTokens.includes(_.contract);return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Text,{...a,marginRight:"4px",children:tokenNameSafe(_)}),$&&jsxRuntimeExports.jsx(VerifiedIcon,{})]})},MAX_TOKENS_SIZE=20,TokenList=({owner:_,tokens:a})=>{if(a.length===0)return jsxRuntimeExports.jsx(NoTokens,{size:"md"});const $=a.slice(0,MAX_TOKENS_SIZE);return jsxRuntimeExports.jsxs(Box,{children:[$.map(j=>jsxRuntimeExports.jsx(TokenTile$1,{token:j},fullId(j))),a.length>MAX_TOKENS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{owner:_,to:"/tokens"})]})},TokenTile$1=({token:_})=>{const a=tokenPrettyAmount(_.balance,_,{showSymbol:!1});return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-around",height:20,borderBottom:`1px solid ${colors.gray[800]}`,"data-testid":"token-tile",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",flex:1,children:[jsxRuntimeExports.jsx(TokenIcon,{width:"38px",background:colors.gray[500],borderRadius:"4px",contract:_.contract}),jsxRuntimeExports.jsx(Box,{marginLeft:"16px",children:jsxRuntimeExports.jsx(TokenNameWithIcon,{fontWeight:600,"data-testid":"token-name",token:_})})]}),jsxRuntimeExports.jsx(Heading,{"data-testid":"token-balance",size:"lg",children:a})]})},buildTzktAddressUrl=(_,a)=>`${_.tzktExplorerUrl}/${a}`,useGetOperations=_=>{const a=useSelectedNetwork(),$=useAppDispatch(),j=useRefetchTrigger(),et=useReactQueryErrorHandler(),{isFetching:tt,data:rt,hasNextPage:nt,isLoading:it,fetchNextPage:ot,fetchPreviousPage:st,error:ct}=useInfiniteQuery({queryFn:({pageParam:ut})=>fetchOperationsAndUpdateTokensInfo($,a,_,ut),queryKey:["operations",_,$,a],initialPageParam:{},retry:3,retryDelay:ut=>ut*2e3,gcTime:0,refetchOnWindowFocus:!1,getNextPageParam:ut=>ut.length===0?null:{lastId:ut[ut.length-1].id},getPreviousPageParam:(ut,ht)=>{var St;const Et=(St=lodashExports.maxBy(ht.flat(),"id"))==null?void 0:St.id;return Et?{lastId:Et,sort:"asc"}:{}},select:({pages:ut})=>filterDuplicatedTokenTransfers([[...ut[0]].sort((ht,Et)=>ht.id{const ut=setInterval(()=>void st(),BLOCK_TIME);return()=>clearInterval(ut)},[st]),reactExports.useEffect(()=>{st()},[j,st]),{operations:rt||[],isFirstLoad:it,isLoading:tt,hasMore:nt,loadMore:ot}},fetchOperationsAndUpdateTokensInfo=async(_,a,$,j)=>{const et=await getCombinedOperations($.map(ot=>ot.address.pkh),a,j),tt=et.filter(ot=>ot.type==="transaction").map(ot=>ot.id),rt=await getRelatedTokenTransfers(tt,a),nt=et.filter(ot=>ot.type==="token_transfer"),it=[...rt,...nt];return _(assetsActions.updateTokenTransfers(it)),_(tokensActions.addTokens({network:a,tokens:it.map(ot=>ot.token)})),et},filterDuplicatedTokenTransfers=_=>{const a=new Set(_.filter($=>$.type!=="token_transfer").map($=>$.id));return _.filter($=>$.type!=="token_transfer"||!a.has($.transactionId))},SmallTab=({children:_,...a})=>jsxRuntimeExports.jsx(Tab,{...a,fontSize:"sm",paddingX:3,children:_}),AssetsPanel=({tokens:_,nfts:a,account:$,delegation:j})=>{const et=useGetPendingMultisigOperations(),tt=$.type==="multisig"&&et($).length>0,rt=useSelectedNetwork(),{operations:nt,isFirstLoad:it}=useGetOperations([$]);return jsxRuntimeExports.jsxs(Tabs,{flexDirection:"column",display:"flex",width:"100%",marginTop:"60px","data-testid":"asset-panel",children:[jsxRuntimeExports.jsxs(TabList,{justifyContent:"space-between","data-testid":"asset-panel-tablist",children:[jsxRuntimeExports.jsxs(Flex,{children:[tt&&jsxRuntimeExports.jsxs(SmallTab,{"data-testid":"account-card-pending-tab",children:[jsxRuntimeExports.jsx(Text,{children:"Pending"}),jsxRuntimeExports.jsx(Box,{width:"6px",height:"6px",marginTop:"-7px",marginRight:"-3px",marginLeft:"3px",borderRadius:"100%",backgroundColor:colors.orangeL})]}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-operations-tab",children:"Operations"}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-delegation-tab",children:"Delegation"}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-nfts-tab",children:"NFTs"}),jsxRuntimeExports.jsx(SmallTab,{"data-testid":"account-card-tokens-tab",children:"Tokens"})]}),jsxRuntimeExports.jsx(ExternalLink,{href:buildTzktAddressUrl(rt,$.address.pkh),children:jsxRuntimeExports.jsxs(Button,{paddingRight:0,variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{marginRight:"7px",size:"sm",children:"View on Tzkt"}),jsxRuntimeExports.jsx(ExternalLinkIcon,{stroke:"currentcolor"})]})})]}),jsxRuntimeExports.jsxs(TabPanels,{height:"100%",children:[tt&&jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px",paddingBottom:"60px","data-testid":"account-card-pending-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(MultisigPendingOperations,{account:$})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px",paddingBottom:"60px","data-testid":"account-card-operations-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsxs(OperationTileContext.Provider,{value:{mode:"drawer",selectedAddress:$.address},children:[jsxRuntimeExports.jsx(Center,{display:it?"flex":"none",height:"50px",children:jsxRuntimeExports.jsx(Image$1,{width:"150px",height:"75px",src:"./static/media/loading-wheel.gif"})}),!it&&jsxRuntimeExports.jsx(OperationListDisplay,{operations:nt,owner:$.address.pkh})]})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",paddingTop:"24px","data-testid":"account-card-delegation-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(DelegationDisplay,{account:$,delegation:j})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px",paddingBottom:0,"data-testid":"account-card-nfts-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(NFTsGrid,{columns:3,nfts:a,owner:$.address.pkh})}),jsxRuntimeExports.jsx(TabPanel,{overflowX:"hidden",height:"100%",paddingTop:"24px","data-testid":"account-card-tokens-tab-panel",paddingX:"0",children:jsxRuntimeExports.jsx(TokenList,{owner:$.address.pkh,tokens:_})})]})]})},MultisigApprovers=({signers:_})=>jsxRuntimeExports.jsx(Box,{width:"100%",marginTop:"40px",marginBottom:"-20px",background:colors.gray[800],borderRadius:"8px",children:jsxRuntimeExports.jsx(Accordion,{padding:"15px",allowToggle:!0,children:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],border:"none",borderRadius:"8px",children:[jsxRuntimeExports.jsxs(AccordionButton,{as:"span",flex:"1",padding:"0",textAlign:"left",cursor:"pointer",children:[jsxRuntimeExports.jsx(Heading,{width:"100%",size:"md",children:"Approvers"}),jsxRuntimeExports.jsx(AccordionIcon,{cursor:"pointer"})]}),jsxRuntimeExports.jsx(AccordionPanel,{padding:"0",children:jsxRuntimeExports.jsx(Wrap,{marginTop:"20px","data-testid":"multisig-tag-section",spacingX:"0",spacingY:"12px",children:_.map(a=>jsxRuntimeExports.jsx(AddressPill,{marginRight:"12px",address:a},a.pkh))})})]})})}),renameAccount=(_,a)=>($,j)=>{const{accounts:et,multisigs:tt,contacts:rt}=j(),nt=_.type==="multisig",it=et.items.map(ct=>ct.label),ot=tt.items.map(ct=>ct.label),st=Object.values(rt).map(ct=>ct.name);[it,ot,st].flat().includes(a)||$(nt?multisigsSlice.actions.setName({newName:a,account:_}):accountsSlice.actions.renameAccount({newName:a,account:_}))},RenameAccountModal=({account:_})=>{const a=useAppDispatch(),{onClose:$}=reactExports.useContext(DynamicModalContext),j=({name:ct})=>{a(renameAccount(_,ct)),$()},{handleSubmit:et,formState:{isValid:tt,errors:rt},register:nt,reset:it}=useForm({mode:"onBlur",defaultValues:{name:_.label}}),ot=({name:ct})=>{j({name:ct.trim()}),it()},st=useValidateName(_.label);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:et(ot),children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"Edit your account name here.",title:"Edit Name"}),jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!rt.name,marginY:"20px",children:[jsxRuntimeExports.jsx(FormLabel,{children:"Account name"}),jsxRuntimeExports.jsx(Input,{type:"text",...nt("name",{required:"Name is required",validate:st}),placeholder:"Enter contact's name"}),rt.name&&jsxRuntimeExports.jsx(FormErrorMessage$1,{"data-testid":"name-error",children:rt.name.message})]})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"8px",isDisabled:!tt,size:"lg",type:"submit",children:"Save"})})]})})},RenameRemoveMenuSwitch=({account:_})=>{const{openWith:a,onClose:$}=reactExports.useContext(DynamicModalContext),j=useNavigate(),et=useImplicitAccounts().length===1,tt=useRemoveAccount();let rt;switch(_.type){case"secret_key":case"ledger":case"social":rt=()=>a(jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:ot,description:it,onSubmit:()=>{tt(_),$(),j("/")},title:nt}));break}const nt="Remove Account";let it="Are you sure you want to remove this account?",ot="Remove Account";return et&&(it="Removing your last account will off-board you from Umami. This will remove or reset all customized settings to their defaults. Personal data (including saved contacts, password and accounts) won't be affected.",ot="Remove & Off-board"),jsxRuntimeExports.jsx(RenameRemoveMenu,{onRemove:rt,onRename:()=>a(jsxRuntimeExports.jsx(RenameAccountModal,{account:_}))})},makeDelegation=_=>_.newDelegate?{sender:_.sender.address,timestamp:_.timestamp,id:_.id,amount:new BigNumber(_.amount),delegate:{address:_.newDelegate.address,alias:_.newDelegate.alias??void 0}}:null,TezRecapDisplay=_=>jsxRuntimeExports.jsxs(Box,{textAlign:_.center?"center":"initial",children:[jsxRuntimeExports.jsx(Heading,{size:"md",children:prettyTezAmount(_.balance)}),_.dollarBalance!==void 0&&jsxRuntimeExports.jsxs(Text,{marginTop:"6px",color:colors.gray[400],size:"sm",children:["$",_.dollarBalance.toFixed(2)]})]}),RoundButton=({icon:_,label:a,onClick:$=()=>{}})=>jsxRuntimeExports.jsxs(Box,{className:"account-drawer-cta-button",color:colors.gray[300],textAlign:"center",_hover:{color:colors.green},cursor:"pointer",marginX:"24px",onClick:$,children:[jsxRuntimeExports.jsx(IconButton,{className:"account-drawer-cta-button-icon",marginBottom:"8px","aria-label":"button",icon:_,size:"lg",variant:"circle_without_color"}),jsxRuntimeExports.jsx(Text,{cursor:"pointer",size:"sm",children:a})]}),AccountDrawerDisplay=({onSend:_,onReceive:a=()=>{},balance:$,dollarBalance:j,tokens:et,nfts:tt,account:rt})=>{const nt=rt.type==="multisig",{openWith:it}=reactExports.useContext(DynamicModalContext),ot=useSelectedNetwork(),[st,ct]=reactExports.useState(null),{handleAsyncAction:ut}=useAsyncActionHandler();return reactExports.useEffect(()=>{ut(async()=>{const ht=await getLastDelegation(rt.address.pkh,ot);ht&&ct(makeDelegation(ht))}).catch(lodashExports.noop)},[rt.address.pkh,ut,ot]),jsxRuntimeExports.jsxs(Flex,{zIndex:2,alignItems:"center",flexDirection:"column",height:"100%",marginTop:"-86px",paddingTop:"86px",paddingRight:"30px",background:accountIconGradient({account:rt,radius:"350px",opacity:"35",mainBackgroundColor:"transparent",left:"300px",top:"-125px"}),"data-testid":`account-card-${rt.address.pkh}`,children:[jsxRuntimeExports.jsx(AccountTileIcon,{account:rt,size:"lg"}),jsxRuntimeExports.jsx(Heading,{marginTop:"24px",size:"md",children:rt.label}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"8px",marginBottom:"30px",children:[jsxRuntimeExports.jsx(AddressPill,{marginRight:"4px",address:rt.address,mode:{type:"no_icons"}}),jsxRuntimeExports.jsx(RenameRemoveMenuSwitch,{account:rt})]}),$&&jsxRuntimeExports.jsx(TezRecapDisplay,{balance:$,center:!0,dollarBalance:j}),jsxRuntimeExports.jsxs(Center,{marginTop:"34px",children:[jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(OutgoingArrow,{width:"24px",height:"24px",stroke:"currentcolor"}),label:"Send",onClick:_}),jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(IncomingArrow,{width:"24px",height:"24px",stroke:"currentcolor"}),label:"Receive",onClick:a}),!nt&&jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(PlusIcon,{stroke:"currentcolor"}),label:"Buy Tez",onClick:()=>it(jsxRuntimeExports.jsx(BuyTezForm,{recipient:rt.address.pkh}))}),jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(BakerIcon,{width:"24px",height:"24px",stroke:"currentcolor"}),label:"Delegate",onClick:()=>it(jsxRuntimeExports.jsx(FormPage$3,{form:st?{baker:st.delegate.address,sender:rt.address.pkh}:void 0,sender:rt}))})]}),nt&&jsxRuntimeExports.jsx(MultisigApprovers,{signers:rt.signers}),jsxRuntimeExports.jsx(AssetsPanel,{account:rt,delegation:st,nfts:tt,tokens:et})]})};var dist={},lodash_isequal={exports:{}};lodash_isequal.exports;(function(_,a){var $=200,j="__lodash_hash_undefined__",et=1,tt=2,rt=9007199254740991,nt="[object Arguments]",it="[object Array]",ot="[object AsyncFunction]",st="[object Boolean]",ct="[object Date]",ut="[object Error]",ht="[object Function]",Et="[object GeneratorFunction]",St="[object Map]",Mt="[object Number]",kt="[object Null]",Ct="[object Object]",Ot="[object Promise]",zt="[object Proxy]",Ut="[object RegExp]",Vt="[object Set]",jt="[object String]",$t="[object Symbol]",Bt="[object Undefined]",Nt="[object WeakMap]",Lt="[object ArrayBuffer]",Pt="[object DataView]",bt="[object Float32Array]",at="[object Float64Array]",dt="[object Int8Array]",vt="[object Int16Array]",xt="[object Int32Array]",wt="[object Uint8Array]",_t="[object Uint8ClampedArray]",At="[object Uint16Array]",Tt="[object Uint32Array]",yt=/[\\^$.*+?()[\]{}|]/g,It=/^\[object .+?Constructor\]$/,rr=/^(?:0|[1-9]\d*)$/,ir={};ir[bt]=ir[at]=ir[dt]=ir[vt]=ir[xt]=ir[wt]=ir[_t]=ir[At]=ir[Tt]=!0,ir[nt]=ir[it]=ir[Lt]=ir[st]=ir[Pt]=ir[ct]=ir[ut]=ir[ht]=ir[St]=ir[Mt]=ir[Ct]=ir[Ut]=ir[Vt]=ir[jt]=ir[Nt]=!1;var nr=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Gt=typeof self=="object"&&self&&self.Object===Object&&self,qt=nr||Gt||Function("return this")(),Jt=a&&!a.nodeType&&a,Ft=Jt&&!0&&_&&!_.nodeType&&_,Kt=Ft&&Ft.exports===Jt,Qt=Kt&&nr.process,dr=function(){try{return Qt&&Qt.binding&&Qt.binding("util")}catch{}}(),xr=dr&&dr.isTypedArray;function pr(_r,Yt){for(var cr=-1,gr=_r==null?0:_r.length,Dr=0,Zr=[];++cr-1}function vs(_r,Yt){var cr=this.__data__,gr=wo(cr,_r);return gr<0?(++this.size,cr.push([_r,Yt])):cr[gr][1]=Yt,this}hn.prototype.clear=yn,hn.prototype.delete=ps,hn.prototype.get=ms,hn.prototype.has=gs,hn.prototype.set=vs;function Zn(_r){var Yt=-1,cr=_r==null?0:_r.length;for(this.clear();++Ytwn))return!1;var mn=Zr.get(_r);if(mn&&Zr.get(Yt))return mn==Yt;var Bn=-1,Fn=!0,Xn=cr&tt?new as:void 0;for(Zr.set(_r,Yt),Zr.set(Yt,_r);++Bn-1&&_r%1==0&&_r-1&&_r%1==0&&_r<=rt}function Lo(_r){var Yt=typeof _r;return _r!=null&&(Yt=="object"||Yt=="function")}function Co(_r){return _r!=null&&typeof _r=="object"}var Bo=xr?fr(xr):xl;function Xl(_r){return To(_r)?yl(_r):El(_r)}function Qn(){return[]}function Gn(){return!1}_.exports=Cs})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports,qrcode={exports:{}};(function(_,a){var $=function(){var j=function(Ut,Vt){var jt=236,$t=17,Bt=Ut,Nt=tt[Vt],Lt=null,Pt=0,bt=null,at=[],dt={},vt=function(qt,Jt){Pt=Bt*4+17,Lt=function(Ft){for(var Kt=new Array(Ft),Qt=0;Qt=7&&Tt(qt),bt==null&&(bt=ir(Bt,Nt,at)),It(bt,Jt)},xt=function(qt,Jt){for(var Ft=-1;Ft<=7;Ft+=1)if(!(qt+Ft<=-1||Pt<=qt+Ft))for(var Kt=-1;Kt<=7;Kt+=1)Jt+Kt<=-1||Pt<=Jt+Kt||(0<=Ft&&Ft<=6&&(Kt==0||Kt==6)||0<=Kt&&Kt<=6&&(Ft==0||Ft==6)||2<=Ft&&Ft<=4&&2<=Kt&&Kt<=4?Lt[qt+Ft][Jt+Kt]=!0:Lt[qt+Ft][Jt+Kt]=!1)},wt=function(){for(var qt=0,Jt=0,Ft=0;Ft<8;Ft+=1){vt(!0,Ft);var Kt=nt.getLostPoint(dt);(Ft==0||qt>Kt)&&(qt=Kt,Jt=Ft)}return Jt},_t=function(){for(var qt=8;qt>Ft&1)==1;Lt[Math.floor(Ft/3)][Ft%3+Pt-8-3]=Kt}for(var Ft=0;Ft<18;Ft+=1){var Kt=!qt&&(Jt>>Ft&1)==1;Lt[Ft%3+Pt-8-3][Math.floor(Ft/3)]=Kt}},yt=function(qt,Jt){for(var Ft=Nt<<3|Jt,Kt=nt.getBCHTypeInfo(Ft),Qt=0;Qt<15;Qt+=1){var dr=!qt&&(Kt>>Qt&1)==1;Qt<6?Lt[Qt][8]=dr:Qt<8?Lt[Qt+1][8]=dr:Lt[Pt-15+Qt][8]=dr}for(var Qt=0;Qt<15;Qt+=1){var dr=!qt&&(Kt>>Qt&1)==1;Qt<8?Lt[8][Pt-Qt-1]=dr:Qt<9?Lt[8][15-Qt-1+1]=dr:Lt[8][15-Qt-1]=dr}Lt[Pt-8][8]=!qt},It=function(qt,Jt){for(var Ft=-1,Kt=Pt-1,Qt=7,dr=0,xr=nt.getMaskFunction(Jt),pr=Pt-1;pr>0;pr-=2)for(pr==6&&(pr-=1);;){for(var Ir=0;Ir<2;Ir+=1)if(Lt[Kt][pr-Ir]==null){var Cr=!1;dr>>Qt&1)==1);var lr=xr(Kt,pr-Ir);lr&&(Cr=!Cr),Lt[Kt][pr-Ir]=Cr,Qt-=1,Qt==-1&&(dr+=1,Qt=7)}if(Kt+=Ft,Kt<0||Pt<=Kt){Kt-=Ft,Ft=-Ft;break}}},rr=function(qt,Jt){for(var Ft=0,Kt=0,Qt=0,dr=new Array(Jt.length),xr=new Array(Jt.length),pr=0;pr=0?Ar.getAt(kr):0}}for(var Sr=0,lr=0;lrpr*8)throw"code length overflow. ("+Qt.getLengthInBits()+">"+pr*8+")";for(Qt.getLengthInBits()+4<=pr*8&&Qt.put(0,4);Qt.getLengthInBits()%8!=0;)Qt.putBit(!1);for(;!(Qt.getLengthInBits()>=pr*8||(Qt.put(jt,8),Qt.getLengthInBits()>=pr*8));)Qt.put($t,8);return rr(Qt,Kt)};dt.addData=function(qt,Jt){Jt=Jt||"Byte";var Ft=null;switch(Jt){case"Numeric":Ft=ut(qt);break;case"Alphanumeric":Ft=ht(qt);break;case"Byte":Ft=Et(qt);break;case"Kanji":Ft=St(qt);break;default:throw"mode:"+Jt}at.push(Ft),bt=null},dt.isDark=function(qt,Jt){if(qt<0||Pt<=qt||Jt<0||Pt<=Jt)throw qt+","+Jt;return Lt[qt][Jt]},dt.getModuleCount=function(){return Pt},dt.make=function(){if(Bt<1){for(var qt=1;qt<40;qt++){for(var Jt=st.getRSBlocks(qt,Nt),Ft=ct(),Kt=0;Kt"u"?qt*4:Jt;var Ft="";Ft+='";for(var Qt=0;Qt';Ft+=""}return Ft+="",Ft+="
",Ft},dt.createSvgTag=function(qt,Jt,Ft,Kt){var Qt={};typeof arguments[0]=="object"&&(Qt=arguments[0],qt=Qt.cellSize,Jt=Qt.margin,Ft=Qt.alt,Kt=Qt.title),qt=qt||2,Jt=typeof Jt>"u"?qt*4:Jt,Ft=typeof Ft=="string"?{text:Ft}:Ft||{},Ft.text=Ft.text||null,Ft.id=Ft.text?Ft.id||"qrcode-description":null,Kt=typeof Kt=="string"?{text:Kt}:Kt||{},Kt.text=Kt.text||null,Kt.id=Kt.text?Kt.id||"qrcode-title":null;var dr=dt.getModuleCount()*qt+Jt*2,xr,pr,Ir,Cr,lr="",fr;for(fr="l"+qt+",0 0,"+qt+" -"+qt+",0 0,-"+qt+"z ",lr+=''+nr(Kt.text)+"":"",lr+=Ft.text?''+nr(Ft.text)+"":"",lr+='',lr+='"u"?qt*4:Jt;var Ft=dt.getModuleCount()*qt+Jt*2,Kt=Jt,Qt=Ft-Jt;return zt(Ft,Ft,function(dr,xr){if(Kt<=dr&&dr"u"?qt*4:Jt;var Kt=dt.getModuleCount()*qt+Jt*2,Qt="";return Qt+="",Qt};var nr=function(qt){for(var Jt="",Ft=0;Ft":Jt+=">";break;case"&":Jt+="&";break;case'"':Jt+=""";break;default:Jt+=Kt;break}}return Jt},Gt=function(qt){var Jt=1;qt=typeof qt>"u"?Jt*2:qt;var Ft=dt.getModuleCount()*Jt+qt*2,Kt=qt,Qt=Ft-qt,dr,xr,pr,Ir,Cr,lr={"██":"█","█ ":"▀"," █":"▄"," ":" "},fr={"██":"▀","█ ":"▀"," █":" "," ":" "},Er="";for(dr=0;dr=Qt?fr[Cr]:lr[Cr];Er+=` `}return Ft%2&&qt>0?Er.substring(0,Er.length-Ft-1)+Array(Ft+1).join("▀"):Er.substring(0,Er.length-1)};return dt.createASCII=function(qt,Jt){if(qt=qt||1,qt<2)return Gt(Jt);qt-=1,Jt=typeof Jt>"u"?qt*2:Jt;var Ft=dt.getModuleCount()*qt+Jt*2,Kt=Jt,Qt=Ft-Jt,dr,xr,pr,Ir,Cr=Array(qt+1).join("██"),lr=Array(qt+1).join(" "),fr="",Er="";for(dr=0;dr>>8),Nt.push(bt&255)):Nt.push($t)}}return Nt}};var et={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},tt={L:1,M:0,Q:3,H:2},rt={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},nt=function(){var Ut=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],Vt=1335,jt=7973,$t=21522,Bt={},Nt=function(Lt){for(var Pt=0;Lt!=0;)Pt+=1,Lt>>>=1;return Pt};return Bt.getBCHTypeInfo=function(Lt){for(var Pt=Lt<<10;Nt(Pt)-Nt(Vt)>=0;)Pt^=Vt<=0;)Pt^=jt<5&&(bt+=3+vt-5)}for(var at=0;at=256;)Bt-=255;return Ut[Bt]},$t}();function ot(Ut,Vt){if(typeof Ut.length>"u")throw Ut.length+"/"+Vt;var jt=function(){for(var Bt=0;Bt"u")throw"bad rs block @ typeNumber:"+Bt+"/errorCorrectionLevel:"+Nt;for(var Pt=Lt.length/3,bt=[],at=0;at>>7-$t%8&1)==1},jt.put=function($t,Bt){for(var Nt=0;Nt>>Bt-Nt-1&1)==1)},jt.getLengthInBits=function(){return Vt},jt.putBit=function($t){var Bt=Math.floor(Vt/8);Ut.length<=Bt&&Ut.push(0),$t&&(Ut[Bt]|=128>>>Vt%8),Vt+=1},jt},ut=function(Ut){var Vt=et.MODE_NUMBER,jt=Ut,$t={};$t.getMode=function(){return Vt},$t.getLength=function(Lt){return jt.length},$t.write=function(Lt){for(var Pt=jt,bt=0;bt+2>>8&255)*192+(bt&255),Nt.put(bt,13),Pt+=2}if(Pt>>8)},Vt.writeBytes=function(jt,$t,Bt){$t=$t||0,Bt=Bt||jt.length;for(var Nt=0;Nt0&&(jt+=","),jt+=Ut[$t];return jt+="]",jt},Vt},kt=function(){var Ut=0,Vt=0,jt=0,$t="",Bt={},Nt=function(Pt){$t+=String.fromCharCode(Lt(Pt&63))},Lt=function(Pt){if(!(Pt<0)){if(Pt<26)return 65+Pt;if(Pt<52)return 97+(Pt-26);if(Pt<62)return 48+(Pt-52);if(Pt==62)return 43;if(Pt==63)return 47}throw"n:"+Pt};return Bt.writeByte=function(Pt){for(Ut=Ut<<8|Pt&255,Vt+=8,jt+=1;Vt>=6;)Nt(Ut>>>Vt-6),Vt-=6},Bt.flush=function(){if(Vt>0&&(Nt(Ut<<6-Vt),Ut=0,Vt=0),jt%3!=0)for(var Pt=3-jt%3,bt=0;bt=Vt.length){if(Bt==0)return-1;throw"unexpected end of file./"+Bt}var Pt=Vt.charAt(jt);if(jt+=1,Pt=="=")return Bt=0,-1;if(Pt.match(/^\s$/))continue;$t=$t<<6|Lt(Pt.charCodeAt(0)),Bt+=6}var bt=$t>>>Bt-8&255;return Bt-=8,bt};var Lt=function(Pt){if(65<=Pt&&Pt<=90)return Pt-65;if(97<=Pt&&Pt<=122)return Pt-97+26;if(48<=Pt&&Pt<=57)return Pt-48+52;if(Pt==43)return 62;if(Pt==47)return 63;throw"c:"+Pt};return Nt},Ot=function(Ut,Vt){var jt=Ut,$t=Vt,Bt=new Array(Ut*Vt),Nt={};Nt.setPixel=function(at,dt,vt){Bt[dt*jt+at]=vt},Nt.write=function(at){at.writeString("GIF87a"),at.writeShort(jt),at.writeShort($t),at.writeByte(128),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(255),at.writeByte(255),at.writeByte(255),at.writeString(","),at.writeShort(0),at.writeShort(0),at.writeShort(jt),at.writeShort($t),at.writeByte(0);var dt=2,vt=Pt(dt);at.writeByte(dt);for(var xt=0;vt.length-xt>255;)at.writeByte(255),at.writeBytes(vt,xt,255),xt+=255;at.writeByte(vt.length-xt),at.writeBytes(vt,xt,vt.length-xt),at.writeByte(0),at.writeString(";")};var Lt=function(at){var dt=at,vt=0,xt=0,wt={};return wt.write=function(_t,At){if(_t>>>At)throw"length over";for(;vt+At>=8;)dt.writeByte(255&(_t<>>=8-vt,xt=0,vt=0;xt=_t<0&&dt.writeByte(xt)},wt},Pt=function(at){for(var dt=1<>6,128|it&63):it<55296||it>=57344?rt.push(224|it>>12,128|it>>6&63,128|it&63):(nt++,it=65536+((it&1023)<<10|tt.charCodeAt(nt)&1023),rt.push(240|it>>18,128|it>>12&63,128|it>>6&63,128|it&63))}return rt}return et(j)}})(),function(j){_.exports=j()}(function(){return $})})(qrcode);var qrcodeExports=qrcode.exports,__extends=commonjsGlobal&&commonjsGlobal.__extends||function(){var _=function(a,$){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(j,et){j.__proto__=et}||function(j,et){for(var tt in et)Object.prototype.hasOwnProperty.call(et,tt)&&(j[tt]=et[tt])},_(a,$)};return function(a,$){if(typeof $!="function"&&$!==null)throw new TypeError("Class extends value "+String($)+" is not a constructor or null");_(a,$);function j(){this.constructor=a}a.prototype=$===null?Object.create($):(j.prototype=$.prototype,new j)}}(),__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(_){for(var a,$=1,j=arguments.length;$=1&&tt<=127?j+=$.charAt(et):tt>2047?(j+=String.fromCharCode(224|tt>>12&15),j+=String.fromCharCode(128|tt>>6&63),j+=String.fromCharCode(128|tt>>0&63)):(j+=String.fromCharCode(192|tt>>6&31),j+=String.fromCharCode(128|tt>>0&63));return j},a.prototype.drawRoundedSquare=function($,j,et,tt,rt,nt,it,ot){ot.lineWidth=$,ot.fillStyle=rt,ot.strokeStyle=rt,et+=$/2,j+=$/2,tt-=$,Array.isArray(nt)||(nt=[nt,nt,nt,nt]),nt=nt.map(function(Et){return Et=Math.min(Et,tt/2),Et<0?0:Et});var st=nt[0]||0,ct=nt[1]||0,ut=nt[2]||0,ht=nt[3]||0;ot.beginPath(),ot.moveTo(j+st,et),ot.lineTo(j+tt-ct,et),ct&&ot.quadraticCurveTo(j+tt,et,j+tt,et+ct),ot.lineTo(j+tt,et+tt-ut),ut&&ot.quadraticCurveTo(j+tt,et+tt,j+tt-ut,et+tt),ot.lineTo(j+ht,et+tt),ht&&ot.quadraticCurveTo(j,et+tt,j,et+tt-ht),ot.lineTo(j,et+st),st&&ot.quadraticCurveTo(j,et,j+st,et),ot.closePath(),ot.stroke(),it&&ot.fill()},a.prototype.drawPositioningPattern=function($,j,et,tt,rt,nt,it){it===void 0&&(it=[0,0,0,0]);var ot=Math.ceil(j),st,ct;typeof it!="number"&&!Array.isArray(it)?(st=it.outer||0,ct=it.inner||0):(st=it,ct=st);var ut,ht;typeof nt!="string"?(ut=nt.outer,ht=nt.inner):(ut=nt,ht=nt);var Et=tt*j+et,St=rt*j+et,Mt=j*7;this.drawRoundedSquare(ot,St,Et,Mt,ut,st,!1,$),Mt=j*3,Et+=j*2,St+=j*2,this.drawRoundedSquare(ot,St,Et,Mt,ht,ct,!0,$)},a.prototype.isInPositioninZone=function($,j,et){return et.some(function(tt){return j>=tt.row&&j<=tt.row+7&&$>=tt.col&&$<=tt.col+7})},a.prototype.transformPixelLengthIntoNumberOfCells=function($,j){return $/j},a.prototype.isCoordinateInImage=function($,j,et,tt,rt,nt,it,ot){if(ot){var st=2,ct=this.transformPixelLengthIntoNumberOfCells(rt,it),ut=this.transformPixelLengthIntoNumberOfCells(nt,it),ht=this.transformPixelLengthIntoNumberOfCells(et,it)-1,Et=this.transformPixelLengthIntoNumberOfCells(tt,it)-1;return j>=ct-st&&j<=ct+ht+st&&$>=ut-st&&$<=ut+Et+st}else return!1},a.prototype.shouldComponentUpdate=function($){return!isEqual$1(this.props,$)},a.prototype.componentDidMount=function(){this.update()},a.prototype.componentDidUpdate=function(){this.update()},a.prototype.update=function(){var $,j=this.props,et=j.value,tt=j.ecLevel,rt=j.enableCORS,nt=j.bgColor,it=j.fgColor,ot=j.logoImage,st=j.logoOpacity,ct=j.logoOnLoad,ut=j.removeQrCodeBehindLogo,ht=j.qrStyle,Et=j.eyeRadius,St=j.eyeColor,Mt=j.logoPaddingStyle,kt=+this.props.size,Ct=+this.props.quietZone,Ot=this.props.logoWidth?+this.props.logoWidth:0,zt=this.props.logoHeight?+this.props.logoHeight:0,Ut=this.props.logoPadding?+this.props.logoPadding:0,Vt=qrGenerator(0,tt);Vt.addData(this.utf16to8(et)),Vt.make();var jt=($=this.canvasRef)===null||$===void 0?void 0:$.current,$t=jt.getContext("2d"),Bt=kt+2*Ct,Nt=Vt.getModuleCount(),Lt=kt/Nt,Pt=window.devicePixelRatio||1;jt.height=jt.width=Bt*Pt,$t.scale(Pt,Pt),$t.fillStyle=nt,$t.fillRect(0,0,Bt,Bt);var bt=Ct,at=[{row:0,col:0},{row:0,col:Nt-7},{row:Nt-7,col:0}];if($t.strokeStyle=it,ht==="dots"){$t.fillStyle=it;for(var dt=Lt/2,vt=0;vt0&&!Vt.isDark(vt-1,xt)&&xt>0&&!Vt.isDark(vt,xt-1)&&(wt[0]=!0),vt>0&&!Vt.isDark(vt-1,xt)&&xt0&&!Vt.isDark(vt,xt-1)&&(wt[3]=!0);var _t=Math.ceil((xt+1)*Lt)-Math.floor(xt*Lt),At=Math.ceil((vt+1)*Lt)-Math.floor(vt*Lt);$t.fillStyle=it,$t.beginPath(),$t.arc(Math.round(xt*Lt)+dt+bt,Math.round(vt*Lt)+dt+bt,dt,0,2*Math.PI,!1),$t.closePath(),$t.fill(),wt[0]||$t.fillRect(Math.round(xt*Lt)+bt,Math.round(vt*Lt)+bt,_t/2,At/2),wt[1]||$t.fillRect(Math.round(xt*Lt)+bt+Math.floor(_t/2),Math.round(vt*Lt)+bt,_t/2,At/2),wt[2]||$t.fillRect(Math.round(xt*Lt)+bt+Math.floor(_t/2),Math.round(vt*Lt)+bt+Math.floor(At/2),_t/2,At/2),wt[3]||$t.fillRect(Math.round(xt*Lt)+bt,Math.round(vt*Lt)+bt+Math.floor(At/2),_t/2,At/2)}}else for(var vt=0;vt{const $=useGetOwnedAccountSafe()(_);return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"You can receive tez or other digital assets by scanning or sharing this QR code",title:"Receive"}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",flexDirection:"column",children:jsxRuntimeExports.jsx(Box,{padding:"8px",background:"white",borderRadius:"8px",children:jsxRuntimeExports.jsx(QRCode_1,{size:232,value:_})})})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsxs(Box,{width:"100%",children:[$&&jsxRuntimeExports.jsx(Heading,{textAlign:"center",marginY:2,children:$.label}),jsxRuntimeExports.jsx(Flex,{justifyContent:"center",width:"100%",children:jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_),mode:{type:"no_icons"}})})]})})]})},AccountCard=({accountPkh:_})=>{const a=useGetOwnedAccount(),$=useGetAccountBalance(),j=useGetDollarBalance(),et=useGetAccountAllTokens(),tt=useGetAccountNFTs(),{openWith:rt}=reactExports.useContext(DynamicModalContext),nt=a(_),it=$(_),ot=j(_),st=et(_),ct=sortedByLastUpdate(tt(_));return jsxRuntimeExports.jsx(AccountDrawerDisplay,{account:nt,balance:it,dollarBalance:ot,nfts:ct,onReceive:()=>rt(jsxRuntimeExports.jsx(ReceiveModal,{pkh:_})),onSend:()=>rt(jsxRuntimeExports.jsx(FormPage$4,{sender:nt})),tokens:st})},InfoModal=({account:_})=>{const a=[{title:"Template",content:_.derivationPathTemplate},{title:"Path",content:_.derivationPath},{title:"Type (Curve)",content:_.curve}];return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalHeader,{children:[jsxRuntimeExports.jsx(CircleIcon,{icon:jsxRuntimeExports.jsx(SlashIcon,{}),size:"48px"}),jsxRuntimeExports.jsx(Center,{marginBottom:"8px",children:jsxRuntimeExports.jsx(Heading,{marginTop:"16px",children:"Derivation Info"})}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsx(ModalBody,{children:a.map(({title:$,content:j})=>j?jsxRuntimeExports.jsxs(Box,{marginTop:"24px",children:[jsxRuntimeExports.jsx(Heading,{size:"md",children:$}),jsxRuntimeExports.jsx(Center,{justifyContent:"flex-start",marginTop:"12px",padding:"15px",borderRadius:"4px",backgroundColor:colors.gray[800],children:jsxRuntimeExports.jsx(Text,{size:"sm",children:j})})]},j):null)})]})},DerivationInfoButton=({account:_,...a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);switch(_.type){case"multisig":case"secret_key":case"social":return null;case"ledger":case"mnemonic":return jsxRuntimeExports.jsx(Button,{"data-testid":"derivation-info-button",onClick:()=>$(jsxRuntimeExports.jsx(InfoModal,{account:_})),variant:"CTAWithIcon",...a,children:jsxRuntimeExports.jsx(FolderInfoIcon,{stroke:"currentcolor"})})}},CloseDrawerButton=({onClose:_})=>jsxRuntimeExports.jsx(Button,{minWidth:"24px",padding:"0",onClick:_,variant:"CTAWithIcon",children:jsxRuntimeExports.jsx(ExitArrowIcon,{stroke:"currentcolor"})}),scriptRel="modulepreload",assetsURL=function(_,a){return new URL(_,a).href},seen={},__vitePreload=function _(a,$,j){let et=Promise.resolve();if($&&$.length>0){const tt=document.getElementsByTagName("link"),rt=document.querySelector("meta[property=csp-nonce]"),nt=(rt==null?void 0:rt.nonce)||(rt==null?void 0:rt.getAttribute("nonce"));et=Promise.all($.map(it=>{if(it=assetsURL(it,j),it in seen)return;seen[it]=!0;const ot=it.endsWith(".css"),st=ot?'[rel="stylesheet"]':"";if(!!j)for(let ht=tt.length-1;ht>=0;ht--){const Et=tt[ht];if(Et.href===it&&(!ot||Et.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${it}"]${st}`))return;const ut=document.createElement("link");if(ut.rel=ot?"stylesheet":scriptRel,ot||(ut.as="script",ut.crossOrigin=""),ut.href=it,nt&&ut.setAttribute("nonce",nt),document.head.appendChild(ut),ot)return new Promise((ht,Et)=>{ut.addEventListener("load",ht),ut.addEventListener("error",()=>Et(new Error(`Unable to preload CSS for ${it}`)))})}))}return et.then(()=>a()).catch(tt=>{const rt=new Event("vite:preloadError",{cancelable:!0});if(rt.payload=tt,window.dispatchEvent(rt),!rt.defaultPrevented)throw tt})};var loadScript=function _(a,$,j){var et=document.head||document.getElementsByTagName("head")[0],tt=document.createElement("script");typeof $=="function"&&(j=$,$={}),$=$||{},j=j||function(){},tt.type=$.type||"text/javascript",tt.charset=$.charset||"utf8",tt.async="async"in $?!!$.async:!0,tt.src=a,$.attrs&&setAttributes(tt,$.attrs),$.text&&(tt.text=""+$.text);var rt="onload"in tt?stdOnEnd:ieOnEnd;rt(tt,j),tt.onload||stdOnEnd(tt,j),et.appendChild(tt)};function setAttributes(_,a){for(var $ in a)_.setAttribute($,a[$])}function stdOnEnd(_,a){_.onload=function(){this.onerror=this.onload=null,a(null,_)},_.onerror=function(){this.onerror=this.onload=null,a(new Error("Failed to load "+this.src),_)}}function ieOnEnd(_,a){_.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,a(null,_))}}var isMergeableObject=function _(a){return isNonNullObject(a)&&!isSpecial(a)};function isNonNullObject(_){return!!_&&typeof _=="object"}function isSpecial(_){var a=Object.prototype.toString.call(_);return a==="[object RegExp]"||a==="[object Date]"||isReactElement(_)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(_){return _.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(_){return Array.isArray(_)?[]:{}}function cloneUnlessOtherwiseSpecified(_,a){return a.clone!==!1&&a.isMergeableObject(_)?deepmerge(emptyTarget(_),_,a):_}function defaultArrayMerge(_,a,$){return _.concat(a).map(function(j){return cloneUnlessOtherwiseSpecified(j,$)})}function getMergeFunction(_,a){if(!a.customMerge)return deepmerge;var $=a.customMerge(_);return typeof $=="function"?$:deepmerge}function getEnumerableOwnPropertySymbols(_){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(_).filter(function(a){return Object.propertyIsEnumerable.call(_,a)}):[]}function getKeys(_){return Object.keys(_).concat(getEnumerableOwnPropertySymbols(_))}function propertyIsOnObject(_,a){try{return a in _}catch{return!1}}function propertyIsUnsafe(_,a){return propertyIsOnObject(_,a)&&!(Object.hasOwnProperty.call(_,a)&&Object.propertyIsEnumerable.call(_,a))}function mergeObject(_,a,$){var j={};return $.isMergeableObject(_)&&getKeys(_).forEach(function(et){j[et]=cloneUnlessOtherwiseSpecified(_[et],$)}),getKeys(a).forEach(function(et){propertyIsUnsafe(_,et)||(propertyIsOnObject(_,et)&&$.isMergeableObject(a[et])?j[et]=getMergeFunction(et,$)(_[et],a[et],$):j[et]=cloneUnlessOtherwiseSpecified(a[et],$))}),j}function deepmerge(_,a,$){$=$||{},$.arrayMerge=$.arrayMerge||defaultArrayMerge,$.isMergeableObject=$.isMergeableObject||isMergeableObject,$.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var j=Array.isArray(a),et=Array.isArray(_),tt=j===et;return tt?j?$.arrayMerge(_,a,$):mergeObject(_,a,$):cloneUnlessOtherwiseSpecified(a,$)}deepmerge.all=function _(a,$){if(!Array.isArray(a))throw new Error("first argument should be an array");return a.reduce(function(j,et){return deepmerge(j,et,$)},{})};var deepmerge_1=deepmerge,cjs=deepmerge_1,__create$4=Object.create,__defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__getOwnPropNames$6=Object.getOwnPropertyNames,__getProtoOf$4=Object.getPrototypeOf,__hasOwnProp$6=Object.prototype.hasOwnProperty,__export$6=(_,a)=>{for(var $ in a)__defProp$6(_,$,{get:a[$],enumerable:!0})},__copyProps$6=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$6(a))!__hasOwnProp$6.call(_,et)&&et!==$&&__defProp$6(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$6(a,et))||j.enumerable});return _},__toESM$4=(_,a,$)=>($=_!=null?__create$4(__getProtoOf$4(_)):{},__copyProps$6(!_||!_.__esModule?__defProp$6($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$6=_=>__copyProps$6(__defProp$6({},"__esModule",{value:!0}),_),utils_exports={};__export$6(utils_exports,{callPlayer:()=>callPlayer,getConfig:()=>getConfig,getSDK:()=>getSDK,isBlobUrl:()=>isBlobUrl,isMediaStream:()=>isMediaStream,lazy:()=>lazy,omit:()=>omit,parseEndTime:()=>parseEndTime,parseStartTime:()=>parseStartTime,queryString:()=>queryString,randomString:()=>randomString,supportsWebKitPresentationMode:()=>supportsWebKitPresentationMode});var utils$1=__toCommonJS$6(utils_exports),import_react$2=__toESM$4(reactExports),import_load_script=__toESM$4(loadScript),import_deepmerge$1=__toESM$4(cjs);const lazy=_=>import_react$2.default.lazy(async()=>{const a=await _();return typeof a.default=="function"?a:a.default}),MATCH_START_QUERY=/[?&#](?:start|t)=([0-9hms]+)/,MATCH_END_QUERY=/[?&#]end=([0-9hms]+)/,MATCH_START_STAMP=/(\d+)(h|m|s)/g,MATCH_NUMERIC=/^\d+$/;function parseTimeParam(_,a){if(_ instanceof Array)return;const $=_.match(a);if($){const j=$[1];if(j.match(MATCH_START_STAMP))return parseTimeString(j);if(MATCH_NUMERIC.test(j))return parseInt(j)}}function parseTimeString(_){let a=0,$=MATCH_START_STAMP.exec(_);for(;$!==null;){const[,j,et]=$;et==="h"&&(a+=parseInt(j,10)*60*60),et==="m"&&(a+=parseInt(j,10)*60),et==="s"&&(a+=parseInt(j,10)),$=MATCH_START_STAMP.exec(_)}return a}function parseStartTime(_){return parseTimeParam(_,MATCH_START_QUERY)}function parseEndTime(_){return parseTimeParam(_,MATCH_END_QUERY)}function randomString(){return Math.random().toString(36).substr(2,5)}function queryString(_){return Object.keys(_).map(a=>`${a}=${_[a]}`).join("&")}function getGlobal(_){return window[_]?window[_]:window.exports&&window.exports[_]?window.exports[_]:window.module&&window.module.exports&&window.module.exports[_]?window.module.exports[_]:null}const requests={},getSDK=function _(a,$,j=null,et=()=>!0,tt=import_load_script.default){const rt=getGlobal($);return rt&&et(rt)?Promise.resolve(rt):new Promise((nt,it)=>{if(requests[a]){requests[a].push({resolve:nt,reject:it});return}requests[a]=[{resolve:nt,reject:it}];const ot=st=>{requests[a].forEach(ct=>ct.resolve(st))};if(j){const st=window[j];window[j]=function(){st&&st(),ot(getGlobal($))}}tt(a,st=>{st?(requests[a].forEach(ct=>ct.reject(st)),requests[a]=null):j||ot(getGlobal($))})})};function getConfig(_,a){return(0,import_deepmerge$1.default)(a.config,_.config)}function omit(_,...a){const $=[].concat(...a),j={},et=Object.keys(_);for(const tt of et)$.indexOf(tt)===-1&&(j[tt]=_[tt]);return j}function callPlayer(_,...a){if(!this.player||!this.player[_]){let $=`ReactPlayer: ${this.constructor.displayName} player could not call %c${_}%c – `;return this.player?this.player[_]||($+="The method was not available"):$+="The player was not available",console.warn($,"font-weight: bold",""),null}return this.player[_](...a)}function isMediaStream(_){return typeof window<"u"&&typeof window.MediaStream<"u"&&_ instanceof window.MediaStream}function isBlobUrl(_){return/^blob:/.test(_)}function supportsWebKitPresentationMode(_=document.createElement("video")){const a=/iPhone|iPod/.test(navigator.userAgent)===!1;return _.webkitSupportsPresentationMode&&typeof _.webkitSetPresentationMode=="function"&&a}function enableStubOn(_){return _}var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__getOwnPropNames$5=Object.getOwnPropertyNames,__hasOwnProp$5=Object.prototype.hasOwnProperty,__export$5=(_,a)=>{for(var $ in a)__defProp$5(_,$,{get:a[$],enumerable:!0})},__copyProps$5=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$5(a))!__hasOwnProp$5.call(_,et)&&et!==$&&__defProp$5(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$5(a,et))||j.enumerable});return _},__toCommonJS$5=_=>__copyProps$5(__defProp$5({},"__esModule",{value:!0}),_),patterns_exports={};__export$5(patterns_exports,{AUDIO_EXTENSIONS:()=>AUDIO_EXTENSIONS,DASH_EXTENSIONS:()=>DASH_EXTENSIONS,FLV_EXTENSIONS:()=>FLV_EXTENSIONS,HLS_EXTENSIONS:()=>HLS_EXTENSIONS,MATCH_URL_DAILYMOTION:()=>MATCH_URL_DAILYMOTION,MATCH_URL_FACEBOOK:()=>MATCH_URL_FACEBOOK,MATCH_URL_FACEBOOK_WATCH:()=>MATCH_URL_FACEBOOK_WATCH,MATCH_URL_KALTURA:()=>MATCH_URL_KALTURA,MATCH_URL_MIXCLOUD:()=>MATCH_URL_MIXCLOUD,MATCH_URL_MUX:()=>MATCH_URL_MUX,MATCH_URL_SOUNDCLOUD:()=>MATCH_URL_SOUNDCLOUD,MATCH_URL_STREAMABLE:()=>MATCH_URL_STREAMABLE,MATCH_URL_TWITCH_CHANNEL:()=>MATCH_URL_TWITCH_CHANNEL,MATCH_URL_TWITCH_VIDEO:()=>MATCH_URL_TWITCH_VIDEO,MATCH_URL_VIDYARD:()=>MATCH_URL_VIDYARD,MATCH_URL_VIMEO:()=>MATCH_URL_VIMEO,MATCH_URL_WISTIA:()=>MATCH_URL_WISTIA,MATCH_URL_YOUTUBE:()=>MATCH_URL_YOUTUBE,VIDEO_EXTENSIONS:()=>VIDEO_EXTENSIONS,canPlay:()=>canPlay});var patterns=__toCommonJS$5(patterns_exports),import_utils$3=utils$1;const MATCH_URL_YOUTUBE=/(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//,MATCH_URL_SOUNDCLOUD=/(?:soundcloud\.com|snd\.sc)\/[^.]+$/,MATCH_URL_VIMEO=/vimeo\.com\/(?!progressive_redirect).+/,MATCH_URL_MUX=/stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/,MATCH_URL_FACEBOOK=/^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/,MATCH_URL_FACEBOOK_WATCH=/^https?:\/\/fb\.watch\/.+$/,MATCH_URL_STREAMABLE=/streamable\.com\/([a-z0-9]+)$/,MATCH_URL_WISTIA=/(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/,MATCH_URL_TWITCH_VIDEO=/(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/,MATCH_URL_TWITCH_CHANNEL=/(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/,MATCH_URL_DAILYMOTION=/^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?(?:[\w.#_-]+)?/,MATCH_URL_MIXCLOUD=/mixcloud\.com\/([^/]+\/[^/]+)/,MATCH_URL_VIDYARD=/vidyard.com\/(?:watch\/)?([a-zA-Z0-9-_]+)/,MATCH_URL_KALTURA=/^https?:\/\/[a-zA-Z]+\.kaltura.(com|org)\/p\/([0-9]+)\/sp\/([0-9]+)00\/embedIframeJs\/uiconf_id\/([0-9]+)\/partner_id\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_].*)$/,AUDIO_EXTENSIONS=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,VIDEO_EXTENSIONS=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,HLS_EXTENSIONS=/\.(m3u8)($|\?)/i,DASH_EXTENSIONS=/\.(mpd)($|\?)/i,FLV_EXTENSIONS=/\.(flv)($|\?)/i,canPlayFile=_=>{if(_ instanceof Array){for(const a of _)if(typeof a=="string"&&canPlayFile(a)||canPlayFile(a.src))return!0;return!1}return(0,import_utils$3.isMediaStream)(_)||(0,import_utils$3.isBlobUrl)(_)?!0:AUDIO_EXTENSIONS.test(_)||VIDEO_EXTENSIONS.test(_)||HLS_EXTENSIONS.test(_)||DASH_EXTENSIONS.test(_)||FLV_EXTENSIONS.test(_)},canPlay={youtube:_=>_ instanceof Array?_.every(a=>MATCH_URL_YOUTUBE.test(a)):MATCH_URL_YOUTUBE.test(_),soundcloud:_=>MATCH_URL_SOUNDCLOUD.test(_)&&!AUDIO_EXTENSIONS.test(_),vimeo:_=>MATCH_URL_VIMEO.test(_)&&!VIDEO_EXTENSIONS.test(_)&&!HLS_EXTENSIONS.test(_),mux:_=>MATCH_URL_MUX.test(_),facebook:_=>MATCH_URL_FACEBOOK.test(_)||MATCH_URL_FACEBOOK_WATCH.test(_),streamable:_=>MATCH_URL_STREAMABLE.test(_),wistia:_=>MATCH_URL_WISTIA.test(_),twitch:_=>MATCH_URL_TWITCH_VIDEO.test(_)||MATCH_URL_TWITCH_CHANNEL.test(_),dailymotion:_=>MATCH_URL_DAILYMOTION.test(_),mixcloud:_=>MATCH_URL_MIXCLOUD.test(_),vidyard:_=>MATCH_URL_VIDYARD.test(_),kaltura:_=>MATCH_URL_KALTURA.test(_),file:canPlayFile};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__getOwnPropNames$4=Object.getOwnPropertyNames,__hasOwnProp$4=Object.prototype.hasOwnProperty,__export$4=(_,a)=>{for(var $ in a)__defProp$4(_,$,{get:a[$],enumerable:!0})},__copyProps$4=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$4(a))!__hasOwnProp$4.call(_,et)&&et!==$&&__defProp$4(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$4(a,et))||j.enumerable});return _},__toCommonJS$4=_=>__copyProps$4(__defProp$4({},"__esModule",{value:!0}),_),players_exports={};__export$4(players_exports,{default:()=>players_default});var players=__toCommonJS$4(players_exports),import_utils$2=utils$1,import_patterns=patterns,players_default=[{key:"youtube",name:"YouTube",canPlay:import_patterns.canPlay.youtube,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./YouTube-BjhGkced.js").then(_=>_.Y),[],import.meta.url))},{key:"soundcloud",name:"SoundCloud",canPlay:import_patterns.canPlay.soundcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./SoundCloud-B9yL4Zna.js").then(_=>_.S),[],import.meta.url))},{key:"vimeo",name:"Vimeo",canPlay:import_patterns.canPlay.vimeo,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vimeo-DM5D1w5E.js").then(_=>_.V),[],import.meta.url))},{key:"mux",name:"Mux",canPlay:import_patterns.canPlay.mux,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mux-DZP56nNu.js").then(_=>_.M),[],import.meta.url))},{key:"facebook",name:"Facebook",canPlay:import_patterns.canPlay.facebook,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Facebook-B4ycyCYk.js").then(_=>_.F),[],import.meta.url))},{key:"streamable",name:"Streamable",canPlay:import_patterns.canPlay.streamable,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Streamable-C-aCc4Wc.js").then(_=>_.S),[],import.meta.url))},{key:"wistia",name:"Wistia",canPlay:import_patterns.canPlay.wistia,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Wistia-BWPNehd-.js").then(_=>_.W),[],import.meta.url))},{key:"twitch",name:"Twitch",canPlay:import_patterns.canPlay.twitch,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Twitch-DI1N8bhx.js").then(_=>_.T),[],import.meta.url))},{key:"dailymotion",name:"DailyMotion",canPlay:import_patterns.canPlay.dailymotion,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./DailyMotion-CKPjzhXZ.js").then(_=>_.D),[],import.meta.url))},{key:"mixcloud",name:"Mixcloud",canPlay:import_patterns.canPlay.mixcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mixcloud-CiD2SqOK.js").then(_=>_.M),[],import.meta.url))},{key:"vidyard",name:"Vidyard",canPlay:import_patterns.canPlay.vidyard,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vidyard-CCSmJFry.js").then(_=>_.V),[],import.meta.url))},{key:"kaltura",name:"Kaltura",canPlay:import_patterns.canPlay.kaltura,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Kaltura-9vZ2Lv43.js").then(_=>_.K),[],import.meta.url))},{key:"file",name:"FilePlayer",canPlay:import_patterns.canPlay.file,canEnablePIP:_=>import_patterns.canPlay.file(_)&&(document.pictureInPictureEnabled||(0,import_utils$2.supportsWebKitPresentationMode)())&&!import_patterns.AUDIO_EXTENSIONS.test(_),lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./FilePlayer-Bhc98JXj.js").then(_=>_.F),[],import.meta.url))}],safeIsNaN=Number.isNaN||function _(a){return typeof a=="number"&&a!==a};function isEqual(_,a){return!!(_===a||safeIsNaN(_)&&safeIsNaN(a))}function areInputsEqual(_,a){if(_.length!==a.length)return!1;for(var $=0;$<_.length;$++)if(!isEqual(_[$],a[$]))return!1;return!0}function memoizeOne(_,a){a===void 0&&(a=areInputsEqual);var $,j=[],et,tt=!1;function rt(){for(var nt=[],it=0;it{for(var $ in a)__defProp$3(_,$,{get:a[$],enumerable:!0})},__copyProps$3=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$3(a))!__hasOwnProp$3.call(_,et)&&et!==$&&__defProp$3(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$3(a,et))||j.enumerable});return _},__toESM$3=(_,a,$)=>($=_!=null?__create$3(__getProtoOf$3(_)):{},__copyProps$3(!_||!_.__esModule?__defProp$3($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$3=_=>__copyProps$3(__defProp$3({},"__esModule",{value:!0}),_),props_exports={};__export$3(props_exports,{defaultProps:()=>defaultProps,propTypes:()=>propTypes});var props=__toCommonJS$3(props_exports),import_prop_types=__toESM$3(propTypesExports);const{string,bool,number,array,oneOfType,shape,object,func,node}=import_prop_types.default,propTypes={url:oneOfType([string,array,object]),playing:bool,loop:bool,controls:bool,volume:number,muted:bool,playbackRate:number,width:oneOfType([string,number]),height:oneOfType([string,number]),style:object,progressInterval:number,playsinline:bool,pip:bool,stopOnUnmount:bool,light:oneOfType([bool,string,object]),playIcon:node,previewTabIndex:number,previewAriaLabel:string,fallback:node,oEmbedUrl:string,wrapper:oneOfType([string,func,shape({render:func.isRequired})]),config:shape({soundcloud:shape({options:object}),youtube:shape({playerVars:object,embedOptions:object,onUnstarted:func}),facebook:shape({appId:string,version:string,playerId:string,attributes:object}),dailymotion:shape({params:object}),vimeo:shape({playerOptions:object,title:string}),mux:shape({attributes:object,version:string}),file:shape({attributes:object,tracks:array,forceVideo:bool,forceAudio:bool,forceHLS:bool,forceSafariHLS:bool,forceDisableHls:bool,forceDASH:bool,forceFLV:bool,hlsOptions:object,hlsVersion:string,dashVersion:string,flvVersion:string}),wistia:shape({options:object,playerId:string,customControls:array}),mixcloud:shape({options:object}),twitch:shape({options:object,playerId:string}),vidyard:shape({options:object})}),onReady:func,onStart:func,onPlay:func,onPause:func,onBuffer:func,onBufferEnd:func,onEnded:func,onError:func,onDuration:func,onSeek:func,onPlaybackRateChange:func,onPlaybackQualityChange:func,onProgress:func,onClickPreview:func,onEnablePIP:func,onDisablePIP:func},noop$1=()=>{},defaultProps={playing:!1,loop:!1,controls:!1,volume:null,muted:!1,playbackRate:1,width:"640px",height:"360px",style:{},progressInterval:1e3,playsinline:!1,pip:!1,stopOnUnmount:!0,light:!1,fallback:null,wrapper:"div",previewTabIndex:0,previewAriaLabel:"",oEmbedUrl:"https://noembed.com/embed?url={url}",config:{soundcloud:{options:{visual:!0,buying:!1,liking:!1,download:!1,sharing:!1,show_comments:!1,show_playcount:!1}},youtube:{playerVars:{playsinline:1,showinfo:0,rel:0,iv_load_policy:3,modestbranding:1},embedOptions:{},onUnstarted:noop$1},facebook:{appId:"1309697205772819",version:"v3.3",playerId:null,attributes:{}},dailymotion:{params:{api:1,"endscreen-enable":!1}},vimeo:{playerOptions:{autopause:!1,byline:!1,portrait:!1,title:!1},title:null},mux:{attributes:{},version:"2"},file:{attributes:{},tracks:[],forceVideo:!1,forceAudio:!1,forceHLS:!1,forceDASH:!1,forceFLV:!1,hlsOptions:{},hlsVersion:"1.1.4",dashVersion:"3.1.3",flvVersion:"1.5.0",forceDisableHls:!1},wistia:{options:{},playerId:null,customControls:null},mixcloud:{options:{hide_cover:1}},twitch:{options:{},playerId:null},vidyard:{options:{}}},onReady:noop$1,onStart:noop$1,onPlay:noop$1,onPause:noop$1,onBuffer:noop$1,onBufferEnd:noop$1,onEnded:noop$1,onError:noop$1,onDuration:noop$1,onSeek:noop$1,onPlaybackRateChange:noop$1,onPlaybackQualityChange:noop$1,onProgress:noop$1,onClickPreview:noop$1,onEnablePIP:noop$1,onDisablePIP:noop$1};var __create$2=Object.create,__defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__getOwnPropNames$2=Object.getOwnPropertyNames,__getProtoOf$2=Object.getPrototypeOf,__hasOwnProp$2=Object.prototype.hasOwnProperty,__defNormalProp$1=(_,a,$)=>a in _?__defProp$2(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__export$2=(_,a)=>{for(var $ in a)__defProp$2(_,$,{get:a[$],enumerable:!0})},__copyProps$2=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$2(a))!__hasOwnProp$2.call(_,et)&&et!==$&&__defProp$2(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$2(a,et))||j.enumerable});return _},__toESM$2=(_,a,$)=>($=_!=null?__create$2(__getProtoOf$2(_)):{},__copyProps$2(!_||!_.__esModule?__defProp$2($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$2=_=>__copyProps$2(__defProp$2({},"__esModule",{value:!0}),_),__publicField$1=(_,a,$)=>(__defNormalProp$1(_,typeof a!="symbol"?a+"":a,$),$),Player_exports={};__export$2(Player_exports,{default:()=>Player});var Player_1=__toCommonJS$2(Player_exports),import_react$1=__toESM$2(reactExports),import_react_fast_compare$1=__toESM$2(reactFastCompare),import_props$1=props,import_utils$1=utils$1;const SEEK_ON_PLAY_EXPIRY=5e3;class Player extends import_react$1.Component{constructor(){super(...arguments),__publicField$1(this,"mounted",!1),__publicField$1(this,"isReady",!1),__publicField$1(this,"isPlaying",!1),__publicField$1(this,"isLoading",!0),__publicField$1(this,"loadOnReady",null),__publicField$1(this,"startOnPlay",!0),__publicField$1(this,"seekOnPlay",null),__publicField$1(this,"onDurationCalled",!1),__publicField$1(this,"handlePlayerMount",a=>{if(this.player){this.progress();return}this.player=a,this.player.load(this.props.url),this.progress()}),__publicField$1(this,"getInternalPlayer",a=>this.player?this.player[a]:null),__publicField$1(this,"progress",()=>{if(this.props.url&&this.player&&this.isReady){const a=this.getCurrentTime()||0,$=this.getSecondsLoaded(),j=this.getDuration();if(j){const et={playedSeconds:a,played:a/j};$!==null&&(et.loadedSeconds=$,et.loaded=$/j),(et.playedSeconds!==this.prevPlayed||et.loadedSeconds!==this.prevLoaded)&&this.props.onProgress(et),this.prevPlayed=et.playedSeconds,this.prevLoaded=et.loadedSeconds}}this.progressTimeout=setTimeout(this.progress,this.props.progressFrequency||this.props.progressInterval)}),__publicField$1(this,"handleReady",()=>{if(!this.mounted)return;this.isReady=!0,this.isLoading=!1;const{onReady:a,playing:$,volume:j,muted:et}=this.props;a(),!et&&j!==null&&this.player.setVolume(j),this.loadOnReady?(this.player.load(this.loadOnReady,!0),this.loadOnReady=null):$&&this.player.play(),this.handleDurationCheck()}),__publicField$1(this,"handlePlay",()=>{this.isPlaying=!0,this.isLoading=!1;const{onStart:a,onPlay:$,playbackRate:j}=this.props;this.startOnPlay&&(this.player.setPlaybackRate&&j!==1&&this.player.setPlaybackRate(j),a(),this.startOnPlay=!1),$(),this.seekOnPlay&&(this.seekTo(this.seekOnPlay),this.seekOnPlay=null),this.handleDurationCheck()}),__publicField$1(this,"handlePause",a=>{this.isPlaying=!1,this.isLoading||this.props.onPause(a)}),__publicField$1(this,"handleEnded",()=>{const{activePlayer:a,loop:$,onEnded:j}=this.props;a.loopOnEnded&&$&&this.seekTo(0),$||(this.isPlaying=!1,j())}),__publicField$1(this,"handleError",(...a)=>{this.isLoading=!1,this.props.onError(...a)}),__publicField$1(this,"handleDurationCheck",()=>{clearTimeout(this.durationCheckTimeout);const a=this.getDuration();a?this.onDurationCalled||(this.props.onDuration(a),this.onDurationCalled=!0):this.durationCheckTimeout=setTimeout(this.handleDurationCheck,100)}),__publicField$1(this,"handleLoaded",()=>{this.isLoading=!1})}componentDidMount(){this.mounted=!0}componentWillUnmount(){clearTimeout(this.progressTimeout),clearTimeout(this.durationCheckTimeout),this.isReady&&this.props.stopOnUnmount&&(this.player.stop(),this.player.disablePIP&&this.player.disablePIP()),this.mounted=!1}componentDidUpdate(a){if(!this.player)return;const{url:$,playing:j,volume:et,muted:tt,playbackRate:rt,pip:nt,loop:it,activePlayer:ot,disableDeferredLoading:st}=this.props;if(!(0,import_react_fast_compare$1.default)(a.url,$)){if(this.isLoading&&!ot.forceLoad&&!st&&!(0,import_utils$1.isMediaStream)($)){console.warn(`ReactPlayer: the attempt to load ${$} is being deferred until the player has loaded`),this.loadOnReady=$;return}this.isLoading=!0,this.startOnPlay=!0,this.onDurationCalled=!1,this.player.load($,this.isReady)}!a.playing&&j&&!this.isPlaying&&this.player.play(),a.playing&&!j&&this.isPlaying&&this.player.pause(),!a.pip&&nt&&this.player.enablePIP&&this.player.enablePIP(),a.pip&&!nt&&this.player.disablePIP&&this.player.disablePIP(),a.volume!==et&&et!==null&&this.player.setVolume(et),a.muted!==tt&&(tt?this.player.mute():(this.player.unmute(),et!==null&&setTimeout(()=>this.player.setVolume(et)))),a.playbackRate!==rt&&this.player.setPlaybackRate&&this.player.setPlaybackRate(rt),a.loop!==it&&this.player.setLoop&&this.player.setLoop(it)}getDuration(){return this.isReady?this.player.getDuration():null}getCurrentTime(){return this.isReady?this.player.getCurrentTime():null}getSecondsLoaded(){return this.isReady?this.player.getSecondsLoaded():null}seekTo(a,$,j){if(!this.isReady){a!==0&&(this.seekOnPlay=a,setTimeout(()=>{this.seekOnPlay=null},SEEK_ON_PLAY_EXPIRY));return}if($?$==="fraction":a>0&&a<1){const tt=this.player.getDuration();if(!tt){console.warn("ReactPlayer: could not seek using fraction – duration not yet available");return}this.player.seekTo(tt*a,j);return}this.player.seekTo(a,j)}render(){const a=this.props.activePlayer;return a?import_react$1.default.createElement(a,{...this.props,onMount:this.handlePlayerMount,onReady:this.handleReady,onPlay:this.handlePlay,onPause:this.handlePause,onEnded:this.handleEnded,onLoaded:this.handleLoaded,onError:this.handleError}):null}}__publicField$1(Player,"displayName","Player");__publicField$1(Player,"propTypes",import_props$1.propTypes);__publicField$1(Player,"defaultProps",import_props$1.defaultProps);var __create$1=Object.create,__defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__getOwnPropNames$1=Object.getOwnPropertyNames,__getProtoOf$1=Object.getPrototypeOf,__hasOwnProp$1=Object.prototype.hasOwnProperty,__defNormalProp=(_,a,$)=>a in _?__defProp$1(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__export$1=(_,a)=>{for(var $ in a)__defProp$1(_,$,{get:a[$],enumerable:!0})},__copyProps$1=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$1(a))!__hasOwnProp$1.call(_,et)&&et!==$&&__defProp$1(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$1(a,et))||j.enumerable});return _},__toESM$1=(_,a,$)=>($=_!=null?__create$1(__getProtoOf$1(_)):{},__copyProps$1(!_||!_.__esModule?__defProp$1($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$1=_=>__copyProps$1(__defProp$1({},"__esModule",{value:!0}),_),__publicField=(_,a,$)=>(__defNormalProp(_,typeof a!="symbol"?a+"":a,$),$),ReactPlayer_exports={};__export$1(ReactPlayer_exports,{createReactPlayer:()=>createReactPlayer});var ReactPlayer$1=__toCommonJS$1(ReactPlayer_exports),import_react=__toESM$1(reactExports),import_deepmerge=__toESM$1(cjs),import_memoize_one=__toESM$1(require$$2),import_react_fast_compare=__toESM$1(reactFastCompare),import_props=props,import_utils=utils$1,import_Player=__toESM$1(Player_1);const Preview=(0,import_utils.lazy)(()=>__vitePreload(()=>import("./Preview-DqMzhPxX.js").then(_=>_.P),[],import.meta.url)),IS_BROWSER=typeof window<"u"&&window.document&&typeof document<"u",IS_GLOBAL=typeof commonjsGlobal<"u"&&commonjsGlobal.window&&commonjsGlobal.window.document,SUPPORTED_PROPS=Object.keys(import_props.propTypes),UniversalSuspense=IS_BROWSER||IS_GLOBAL?import_react.Suspense:()=>null,customPlayers=[],createReactPlayer=(_,a)=>{var $;return $=class extends import_react.Component{constructor(){super(...arguments),__publicField(this,"state",{showPreview:!!this.props.light}),__publicField(this,"references",{wrapper:j=>{this.wrapper=j},player:j=>{this.player=j}}),__publicField(this,"handleClickPreview",j=>{this.setState({showPreview:!1}),this.props.onClickPreview(j)}),__publicField(this,"showPreview",()=>{this.setState({showPreview:!0})}),__publicField(this,"getDuration",()=>this.player?this.player.getDuration():null),__publicField(this,"getCurrentTime",()=>this.player?this.player.getCurrentTime():null),__publicField(this,"getSecondsLoaded",()=>this.player?this.player.getSecondsLoaded():null),__publicField(this,"getInternalPlayer",(j="player")=>this.player?this.player.getInternalPlayer(j):null),__publicField(this,"seekTo",(j,et,tt)=>{if(!this.player)return null;this.player.seekTo(j,et,tt)}),__publicField(this,"handleReady",()=>{this.props.onReady(this)}),__publicField(this,"getActivePlayer",(0,import_memoize_one.default)(j=>{for(const et of[...customPlayers,..._])if(et.canPlay(j))return et;return a||null})),__publicField(this,"getConfig",(0,import_memoize_one.default)((j,et)=>{const{config:tt}=this.props;return import_deepmerge.default.all([import_props.defaultProps.config,import_props.defaultProps.config[et]||{},tt,tt[et]||{}])})),__publicField(this,"getAttributes",(0,import_memoize_one.default)(j=>(0,import_utils.omit)(this.props,SUPPORTED_PROPS))),__publicField(this,"renderActivePlayer",j=>{if(!j)return null;const et=this.getActivePlayer(j);if(!et)return null;const tt=this.getConfig(j,et.key);return import_react.default.createElement(import_Player.default,{...this.props,key:et.key,ref:this.references.player,config:tt,activePlayer:et.lazyPlayer||et,onReady:this.handleReady})})}shouldComponentUpdate(j,et){return!(0,import_react_fast_compare.default)(this.props,j)||!(0,import_react_fast_compare.default)(this.state,et)}componentDidUpdate(j){const{light:et}=this.props;!j.light&&et&&this.setState({showPreview:!0}),j.light&&!et&&this.setState({showPreview:!1})}renderPreview(j){if(!j)return null;const{light:et,playIcon:tt,previewTabIndex:rt,oEmbedUrl:nt,previewAriaLabel:it}=this.props;return import_react.default.createElement(Preview,{url:j,light:et,playIcon:tt,previewTabIndex:rt,previewAriaLabel:it,oEmbedUrl:nt,onClick:this.handleClickPreview})}render(){const{url:j,style:et,width:tt,height:rt,fallback:nt,wrapper:it}=this.props,{showPreview:ot}=this.state,st=this.getAttributes(j),ct=typeof it=="string"?this.references.wrapper:void 0;return import_react.default.createElement(it,{ref:ct,style:{...et,width:tt,height:rt},...st},import_react.default.createElement(UniversalSuspense,{fallback:nt},ot?this.renderPreview(j):this.renderActivePlayer(j)))}},__publicField($,"displayName","ReactPlayer"),__publicField($,"propTypes",import_props.propTypes),__publicField($,"defaultProps",import_props.defaultProps),__publicField($,"addCustomPlayer",j=>{customPlayers.push(j)}),__publicField($,"removeCustomPlayers",()=>{customPlayers.length=0}),__publicField($,"canPlay",j=>{for(const et of[...customPlayers,..._])if(et.canPlay(j))return!0;return!1}),__publicField($,"canEnablePIP",j=>{for(const et of[...customPlayers,..._])if(et.canEnablePIP&&et.canEnablePIP(j))return!0;return!1}),$};var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(_,a)=>{for(var $ in a)__defProp(_,$,{get:a[$],enumerable:!0})},__copyProps=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames(a))!__hasOwnProp.call(_,et)&&et!==$&&__defProp(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc(a,et))||j.enumerable});return _},__toESM=(_,a,$)=>($=_!=null?__create(__getProtoOf(_)):{},__copyProps(!_||!_.__esModule?__defProp($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS=_=>__copyProps(__defProp({},"__esModule",{value:!0}),_),src_exports={};__export(src_exports,{default:()=>src_default});var lib$1=__toCommonJS(src_exports),import_players=__toESM(players),import_ReactPlayer=ReactPlayer$1;const fallback=import_players.default[import_players.default.length-1];var src_default=(0,import_ReactPlayer.createReactPlayer)(import_players.default,fallback);const ReactPlayer=getDefaultExportFromCjs$1(lib$1),AttributesAccordionItem=({nft:_,style:a})=>{const $=_.metadata.attributes;return!$||$.length===0?null:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],"data-testid":"attributes-section",style:a,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"Attributes"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(Wrap,{marginLeft:"0",spacing:"10px",children:$.map(j=>jsxRuntimeExports.jsx(WrapItem,{flex:"1","data-testid":"nft-attribute",children:jsxRuntimeExports.jsx(Card,{width:"160px",height:"128px",marginBottom:"2px",background:colors.gray[700],children:jsxRuntimeExports.jsxs(CardBody,{padding:"16px",children:[jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:j.name}),jsxRuntimeExports.jsx(Heading,{size:"md",children:j.value})]})})},j.name))})})]})},TruncatedTextWithTooltip=({text:_,maxLength:a})=>_.length<=a?jsxRuntimeExports.jsx(Text,{"data-testid":"truncated-text",children:_}):jsxRuntimeExports.jsx(Tooltip,{label:_,children:jsxRuntimeExports.jsx(Text,{"data-testid":"truncated-text",children:truncate(_,a)})}),TzktLink=({url:_,...a})=>jsxRuntimeExports.jsx("a",{"data-testid":"tzkt-link",href:_,rel:"noopener noreferrer",target:"_blank",children:jsxRuntimeExports.jsx(WindowLinkIcon,{...a})}),CreatorElement=({nft:_})=>{if(!_.metadata.creators||_.metadata.creators.length===0)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"-"});const a=_.metadata.creators[0];return a.startsWith("tz")?jsxRuntimeExports.jsx(AddressPill,{marginRight:1,address:parsePkh(a)}):jsxRuntimeExports.jsx(TruncatedTextWithTooltip,{maxLength:15,text:a})},PropertiesAccordionItem=({nft:_,style:a})=>{const $=royalties(_),j=$.reduce((tt,rt)=>tt+rt.share,0).toFixed(2),et=useSelectedNetwork();return jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],style:a,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"Properties"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(TableContainer,{children:jsxRuntimeExports.jsx(Table,{variant:"stripped",children:jsxRuntimeExports.jsxs(Tbody,{fontSize:"14px",children:[jsxRuntimeExports.jsxs(Tr,{background:colors.gray[900],borderColor:colors.gray[700],borderBottomWidth:"1px",borderRadius:"8px",children:[jsxRuntimeExports.jsx(Td,{width:"20%",padding:"16px 0 16px 15px",paddingRight:"0",color:colors.gray[400],borderTopLeftRadius:"8px","data-testid":"nft-editions",children:"Editions:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-editions-value",children:_.totalSupply||"?"}),jsxRuntimeExports.jsx(Td,{width:"20%",padding:"16px 0 16px 15px",color:colors.gray[400],children:"Token ID:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",borderTopRightRadius:"8px",children:_.tokenId})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[800],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsxs(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-royalty",children:["Royalties",$.length>1?" ("+$.length+")":"",":"]}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-royalty-value",children:$.length>0?j+"%":"-"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-mime",children:"MIME type:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px","data-testid":"nft-mime-value",children:mimeType(_)||"-"})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[900],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"Contract:"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px",children:jsxRuntimeExports.jsx(AddressPill,{marginRight:1,address:parsePkh(_.contract)})}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"Metadata:"}),jsxRuntimeExports.jsxs(Td,{width:"30%",padding:"16px 0 16px 5px",children:["TzKT ",jsxRuntimeExports.jsx(TzktLink,{url:metadataUri(_,et)})]})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[800],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-creator",children:"Creator:"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-creator-value",children:jsxRuntimeExports.jsx(CreatorElement,{nft:_})}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"License:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",children:jsxRuntimeExports.jsx(TruncatedTextWithTooltip,{maxLength:15,text:_.metadata.rights||"-"})})]})]})})})})]})},TagsSection=({nft:_})=>{const a=_.metadata.tags;return!a||a.length===0?null:jsxRuntimeExports.jsx(Wrap,{marginTop:"20px","data-testid":"tags-section",children:a.map($=>jsxRuntimeExports.jsx(WrapItem,{padding:"3px 8px",background:colors.gray[600],borderRadius:"100px",children:jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-tag",children:$})},$))})},SendNFTRecapTile=({nft:_})=>{const a=getIPFSurl(thumbnailUri(_)),$=getIPFSurl(_.displayUri);return jsxRuntimeExports.jsx(Box,{width:"100%","aria-label":"nft",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"60px",padding:3,background:colors.gray[800],borderRadius:"4px","data-testid":"nft-name",children:[jsxRuntimeExports.jsx(AspectRatio,{width:"30px",height:"30px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{fallbackSrc:$,src:a})}),_.metadata.name&&jsxRuntimeExports.jsx(Heading,{marginLeft:4,size:"sm",children:truncate(_.metadata.name,45)})]})})},SignPage$1=_=>{const{mode:a,operations:$,data:{nft:j}}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:ct}=useSignPageHelpers($,a),{recipient:ut}=tt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:tt.type,signer:tt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Flex,{marginBottom:"12px",children:jsxRuntimeExports.jsx(SendNFTRecapTile,{nft:j})}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",marginY:"12px",paddingX:"4px",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Owned:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-owned",size:"sm",children:j.balance})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:et})]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"12px",marginBottom:"24px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"12px",size:"md",children:"Quantity:"}),jsxRuntimeExports.jsx(Center,{width:"100px",height:"48px",background:colors.gray[800],borderRadius:"4px",children:jsxRuntimeExports.jsxs(Text,{textAlign:"center",children:[tt.operations[0].amount," out of ",j.balance]})})]}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:tt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ut}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ct,signer:ot,text:headerText(tt.type,a)})})]})})})},FormPage$1=_=>{const{nft:a}=_,$=useOpenSignPageFormAction({SignPage:SignPage$1,signPageExtraData:{nft:a},FormPage:FormPage$1,defaultFormPageProps:_,toOperation:toOperation$1(a)}),j=useAddToBatchFormAction(toOperation$1(a)),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:{quantity:1,...formDefaultValues(_)}}),{formState:{isValid:it,errors:ot},register:st,handleSubmit:ct}=nt;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(FormPageHeader,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Flex,{marginBottom:"12px",children:jsxRuntimeExports.jsx(SendNFTRecapTile,{nft:_.nft})}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Owned:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-owned",size:"sm",children:a.balance})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.quantity,children:[jsxRuntimeExports.jsx(FormLabel,{children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"8px",size:"md",children:"Quantity:"}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(InputGroup,{width:"75px",children:jsxRuntimeExports.jsx(Input,{width:"60px",color:"white","data-testid":"quantity-input",step:1,type:"number",...st("quantity",{required:"Quantity is required",max:{value:a.balance,message:`Max quantity is ${a.balance}`},min:{value:1,message:"Min quantity is 1"}})})}),jsxRuntimeExports.jsxs(Text,{"data-testid":"out-of-nft",children:["out of ",a.balance]})]})]})}),ot.quantity&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"quantity-error",children:ot.quantity.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),ot.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:ot.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ct(tt),onSingleSubmit:ct(et)})})]})})})},toOperation$1=_=>a=>({type:"fa2",sender:parsePkh(a.sender),recipient:parsePkh(a.recipient),contract:parseContractPkh(_.contract),tokenId:_.tokenId,amount:a.quantity.toString()}),NFTDrawerCard=({nft:_})=>{var it;const a=getIPFSurl(artifactUri(_)),$=getIPFSurl(_.displayUri),j=useGetOwnedAccount(),{openWith:et}=reactExports.useContext(DynamicModalContext),tt=(it=mimeType(_))==null?void 0:it.startsWith("video/"),rt=tokenName(_),nt={border:"none",borderRadius:"8px",marginBottom:"20px"};return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Card,{width:"534px",height:"534px",background:colors.gray[800],children:jsxRuntimeExports.jsxs(CardBody,{padding:"24px",children:[jsxRuntimeExports.jsx(Box,{position:"relative",width:"486px",height:"486px",children:tt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box,{position:"absolute",zIndex:1,width:"486px",height:"486px",children:jsxRuntimeExports.jsx(ReactPlayer,{width:"100%",height:"100%",loop:!0,playing:!0,url:a})}),jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:0,top:"0",width:"486px",height:"486px",objectFit:"contain",alt:rt,filter:"blur(20px)",src:$})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:1,width:"486px",height:"486px",objectFit:"contain",alt:rt,fallbackSrc:$,src:a}),jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:0,top:"0",width:"486px",height:"486px",objectFit:"contain",alt:rt,"data-testid":"nft-image",fallbackSrc:$,filter:"blur(20px)",src:a})]})}),Number(_.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"24px",marginTop:"-38px",marginLeft:"16px",borderRadius:"100px",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",paddingX:"8px",children:"x"+_.balance})]})}),jsxRuntimeExports.jsx(TagsSection,{nft:_}),rt&&jsxRuntimeExports.jsx(Heading,{marginTop:"16px",marginBottom:"14px","data-testid":"nft-name",size:"lg",children:rt}),_.metadata.description&&jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-description",size:"sm",children:_.metadata.description}),jsxRuntimeExports.jsx(Button,{marginTop:"20px",onClick:()=>et(jsxRuntimeExports.jsx(FormPage$1,{nft:_,sender:j(_.owner)})),children:"Send"}),jsxRuntimeExports.jsxs(Accordion,{marginTop:"32px",allowMultiple:!0,children:[jsxRuntimeExports.jsx(AttributesAccordionItem,{nft:_,style:nt}),jsxRuntimeExports.jsx(PropertiesAccordionItem,{nft:_,style:nt}),jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],style:nt,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"JSON"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(JsValueWrap,{value:_})})]})]})]})},NFTDrawerBody=({nft:_,onCloseDrawer:a})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",paddingBottom:"22px",color:colors.gray[400],"data-testid":"nft-drawer-body",children:[jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.owner)}),jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:a})]}),jsxRuntimeExports.jsx(NFTDrawerCard,{nft:_})]}),AccountListWithDrawer=()=>{const[_,a]=reactExports.useState(null),{ownerPkh:$,nftId:j}=useParams(),et=useAllNfts(),tt=$&&lodashExports.get(et,[$],[]).find(ht=>fullId(ht)===j),rt=!!tt,{isOpen:nt,onOpen:it,onClose:ot}=useDisclosure$1({defaultIsOpen:rt}),st=useNavigate(),ct=reactExports.useCallback(()=>{a(null),ot(),st("/home")},[ot,st]);reactExports.useEffect(()=>{const ht=Et=>{Et.key==="Escape"&&ct()};return document.addEventListener("keydown",ht),()=>document.removeEventListener("keydown",ht)},[ct]);const ut=reactExports.useMemo(()=>({selectedAccount:_,selectAccount:ht=>{a(ht),it()}}),[_,it]);return jsxRuntimeExports.jsxs(SelectedAccountContext.Provider,{value:ut,children:[jsxRuntimeExports.jsx(AccountsList,{}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:nt,onClose:ct,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsxs(DrawerContent,{children:[rt&&jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(NFTDrawerBody,{nft:{...tt,owner:$},onCloseDrawer:ct})}),!rt&&_&&jsxRuntimeExports.jsxs(ModalBody,{overflow:"hidden",overflowY:"scroll",paddingRight:"0",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"flex-end",width:"100%",paddingRight:"24px",children:[jsxRuntimeExports.jsx(DerivationInfoButton,{marginRight:"5px",account:_}),jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:ct})]}),jsxRuntimeExports.jsx(AccountCard,{accountPkh:_.address.pkh})]})]})]})]})},HomeView=()=>jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Accounts"}),jsxRuntimeExports.jsx(Flex,{flex:1,minHeight:1,children:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",flex:1,marginRight:"12px",paddingBottom:"12px",children:[jsxRuntimeExports.jsx(AccountListHeader,{}),jsxRuntimeExports.jsx(Box,{flex:1,overflow:"hidden",borderRadius:"8px",children:jsxRuntimeExports.jsx(AccountListWithDrawer,{})})]})})]}),SelectedNFTContext=reactExports.createContext({selectedNFT:void 0,setSelectedNFT:_=>{}}),NFTCard=({nft:_})=>{const{selectedNFT:a,setSelectedNFT:$}=reactExports.useContext(SelectedNFTContext),j=getIPFSurl(thumbnailUri(_)),et=getIPFSurl(_.displayUri),tt=_.metadata.name,rt={width:"100%",minWidth:"242px",minHeight:"242px",objectFit:"contain",aspectRatio:"1",fallbackSrc:et,src:j},nt=a&&fullId(a)===fullId(_)&&a.owner===_.owner;return jsxRuntimeExports.jsx(Card,{minWidth:"274px",borderRadius:"8px",cursor:"pointer","data-testid":`nft-card${nt?"-selected":""}`,onClick:()=>$(_),children:jsxRuntimeExports.jsxs(CardBody,{padding:"16px",background:colors.gray[900],border:"1px solid",borderColor:nt?colors.orangeL:"transparent",borderRadius:"8px",_hover:{background:colors.gray[700],borderColor:colors.gray[500]},children:[jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsxs(Box,{position:"relative",width:"100%",children:[jsxRuntimeExports.jsx(Image$1,{...rt,zIndex:2,opacity:"0"}),jsxRuntimeExports.jsx(Image$1,{...rt,position:"absolute",zIndex:0,top:"0",filter:"blur(20px)"}),jsxRuntimeExports.jsx(Image$1,{...rt,position:"absolute",zIndex:1,top:"0","data-testid":"nft-image"})]})}),Number(_.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"24px",marginTop:"-36px",marginLeft:"10px",paddingTop:"1px",fontSize:"14px",borderRadius:"full",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",paddingX:"8px",children:"x"+_.balance}),jsxRuntimeExports.jsx(Box,{overflow:"hidden","data-testid":"nft-card-name",children:jsxRuntimeExports.jsx(Heading,{overflow:"hidden",marginTop:"15px",marginBottom:"8px",fontSize:"sm",whiteSpace:"nowrap",textOverflow:"ellipsis",children:tt})}),jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.owner)})]})})},NFTGallery=({nftsByOwner:_})=>{const a=Object.entries(_).flatMap(([j,et])=>(et||[]).map(tt=>({owner:j,...tt})));let $="repeat(auto-fit, minmax(min(100%/2, max(274px, 100%/7)), 1fr))";return a.length<3&&($=`repeat(auto-fit, min(100% / ${a.length} - 16px, 450px))`),jsxRuntimeExports.jsx(SimpleGrid,{gridTemplateColumns:$,marginBottom:"16px",minChildWidth:"340px",spacing:"16px",children:sortedByLastUpdate(a).map(j=>jsxRuntimeExports.jsx(NFTCard,{nft:j},`${j.owner}:${fullId(j)}`))})},AccountListDisplay=({accounts:_,onSelect:a})=>jsxRuntimeExports.jsx(MenuList,{zIndex:"docked",overflowY:"scroll",maxHeight:"300px",padding:0,background:colors.gray[900],children:_.map($=>jsxRuntimeExports.jsx(MenuItem$1,{width:"100%",minHeight:"48px",padding:"5px",background:colors.gray[700],"aria-label":$.label,onClick:()=>{a($)},value:$.address.pkh,children:jsxRuntimeExports.jsx(AddressTile,{width:"370px",height:"40px",padding:"5px",background:colors.gray[700],borderRadius:"4px",_hover:{background:colors.gray[500]},cursor:"pointer",address:$.address})},$.address.pkh))}),useAccountsFilter=()=>{const _=useAllAccounts(),[a]=reactExports.useState(_),[$,j]=useSearchParams(),et=$.getAll("accounts"),[tt,rt]=reactExports.useState(et.length===0),[nt,it]=reactExports.useState(_.filter(ct=>et.includes(ct.address.pkh))),ot=lodashExports.differenceBy(_,nt,ct=>ct.address.pkh),st=nt.length===_.length;return reactExports.useEffect(()=>{j(ct=>({...ct,accounts:nt.map(ut=>ut.address.pkh)}))},[nt,j]),{selectedAccounts:tt?a:nt,accountsFilter:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(Box,{alignSelf:"flex-start",children:jsxRuntimeExports.jsxs(Menu,{children:[jsxRuntimeExports.jsx(MenuButton,{as:Button,maxHeight:"26px",paddingLeft:0,fontWeight:"normal",_hover:{bg:"none"},_active:{bg:"none"},"data-testid":"account-filter",isDisabled:st,marginY:"16px",rightIcon:jsxRuntimeExports.jsx(ChevronDownIcon,{}),variant:"ghost",children:"Filter by Account"}),jsxRuntimeExports.jsx(AccountListDisplay,{accounts:ot,onSelect:ct=>{rt(!1),it(ut=>[...ut,ct])}})]})}),jsxRuntimeExports.jsx(Wrap,{width:"100%",children:nt.map(ct=>jsxRuntimeExports.jsx(AddressPill,{address:ct.address,"data-testid":"account-pill",mode:{type:"removable",onRemove:()=>{rt(nt.length===1),it(ut=>ut.filter(ht=>ht.address.pkh!==ct.address.pkh))}}},ct.address.pkh))})]})}},NFTsView=()=>{const _=useAllNfts(),{accountsFilter:a,selectedAccounts:$}=useAccountsFilter(),[j,et]=reactExports.useState(void 0);reactExports.useEffect(()=>{const it=ot=>{ot.key==="Escape"&&et(void 0)};return document.addEventListener("keydown",it),()=>document.removeEventListener("keydown",it)},[]);const tt=lodashExports.pick(_,$.map(it=>it.address.pkh)),rt=lodashExports.sumBy(Object.values(tt).flat(),it=>Number((it==null?void 0:it.balance)||0)),nt=lodashExports.every(tt,it=>!it||it.length===0);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{subtitle:`(${rt})`,title:"NFTs"}),a,nt?jsxRuntimeExports.jsx(NoNFTs,{size:"lg"}):jsxRuntimeExports.jsxs(SelectedNFTContext.Provider,{value:{setSelectedNFT:et,selectedNFT:j},children:[jsxRuntimeExports.jsx(Box,{overflowY:"scroll",children:jsxRuntimeExports.jsx(NFTGallery,{nftsByOwner:tt})}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:!!j,onClose:()=>et(void 0),placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsx(ModalBody,{children:j&&jsxRuntimeExports.jsx(NFTDrawerBody,{nft:j,onCloseDrawer:()=>et(void 0)})})})]})]})]})},OperationsView=()=>{const{accountsFilter:_,selectedAccounts:a}=useAccountsFilter(),{operations:$,loadMore:j,hasMore:et,isLoading:tt,isFirstLoad:rt}=useGetOperations(a),nt=reactExports.useRef(!1),it=ot=>{if(nt.current||!et||tt)return;const st=ot.target;if(st.scrollHeight-st.scrollTop-st.clientHeight<100)return nt.current=!0,j().finally(()=>{nt.current=!1})};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Operations"}),_,jsxRuntimeExports.jsx(Center,{display:tt&&rt?"flex":"none",height:"100%",children:jsxRuntimeExports.jsx(Image$1,{width:"150px",height:"75px",marginBottom:"136px",src:"./static/media/loading-wheel.gif"})}),$.length===0&&!tt&&jsxRuntimeExports.jsx(NoOperations,{size:"lg"}),$.length>0&&jsxRuntimeExports.jsxs(Box,{overflowY:"scroll",marginBottom:"20px",background:colors.gray[900],borderRadius:"8px",onScroll:it,paddingX:"20px",children:[jsxRuntimeExports.jsx(OperationTileContext.Provider,{value:{mode:"page"},children:$.map((ot,st)=>{const ct=st===$.length-1;return jsxRuntimeExports.jsxs(Box,{height:"90px",marginBottom:ct?"10px":0,paddingY:"20px",children:[jsxRuntimeExports.jsx(OperationTile,{operation:ot}),!ct&&jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(Divider,{marginTop:"20px"})})]},ot.id)})}),jsxRuntimeExports.jsxs(Center,{flexDirection:"column",display:tt&&!rt?"flex":"none",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Image$1,{width:"100px",height:"50px",src:"./static/media/loading-dots.gif"})]})]})]})},DrawerTopButtons=({onClose:_,...a})=>jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",paddingBottom:"30px",cursor:"pointer",...a,children:jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:_})}),BeaconPeers=()=>{const _=usePeers(),[a,$]=reactExports.useState([]);return reactExports.useEffect(()=>{const j=_.map(async et=>({...et,senderId:et.senderId||await getSenderId(et.publicKey)}));Promise.all(j).then($).catch(lodashExports.noop)},[_]),a.length===0?jsxRuntimeExports.jsxs(Box,{"data-testid":"beacon-peers-empty",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Text,{marginTop:"31px",color:colors.gray[400],size:"lg",children:"Your dApps will appear here"})]}):jsxRuntimeExports.jsx(PeersDisplay,{"data-testid":"beacon-peers",peerInfos:a})},PeersDisplay=({peerInfos:_})=>jsxRuntimeExports.jsx(Box,{children:_.map(a=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(PeerRow,{peerInfo:a})]},a.senderId))}),PeerRow=({peerInfo:_})=>{const a=useRemovePeer();return jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",height:"106px","data-testid":"peer-row",paddingY:"30px",children:[jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(AspectRatio,{width:"48px",marginRight:"16px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{width:"100%",src:_.icon})}),jsxRuntimeExports.jsxs(Center,{alignItems:"flex-start",flexDirection:"column",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"6px",size:"md",children:_.name}),jsxRuntimeExports.jsx(StoredPeerInfo,{peerInfo:_})]})]}),jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsx(IconButton,{"aria-label":"Remove Peer",icon:jsxRuntimeExports.jsx(TrashIcon,{}),onClick:()=>a(_),size:"xs",variant:"circle"})})]})},StoredPeerInfo=({peerInfo:_})=>{const a=useGetConnectionInfo(_.senderId);return a?jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(AddressPill,{marginRight:"10px",address:parsePkh(a.accountPkh)}),jsxRuntimeExports.jsx(Divider,{marginRight:"10px",orientation:"vertical"}),jsxRuntimeExports.jsx(Text,{marginTop:"2px",marginRight:"4px",color:colors.gray[450],fontWeight:650,size:"sm",children:"Network:"}),jsxRuntimeExports.jsx(Text,{marginTop:"2px",color:colors.white,"data-testid":"dapp-connection-network",size:"sm",children:lodashExports.capitalize(a.networkType)})]}):null},DAppsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1(),j=useAddPeer();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"dApps",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{"data-testid":"drawer-body",children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",height:"96px",children:jsxRuntimeExports.jsx(Heading,{children:"dApps"})}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.readText().then(et=>j(et)),children:"Connect with Pairing Request"}),jsxRuntimeExports.jsx(Text,{marginTop:"16px",marginBottom:"32px",color:colors.gray[400],children:"or open a deeplink from inside the dApp..."}),jsxRuntimeExports.jsx(BeaconPeers,{})]})]})})]})]})},ErrorLogsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Error Logs",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsx(ErrorLogsDrawerBody,{})]})})]})]})},ErrorLogsDrawerBody=()=>{const _=[...useAppSelector(j=>j.errors)].reverse(),a=useDispatch(),$=()=>{a(errorsSlice.actions.reset())};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",height:"50px",marginBottom:"20px",children:[jsxRuntimeExports.jsx(Heading,{size:"xl",children:"Error Logs"}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx("a",{download:"UmamiErrorLogs.json",href:`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(_))}`,children:jsxRuntimeExports.jsx(Button,{variant:"tertiary",children:"Download error logs"})}),jsxRuntimeExports.jsx(Button,{marginLeft:"8px",onClick:$,variant:"warning",children:"Clear All"})]})]}),_.map(j=>jsxRuntimeExports.jsx(ErrorLogRow,{errorLog:j},nanoid()))]})},ErrorLogRow=({errorLog:_})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:1}),jsxRuntimeExports.jsx(Flex,{justifyContent:"space-between",paddingY:"12px",children:jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutlineExclamationCircleIcon,{marginTop:"1px",marginRight:"8px"}),jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[jsxRuntimeExports.jsx(Heading,{wordBreak:"break-all",size:"sm",children:_.description}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:_.timestamp})]})]})})]}),removeTrailingSlashes=_=>_.replace(/\/+$/g,""),UpsertNetworkModal=({network:_})=>{const a=_?"edit":"create",{onClose:$}=reactExports.useContext(DynamicModalContext),j=useDispatch(),et=useAvailableNetworks(),{formState:{errors:tt,isValid:rt},register:nt,handleSubmit:it}=useForm({mode:"onBlur",defaultValues:_}),ot=st=>{j(networksActions.upsertNetwork(st)),$()};return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:it(ot),children:[jsxRuntimeExports.jsxs(ModalHeader,{textAlign:"center",children:[a==="edit"?"Edit":"Add"," Network",jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsxs(ModalBody,{children:[a==="create"&&jsxRuntimeExports.jsxs(FormControl,{marginTop:"32px",marginBottom:"24px",isInvalid:!!tt.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Name"}),jsxRuntimeExports.jsx(Input,{placeholder:"mainnet",...nt("name",{required:"Name is required",validate:st=>{if(et.find(ct=>ct.name===st))return"Network with this name already exists"}})}),tt.name&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.name.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.rpcUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"RPC URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://prod.tcinfra.net/rpc/mainnet",...nt("rpcUrl",{required:"RPC URL is required",setValueAs:removeTrailingSlashes})}),tt.rpcUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.rpcUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.tzktApiUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Tzkt API URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://api.ghostnet.tzkt.io",...nt("tzktApiUrl",{required:"Tzkt API URL is required",setValueAs:removeTrailingSlashes})}),tt.tzktApiUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.tzktApiUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.tzktExplorerUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Tzkt Explorer URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://ghostnet.tzkt.io",...nt("tzktExplorerUrl",{required:"Tzkt Explorer URL is required",setValueAs:removeTrailingSlashes})}),tt.tzktExplorerUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.tzktExplorerUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"Buy Tez URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://faucet.ghostnet.teztnets.com",...nt("buyTezUrl")})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!rt,onClick:()=>{},type:"submit",children:a==="edit"?"Save changes":"Add network"})})]})]})})},NetworkSettingsDrawerBody=()=>{const{openWith:_}=reactExports.useContext(DynamicModalContext),a=useSelectedNetwork(),$=useSelectNetwork(),j=useAvailableNetworks(),et=useAppDispatch(),tt=rt=>{et(networksActions.removeNetwork(rt))};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{children:"Network Settings"}),jsxRuntimeExports.jsxs(Button,{paddingRight:"0",onClick:()=>_(jsxRuntimeExports.jsx(UpsertNetworkModal,{})),variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{size:"sm",children:"Add Network"}),jsxRuntimeExports.jsx(PlusIcon,{width:"18px",height:"18px",marginLeft:"4px",stroke:"currentcolor"})]})]}),jsxRuntimeExports.jsx(RadioGroup,{marginTop:"60px",onChange:$,value:a.name,children:jsxRuntimeExports.jsx(Stack,{children:j.map(rt=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700]}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between","data-testid":`network-${rt.name}`,children:[jsxRuntimeExports.jsx(Radio,{height:"100px",value:rt.name,variant:"primary",children:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",marginLeft:"16px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"4px",size:"sm",children:rt.name}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],children:rt.rpcUrl})]})}),!isDefault(rt)&&jsxRuntimeExports.jsx(Center,{"data-testid":"popover-menu",children:jsxRuntimeExports.jsxs(PopoverMenu,{children:[jsxRuntimeExports.jsxs(Button,{onClick:()=>_(jsxRuntimeExports.jsx(UpsertNetworkModal,{network:rt})),variant:"popover",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Edit"}),jsxRuntimeExports.jsx(PenIcon,{stroke:"inherit"})]}),jsxRuntimeExports.jsx(Divider,{marginTop:"4px"}),jsxRuntimeExports.jsxs(Button,{onClick:()=>tt(rt),variant:"popover",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Remove"}),jsxRuntimeExports.jsx(TrashIcon,{stroke:"inherit"})]})]})})]})]},rt.name))})})]})},NetworkSettingsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Network Settings",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsx(NetworkSettingsDrawerBody,{})]})})]})]})},ChangePasswordForm=()=>{const{onClose:_}=reactExports.useContext(DynamicModalContext),a=useForm({mode:"onBlur"}),$=useToast(),j=useAppDispatch(),{handleAsyncAction:et,isLoading:tt}=useAsyncActionHandler(),{handleSubmit:rt,formState:{isValid:nt,errors:it},getValues:ot}=a,st=async({currentPassword:ct,newPassword:ut,newPasswordConfirmation:ht})=>{if(!(ct===ut||ut!==ht))return et(async()=>{await j(changeMnemonicPassword({currentPassword:ct,newPassword:ut})).unwrap(),$({description:"Password updated",status:"success"}),_()})};return jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx(ModalContent,{background:colors.gray[700],"data-testid":"change-password-modal",children:jsxRuntimeExports.jsxs("form",{onSubmit:rt(st),children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{textAlign:"center",children:jsxRuntimeExports.jsx(Heading,{children:"Change Password"})}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{marginTop:"32px",isInvalid:!!it.currentPassword,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"current-password",inputName:"currentPassword",label:"Current Password",placeholder:"Enter your current password",required:"Current password is required"}),it.currentPassword&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"current-password-error",children:it.currentPassword.message})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!it.newPassword,marginY:6,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"new-password",inputName:"newPassword",label:"New Password",placeholder:"Enter new password",required:"New password is required",validate:ct=>ot("currentPassword")!==ct||"Cannot be the same as old password"}),it.newPassword&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"new-password-error",children:it.newPassword.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:3,isInvalid:!!it.newPasswordConfirmation,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"new-password-confirmation",inputName:"newPasswordConfirmation",label:"Confirm New Password",placeholder:"Confirm new password",required:"Confirmation is required",validate:ct=>ot("newPassword")===ct||"Your new passwords do no match"}),it.newPasswordConfirmation&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"new-password-confirmation-error",children:it.newPasswordConfirmation.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!nt,isLoading:tt,size:"lg",type:"submit",children:"Update Password"})})]})})})},SettingsView=()=>jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Settings"}),jsxRuntimeExports.jsxs(Box,{overflowY:"scroll",children:[jsxRuntimeExports.jsx(Box,{marginTop:"16px",children:jsxRuntimeExports.jsx(GeneralSection,{})}),jsxRuntimeExports.jsx(BackupSection,{}),jsxRuntimeExports.jsx(AdvancedSection,{})]})]}),GeneralSection=()=>jsxRuntimeExports.jsxs(SectionContainer,{title:"General",children:[jsxRuntimeExports.jsx(NetworkSettingsDrawerCard,{}),jsxRuntimeExports.jsx(ErrorLogsDrawerCard,{})]}),BackupSection=()=>jsxRuntimeExports.jsx(SectionContainer,{title:"Backup",children:jsxRuntimeExports.jsx(ClickableCard,{isSelected:!1,onClick:downloadBackupFile,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{size:"sm",children:"Download backup file"}),jsxRuntimeExports.jsx(Button,{onClick:downloadBackupFile,variant:"unstyled",children:jsxRuntimeExports.jsx(DownloadIcon,{cursor:"pointer"})})]})})}),AdvancedSection=()=>{const{modalElement:_,onOpen:a}=useOffboardingModal(),{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(SectionContainer,{title:"Advanced Settings",children:[jsxRuntimeExports.jsx(DAppsDrawerCard,{}),jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Off-board Wallet",isSelected:!1,onClick:a}),jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Change Password",isSelected:!1,onClick:()=>$(jsxRuntimeExports.jsx(ChangePasswordForm,{}))}),_]})},SectionContainer=({title:_,children:a})=>jsxRuntimeExports.jsx(Box,{marginTop:"8px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsxs(Box,{width:"550px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"16px",size:"lg",children:_}),a]})})}),TokenTile=({token:_,amount:a,...$})=>{const{contract:j}=_,et=tokenPrettyAmount(a,_),tt=tokenSymbolSafe(_);return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"start",width:"400px",padding:"15px",background:colors.gray[800],borderRadius:"4px","data-testid":"token-tile",...$,children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(AspectRatio,{width:"30px",height:"30px",marginRight:"12px",ratio:1,children:jsxRuntimeExports.jsx(TokenIcon,{padding:"6.25px",background:colors.gray[500],borderRadius:"4px",contract:j})})}),jsxRuntimeExports.jsx(PrettyNumber,{number:et}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:tt})]})},SignPage=_=>{const{mode:a,operations:$,data:{token:j}}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:ct}=useSignPageHelpers($,a),{amount:ut,recipient:ht}=tt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:tt.type,signer:tt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TokenTile,{amount:ut,token:j}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(SignPageFee,{fee:et})})}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:tt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ht}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ct,signer:ot,text:headerText(tt.type,a)})})]})})})},FormPage=_=>{const{token:a}=_,$=useOpenSignPageFormAction({SignPage,signPageExtraData:{token:a},FormPage,defaultFormPageProps:_,toOperation:toOperation(a)}),j=useAddToBatchFormAction(toOperation(a)),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(_)}),{formState:{isValid:it,errors:ot},register:st,handleSubmit:ct}=nt,ut=tokenDecimals(a),ht=formatTokenAmount(a.balance,ut),Et=getSmallestUnit(Number(ut));return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(FormPageHeader,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!ot.prettyAmount,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Amount"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{isDisabled:rt,step:Et,type:"number",...st("prettyAmount",{required:"Amount is required",max:{value:ht.toString(),message:`Max amount is ${ht}`},validate:makeValidateDecimals(Number(ut))}),placeholder:Et}),jsxRuntimeExports.jsx(InputRightElement,{paddingRight:"12px","data-testid":"token-symbol",children:tokenSymbolSafe(a)})]}),ot.prettyAmount&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"amount-error",children:ot.prettyAmount.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),ot.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:ot.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ct(tt),onSingleSubmit:ct(et)})})]})})})},toOperation=_=>a=>{const $={type:"fa2",sender:parsePkh(a.sender),recipient:parsePkh(a.recipient),contract:parseContractPkh(_.contract),tokenId:_.tokenId,amount:getRealAmount(_,a.prettyAmount)};return _.type==="fa2"?$:{...$,type:"fa1.2",tokenId:"0"}},Header=({account:_})=>{const{address:a,label:$}=_;return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"78px",background:accountIconGradient({left:"-10px",top:"-10px",account:_,radius:"100px",mainBackgroundColor:colors.gray[800]}),borderTopRadius:"8px","data-testid":"header",paddingX:"30px",children:[jsxRuntimeExports.jsx(AccountTileIcon,{account:_,size:"lg"}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",flex:1,children:[jsxRuntimeExports.jsxs(Box,{marginLeft:"16px","data-testid":"account-identifier",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"4px",size:"md",children:$}),jsxRuntimeExports.jsx(Text,{color:colors.gray[300],size:"sm",children:formatPkh(a.pkh)})]}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column-reverse",children:jsxRuntimeExports.jsx(AccountBalance,{verticalAlign:"bottom",address:_.address.pkh})})]})]})},AccountTokens=({account:_,tokens:a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Card,{overflowX:"auto",marginBottom:"16px",borderBottomRadius:"8px",backgroundColor:colors.gray[900],children:[jsxRuntimeExports.jsx(Header,{account:_}),jsxRuntimeExports.jsx(TableContainer,{paddingX:"30px",children:jsxRuntimeExports.jsx(Table,{children:jsxRuntimeExports.jsx(Tbody,{children:a.map((j,et)=>{const tt=et===a.length-1?"transparent":colors.gray[700];return jsxRuntimeExports.jsxs(Tr,{"data-testid":"token-tile",children:[jsxRuntimeExports.jsx(Td,{width:"20%",minWidth:"240px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(TokenIcon,{display:"inline-block",width:"38px",contract:j.contract}),jsxRuntimeExports.jsx(Heading,{display:"inline-block",marginLeft:"16px",size:"sm",children:jsxRuntimeExports.jsx(TokenNameWithIcon,{token:j})})]})}),jsxRuntimeExports.jsx(Td,{width:"20%",minWidth:"200px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(AddressPill,{address:parseContractPkh(j.contract)})}),jsxRuntimeExports.jsx(Td,{width:"15%",minWidth:"160px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(Heading,{size:"sm",children:tokenPrettyAmount(j.balance,j,{showSymbol:!1})})}),jsxRuntimeExports.jsx(Td,{textAlign:"right",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(SendButton,{onClick:()=>$(jsxRuntimeExports.jsx(FormPage,{sender:_,token:j}))})})]},fullId(j))})})})})]})},TokensPage=()=>{const{accountsFilter:_,selectedAccounts:a}=useAccountsFilter(),$=useGetAccountAllTokens(),j=a.map(et=>[et,$(et.address.pkh)]).filter(([,et])=>et.length>0);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Tokens"}),_,j.length===0?jsxRuntimeExports.jsx(NoTokens,{size:"lg"}):jsxRuntimeExports.jsx(Box,{overflowY:"auto",children:j.map(([et,tt])=>jsxRuntimeExports.jsx(AccountTokens,{account:et,tokens:tt},et.address.pkh))})]})},AppVersion=({isCollapsed:_,...a})=>{const $=_?packageInfo.version:`Umami v${packageInfo.version}`;return jsxRuntimeExports.jsx(Text,{color:colors.gray[450],...a,children:$})},CollapseMenuButton=({toggle:_,...a})=>jsxRuntimeExports.jsx(Center,{width:"44px",height:"44px",marginRight:"-14px",borderRadius:"4px",_hover:{background:colors.gray[800]},cursor:"pointer","data-testid":"collapse-menu-button",onClick:_,...a,children:jsxRuntimeExports.jsx(BurgerMenuIcon,{})}),useCollapseMenu=()=>{const[_,a]=reactExports.useState(!1),$=reactExports.useCallback(()=>{a(j=>!j)},[]);return{isCollapsed:_,toggle:$}},ORANGE="#F74F18",MakiLogo=_=>{const a=useSelectedNetwork();return jsxRuntimeExports.jsx(MakiIcon,{background:"white",borderRadius:"8px","data-testid":"maki-logo",fishColor:a.name==="mainnet"?ORANGE:"black",..._})},NetworkSelector=()=>{const _=useSelectedNetwork(),a=useAvailableNetworks(),$=useSelectNetwork(),{onOpen:j,onClose:et,isOpen:tt}=useDisclosure$1();return jsxRuntimeExports.jsxs(Popover,{isOpen:tt,onClose:et,onOpen:j,placement:"bottom-end",children:[jsxRuntimeExports.jsx(PopoverTrigger,{children:jsxRuntimeExports.jsxs(Button,{marginTop:"4px",color:colors.green,"data-testid":"network-selector",variant:"unstyled",children:[lodashExports.capitalize(_.name),tt?jsxRuntimeExports.jsx(ChevronUpIcon,{marginTop:"-2px",stroke:"currentcolor"}):jsxRuntimeExports.jsx(ChevronDownIcon$1,{marginTop:"-2px",stroke:"currentcolor"})]})}),jsxRuntimeExports.jsx(PopoverContent,{width:"100px",marginTop:"-10px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],children:jsxRuntimeExports.jsx(PopoverBody,{padding:"4px 12px",children:jsxRuntimeExports.jsx(Flex,{flexDirection:"column",children:a.map((rt,nt)=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{height:"34px",color:rt.name===_.name?colors.green:colors.gray[300],fontSize:"14px",fontWeight:400,textAlign:"right",_hover:{color:colors.greenL},onClick:()=>{$(rt.name),et()},variant:"unstyled",children:lodashExports.capitalize(rt.name)}),nt{const[_,a]=reactExports.useState(!1),$=window;reactExports.useEffect(()=>{$&&$.electronAPI&&$.electronAPI.onAppUpdateDownloaded(et=>a(!0))},[$]);const j=()=>{$&&$.electronAPI&&$.electronAPI.installAppUpdateAndQuit()};return _?jsxRuntimeExports.jsx(Box,{marginTop:"24px",marginBottom:"6px",children:jsxRuntimeExports.jsxs(Button,{justifyContent:"flex-start",width:"100%",height:"32px",paddingTop:"7px",paddingRight:"8px",paddingBottom:"7px",paddingLeft:"8px",color:colors.black,background:colors.green,_hover:{color:colors.black,background:colors.greenL},onClick:j,children:[jsxRuntimeExports.jsx(FlipForwardEnergy,{}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Update Umami"})]})}):null},SideNavbar=()=>{const{isCollapsed:_,toggle:a}=useCollapseMenu(),$=jsxRuntimeExports.jsx(CollapseMenuButton,{marginTop:_?0:"2px",marginRight:_?0:"-14px",toggle:a});return jsxRuntimeExports.jsxs(Flex,{alignItems:_?"center":"normal",flexDirection:"column",width:_?"80px":"236px",padding:_?"30px 20px":"30px",background:colors.gray[900],"data-testid":`side-navbar${_?"-collapsed":""}`,children:[jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",height:"30px",children:_?$:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(MakiLogo,{width:"38px",height:"38px"}),jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(NetworkSelector,{}),$]})]})}),jsxRuntimeExports.jsx(Divider,{marginTop:"28px"})]}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",flexDirection:"column",flex:1,children:[jsxRuntimeExports.jsxs(Box,{alignItems:_?"center":"normal",justifyContent:_?"space-around":"normal",display:_?"flex":"block",height:"100%",children:[!_&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(UpdateAppButton,{}),jsxRuntimeExports.jsx(TotalBalance,{})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(AccountsIcon,{}),isCollapsed:_,label:"Accounts",to:"/home"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(DiamondIcon,{}),isCollapsed:_,label:"NFTs",to:"/nfts"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(RefreshClockIcon,{width:"24px",height:"24px"}),isCollapsed:_,label:"Operations",to:"/operations"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(CoinIcon,{}),isCollapsed:_,label:"Tokens",to:"/tokens"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(BatchIcon,{}),isCollapsed:_,label:"Batch",to:"/batch"})]})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(MenuItem,{marginTop:"22px",icon:jsxRuntimeExports.jsx(AddressBookIcon,{}),isCollapsed:_,label:"Address Book",to:"/address-book"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(GearIcon,{}),isCollapsed:_,label:"Settings",to:"/settings"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(HelpIcon,{}),isCollapsed:_,label:"Help",to:"/help"}),jsxRuntimeExports.jsx(AppVersion,{marginTop:"24px",fontSize:"14px",textAlign:_?"center":"left",isCollapsed:_})]})]})]})},MenuItem=({icon:_,label:a,to:$,isCollapsed:j,...et})=>{const rt=useLocation().pathname.startsWith($);return jsxRuntimeExports.jsx(Link,{to:$,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"flex-start",width:j?"44px":"176px",marginBottom:"8px",padding:"10px",background:rt?colors.gray[600]:"transparent",borderRadius:"4px",_hover:{background:rt?colors.gray[600]:colors.gray[800]},cursor:"pointer",...et,children:[_,!j&&jsxRuntimeExports.jsx(Text,{marginLeft:"10px",size:"sm",children:a})]})})},TotalBalance=()=>{const _=useTotalBalance(),[a]=useMediaQuery("(max-height: 900px)");return jsxRuntimeExports.jsxs(Box,{marginTop:"24px",marginBottom:a?"30px":"100px","data-testid":"total-balance",children:[jsxRuntimeExports.jsx(Text,{marginBottom:"4px",size:"sm",children:"Balance"}),_&&jsxRuntimeExports.jsx(TezRecapDisplay,{balance:_.mutez,dollarBalance:_.usd})]})},withSideMenu=_=>jsxRuntimeExports.jsxs(Flex,{height:"100vh",children:[jsxRuntimeExports.jsx(SideNavbar,{}),jsxRuntimeExports.jsx(Box,{flex:1,overflowX:"hidden",height:"100%",background:"linear-gradient(180deg, rgba(0, 231, 182, 0.35) -41.53%, rgba(0, 231, 182, 0.00) 34.71%)",paddingX:"24px",children:_})]}),AccountsImage=""+new URL("accounts-DTYOez9Q.png",import.meta.url).href,BatchImage=""+new URL("batch-CoYFN9ox.png",import.meta.url).href,MultisigImage=""+new URL("multisig-GRRIvmJS.png",import.meta.url).href;var js={},Carousel$1={},lib={},reactSwipe={},hasRequiredReactSwipe;function requireReactSwipe(){return hasRequiredReactSwipe||(hasRequiredReactSwipe=1,function(_){(function(a,$){$(_,reactExports,propTypesExports)})(commonjsGlobal,function(a,$,j){Object.defineProperty(a,"__esModule",{value:!0}),a.setHasSupportToCaptureOption=Et;var et=rt($),tt=rt(j);function rt(Ct){return Ct&&Ct.__esModule?Ct:{default:Ct}}var nt=Object.assign||function(Ct){for(var Ot=1;Ot=0||Object.prototype.hasOwnProperty.call(Ct,Ut)&&(zt[Ut]=Ct[Ut]);return zt}function ot(Ct,Ot){if(!(Ct instanceof Ot))throw new TypeError("Cannot call a class as a function")}var st=function(){function Ct(Ot,zt){for(var Ut=0;Ut0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return ht?Ct:Ct.capture}function Mt(Ct){if("touches"in Ct){var Ot=Ct.touches[0],zt=Ot.pageX,Ut=Ot.pageY;return{x:zt,y:Ut}}var Vt=Ct.screenX,jt=Ct.screenY;return{x:Vt,y:jt}}var kt=function(Ct){ut(Ot,Ct);function Ot(){var zt;ot(this,Ot);for(var Ut=arguments.length,Vt=Array(Ut),jt=0;jtVt&&this.props.onSwipeRight(1,Ut),this.movePosition.deltaY<-Vt?this.props.onSwipeUp(1,Ut):this.movePosition.deltaY>Vt&&this.props.onSwipeDown(1,Ut)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(Ut){this.swiper=Ut,this.props.innerRef(Ut)}},{key:"render",value:function(){var Ut=this.props;Ut.tagName;var Vt=Ut.className,jt=Ut.style,$t=Ut.children;Ut.allowMouseEvents,Ut.onSwipeUp,Ut.onSwipeDown,Ut.onSwipeLeft,Ut.onSwipeRight,Ut.onSwipeStart,Ut.onSwipeMove,Ut.onSwipeEnd,Ut.innerRef,Ut.tolerance;var Bt=it(Ut,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]);return et.default.createElement(this.props.tagName,nt({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:Vt,style:jt},Bt),$t)}}]),Ot}($.Component);kt.displayName="ReactSwipe",kt.propTypes={tagName:tt.default.string,className:tt.default.string,style:tt.default.object,children:tt.default.node,allowMouseEvents:tt.default.bool,onSwipeUp:tt.default.func,onSwipeDown:tt.default.func,onSwipeLeft:tt.default.func,onSwipeRight:tt.default.func,onSwipeStart:tt.default.func,onSwipeMove:tt.default.func,onSwipeEnd:tt.default.func,innerRef:tt.default.func,tolerance:tt.default.number.isRequired},kt.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},a.default=kt})}(reactSwipe)),reactSwipe}(function(_){(function(a,$){$(_,requireReactSwipe())})(commonjsGlobal,function(a,$){Object.defineProperty(a,"__esModule",{value:!0});var j=et($);function et(tt){return tt&&tt.__esModule?tt:{default:tt}}a.default=j.default})})(lib);var cssClasses={},classnames={exports:{}};/*! +`}return fr.substring(0,fr.length-1)},dt.renderTo2dContext=function(qt,Jt){Jt=Jt||2;for(var Ft=dt.getModuleCount(),Kt=0;Kt>>8),Nt.push(bt&255)):Nt.push($t)}}return Nt}};var et={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},tt={L:1,M:0,Q:3,H:2},rt={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},nt=function(){var Ut=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],Vt=1335,jt=7973,$t=21522,Bt={},Nt=function(Lt){for(var Pt=0;Lt!=0;)Pt+=1,Lt>>>=1;return Pt};return Bt.getBCHTypeInfo=function(Lt){for(var Pt=Lt<<10;Nt(Pt)-Nt(Vt)>=0;)Pt^=Vt<=0;)Pt^=jt<5&&(bt+=3+vt-5)}for(var at=0;at=256;)Bt-=255;return Ut[Bt]},$t}();function ot(Ut,Vt){if(typeof Ut.length>"u")throw Ut.length+"/"+Vt;var jt=function(){for(var Bt=0;Bt"u")throw"bad rs block @ typeNumber:"+Bt+"/errorCorrectionLevel:"+Nt;for(var Pt=Lt.length/3,bt=[],at=0;at>>7-$t%8&1)==1},jt.put=function($t,Bt){for(var Nt=0;Nt>>Bt-Nt-1&1)==1)},jt.getLengthInBits=function(){return Vt},jt.putBit=function($t){var Bt=Math.floor(Vt/8);Ut.length<=Bt&&Ut.push(0),$t&&(Ut[Bt]|=128>>>Vt%8),Vt+=1},jt},ut=function(Ut){var Vt=et.MODE_NUMBER,jt=Ut,$t={};$t.getMode=function(){return Vt},$t.getLength=function(Lt){return jt.length},$t.write=function(Lt){for(var Pt=jt,bt=0;bt+2>>8&255)*192+(bt&255),Nt.put(bt,13),Pt+=2}if(Pt>>8)},Vt.writeBytes=function(jt,$t,Bt){$t=$t||0,Bt=Bt||jt.length;for(var Nt=0;Nt0&&(jt+=","),jt+=Ut[$t];return jt+="]",jt},Vt},kt=function(){var Ut=0,Vt=0,jt=0,$t="",Bt={},Nt=function(Pt){$t+=String.fromCharCode(Lt(Pt&63))},Lt=function(Pt){if(!(Pt<0)){if(Pt<26)return 65+Pt;if(Pt<52)return 97+(Pt-26);if(Pt<62)return 48+(Pt-52);if(Pt==62)return 43;if(Pt==63)return 47}throw"n:"+Pt};return Bt.writeByte=function(Pt){for(Ut=Ut<<8|Pt&255,Vt+=8,jt+=1;Vt>=6;)Nt(Ut>>>Vt-6),Vt-=6},Bt.flush=function(){if(Vt>0&&(Nt(Ut<<6-Vt),Ut=0,Vt=0),jt%3!=0)for(var Pt=3-jt%3,bt=0;bt=Vt.length){if(Bt==0)return-1;throw"unexpected end of file./"+Bt}var Pt=Vt.charAt(jt);if(jt+=1,Pt=="=")return Bt=0,-1;if(Pt.match(/^\s$/))continue;$t=$t<<6|Lt(Pt.charCodeAt(0)),Bt+=6}var bt=$t>>>Bt-8&255;return Bt-=8,bt};var Lt=function(Pt){if(65<=Pt&&Pt<=90)return Pt-65;if(97<=Pt&&Pt<=122)return Pt-97+26;if(48<=Pt&&Pt<=57)return Pt-48+52;if(Pt==43)return 62;if(Pt==47)return 63;throw"c:"+Pt};return Nt},Ot=function(Ut,Vt){var jt=Ut,$t=Vt,Bt=new Array(Ut*Vt),Nt={};Nt.setPixel=function(at,dt,vt){Bt[dt*jt+at]=vt},Nt.write=function(at){at.writeString("GIF87a"),at.writeShort(jt),at.writeShort($t),at.writeByte(128),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(0),at.writeByte(255),at.writeByte(255),at.writeByte(255),at.writeString(","),at.writeShort(0),at.writeShort(0),at.writeShort(jt),at.writeShort($t),at.writeByte(0);var dt=2,vt=Pt(dt);at.writeByte(dt);for(var xt=0;vt.length-xt>255;)at.writeByte(255),at.writeBytes(vt,xt,255),xt+=255;at.writeByte(vt.length-xt),at.writeBytes(vt,xt,vt.length-xt),at.writeByte(0),at.writeString(";")};var Lt=function(at){var dt=at,vt=0,xt=0,wt={};return wt.write=function(_t,At){if(_t>>>At)throw"length over";for(;vt+At>=8;)dt.writeByte(255&(_t<>>=8-vt,xt=0,vt=0;xt=_t<0&&dt.writeByte(xt)},wt},Pt=function(at){for(var dt=1<>6,128|it&63):it<55296||it>=57344?rt.push(224|it>>12,128|it>>6&63,128|it&63):(nt++,it=65536+((it&1023)<<10|tt.charCodeAt(nt)&1023),rt.push(240|it>>18,128|it>>12&63,128|it>>6&63,128|it&63))}return rt}return et(j)}})(),function(j){_.exports=j()}(function(){return $})})(qrcode);var qrcodeExports=qrcode.exports,__extends=commonjsGlobal&&commonjsGlobal.__extends||function(){var _=function(a,$){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(j,et){j.__proto__=et}||function(j,et){for(var tt in et)Object.prototype.hasOwnProperty.call(et,tt)&&(j[tt]=et[tt])},_(a,$)};return function(a,$){if(typeof $!="function"&&$!==null)throw new TypeError("Class extends value "+String($)+" is not a constructor or null");_(a,$);function j(){this.constructor=a}a.prototype=$===null?Object.create($):(j.prototype=$.prototype,new j)}}(),__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(_){for(var a,$=1,j=arguments.length;$=1&&tt<=127?j+=$.charAt(et):tt>2047?(j+=String.fromCharCode(224|tt>>12&15),j+=String.fromCharCode(128|tt>>6&63),j+=String.fromCharCode(128|tt>>0&63)):(j+=String.fromCharCode(192|tt>>6&31),j+=String.fromCharCode(128|tt>>0&63));return j},a.prototype.drawRoundedSquare=function($,j,et,tt,rt,nt,it,ot){ot.lineWidth=$,ot.fillStyle=rt,ot.strokeStyle=rt,et+=$/2,j+=$/2,tt-=$,Array.isArray(nt)||(nt=[nt,nt,nt,nt]),nt=nt.map(function(Et){return Et=Math.min(Et,tt/2),Et<0?0:Et});var st=nt[0]||0,ct=nt[1]||0,ut=nt[2]||0,ht=nt[3]||0;ot.beginPath(),ot.moveTo(j+st,et),ot.lineTo(j+tt-ct,et),ct&&ot.quadraticCurveTo(j+tt,et,j+tt,et+ct),ot.lineTo(j+tt,et+tt-ut),ut&&ot.quadraticCurveTo(j+tt,et+tt,j+tt-ut,et+tt),ot.lineTo(j+ht,et+tt),ht&&ot.quadraticCurveTo(j,et+tt,j,et+tt-ht),ot.lineTo(j,et+st),st&&ot.quadraticCurveTo(j,et,j+st,et),ot.closePath(),ot.stroke(),it&&ot.fill()},a.prototype.drawPositioningPattern=function($,j,et,tt,rt,nt,it){it===void 0&&(it=[0,0,0,0]);var ot=Math.ceil(j),st,ct;typeof it!="number"&&!Array.isArray(it)?(st=it.outer||0,ct=it.inner||0):(st=it,ct=st);var ut,ht;typeof nt!="string"?(ut=nt.outer,ht=nt.inner):(ut=nt,ht=nt);var Et=tt*j+et,St=rt*j+et,Mt=j*7;this.drawRoundedSquare(ot,St,Et,Mt,ut,st,!1,$),Mt=j*3,Et+=j*2,St+=j*2,this.drawRoundedSquare(ot,St,Et,Mt,ht,ct,!0,$)},a.prototype.isInPositioninZone=function($,j,et){return et.some(function(tt){return j>=tt.row&&j<=tt.row+7&&$>=tt.col&&$<=tt.col+7})},a.prototype.transformPixelLengthIntoNumberOfCells=function($,j){return $/j},a.prototype.isCoordinateInImage=function($,j,et,tt,rt,nt,it,ot){if(ot){var st=2,ct=this.transformPixelLengthIntoNumberOfCells(rt,it),ut=this.transformPixelLengthIntoNumberOfCells(nt,it),ht=this.transformPixelLengthIntoNumberOfCells(et,it)-1,Et=this.transformPixelLengthIntoNumberOfCells(tt,it)-1;return j>=ct-st&&j<=ct+ht+st&&$>=ut-st&&$<=ut+Et+st}else return!1},a.prototype.shouldComponentUpdate=function($){return!isEqual$1(this.props,$)},a.prototype.componentDidMount=function(){this.update()},a.prototype.componentDidUpdate=function(){this.update()},a.prototype.update=function(){var $,j=this.props,et=j.value,tt=j.ecLevel,rt=j.enableCORS,nt=j.bgColor,it=j.fgColor,ot=j.logoImage,st=j.logoOpacity,ct=j.logoOnLoad,ut=j.removeQrCodeBehindLogo,ht=j.qrStyle,Et=j.eyeRadius,St=j.eyeColor,Mt=j.logoPaddingStyle,kt=+this.props.size,Ct=+this.props.quietZone,Ot=this.props.logoWidth?+this.props.logoWidth:0,zt=this.props.logoHeight?+this.props.logoHeight:0,Ut=this.props.logoPadding?+this.props.logoPadding:0,Vt=qrGenerator(0,tt);Vt.addData(this.utf16to8(et)),Vt.make();var jt=($=this.canvasRef)===null||$===void 0?void 0:$.current,$t=jt.getContext("2d"),Bt=kt+2*Ct,Nt=Vt.getModuleCount(),Lt=kt/Nt,Pt=window.devicePixelRatio||1;jt.height=jt.width=Bt*Pt,$t.scale(Pt,Pt),$t.fillStyle=nt,$t.fillRect(0,0,Bt,Bt);var bt=Ct,at=[{row:0,col:0},{row:0,col:Nt-7},{row:Nt-7,col:0}];if($t.strokeStyle=it,ht==="dots"){$t.fillStyle=it;for(var dt=Lt/2,vt=0;vt0&&!Vt.isDark(vt-1,xt)&&xt>0&&!Vt.isDark(vt,xt-1)&&(wt[0]=!0),vt>0&&!Vt.isDark(vt-1,xt)&&xt0&&!Vt.isDark(vt,xt-1)&&(wt[3]=!0);var _t=Math.ceil((xt+1)*Lt)-Math.floor(xt*Lt),At=Math.ceil((vt+1)*Lt)-Math.floor(vt*Lt);$t.fillStyle=it,$t.beginPath(),$t.arc(Math.round(xt*Lt)+dt+bt,Math.round(vt*Lt)+dt+bt,dt,0,2*Math.PI,!1),$t.closePath(),$t.fill(),wt[0]||$t.fillRect(Math.round(xt*Lt)+bt,Math.round(vt*Lt)+bt,_t/2,At/2),wt[1]||$t.fillRect(Math.round(xt*Lt)+bt+Math.floor(_t/2),Math.round(vt*Lt)+bt,_t/2,At/2),wt[2]||$t.fillRect(Math.round(xt*Lt)+bt+Math.floor(_t/2),Math.round(vt*Lt)+bt+Math.floor(At/2),_t/2,At/2),wt[3]||$t.fillRect(Math.round(xt*Lt)+bt,Math.round(vt*Lt)+bt+Math.floor(At/2),_t/2,At/2)}}else for(var vt=0;vt{const $=useGetOwnedAccountSafe()(_);return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:"You can receive tez or other digital assets by scanning or sharing this QR code",title:"Receive"}),jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",flexDirection:"column",children:jsxRuntimeExports.jsx(Box,{padding:"8px",background:"white",borderRadius:"8px",children:jsxRuntimeExports.jsx(QRCode_1,{size:232,value:_})})})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsxs(Box,{width:"100%",children:[$&&jsxRuntimeExports.jsx(Heading,{textAlign:"center",marginY:2,children:$.label}),jsxRuntimeExports.jsx(Flex,{justifyContent:"center",width:"100%",children:jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_),mode:{type:"no_icons"}})})]})})]})},AccountCard=({accountPkh:_})=>{const a=useGetOwnedAccount(),$=useGetAccountBalance(),j=useGetDollarBalance(),et=useGetAccountAllTokens(),tt=useGetAccountNFTs(),{openWith:rt}=reactExports.useContext(DynamicModalContext),nt=a(_),it=$(_),ot=j(_),st=et(_),ct=sortedByLastUpdate(tt(_));return jsxRuntimeExports.jsx(AccountDrawerDisplay,{account:nt,balance:it,dollarBalance:ot,nfts:ct,onReceive:()=>rt(jsxRuntimeExports.jsx(ReceiveModal,{pkh:_})),onSend:()=>rt(jsxRuntimeExports.jsx(FormPage$4,{sender:nt})),tokens:st})},InfoModal=({account:_})=>{const a=[{title:"Template",content:_.derivationPathTemplate},{title:"Path",content:_.derivationPath},{title:"Type (Curve)",content:_.curve}];return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalHeader,{children:[jsxRuntimeExports.jsx(CircleIcon,{icon:jsxRuntimeExports.jsx(SlashIcon,{}),size:"48px"}),jsxRuntimeExports.jsx(Center,{marginBottom:"8px",children:jsxRuntimeExports.jsx(Heading,{marginTop:"16px",children:"Derivation Info"})}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsx(ModalBody,{children:a.map(({title:$,content:j})=>j?jsxRuntimeExports.jsxs(Box,{marginTop:"24px",children:[jsxRuntimeExports.jsx(Heading,{size:"md",children:$}),jsxRuntimeExports.jsx(Center,{justifyContent:"flex-start",marginTop:"12px",padding:"15px",borderRadius:"4px",backgroundColor:colors.gray[800],children:jsxRuntimeExports.jsx(Text,{size:"sm",children:j})})]},j):null)})]})},DerivationInfoButton=({account:_,...a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);switch(_.type){case"multisig":case"secret_key":case"social":return null;case"ledger":case"mnemonic":return jsxRuntimeExports.jsx(Button,{"data-testid":"derivation-info-button",onClick:()=>$(jsxRuntimeExports.jsx(InfoModal,{account:_})),variant:"CTAWithIcon",...a,children:jsxRuntimeExports.jsx(FolderInfoIcon,{stroke:"currentcolor"})})}},CloseDrawerButton=({onClose:_})=>jsxRuntimeExports.jsx(Button,{minWidth:"24px",padding:"0",onClick:_,variant:"CTAWithIcon",children:jsxRuntimeExports.jsx(ExitArrowIcon,{stroke:"currentcolor"})}),scriptRel="modulepreload",assetsURL=function(_,a){return new URL(_,a).href},seen={},__vitePreload=function _(a,$,j){let et=Promise.resolve();if($&&$.length>0){const tt=document.getElementsByTagName("link"),rt=document.querySelector("meta[property=csp-nonce]"),nt=(rt==null?void 0:rt.nonce)||(rt==null?void 0:rt.getAttribute("nonce"));et=Promise.all($.map(it=>{if(it=assetsURL(it,j),it in seen)return;seen[it]=!0;const ot=it.endsWith(".css"),st=ot?'[rel="stylesheet"]':"";if(!!j)for(let ht=tt.length-1;ht>=0;ht--){const Et=tt[ht];if(Et.href===it&&(!ot||Et.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${it}"]${st}`))return;const ut=document.createElement("link");if(ut.rel=ot?"stylesheet":scriptRel,ot||(ut.as="script",ut.crossOrigin=""),ut.href=it,nt&&ut.setAttribute("nonce",nt),document.head.appendChild(ut),ot)return new Promise((ht,Et)=>{ut.addEventListener("load",ht),ut.addEventListener("error",()=>Et(new Error(`Unable to preload CSS for ${it}`)))})}))}return et.then(()=>a()).catch(tt=>{const rt=new Event("vite:preloadError",{cancelable:!0});if(rt.payload=tt,window.dispatchEvent(rt),!rt.defaultPrevented)throw tt})};var loadScript=function _(a,$,j){var et=document.head||document.getElementsByTagName("head")[0],tt=document.createElement("script");typeof $=="function"&&(j=$,$={}),$=$||{},j=j||function(){},tt.type=$.type||"text/javascript",tt.charset=$.charset||"utf8",tt.async="async"in $?!!$.async:!0,tt.src=a,$.attrs&&setAttributes(tt,$.attrs),$.text&&(tt.text=""+$.text);var rt="onload"in tt?stdOnEnd:ieOnEnd;rt(tt,j),tt.onload||stdOnEnd(tt,j),et.appendChild(tt)};function setAttributes(_,a){for(var $ in a)_.setAttribute($,a[$])}function stdOnEnd(_,a){_.onload=function(){this.onerror=this.onload=null,a(null,_)},_.onerror=function(){this.onerror=this.onload=null,a(new Error("Failed to load "+this.src),_)}}function ieOnEnd(_,a){_.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,a(null,_))}}var isMergeableObject=function _(a){return isNonNullObject(a)&&!isSpecial(a)};function isNonNullObject(_){return!!_&&typeof _=="object"}function isSpecial(_){var a=Object.prototype.toString.call(_);return a==="[object RegExp]"||a==="[object Date]"||isReactElement(_)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(_){return _.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(_){return Array.isArray(_)?[]:{}}function cloneUnlessOtherwiseSpecified(_,a){return a.clone!==!1&&a.isMergeableObject(_)?deepmerge(emptyTarget(_),_,a):_}function defaultArrayMerge(_,a,$){return _.concat(a).map(function(j){return cloneUnlessOtherwiseSpecified(j,$)})}function getMergeFunction(_,a){if(!a.customMerge)return deepmerge;var $=a.customMerge(_);return typeof $=="function"?$:deepmerge}function getEnumerableOwnPropertySymbols(_){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(_).filter(function(a){return Object.propertyIsEnumerable.call(_,a)}):[]}function getKeys(_){return Object.keys(_).concat(getEnumerableOwnPropertySymbols(_))}function propertyIsOnObject(_,a){try{return a in _}catch{return!1}}function propertyIsUnsafe(_,a){return propertyIsOnObject(_,a)&&!(Object.hasOwnProperty.call(_,a)&&Object.propertyIsEnumerable.call(_,a))}function mergeObject(_,a,$){var j={};return $.isMergeableObject(_)&&getKeys(_).forEach(function(et){j[et]=cloneUnlessOtherwiseSpecified(_[et],$)}),getKeys(a).forEach(function(et){propertyIsUnsafe(_,et)||(propertyIsOnObject(_,et)&&$.isMergeableObject(a[et])?j[et]=getMergeFunction(et,$)(_[et],a[et],$):j[et]=cloneUnlessOtherwiseSpecified(a[et],$))}),j}function deepmerge(_,a,$){$=$||{},$.arrayMerge=$.arrayMerge||defaultArrayMerge,$.isMergeableObject=$.isMergeableObject||isMergeableObject,$.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var j=Array.isArray(a),et=Array.isArray(_),tt=j===et;return tt?j?$.arrayMerge(_,a,$):mergeObject(_,a,$):cloneUnlessOtherwiseSpecified(a,$)}deepmerge.all=function _(a,$){if(!Array.isArray(a))throw new Error("first argument should be an array");return a.reduce(function(j,et){return deepmerge(j,et,$)},{})};var deepmerge_1=deepmerge,cjs=deepmerge_1,__create$4=Object.create,__defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__getOwnPropNames$6=Object.getOwnPropertyNames,__getProtoOf$4=Object.getPrototypeOf,__hasOwnProp$6=Object.prototype.hasOwnProperty,__export$6=(_,a)=>{for(var $ in a)__defProp$6(_,$,{get:a[$],enumerable:!0})},__copyProps$6=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$6(a))!__hasOwnProp$6.call(_,et)&&et!==$&&__defProp$6(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$6(a,et))||j.enumerable});return _},__toESM$4=(_,a,$)=>($=_!=null?__create$4(__getProtoOf$4(_)):{},__copyProps$6(!_||!_.__esModule?__defProp$6($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$6=_=>__copyProps$6(__defProp$6({},"__esModule",{value:!0}),_),utils_exports={};__export$6(utils_exports,{callPlayer:()=>callPlayer,getConfig:()=>getConfig,getSDK:()=>getSDK,isBlobUrl:()=>isBlobUrl,isMediaStream:()=>isMediaStream,lazy:()=>lazy,omit:()=>omit,parseEndTime:()=>parseEndTime,parseStartTime:()=>parseStartTime,queryString:()=>queryString,randomString:()=>randomString,supportsWebKitPresentationMode:()=>supportsWebKitPresentationMode});var utils$1=__toCommonJS$6(utils_exports),import_react$2=__toESM$4(reactExports),import_load_script=__toESM$4(loadScript),import_deepmerge$1=__toESM$4(cjs);const lazy=_=>import_react$2.default.lazy(async()=>{const a=await _();return typeof a.default=="function"?a:a.default}),MATCH_START_QUERY=/[?&#](?:start|t)=([0-9hms]+)/,MATCH_END_QUERY=/[?&#]end=([0-9hms]+)/,MATCH_START_STAMP=/(\d+)(h|m|s)/g,MATCH_NUMERIC=/^\d+$/;function parseTimeParam(_,a){if(_ instanceof Array)return;const $=_.match(a);if($){const j=$[1];if(j.match(MATCH_START_STAMP))return parseTimeString(j);if(MATCH_NUMERIC.test(j))return parseInt(j)}}function parseTimeString(_){let a=0,$=MATCH_START_STAMP.exec(_);for(;$!==null;){const[,j,et]=$;et==="h"&&(a+=parseInt(j,10)*60*60),et==="m"&&(a+=parseInt(j,10)*60),et==="s"&&(a+=parseInt(j,10)),$=MATCH_START_STAMP.exec(_)}return a}function parseStartTime(_){return parseTimeParam(_,MATCH_START_QUERY)}function parseEndTime(_){return parseTimeParam(_,MATCH_END_QUERY)}function randomString(){return Math.random().toString(36).substr(2,5)}function queryString(_){return Object.keys(_).map(a=>`${a}=${_[a]}`).join("&")}function getGlobal(_){return window[_]?window[_]:window.exports&&window.exports[_]?window.exports[_]:window.module&&window.module.exports&&window.module.exports[_]?window.module.exports[_]:null}const requests={},getSDK=function _(a,$,j=null,et=()=>!0,tt=import_load_script.default){const rt=getGlobal($);return rt&&et(rt)?Promise.resolve(rt):new Promise((nt,it)=>{if(requests[a]){requests[a].push({resolve:nt,reject:it});return}requests[a]=[{resolve:nt,reject:it}];const ot=st=>{requests[a].forEach(ct=>ct.resolve(st))};if(j){const st=window[j];window[j]=function(){st&&st(),ot(getGlobal($))}}tt(a,st=>{st?(requests[a].forEach(ct=>ct.reject(st)),requests[a]=null):j||ot(getGlobal($))})})};function getConfig(_,a){return(0,import_deepmerge$1.default)(a.config,_.config)}function omit(_,...a){const $=[].concat(...a),j={},et=Object.keys(_);for(const tt of et)$.indexOf(tt)===-1&&(j[tt]=_[tt]);return j}function callPlayer(_,...a){if(!this.player||!this.player[_]){let $=`ReactPlayer: ${this.constructor.displayName} player could not call %c${_}%c – `;return this.player?this.player[_]||($+="The method was not available"):$+="The player was not available",console.warn($,"font-weight: bold",""),null}return this.player[_](...a)}function isMediaStream(_){return typeof window<"u"&&typeof window.MediaStream<"u"&&_ instanceof window.MediaStream}function isBlobUrl(_){return/^blob:/.test(_)}function supportsWebKitPresentationMode(_=document.createElement("video")){const a=/iPhone|iPod/.test(navigator.userAgent)===!1;return _.webkitSupportsPresentationMode&&typeof _.webkitSetPresentationMode=="function"&&a}function enableStubOn(_){return _}var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__getOwnPropNames$5=Object.getOwnPropertyNames,__hasOwnProp$5=Object.prototype.hasOwnProperty,__export$5=(_,a)=>{for(var $ in a)__defProp$5(_,$,{get:a[$],enumerable:!0})},__copyProps$5=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$5(a))!__hasOwnProp$5.call(_,et)&&et!==$&&__defProp$5(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$5(a,et))||j.enumerable});return _},__toCommonJS$5=_=>__copyProps$5(__defProp$5({},"__esModule",{value:!0}),_),patterns_exports={};__export$5(patterns_exports,{AUDIO_EXTENSIONS:()=>AUDIO_EXTENSIONS,DASH_EXTENSIONS:()=>DASH_EXTENSIONS,FLV_EXTENSIONS:()=>FLV_EXTENSIONS,HLS_EXTENSIONS:()=>HLS_EXTENSIONS,MATCH_URL_DAILYMOTION:()=>MATCH_URL_DAILYMOTION,MATCH_URL_FACEBOOK:()=>MATCH_URL_FACEBOOK,MATCH_URL_FACEBOOK_WATCH:()=>MATCH_URL_FACEBOOK_WATCH,MATCH_URL_KALTURA:()=>MATCH_URL_KALTURA,MATCH_URL_MIXCLOUD:()=>MATCH_URL_MIXCLOUD,MATCH_URL_MUX:()=>MATCH_URL_MUX,MATCH_URL_SOUNDCLOUD:()=>MATCH_URL_SOUNDCLOUD,MATCH_URL_STREAMABLE:()=>MATCH_URL_STREAMABLE,MATCH_URL_TWITCH_CHANNEL:()=>MATCH_URL_TWITCH_CHANNEL,MATCH_URL_TWITCH_VIDEO:()=>MATCH_URL_TWITCH_VIDEO,MATCH_URL_VIDYARD:()=>MATCH_URL_VIDYARD,MATCH_URL_VIMEO:()=>MATCH_URL_VIMEO,MATCH_URL_WISTIA:()=>MATCH_URL_WISTIA,MATCH_URL_YOUTUBE:()=>MATCH_URL_YOUTUBE,VIDEO_EXTENSIONS:()=>VIDEO_EXTENSIONS,canPlay:()=>canPlay});var patterns=__toCommonJS$5(patterns_exports),import_utils$3=utils$1;const MATCH_URL_YOUTUBE=/(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//,MATCH_URL_SOUNDCLOUD=/(?:soundcloud\.com|snd\.sc)\/[^.]+$/,MATCH_URL_VIMEO=/vimeo\.com\/(?!progressive_redirect).+/,MATCH_URL_MUX=/stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/,MATCH_URL_FACEBOOK=/^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/,MATCH_URL_FACEBOOK_WATCH=/^https?:\/\/fb\.watch\/.+$/,MATCH_URL_STREAMABLE=/streamable\.com\/([a-z0-9]+)$/,MATCH_URL_WISTIA=/(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/,MATCH_URL_TWITCH_VIDEO=/(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/,MATCH_URL_TWITCH_CHANNEL=/(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/,MATCH_URL_DAILYMOTION=/^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?(?:[\w.#_-]+)?/,MATCH_URL_MIXCLOUD=/mixcloud\.com\/([^/]+\/[^/]+)/,MATCH_URL_VIDYARD=/vidyard.com\/(?:watch\/)?([a-zA-Z0-9-_]+)/,MATCH_URL_KALTURA=/^https?:\/\/[a-zA-Z]+\.kaltura.(com|org)\/p\/([0-9]+)\/sp\/([0-9]+)00\/embedIframeJs\/uiconf_id\/([0-9]+)\/partner_id\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_].*)$/,AUDIO_EXTENSIONS=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,VIDEO_EXTENSIONS=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,HLS_EXTENSIONS=/\.(m3u8)($|\?)/i,DASH_EXTENSIONS=/\.(mpd)($|\?)/i,FLV_EXTENSIONS=/\.(flv)($|\?)/i,canPlayFile=_=>{if(_ instanceof Array){for(const a of _)if(typeof a=="string"&&canPlayFile(a)||canPlayFile(a.src))return!0;return!1}return(0,import_utils$3.isMediaStream)(_)||(0,import_utils$3.isBlobUrl)(_)?!0:AUDIO_EXTENSIONS.test(_)||VIDEO_EXTENSIONS.test(_)||HLS_EXTENSIONS.test(_)||DASH_EXTENSIONS.test(_)||FLV_EXTENSIONS.test(_)},canPlay={youtube:_=>_ instanceof Array?_.every(a=>MATCH_URL_YOUTUBE.test(a)):MATCH_URL_YOUTUBE.test(_),soundcloud:_=>MATCH_URL_SOUNDCLOUD.test(_)&&!AUDIO_EXTENSIONS.test(_),vimeo:_=>MATCH_URL_VIMEO.test(_)&&!VIDEO_EXTENSIONS.test(_)&&!HLS_EXTENSIONS.test(_),mux:_=>MATCH_URL_MUX.test(_),facebook:_=>MATCH_URL_FACEBOOK.test(_)||MATCH_URL_FACEBOOK_WATCH.test(_),streamable:_=>MATCH_URL_STREAMABLE.test(_),wistia:_=>MATCH_URL_WISTIA.test(_),twitch:_=>MATCH_URL_TWITCH_VIDEO.test(_)||MATCH_URL_TWITCH_CHANNEL.test(_),dailymotion:_=>MATCH_URL_DAILYMOTION.test(_),mixcloud:_=>MATCH_URL_MIXCLOUD.test(_),vidyard:_=>MATCH_URL_VIDYARD.test(_),kaltura:_=>MATCH_URL_KALTURA.test(_),file:canPlayFile};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__getOwnPropNames$4=Object.getOwnPropertyNames,__hasOwnProp$4=Object.prototype.hasOwnProperty,__export$4=(_,a)=>{for(var $ in a)__defProp$4(_,$,{get:a[$],enumerable:!0})},__copyProps$4=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$4(a))!__hasOwnProp$4.call(_,et)&&et!==$&&__defProp$4(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$4(a,et))||j.enumerable});return _},__toCommonJS$4=_=>__copyProps$4(__defProp$4({},"__esModule",{value:!0}),_),players_exports={};__export$4(players_exports,{default:()=>players_default});var players=__toCommonJS$4(players_exports),import_utils$2=utils$1,import_patterns=patterns,players_default=[{key:"youtube",name:"YouTube",canPlay:import_patterns.canPlay.youtube,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./YouTube-DcDtkFBr.js").then(_=>_.Y),[],import.meta.url))},{key:"soundcloud",name:"SoundCloud",canPlay:import_patterns.canPlay.soundcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./SoundCloud-CJBssnni.js").then(_=>_.S),[],import.meta.url))},{key:"vimeo",name:"Vimeo",canPlay:import_patterns.canPlay.vimeo,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vimeo-CqPw8YBK.js").then(_=>_.V),[],import.meta.url))},{key:"mux",name:"Mux",canPlay:import_patterns.canPlay.mux,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mux-DDFtGK4v.js").then(_=>_.M),[],import.meta.url))},{key:"facebook",name:"Facebook",canPlay:import_patterns.canPlay.facebook,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Facebook-B8moW65v.js").then(_=>_.F),[],import.meta.url))},{key:"streamable",name:"Streamable",canPlay:import_patterns.canPlay.streamable,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Streamable-CaSBmFqa.js").then(_=>_.S),[],import.meta.url))},{key:"wistia",name:"Wistia",canPlay:import_patterns.canPlay.wistia,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Wistia-rK1r5TC7.js").then(_=>_.W),[],import.meta.url))},{key:"twitch",name:"Twitch",canPlay:import_patterns.canPlay.twitch,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Twitch-CtVsxlKz.js").then(_=>_.T),[],import.meta.url))},{key:"dailymotion",name:"DailyMotion",canPlay:import_patterns.canPlay.dailymotion,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./DailyMotion-D8DjCF95.js").then(_=>_.D),[],import.meta.url))},{key:"mixcloud",name:"Mixcloud",canPlay:import_patterns.canPlay.mixcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mixcloud-BOrRDsU8.js").then(_=>_.M),[],import.meta.url))},{key:"vidyard",name:"Vidyard",canPlay:import_patterns.canPlay.vidyard,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vidyard-CaFKMdon.js").then(_=>_.V),[],import.meta.url))},{key:"kaltura",name:"Kaltura",canPlay:import_patterns.canPlay.kaltura,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Kaltura-BAapSDAT.js").then(_=>_.K),[],import.meta.url))},{key:"file",name:"FilePlayer",canPlay:import_patterns.canPlay.file,canEnablePIP:_=>import_patterns.canPlay.file(_)&&(document.pictureInPictureEnabled||(0,import_utils$2.supportsWebKitPresentationMode)())&&!import_patterns.AUDIO_EXTENSIONS.test(_),lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./FilePlayer-C-fIliW0.js").then(_=>_.F),[],import.meta.url))}],safeIsNaN=Number.isNaN||function _(a){return typeof a=="number"&&a!==a};function isEqual(_,a){return!!(_===a||safeIsNaN(_)&&safeIsNaN(a))}function areInputsEqual(_,a){if(_.length!==a.length)return!1;for(var $=0;$<_.length;$++)if(!isEqual(_[$],a[$]))return!1;return!0}function memoizeOne(_,a){a===void 0&&(a=areInputsEqual);var $,j=[],et,tt=!1;function rt(){for(var nt=[],it=0;it{for(var $ in a)__defProp$3(_,$,{get:a[$],enumerable:!0})},__copyProps$3=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$3(a))!__hasOwnProp$3.call(_,et)&&et!==$&&__defProp$3(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$3(a,et))||j.enumerable});return _},__toESM$3=(_,a,$)=>($=_!=null?__create$3(__getProtoOf$3(_)):{},__copyProps$3(!_||!_.__esModule?__defProp$3($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$3=_=>__copyProps$3(__defProp$3({},"__esModule",{value:!0}),_),props_exports={};__export$3(props_exports,{defaultProps:()=>defaultProps,propTypes:()=>propTypes});var props=__toCommonJS$3(props_exports),import_prop_types=__toESM$3(propTypesExports);const{string,bool,number,array,oneOfType,shape,object,func,node}=import_prop_types.default,propTypes={url:oneOfType([string,array,object]),playing:bool,loop:bool,controls:bool,volume:number,muted:bool,playbackRate:number,width:oneOfType([string,number]),height:oneOfType([string,number]),style:object,progressInterval:number,playsinline:bool,pip:bool,stopOnUnmount:bool,light:oneOfType([bool,string,object]),playIcon:node,previewTabIndex:number,previewAriaLabel:string,fallback:node,oEmbedUrl:string,wrapper:oneOfType([string,func,shape({render:func.isRequired})]),config:shape({soundcloud:shape({options:object}),youtube:shape({playerVars:object,embedOptions:object,onUnstarted:func}),facebook:shape({appId:string,version:string,playerId:string,attributes:object}),dailymotion:shape({params:object}),vimeo:shape({playerOptions:object,title:string}),mux:shape({attributes:object,version:string}),file:shape({attributes:object,tracks:array,forceVideo:bool,forceAudio:bool,forceHLS:bool,forceSafariHLS:bool,forceDisableHls:bool,forceDASH:bool,forceFLV:bool,hlsOptions:object,hlsVersion:string,dashVersion:string,flvVersion:string}),wistia:shape({options:object,playerId:string,customControls:array}),mixcloud:shape({options:object}),twitch:shape({options:object,playerId:string}),vidyard:shape({options:object})}),onReady:func,onStart:func,onPlay:func,onPause:func,onBuffer:func,onBufferEnd:func,onEnded:func,onError:func,onDuration:func,onSeek:func,onPlaybackRateChange:func,onPlaybackQualityChange:func,onProgress:func,onClickPreview:func,onEnablePIP:func,onDisablePIP:func},noop$1=()=>{},defaultProps={playing:!1,loop:!1,controls:!1,volume:null,muted:!1,playbackRate:1,width:"640px",height:"360px",style:{},progressInterval:1e3,playsinline:!1,pip:!1,stopOnUnmount:!0,light:!1,fallback:null,wrapper:"div",previewTabIndex:0,previewAriaLabel:"",oEmbedUrl:"https://noembed.com/embed?url={url}",config:{soundcloud:{options:{visual:!0,buying:!1,liking:!1,download:!1,sharing:!1,show_comments:!1,show_playcount:!1}},youtube:{playerVars:{playsinline:1,showinfo:0,rel:0,iv_load_policy:3,modestbranding:1},embedOptions:{},onUnstarted:noop$1},facebook:{appId:"1309697205772819",version:"v3.3",playerId:null,attributes:{}},dailymotion:{params:{api:1,"endscreen-enable":!1}},vimeo:{playerOptions:{autopause:!1,byline:!1,portrait:!1,title:!1},title:null},mux:{attributes:{},version:"2"},file:{attributes:{},tracks:[],forceVideo:!1,forceAudio:!1,forceHLS:!1,forceDASH:!1,forceFLV:!1,hlsOptions:{},hlsVersion:"1.1.4",dashVersion:"3.1.3",flvVersion:"1.5.0",forceDisableHls:!1},wistia:{options:{},playerId:null,customControls:null},mixcloud:{options:{hide_cover:1}},twitch:{options:{},playerId:null},vidyard:{options:{}}},onReady:noop$1,onStart:noop$1,onPlay:noop$1,onPause:noop$1,onBuffer:noop$1,onBufferEnd:noop$1,onEnded:noop$1,onError:noop$1,onDuration:noop$1,onSeek:noop$1,onPlaybackRateChange:noop$1,onPlaybackQualityChange:noop$1,onProgress:noop$1,onClickPreview:noop$1,onEnablePIP:noop$1,onDisablePIP:noop$1};var __create$2=Object.create,__defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__getOwnPropNames$2=Object.getOwnPropertyNames,__getProtoOf$2=Object.getPrototypeOf,__hasOwnProp$2=Object.prototype.hasOwnProperty,__defNormalProp$1=(_,a,$)=>a in _?__defProp$2(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__export$2=(_,a)=>{for(var $ in a)__defProp$2(_,$,{get:a[$],enumerable:!0})},__copyProps$2=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$2(a))!__hasOwnProp$2.call(_,et)&&et!==$&&__defProp$2(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$2(a,et))||j.enumerable});return _},__toESM$2=(_,a,$)=>($=_!=null?__create$2(__getProtoOf$2(_)):{},__copyProps$2(!_||!_.__esModule?__defProp$2($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$2=_=>__copyProps$2(__defProp$2({},"__esModule",{value:!0}),_),__publicField$1=(_,a,$)=>(__defNormalProp$1(_,typeof a!="symbol"?a+"":a,$),$),Player_exports={};__export$2(Player_exports,{default:()=>Player});var Player_1=__toCommonJS$2(Player_exports),import_react$1=__toESM$2(reactExports),import_react_fast_compare$1=__toESM$2(reactFastCompare),import_props$1=props,import_utils$1=utils$1;const SEEK_ON_PLAY_EXPIRY=5e3;class Player extends import_react$1.Component{constructor(){super(...arguments),__publicField$1(this,"mounted",!1),__publicField$1(this,"isReady",!1),__publicField$1(this,"isPlaying",!1),__publicField$1(this,"isLoading",!0),__publicField$1(this,"loadOnReady",null),__publicField$1(this,"startOnPlay",!0),__publicField$1(this,"seekOnPlay",null),__publicField$1(this,"onDurationCalled",!1),__publicField$1(this,"handlePlayerMount",a=>{if(this.player){this.progress();return}this.player=a,this.player.load(this.props.url),this.progress()}),__publicField$1(this,"getInternalPlayer",a=>this.player?this.player[a]:null),__publicField$1(this,"progress",()=>{if(this.props.url&&this.player&&this.isReady){const a=this.getCurrentTime()||0,$=this.getSecondsLoaded(),j=this.getDuration();if(j){const et={playedSeconds:a,played:a/j};$!==null&&(et.loadedSeconds=$,et.loaded=$/j),(et.playedSeconds!==this.prevPlayed||et.loadedSeconds!==this.prevLoaded)&&this.props.onProgress(et),this.prevPlayed=et.playedSeconds,this.prevLoaded=et.loadedSeconds}}this.progressTimeout=setTimeout(this.progress,this.props.progressFrequency||this.props.progressInterval)}),__publicField$1(this,"handleReady",()=>{if(!this.mounted)return;this.isReady=!0,this.isLoading=!1;const{onReady:a,playing:$,volume:j,muted:et}=this.props;a(),!et&&j!==null&&this.player.setVolume(j),this.loadOnReady?(this.player.load(this.loadOnReady,!0),this.loadOnReady=null):$&&this.player.play(),this.handleDurationCheck()}),__publicField$1(this,"handlePlay",()=>{this.isPlaying=!0,this.isLoading=!1;const{onStart:a,onPlay:$,playbackRate:j}=this.props;this.startOnPlay&&(this.player.setPlaybackRate&&j!==1&&this.player.setPlaybackRate(j),a(),this.startOnPlay=!1),$(),this.seekOnPlay&&(this.seekTo(this.seekOnPlay),this.seekOnPlay=null),this.handleDurationCheck()}),__publicField$1(this,"handlePause",a=>{this.isPlaying=!1,this.isLoading||this.props.onPause(a)}),__publicField$1(this,"handleEnded",()=>{const{activePlayer:a,loop:$,onEnded:j}=this.props;a.loopOnEnded&&$&&this.seekTo(0),$||(this.isPlaying=!1,j())}),__publicField$1(this,"handleError",(...a)=>{this.isLoading=!1,this.props.onError(...a)}),__publicField$1(this,"handleDurationCheck",()=>{clearTimeout(this.durationCheckTimeout);const a=this.getDuration();a?this.onDurationCalled||(this.props.onDuration(a),this.onDurationCalled=!0):this.durationCheckTimeout=setTimeout(this.handleDurationCheck,100)}),__publicField$1(this,"handleLoaded",()=>{this.isLoading=!1})}componentDidMount(){this.mounted=!0}componentWillUnmount(){clearTimeout(this.progressTimeout),clearTimeout(this.durationCheckTimeout),this.isReady&&this.props.stopOnUnmount&&(this.player.stop(),this.player.disablePIP&&this.player.disablePIP()),this.mounted=!1}componentDidUpdate(a){if(!this.player)return;const{url:$,playing:j,volume:et,muted:tt,playbackRate:rt,pip:nt,loop:it,activePlayer:ot,disableDeferredLoading:st}=this.props;if(!(0,import_react_fast_compare$1.default)(a.url,$)){if(this.isLoading&&!ot.forceLoad&&!st&&!(0,import_utils$1.isMediaStream)($)){console.warn(`ReactPlayer: the attempt to load ${$} is being deferred until the player has loaded`),this.loadOnReady=$;return}this.isLoading=!0,this.startOnPlay=!0,this.onDurationCalled=!1,this.player.load($,this.isReady)}!a.playing&&j&&!this.isPlaying&&this.player.play(),a.playing&&!j&&this.isPlaying&&this.player.pause(),!a.pip&&nt&&this.player.enablePIP&&this.player.enablePIP(),a.pip&&!nt&&this.player.disablePIP&&this.player.disablePIP(),a.volume!==et&&et!==null&&this.player.setVolume(et),a.muted!==tt&&(tt?this.player.mute():(this.player.unmute(),et!==null&&setTimeout(()=>this.player.setVolume(et)))),a.playbackRate!==rt&&this.player.setPlaybackRate&&this.player.setPlaybackRate(rt),a.loop!==it&&this.player.setLoop&&this.player.setLoop(it)}getDuration(){return this.isReady?this.player.getDuration():null}getCurrentTime(){return this.isReady?this.player.getCurrentTime():null}getSecondsLoaded(){return this.isReady?this.player.getSecondsLoaded():null}seekTo(a,$,j){if(!this.isReady){a!==0&&(this.seekOnPlay=a,setTimeout(()=>{this.seekOnPlay=null},SEEK_ON_PLAY_EXPIRY));return}if($?$==="fraction":a>0&&a<1){const tt=this.player.getDuration();if(!tt){console.warn("ReactPlayer: could not seek using fraction – duration not yet available");return}this.player.seekTo(tt*a,j);return}this.player.seekTo(a,j)}render(){const a=this.props.activePlayer;return a?import_react$1.default.createElement(a,{...this.props,onMount:this.handlePlayerMount,onReady:this.handleReady,onPlay:this.handlePlay,onPause:this.handlePause,onEnded:this.handleEnded,onLoaded:this.handleLoaded,onError:this.handleError}):null}}__publicField$1(Player,"displayName","Player");__publicField$1(Player,"propTypes",import_props$1.propTypes);__publicField$1(Player,"defaultProps",import_props$1.defaultProps);var __create$1=Object.create,__defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__getOwnPropNames$1=Object.getOwnPropertyNames,__getProtoOf$1=Object.getPrototypeOf,__hasOwnProp$1=Object.prototype.hasOwnProperty,__defNormalProp=(_,a,$)=>a in _?__defProp$1(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__export$1=(_,a)=>{for(var $ in a)__defProp$1(_,$,{get:a[$],enumerable:!0})},__copyProps$1=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames$1(a))!__hasOwnProp$1.call(_,et)&&et!==$&&__defProp$1(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc$1(a,et))||j.enumerable});return _},__toESM$1=(_,a,$)=>($=_!=null?__create$1(__getProtoOf$1(_)):{},__copyProps$1(!_||!_.__esModule?__defProp$1($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS$1=_=>__copyProps$1(__defProp$1({},"__esModule",{value:!0}),_),__publicField=(_,a,$)=>(__defNormalProp(_,typeof a!="symbol"?a+"":a,$),$),ReactPlayer_exports={};__export$1(ReactPlayer_exports,{createReactPlayer:()=>createReactPlayer});var ReactPlayer$1=__toCommonJS$1(ReactPlayer_exports),import_react=__toESM$1(reactExports),import_deepmerge=__toESM$1(cjs),import_memoize_one=__toESM$1(require$$2),import_react_fast_compare=__toESM$1(reactFastCompare),import_props=props,import_utils=utils$1,import_Player=__toESM$1(Player_1);const Preview=(0,import_utils.lazy)(()=>__vitePreload(()=>import("./Preview-CzbJIByW.js").then(_=>_.P),[],import.meta.url)),IS_BROWSER=typeof window<"u"&&window.document&&typeof document<"u",IS_GLOBAL=typeof commonjsGlobal<"u"&&commonjsGlobal.window&&commonjsGlobal.window.document,SUPPORTED_PROPS=Object.keys(import_props.propTypes),UniversalSuspense=IS_BROWSER||IS_GLOBAL?import_react.Suspense:()=>null,customPlayers=[],createReactPlayer=(_,a)=>{var $;return $=class extends import_react.Component{constructor(){super(...arguments),__publicField(this,"state",{showPreview:!!this.props.light}),__publicField(this,"references",{wrapper:j=>{this.wrapper=j},player:j=>{this.player=j}}),__publicField(this,"handleClickPreview",j=>{this.setState({showPreview:!1}),this.props.onClickPreview(j)}),__publicField(this,"showPreview",()=>{this.setState({showPreview:!0})}),__publicField(this,"getDuration",()=>this.player?this.player.getDuration():null),__publicField(this,"getCurrentTime",()=>this.player?this.player.getCurrentTime():null),__publicField(this,"getSecondsLoaded",()=>this.player?this.player.getSecondsLoaded():null),__publicField(this,"getInternalPlayer",(j="player")=>this.player?this.player.getInternalPlayer(j):null),__publicField(this,"seekTo",(j,et,tt)=>{if(!this.player)return null;this.player.seekTo(j,et,tt)}),__publicField(this,"handleReady",()=>{this.props.onReady(this)}),__publicField(this,"getActivePlayer",(0,import_memoize_one.default)(j=>{for(const et of[...customPlayers,..._])if(et.canPlay(j))return et;return a||null})),__publicField(this,"getConfig",(0,import_memoize_one.default)((j,et)=>{const{config:tt}=this.props;return import_deepmerge.default.all([import_props.defaultProps.config,import_props.defaultProps.config[et]||{},tt,tt[et]||{}])})),__publicField(this,"getAttributes",(0,import_memoize_one.default)(j=>(0,import_utils.omit)(this.props,SUPPORTED_PROPS))),__publicField(this,"renderActivePlayer",j=>{if(!j)return null;const et=this.getActivePlayer(j);if(!et)return null;const tt=this.getConfig(j,et.key);return import_react.default.createElement(import_Player.default,{...this.props,key:et.key,ref:this.references.player,config:tt,activePlayer:et.lazyPlayer||et,onReady:this.handleReady})})}shouldComponentUpdate(j,et){return!(0,import_react_fast_compare.default)(this.props,j)||!(0,import_react_fast_compare.default)(this.state,et)}componentDidUpdate(j){const{light:et}=this.props;!j.light&&et&&this.setState({showPreview:!0}),j.light&&!et&&this.setState({showPreview:!1})}renderPreview(j){if(!j)return null;const{light:et,playIcon:tt,previewTabIndex:rt,oEmbedUrl:nt,previewAriaLabel:it}=this.props;return import_react.default.createElement(Preview,{url:j,light:et,playIcon:tt,previewTabIndex:rt,previewAriaLabel:it,oEmbedUrl:nt,onClick:this.handleClickPreview})}render(){const{url:j,style:et,width:tt,height:rt,fallback:nt,wrapper:it}=this.props,{showPreview:ot}=this.state,st=this.getAttributes(j),ct=typeof it=="string"?this.references.wrapper:void 0;return import_react.default.createElement(it,{ref:ct,style:{...et,width:tt,height:rt},...st},import_react.default.createElement(UniversalSuspense,{fallback:nt},ot?this.renderPreview(j):this.renderActivePlayer(j)))}},__publicField($,"displayName","ReactPlayer"),__publicField($,"propTypes",import_props.propTypes),__publicField($,"defaultProps",import_props.defaultProps),__publicField($,"addCustomPlayer",j=>{customPlayers.push(j)}),__publicField($,"removeCustomPlayers",()=>{customPlayers.length=0}),__publicField($,"canPlay",j=>{for(const et of[...customPlayers,..._])if(et.canPlay(j))return!0;return!1}),__publicField($,"canEnablePIP",j=>{for(const et of[...customPlayers,..._])if(et.canEnablePIP&&et.canEnablePIP(j))return!0;return!1}),$};var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(_,a)=>{for(var $ in a)__defProp(_,$,{get:a[$],enumerable:!0})},__copyProps=(_,a,$,j)=>{if(a&&typeof a=="object"||typeof a=="function")for(let et of __getOwnPropNames(a))!__hasOwnProp.call(_,et)&&et!==$&&__defProp(_,et,{get:()=>a[et],enumerable:!(j=__getOwnPropDesc(a,et))||j.enumerable});return _},__toESM=(_,a,$)=>($=_!=null?__create(__getProtoOf(_)):{},__copyProps(!_||!_.__esModule?__defProp($,"default",{value:_,enumerable:!0}):$,_)),__toCommonJS=_=>__copyProps(__defProp({},"__esModule",{value:!0}),_),src_exports={};__export(src_exports,{default:()=>src_default});var lib$1=__toCommonJS(src_exports),import_players=__toESM(players),import_ReactPlayer=ReactPlayer$1;const fallback=import_players.default[import_players.default.length-1];var src_default=(0,import_ReactPlayer.createReactPlayer)(import_players.default,fallback);const ReactPlayer=getDefaultExportFromCjs$1(lib$1),AttributesAccordionItem=({nft:_,style:a})=>{const $=_.metadata.attributes;return!$||$.length===0?null:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],"data-testid":"attributes-section",style:a,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"Attributes"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(Wrap,{marginLeft:"0",spacing:"10px",children:$.map(j=>jsxRuntimeExports.jsx(WrapItem,{flex:"1","data-testid":"nft-attribute",children:jsxRuntimeExports.jsx(Card,{width:"160px",height:"128px",marginBottom:"2px",background:colors.gray[700],children:jsxRuntimeExports.jsxs(CardBody,{padding:"16px",children:[jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:j.name}),jsxRuntimeExports.jsx(Heading,{size:"md",children:j.value})]})})},j.name))})})]})},TruncatedTextWithTooltip=({text:_,maxLength:a})=>_.length<=a?jsxRuntimeExports.jsx(Text,{"data-testid":"truncated-text",children:_}):jsxRuntimeExports.jsx(Tooltip,{label:_,children:jsxRuntimeExports.jsx(Text,{"data-testid":"truncated-text",children:truncate(_,a)})}),TzktLink=({url:_,...a})=>jsxRuntimeExports.jsx("a",{"data-testid":"tzkt-link",href:_,rel:"noopener noreferrer",target:"_blank",children:jsxRuntimeExports.jsx(WindowLinkIcon,{...a})}),CreatorElement=({nft:_})=>{if(!_.metadata.creators||_.metadata.creators.length===0)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"-"});const a=_.metadata.creators[0];return a.startsWith("tz")?jsxRuntimeExports.jsx(AddressPill,{marginRight:1,address:parsePkh(a)}):jsxRuntimeExports.jsx(TruncatedTextWithTooltip,{maxLength:15,text:a})},PropertiesAccordionItem=({nft:_,style:a})=>{const $=royalties(_),j=$.reduce((tt,rt)=>tt+rt.share,0).toFixed(2),et=useSelectedNetwork();return jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],style:a,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"Properties"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(TableContainer,{children:jsxRuntimeExports.jsx(Table,{variant:"stripped",children:jsxRuntimeExports.jsxs(Tbody,{fontSize:"14px",children:[jsxRuntimeExports.jsxs(Tr,{background:colors.gray[900],borderColor:colors.gray[700],borderBottomWidth:"1px",borderRadius:"8px",children:[jsxRuntimeExports.jsx(Td,{width:"20%",padding:"16px 0 16px 15px",paddingRight:"0",color:colors.gray[400],borderTopLeftRadius:"8px","data-testid":"nft-editions",children:"Editions:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-editions-value",children:_.totalSupply||"?"}),jsxRuntimeExports.jsx(Td,{width:"20%",padding:"16px 0 16px 15px",color:colors.gray[400],children:"Token ID:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",borderTopRightRadius:"8px",children:_.tokenId})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[800],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsxs(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-royalty",children:["Royalties",$.length>1?" ("+$.length+")":"",":"]}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-royalty-value",children:$.length>0?j+"%":"-"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-mime",children:"MIME type:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px","data-testid":"nft-mime-value",children:mimeType(_)||"-"})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[900],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"Contract:"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px",children:jsxRuntimeExports.jsx(AddressPill,{marginRight:1,address:parsePkh(_.contract)})}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"Metadata:"}),jsxRuntimeExports.jsxs(Td,{width:"30%",padding:"16px 0 16px 5px",children:["TzKT ",jsxRuntimeExports.jsx(TzktLink,{url:metadataUri(_,et)})]})]}),jsxRuntimeExports.jsxs(Tr,{background:colors.gray[800],borderColor:colors.gray[700],borderBottomWidth:"1px",children:[jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],"data-testid":"nft-creator",children:"Creator:"}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 5px",borderColor:colors.gray[700],borderRightWidth:"1px","data-testid":"nft-creator-value",children:jsxRuntimeExports.jsx(CreatorElement,{nft:_})}),jsxRuntimeExports.jsx(Td,{padding:"16px 0 16px 15px",color:colors.gray[400],children:"License:"}),jsxRuntimeExports.jsx(Td,{width:"30%",padding:"16px 0 16px 5px",children:jsxRuntimeExports.jsx(TruncatedTextWithTooltip,{maxLength:15,text:_.metadata.rights||"-"})})]})]})})})})]})},TagsSection=({nft:_})=>{const a=_.metadata.tags;return!a||a.length===0?null:jsxRuntimeExports.jsx(Wrap,{marginTop:"20px","data-testid":"tags-section",children:a.map($=>jsxRuntimeExports.jsx(WrapItem,{padding:"3px 8px",background:colors.gray[600],borderRadius:"100px",children:jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-tag",children:$})},$))})},SendNFTRecapTile=({nft:_})=>{const a=getIPFSurl(thumbnailUri(_)),$=getIPFSurl(_.displayUri);return jsxRuntimeExports.jsx(Box,{width:"100%","aria-label":"nft",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"60px",padding:3,background:colors.gray[800],borderRadius:"4px","data-testid":"nft-name",children:[jsxRuntimeExports.jsx(AspectRatio,{width:"30px",height:"30px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{fallbackSrc:$,src:a})}),_.metadata.name&&jsxRuntimeExports.jsx(Heading,{marginLeft:4,size:"sm",children:truncate(_.metadata.name,45)})]})})},SignPage$1=_=>{const{mode:a,operations:$,data:{nft:j}}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:ct}=useSignPageHelpers($,a),{recipient:ut}=tt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:tt.type,signer:tt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Flex,{marginBottom:"12px",children:jsxRuntimeExports.jsx(SendNFTRecapTile,{nft:j})}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",marginY:"12px",paddingX:"4px",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Owned:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-owned",size:"sm",children:j.balance})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:et})]}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"12px",marginBottom:"24px",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"12px",size:"md",children:"Quantity:"}),jsxRuntimeExports.jsx(Center,{width:"100px",height:"48px",background:colors.gray[800],borderRadius:"4px",children:jsxRuntimeExports.jsxs(Text,{textAlign:"center",children:[tt.operations[0].amount," out of ",j.balance]})})]}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:tt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ut}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ct,signer:ot,text:headerText(tt.type,a)})})]})})})},FormPage$1=_=>{const{nft:a}=_,$=useOpenSignPageFormAction({SignPage:SignPage$1,signPageExtraData:{nft:a},FormPage:FormPage$1,defaultFormPageProps:_,toOperation:toOperation$1(a)}),j=useAddToBatchFormAction(toOperation$1(a)),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:{quantity:1,...formDefaultValues(_)}}),{formState:{isValid:it,errors:ot},register:st,handleSubmit:ct}=nt;return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(FormPageHeader,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Flex,{marginBottom:"12px",children:jsxRuntimeExports.jsx(SendNFTRecapTile,{nft:_.nft})}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],size:"sm",children:"Owned:"}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-owned",size:"sm",children:a.balance})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.quantity,children:[jsxRuntimeExports.jsx(FormLabel,{children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Heading,{marginRight:"8px",size:"md",children:"Quantity:"}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(InputGroup,{width:"75px",children:jsxRuntimeExports.jsx(Input,{width:"60px",color:"white","data-testid":"quantity-input",step:1,type:"number",...st("quantity",{required:"Quantity is required",max:{value:a.balance,message:`Max quantity is ${a.balance}`},min:{value:1,message:"Min quantity is 1"}})})}),jsxRuntimeExports.jsxs(Text,{"data-testid":"out-of-nft",children:["out of ",a.balance]})]})]})}),ot.quantity&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"quantity-error",children:ot.quantity.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),ot.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:ot.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ct(tt),onSingleSubmit:ct(et)})})]})})})},toOperation$1=_=>a=>({type:"fa2",sender:parsePkh(a.sender),recipient:parsePkh(a.recipient),contract:parseContractPkh(_.contract),tokenId:_.tokenId,amount:a.quantity.toString()}),NFTDrawerCard=({nft:_})=>{var it;const a=getIPFSurl(artifactUri(_)),$=getIPFSurl(_.displayUri),j=useGetOwnedAccount(),{openWith:et}=reactExports.useContext(DynamicModalContext),tt=(it=mimeType(_))==null?void 0:it.startsWith("video/"),rt=tokenName(_),nt={border:"none",borderRadius:"8px",marginBottom:"20px"};return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Card,{width:"534px",height:"534px",background:colors.gray[800],children:jsxRuntimeExports.jsxs(CardBody,{padding:"24px",children:[jsxRuntimeExports.jsx(Box,{position:"relative",width:"486px",height:"486px",children:tt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box,{position:"absolute",zIndex:1,width:"486px",height:"486px",children:jsxRuntimeExports.jsx(ReactPlayer,{width:"100%",height:"100%",loop:!0,playing:!0,url:a})}),jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:0,top:"0",width:"486px",height:"486px",objectFit:"contain",alt:rt,filter:"blur(20px)",src:$})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:1,width:"486px",height:"486px",objectFit:"contain",alt:rt,fallbackSrc:$,src:a}),jsxRuntimeExports.jsx(Image$1,{position:"absolute",zIndex:0,top:"0",width:"486px",height:"486px",objectFit:"contain",alt:rt,"data-testid":"nft-image",fallbackSrc:$,filter:"blur(20px)",src:a})]})}),Number(_.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"24px",marginTop:"-38px",marginLeft:"16px",borderRadius:"100px",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",paddingX:"8px",children:"x"+_.balance})]})}),jsxRuntimeExports.jsx(TagsSection,{nft:_}),rt&&jsxRuntimeExports.jsx(Heading,{marginTop:"16px",marginBottom:"14px","data-testid":"nft-name",size:"lg",children:rt}),_.metadata.description&&jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-description",size:"sm",children:_.metadata.description}),jsxRuntimeExports.jsx(Button,{marginTop:"20px",onClick:()=>et(jsxRuntimeExports.jsx(FormPage$1,{nft:_,sender:j(_.owner)})),children:"Send"}),jsxRuntimeExports.jsxs(Accordion,{marginTop:"32px",allowMultiple:!0,children:[jsxRuntimeExports.jsx(AttributesAccordionItem,{nft:_,style:nt}),jsxRuntimeExports.jsx(PropertiesAccordionItem,{nft:_,style:nt}),jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],style:nt,children:[jsxRuntimeExports.jsxs(AccordionButton,{paddingY:"16px",children:[jsxRuntimeExports.jsx(Heading,{flex:"1",textAlign:"left",size:"md",children:"JSON"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(JsValueWrap,{value:_})})]})]})]})},NFTDrawerBody=({nft:_,onCloseDrawer:a})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",paddingBottom:"22px",color:colors.gray[400],"data-testid":"nft-drawer-body",children:[jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.owner)}),jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:a})]}),jsxRuntimeExports.jsx(NFTDrawerCard,{nft:_})]}),AccountListWithDrawer=()=>{const[_,a]=reactExports.useState(null),{ownerPkh:$,nftId:j}=useParams(),et=useAllNfts(),tt=$&&lodashExports.get(et,[$],[]).find(ht=>fullId(ht)===j),rt=!!tt,{isOpen:nt,onOpen:it,onClose:ot}=useDisclosure$1({defaultIsOpen:rt}),st=useNavigate(),ct=reactExports.useCallback(()=>{a(null),ot(),st("/home")},[ot,st]);reactExports.useEffect(()=>{const ht=Et=>{Et.key==="Escape"&&ct()};return document.addEventListener("keydown",ht),()=>document.removeEventListener("keydown",ht)},[ct]);const ut=reactExports.useMemo(()=>({selectedAccount:_,selectAccount:ht=>{a(ht),it()}}),[_,it]);return jsxRuntimeExports.jsxs(SelectedAccountContext.Provider,{value:ut,children:[jsxRuntimeExports.jsx(AccountsList,{}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:nt,onClose:ct,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsxs(DrawerContent,{children:[rt&&jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(NFTDrawerBody,{nft:{...tt,owner:$},onCloseDrawer:ct})}),!rt&&_&&jsxRuntimeExports.jsxs(ModalBody,{overflow:"hidden",overflowY:"scroll",paddingRight:"0",children:[jsxRuntimeExports.jsxs(Flex,{justifyContent:"flex-end",width:"100%",paddingRight:"24px",children:[jsxRuntimeExports.jsx(DerivationInfoButton,{marginRight:"5px",account:_}),jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:ct})]}),jsxRuntimeExports.jsx(AccountCard,{accountPkh:_.address.pkh})]})]})]})]})},HomeView=()=>jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Accounts"}),jsxRuntimeExports.jsx(Flex,{flex:1,minHeight:1,children:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",flex:1,marginRight:"12px",paddingBottom:"12px",children:[jsxRuntimeExports.jsx(AccountListHeader,{}),jsxRuntimeExports.jsx(Box,{flex:1,overflow:"hidden",borderRadius:"8px",children:jsxRuntimeExports.jsx(AccountListWithDrawer,{})})]})})]}),SelectedNFTContext=reactExports.createContext({selectedNFT:void 0,setSelectedNFT:_=>{}}),NFTCard=({nft:_})=>{const{selectedNFT:a,setSelectedNFT:$}=reactExports.useContext(SelectedNFTContext),j=getIPFSurl(thumbnailUri(_)),et=getIPFSurl(_.displayUri),tt=_.metadata.name,rt={width:"100%",minWidth:"242px",minHeight:"242px",objectFit:"contain",aspectRatio:"1",fallbackSrc:et,src:j},nt=a&&fullId(a)===fullId(_)&&a.owner===_.owner;return jsxRuntimeExports.jsx(Card,{minWidth:"274px",borderRadius:"8px",cursor:"pointer","data-testid":`nft-card${nt?"-selected":""}`,onClick:()=>$(_),children:jsxRuntimeExports.jsxs(CardBody,{padding:"16px",background:colors.gray[900],border:"1px solid",borderColor:nt?colors.orangeL:"transparent",borderRadius:"8px",_hover:{background:colors.gray[700],borderColor:colors.gray[500]},children:[jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsxs(Box,{position:"relative",width:"100%",children:[jsxRuntimeExports.jsx(Image$1,{...rt,zIndex:2,opacity:"0"}),jsxRuntimeExports.jsx(Image$1,{...rt,position:"absolute",zIndex:0,top:"0",filter:"blur(20px)"}),jsxRuntimeExports.jsx(Image$1,{...rt,position:"absolute",zIndex:1,top:"0","data-testid":"nft-image"})]})}),Number(_.balance)>1&&jsxRuntimeExports.jsx(Text,{position:"absolute",zIndex:3,display:"inline",height:"24px",marginTop:"-36px",marginLeft:"10px",paddingTop:"1px",fontSize:"14px",borderRadius:"full",backgroundColor:"rgba(33, 33, 33, 0.75)","data-testid":"nft-owned-count",paddingX:"8px",children:"x"+_.balance}),jsxRuntimeExports.jsx(Box,{overflow:"hidden","data-testid":"nft-card-name",children:jsxRuntimeExports.jsx(Heading,{overflow:"hidden",marginTop:"15px",marginBottom:"8px",fontSize:"sm",whiteSpace:"nowrap",textOverflow:"ellipsis",children:tt})}),jsxRuntimeExports.jsx(AddressPill,{address:parsePkh(_.owner)})]})})},NFTGallery=({nftsByOwner:_})=>{const a=Object.entries(_).flatMap(([j,et])=>(et||[]).map(tt=>({owner:j,...tt})));let $="repeat(auto-fit, minmax(min(100%/2, max(274px, 100%/7)), 1fr))";return a.length<3&&($=`repeat(auto-fit, min(100% / ${a.length} - 16px, 450px))`),jsxRuntimeExports.jsx(SimpleGrid,{gridTemplateColumns:$,marginBottom:"16px",minChildWidth:"340px",spacing:"16px",children:sortedByLastUpdate(a).map(j=>jsxRuntimeExports.jsx(NFTCard,{nft:j},`${j.owner}:${fullId(j)}`))})},AccountListDisplay=({accounts:_,onSelect:a})=>jsxRuntimeExports.jsx(MenuList,{zIndex:"docked",overflowY:"scroll",maxHeight:"300px",padding:0,background:colors.gray[900],children:_.map($=>jsxRuntimeExports.jsx(MenuItem$1,{width:"100%",minHeight:"48px",padding:"5px",background:colors.gray[700],"aria-label":$.label,onClick:()=>{a($)},value:$.address.pkh,children:jsxRuntimeExports.jsx(AddressTile,{width:"370px",height:"40px",padding:"5px",background:colors.gray[700],borderRadius:"4px",_hover:{background:colors.gray[500]},cursor:"pointer",address:$.address})},$.address.pkh))}),useAccountsFilter=()=>{const _=useAllAccounts(),[a]=reactExports.useState(_),[$,j]=useSearchParams(),et=$.getAll("accounts"),[tt,rt]=reactExports.useState(et.length===0),[nt,it]=reactExports.useState(_.filter(ct=>et.includes(ct.address.pkh))),ot=lodashExports.differenceBy(_,nt,ct=>ct.address.pkh),st=nt.length===_.length;return reactExports.useEffect(()=>{j(ct=>({...ct,accounts:nt.map(ut=>ut.address.pkh)}))},[nt,j]),{selectedAccounts:tt?a:nt,accountsFilter:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(Box,{alignSelf:"flex-start",children:jsxRuntimeExports.jsxs(Menu,{children:[jsxRuntimeExports.jsx(MenuButton,{as:Button,maxHeight:"26px",paddingLeft:0,fontWeight:"normal",_hover:{bg:"none"},_active:{bg:"none"},"data-testid":"account-filter",isDisabled:st,marginY:"16px",rightIcon:jsxRuntimeExports.jsx(ChevronDownIcon,{}),variant:"ghost",children:"Filter by Account"}),jsxRuntimeExports.jsx(AccountListDisplay,{accounts:ot,onSelect:ct=>{rt(!1),it(ut=>[...ut,ct])}})]})}),jsxRuntimeExports.jsx(Wrap,{width:"100%",children:nt.map(ct=>jsxRuntimeExports.jsx(AddressPill,{address:ct.address,"data-testid":"account-pill",mode:{type:"removable",onRemove:()=>{rt(nt.length===1),it(ut=>ut.filter(ht=>ht.address.pkh!==ct.address.pkh))}}},ct.address.pkh))})]})}},NFTsView=()=>{const _=useAllNfts(),{accountsFilter:a,selectedAccounts:$}=useAccountsFilter(),[j,et]=reactExports.useState(void 0);reactExports.useEffect(()=>{const it=ot=>{ot.key==="Escape"&&et(void 0)};return document.addEventListener("keydown",it),()=>document.removeEventListener("keydown",it)},[]);const tt=lodashExports.pick(_,$.map(it=>it.address.pkh)),rt=lodashExports.sumBy(Object.values(tt).flat(),it=>Number((it==null?void 0:it.balance)||0)),nt=lodashExports.every(tt,it=>!it||it.length===0);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{subtitle:`(${rt})`,title:"NFTs"}),a,nt?jsxRuntimeExports.jsx(NoNFTs,{size:"lg"}):jsxRuntimeExports.jsxs(SelectedNFTContext.Provider,{value:{setSelectedNFT:et,selectedNFT:j},children:[jsxRuntimeExports.jsx(Box,{overflowY:"scroll",children:jsxRuntimeExports.jsx(NFTGallery,{nftsByOwner:tt})}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:!!j,onClose:()=>et(void 0),placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsx(ModalBody,{children:j&&jsxRuntimeExports.jsx(NFTDrawerBody,{nft:j,onCloseDrawer:()=>et(void 0)})})})]})]})]})},OperationsView=()=>{const{accountsFilter:_,selectedAccounts:a}=useAccountsFilter(),{operations:$,loadMore:j,hasMore:et,isLoading:tt,isFirstLoad:rt}=useGetOperations(a),nt=reactExports.useRef(!1),it=ot=>{if(nt.current||!et||tt)return;const st=ot.target;if(st.scrollHeight-st.scrollTop-st.clientHeight<100)return nt.current=!0,j().finally(()=>{nt.current=!1})};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Operations"}),_,jsxRuntimeExports.jsx(Center,{display:tt&&rt?"flex":"none",height:"100%",children:jsxRuntimeExports.jsx(Image$1,{width:"150px",height:"75px",marginBottom:"136px",src:"./static/media/loading-wheel.gif"})}),$.length===0&&!tt&&jsxRuntimeExports.jsx(NoOperations,{size:"lg"}),$.length>0&&jsxRuntimeExports.jsxs(Box,{overflowY:"scroll",marginBottom:"20px",background:colors.gray[900],borderRadius:"8px",onScroll:it,paddingX:"20px",children:[jsxRuntimeExports.jsx(OperationTileContext.Provider,{value:{mode:"page"},children:$.map((ot,st)=>{const ct=st===$.length-1;return jsxRuntimeExports.jsxs(Box,{height:"90px",marginBottom:ct?"10px":0,paddingY:"20px",children:[jsxRuntimeExports.jsx(OperationTile,{operation:ot}),!ct&&jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(Divider,{marginTop:"20px"})})]},ot.id)})}),jsxRuntimeExports.jsxs(Center,{flexDirection:"column",display:tt&&!rt?"flex":"none",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Image$1,{width:"100px",height:"50px",src:"./static/media/loading-dots.gif"})]})]})]})},DrawerTopButtons=({onClose:_,...a})=>jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",paddingBottom:"30px",cursor:"pointer",...a,children:jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:_})}),BeaconPeers=()=>{const _=usePeers(),[a,$]=reactExports.useState([]);return reactExports.useEffect(()=>{const j=_.map(async et=>({...et,senderId:et.senderId||await getSenderId(et.publicKey)}));Promise.all(j).then($).catch(lodashExports.noop)},[_]),a.length===0?jsxRuntimeExports.jsxs(Box,{"data-testid":"beacon-peers-empty",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Text,{marginTop:"31px",color:colors.gray[400],size:"lg",children:"Your dApps will appear here"})]}):jsxRuntimeExports.jsx(PeersDisplay,{"data-testid":"beacon-peers",peerInfos:a})},PeersDisplay=({peerInfos:_})=>jsxRuntimeExports.jsx(Box,{children:_.map(a=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(PeerRow,{peerInfo:a})]},a.senderId))}),PeerRow=({peerInfo:_})=>{const a=useRemovePeer();return jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",height:"106px","data-testid":"peer-row",paddingY:"30px",children:[jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(AspectRatio,{width:"48px",marginRight:"16px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{width:"100%",src:_.icon})}),jsxRuntimeExports.jsxs(Center,{alignItems:"flex-start",flexDirection:"column",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"6px",size:"md",children:_.name}),jsxRuntimeExports.jsx(StoredPeerInfo,{peerInfo:_})]})]}),jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsx(IconButton,{"aria-label":"Remove Peer",icon:jsxRuntimeExports.jsx(TrashIcon,{}),onClick:()=>a(_),size:"xs",variant:"circle"})})]})},StoredPeerInfo=({peerInfo:_})=>{const a=useGetConnectionInfo(_.senderId);return a?jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(AddressPill,{marginRight:"10px",address:parsePkh(a.accountPkh)}),jsxRuntimeExports.jsx(Divider,{marginRight:"10px",orientation:"vertical"}),jsxRuntimeExports.jsx(Text,{marginTop:"2px",marginRight:"4px",color:colors.gray[450],fontWeight:650,size:"sm",children:"Network:"}),jsxRuntimeExports.jsx(Text,{marginTop:"2px",color:colors.white,"data-testid":"dapp-connection-network",size:"sm",children:lodashExports.capitalize(a.networkType)})]}):null},DAppsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1(),j=useAddPeer();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"dApps",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{"data-testid":"drawer-body",children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",height:"96px",children:jsxRuntimeExports.jsx(Heading,{children:"dApps"})}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.readText().then(et=>j(et)),children:"Connect with Pairing Request"}),jsxRuntimeExports.jsx(Text,{marginTop:"16px",marginBottom:"32px",color:colors.gray[400],children:"or open a deeplink from inside the dApp..."}),jsxRuntimeExports.jsx(BeaconPeers,{})]})]})})]})]})},ErrorLogsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Error Logs",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsx(ErrorLogsDrawerBody,{})]})})]})]})},ErrorLogsDrawerBody=()=>{const _=[...useAppSelector(j=>j.errors)].reverse(),a=useDispatch(),$=()=>{a(errorsSlice.actions.reset())};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",height:"50px",marginBottom:"20px",children:[jsxRuntimeExports.jsx(Heading,{size:"xl",children:"Error Logs"}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx("a",{download:"UmamiErrorLogs.json",href:`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(_))}`,children:jsxRuntimeExports.jsx(Button,{variant:"tertiary",children:"Download error logs"})}),jsxRuntimeExports.jsx(Button,{marginLeft:"8px",onClick:$,variant:"warning",children:"Clear All"})]})]}),_.map(j=>jsxRuntimeExports.jsx(ErrorLogRow,{errorLog:j},nanoid()))]})},ErrorLogRow=({errorLog:_})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:1}),jsxRuntimeExports.jsx(Flex,{justifyContent:"space-between",paddingY:"12px",children:jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutlineExclamationCircleIcon,{marginTop:"1px",marginRight:"8px"}),jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[jsxRuntimeExports.jsx(Heading,{wordBreak:"break-all",size:"sm",children:_.description}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:_.timestamp})]})]})})]}),removeTrailingSlashes=_=>_.replace(/\/+$/g,""),UpsertNetworkModal=({network:_})=>{const a=_?"edit":"create",{onClose:$}=reactExports.useContext(DynamicModalContext),j=useDispatch(),et=useAvailableNetworks(),{formState:{errors:tt,isValid:rt},register:nt,handleSubmit:it}=useForm({mode:"onBlur",defaultValues:_}),ot=st=>{j(networksActions.upsertNetwork(st)),$()};return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:it(ot),children:[jsxRuntimeExports.jsxs(ModalHeader,{textAlign:"center",children:[a==="edit"?"Edit":"Add"," Network",jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsxs(ModalBody,{children:[a==="create"&&jsxRuntimeExports.jsxs(FormControl,{marginTop:"32px",marginBottom:"24px",isInvalid:!!tt.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Name"}),jsxRuntimeExports.jsx(Input,{placeholder:"mainnet",...nt("name",{required:"Name is required",validate:st=>{if(et.find(ct=>ct.name===st))return"Network with this name already exists"}})}),tt.name&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.name.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.rpcUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"RPC URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://prod.tcinfra.net/rpc/mainnet",...nt("rpcUrl",{required:"RPC URL is required",setValueAs:removeTrailingSlashes})}),tt.rpcUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.rpcUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.tzktApiUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Tzkt API URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://api.ghostnet.tzkt.io",...nt("tzktApiUrl",{required:"Tzkt API URL is required",setValueAs:removeTrailingSlashes})}),tt.tzktApiUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.tzktApiUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginBottom:"24px",isInvalid:!!tt.tzktExplorerUrl,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Tzkt Explorer URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://ghostnet.tzkt.io",...nt("tzktExplorerUrl",{required:"Tzkt Explorer URL is required",setValueAs:removeTrailingSlashes})}),tt.tzktExplorerUrl&&jsxRuntimeExports.jsx(FormErrorMessage,{children:tt.tzktExplorerUrl.message})]}),jsxRuntimeExports.jsxs(FormControl,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"Buy Tez URL"}),jsxRuntimeExports.jsx(Input,{placeholder:"https://faucet.ghostnet.teztnets.com",...nt("buyTezUrl")})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!rt,onClick:()=>{},type:"submit",children:a==="edit"?"Save changes":"Add network"})})]})]})})},NetworkSettingsDrawerBody=()=>{const{openWith:_}=reactExports.useContext(DynamicModalContext),a=useSelectedNetwork(),$=useSelectNetwork(),j=useAvailableNetworks(),et=useAppDispatch(),tt=rt=>{et(networksActions.removeNetwork(rt))};return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{children:"Network Settings"}),jsxRuntimeExports.jsxs(Button,{paddingRight:"0",onClick:()=>_(jsxRuntimeExports.jsx(UpsertNetworkModal,{})),variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{size:"sm",children:"Add Network"}),jsxRuntimeExports.jsx(PlusIcon,{width:"18px",height:"18px",marginLeft:"4px",stroke:"currentcolor"})]})]}),jsxRuntimeExports.jsx(RadioGroup,{marginTop:"60px",onChange:$,value:a.name,children:jsxRuntimeExports.jsx(Stack,{children:j.map(rt=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700]}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between","data-testid":`network-${rt.name}`,children:[jsxRuntimeExports.jsx(Radio,{height:"100px",value:rt.name,variant:"primary",children:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",marginLeft:"16px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"4px",size:"sm",children:rt.name}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],children:rt.rpcUrl})]})}),!isDefault(rt)&&jsxRuntimeExports.jsx(Center,{"data-testid":"popover-menu",children:jsxRuntimeExports.jsxs(PopoverMenu,{children:[jsxRuntimeExports.jsxs(Button,{onClick:()=>_(jsxRuntimeExports.jsx(UpsertNetworkModal,{network:rt})),variant:"popover",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Edit"}),jsxRuntimeExports.jsx(PenIcon,{stroke:"inherit"})]}),jsxRuntimeExports.jsx(Divider,{marginTop:"4px"}),jsxRuntimeExports.jsxs(Button,{onClick:()=>tt(rt),variant:"popover",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Remove"}),jsxRuntimeExports.jsx(TrashIcon,{stroke:"inherit"})]})]})})]})]},rt.name))})})]})},NetworkSettingsDrawerCard=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Network Settings",isSelected:_,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{blockScrollOnMount:!1,isOpen:_,onClose:a,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:a}),jsxRuntimeExports.jsx(NetworkSettingsDrawerBody,{})]})})]})]})},ChangePasswordForm=()=>{const{onClose:_}=reactExports.useContext(DynamicModalContext),a=useForm({mode:"onBlur"}),$=useToast(),j=useAppDispatch(),{handleAsyncAction:et,isLoading:tt}=useAsyncActionHandler(),{handleSubmit:rt,formState:{isValid:nt,errors:it},getValues:ot}=a,st=async({currentPassword:ct,newPassword:ut,newPasswordConfirmation:ht})=>{if(!(ct===ut||ut!==ht))return et(async()=>{await j(changeMnemonicPassword({currentPassword:ct,newPassword:ut})).unwrap(),$({description:"Password updated",status:"success"}),_()})};return jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx(ModalContent,{background:colors.gray[700],"data-testid":"change-password-modal",children:jsxRuntimeExports.jsxs("form",{onSubmit:rt(st),children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{textAlign:"center",children:jsxRuntimeExports.jsx(Heading,{children:"Change Password"})}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{marginTop:"32px",isInvalid:!!it.currentPassword,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"current-password",inputName:"currentPassword",label:"Current Password",placeholder:"Enter your current password",required:"Current password is required"}),it.currentPassword&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"current-password-error",children:it.currentPassword.message})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!it.newPassword,marginY:6,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"new-password",inputName:"newPassword",label:"New Password",placeholder:"Enter new password",required:"New password is required",validate:ct=>ot("currentPassword")!==ct||"Cannot be the same as old password"}),it.newPassword&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"new-password-error",children:it.newPassword.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:3,isInvalid:!!it.newPasswordConfirmation,children:[jsxRuntimeExports.jsx(PasswordInput,{"data-testid":"new-password-confirmation",inputName:"newPasswordConfirmation",label:"Confirm New Password",placeholder:"Confirm new password",required:"Confirmation is required",validate:ct=>ot("newPassword")===ct||"Your new passwords do no match"}),it.newPasswordConfirmation&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"new-password-confirmation-error",children:it.newPasswordConfirmation.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!nt,isLoading:tt,size:"lg",type:"submit",children:"Update Password"})})]})})})},SettingsView=()=>jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Settings"}),jsxRuntimeExports.jsxs(Box,{overflowY:"scroll",children:[jsxRuntimeExports.jsx(Box,{marginTop:"16px",children:jsxRuntimeExports.jsx(GeneralSection,{})}),jsxRuntimeExports.jsx(BackupSection,{}),jsxRuntimeExports.jsx(AdvancedSection,{})]})]}),GeneralSection=()=>jsxRuntimeExports.jsxs(SectionContainer,{title:"General",children:[jsxRuntimeExports.jsx(NetworkSettingsDrawerCard,{}),jsxRuntimeExports.jsx(ErrorLogsDrawerCard,{})]}),BackupSection=()=>jsxRuntimeExports.jsx(SectionContainer,{title:"Backup",children:jsxRuntimeExports.jsx(ClickableCard,{isSelected:!1,onClick:downloadBackupFile,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{size:"sm",children:"Download backup file"}),jsxRuntimeExports.jsx(Button,{onClick:downloadBackupFile,variant:"unstyled",children:jsxRuntimeExports.jsx(DownloadIcon,{cursor:"pointer"})})]})})}),AdvancedSection=()=>{const{modalElement:_,onOpen:a}=useOffboardingModal(),{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(SectionContainer,{title:"Advanced Settings",children:[jsxRuntimeExports.jsx(DAppsDrawerCard,{}),jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Off-board Wallet",isSelected:!1,onClick:a}),jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Change Password",isSelected:!1,onClick:()=>$(jsxRuntimeExports.jsx(ChangePasswordForm,{}))}),_]})},SectionContainer=({title:_,children:a})=>jsxRuntimeExports.jsx(Box,{marginTop:"8px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsxs(Box,{width:"550px",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"16px",size:"lg",children:_}),a]})})}),TokenTile=({token:_,amount:a,...$})=>{const{contract:j}=_,et=tokenPrettyAmount(a,_),tt=tokenSymbolSafe(_);return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"start",width:"400px",padding:"15px",background:colors.gray[800],borderRadius:"4px","data-testid":"token-tile",...$,children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(AspectRatio,{width:"30px",height:"30px",marginRight:"12px",ratio:1,children:jsxRuntimeExports.jsx(TokenIcon,{padding:"6.25px",background:colors.gray[500],borderRadius:"4px",contract:j})})}),jsxRuntimeExports.jsx(PrettyNumber,{number:et}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:tt})]})},SignPage=_=>{const{mode:a,operations:$,data:{token:j}}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:ct}=useSignPageHelpers($,a),{amount:ut,recipient:ht}=tt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:tt.type,signer:tt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TokenTile,{amount:ut,token:j}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(SignPageFee,{fee:et})})}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:tt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ht}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender}),jsxRuntimeExports.jsx(AdvancedSettingsAccordion,{})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ct,signer:ot,text:headerText(tt.type,a)})})]})})})},FormPage=_=>{const{token:a}=_,$=useOpenSignPageFormAction({SignPage,signPageExtraData:{token:a},FormPage,defaultFormPageProps:_,toOperation:toOperation(a)}),j=useAddToBatchFormAction(toOperation(a)),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(_)}),{formState:{isValid:it,errors:ot},register:st,handleSubmit:ct}=nt,ut=tokenDecimals(a),ht=formatTokenAmount(a.balance,ut),Et=getSmallestUnit(Number(ut));return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(FormPageHeader,{}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!ot.prettyAmount,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Amount"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{isDisabled:rt,step:Et,type:"number",...st("prettyAmount",{required:"Amount is required",max:{value:ht.toString(),message:`Max amount is ${ht}`},validate:makeValidateDecimals(Number(ut))}),placeholder:Et}),jsxRuntimeExports.jsx(InputRightElement,{paddingRight:"12px","data-testid":"token-symbol",children:tokenSymbolSafe(a)})]}),ot.prettyAmount&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"amount-error",children:ot.prettyAmount.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),ot.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:ot.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!ot.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),ot.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:ot.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ct(tt),onSingleSubmit:ct(et)})})]})})})},toOperation=_=>a=>{const $={type:"fa2",sender:parsePkh(a.sender),recipient:parsePkh(a.recipient),contract:parseContractPkh(_.contract),tokenId:_.tokenId,amount:getRealAmount(_,a.prettyAmount)};return _.type==="fa2"?$:{...$,type:"fa1.2",tokenId:"0"}},Header=({account:_})=>{const{address:a,label:$}=_;return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"78px",background:accountIconGradient({left:"-10px",top:"-10px",account:_,radius:"100px",mainBackgroundColor:colors.gray[800]}),borderTopRadius:"8px","data-testid":"header",paddingX:"30px",children:[jsxRuntimeExports.jsx(AccountTileIcon,{account:_,size:"lg"}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",flex:1,children:[jsxRuntimeExports.jsxs(Box,{marginLeft:"16px","data-testid":"account-identifier",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"4px",size:"md",children:$}),jsxRuntimeExports.jsx(Text,{color:colors.gray[300],size:"sm",children:formatPkh(a.pkh)})]}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column-reverse",children:jsxRuntimeExports.jsx(AccountBalance,{verticalAlign:"bottom",address:_.address.pkh})})]})]})},AccountTokens=({account:_,tokens:a})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Card,{overflowX:"auto",marginBottom:"16px",borderBottomRadius:"8px",backgroundColor:colors.gray[900],children:[jsxRuntimeExports.jsx(Header,{account:_}),jsxRuntimeExports.jsx(TableContainer,{paddingX:"30px",children:jsxRuntimeExports.jsx(Table,{children:jsxRuntimeExports.jsx(Tbody,{children:a.map((j,et)=>{const tt=et===a.length-1?"transparent":colors.gray[700];return jsxRuntimeExports.jsxs(Tr,{"data-testid":"token-tile",children:[jsxRuntimeExports.jsx(Td,{width:"20%",minWidth:"240px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(TokenIcon,{display:"inline-block",width:"38px",contract:j.contract}),jsxRuntimeExports.jsx(Heading,{display:"inline-block",marginLeft:"16px",size:"sm",children:jsxRuntimeExports.jsx(TokenNameWithIcon,{token:j})})]})}),jsxRuntimeExports.jsx(Td,{width:"20%",minWidth:"200px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(AddressPill,{address:parseContractPkh(j.contract)})}),jsxRuntimeExports.jsx(Td,{width:"15%",minWidth:"160px",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(Heading,{size:"sm",children:tokenPrettyAmount(j.balance,j,{showSymbol:!1})})}),jsxRuntimeExports.jsx(Td,{textAlign:"right",borderColor:tt,paddingX:"0",children:jsxRuntimeExports.jsx(SendButton,{onClick:()=>$(jsxRuntimeExports.jsx(FormPage,{sender:_,token:j}))})})]},fullId(j))})})})})]})},TokensPage=()=>{const{accountsFilter:_,selectedAccounts:a}=useAccountsFilter(),$=useGetAccountAllTokens(),j=a.map(et=>[et,$(et.address.pkh)]).filter(([,et])=>et.length>0);return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Tokens"}),_,j.length===0?jsxRuntimeExports.jsx(NoTokens,{size:"lg"}):jsxRuntimeExports.jsx(Box,{overflowY:"auto",children:j.map(([et,tt])=>jsxRuntimeExports.jsx(AccountTokens,{account:et,tokens:tt},et.address.pkh))})]})},AppVersion=({isCollapsed:_,...a})=>{const $=_?packageInfo.version:`Umami v${packageInfo.version}`;return jsxRuntimeExports.jsx(Text,{color:colors.gray[450],...a,children:$})},CollapseMenuButton=({toggle:_,...a})=>jsxRuntimeExports.jsx(Center,{width:"44px",height:"44px",marginRight:"-14px",borderRadius:"4px",_hover:{background:colors.gray[800]},cursor:"pointer","data-testid":"collapse-menu-button",onClick:_,...a,children:jsxRuntimeExports.jsx(BurgerMenuIcon,{})}),useCollapseMenu=()=>{const[_,a]=reactExports.useState(!1),$=reactExports.useCallback(()=>{a(j=>!j)},[]);return{isCollapsed:_,toggle:$}},ORANGE="#F74F18",MakiLogo=_=>{const a=useSelectedNetwork();return jsxRuntimeExports.jsx(MakiIcon,{background:"white",borderRadius:"8px","data-testid":"maki-logo",fishColor:a.name==="mainnet"?ORANGE:"black",..._})},NetworkSelector=()=>{const _=useSelectedNetwork(),a=useAvailableNetworks(),$=useSelectNetwork(),{onOpen:j,onClose:et,isOpen:tt}=useDisclosure$1();return jsxRuntimeExports.jsxs(Popover,{isOpen:tt,onClose:et,onOpen:j,placement:"bottom-end",children:[jsxRuntimeExports.jsx(PopoverTrigger,{children:jsxRuntimeExports.jsxs(Button,{marginTop:"4px",color:colors.green,"data-testid":"network-selector",variant:"unstyled",children:[lodashExports.capitalize(_.name),tt?jsxRuntimeExports.jsx(ChevronUpIcon,{marginTop:"-2px",stroke:"currentcolor"}):jsxRuntimeExports.jsx(ChevronDownIcon$1,{marginTop:"-2px",stroke:"currentcolor"})]})}),jsxRuntimeExports.jsx(PopoverContent,{width:"100px",marginTop:"-10px",background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],children:jsxRuntimeExports.jsx(PopoverBody,{padding:"4px 12px",children:jsxRuntimeExports.jsx(Flex,{flexDirection:"column",children:a.map((rt,nt)=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{height:"34px",color:rt.name===_.name?colors.green:colors.gray[300],fontSize:"14px",fontWeight:400,textAlign:"right",_hover:{color:colors.greenL},onClick:()=>{$(rt.name),et()},variant:"unstyled",children:lodashExports.capitalize(rt.name)}),nt{const[_,a]=reactExports.useState(!1),$=window;reactExports.useEffect(()=>{$&&$.electronAPI&&$.electronAPI.onAppUpdateDownloaded(et=>a(!0))},[$]);const j=()=>{$&&$.electronAPI&&$.electronAPI.installAppUpdateAndQuit()};return _?jsxRuntimeExports.jsx(Box,{marginTop:"24px",marginBottom:"6px",children:jsxRuntimeExports.jsxs(Button,{justifyContent:"flex-start",width:"100%",height:"32px",paddingTop:"7px",paddingRight:"8px",paddingBottom:"7px",paddingLeft:"8px",color:colors.black,background:colors.green,_hover:{color:colors.black,background:colors.greenL},onClick:j,children:[jsxRuntimeExports.jsx(FlipForwardEnergy,{}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Update Umami"})]})}):null},SideNavbar=()=>{const{isCollapsed:_,toggle:a}=useCollapseMenu(),$=jsxRuntimeExports.jsx(CollapseMenuButton,{marginTop:_?0:"2px",marginRight:_?0:"-14px",toggle:a});return jsxRuntimeExports.jsxs(Flex,{alignItems:_?"center":"normal",flexDirection:"column",width:_?"80px":"236px",padding:_?"30px 20px":"30px",background:colors.gray[900],"data-testid":`side-navbar${_?"-collapsed":""}`,children:[jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",height:"30px",children:_?$:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(MakiLogo,{width:"38px",height:"38px"}),jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(NetworkSelector,{}),$]})]})}),jsxRuntimeExports.jsx(Divider,{marginTop:"28px"})]}),jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",flexDirection:"column",flex:1,children:[jsxRuntimeExports.jsxs(Box,{alignItems:_?"center":"normal",justifyContent:_?"space-around":"normal",display:_?"flex":"block",height:"100%",children:[!_&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(UpdateAppButton,{}),jsxRuntimeExports.jsx(TotalBalance,{})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(AccountsIcon,{}),isCollapsed:_,label:"Accounts",to:"/home"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(DiamondIcon,{}),isCollapsed:_,label:"NFTs",to:"/nfts"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(RefreshClockIcon,{width:"24px",height:"24px"}),isCollapsed:_,label:"Operations",to:"/operations"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(CoinIcon,{}),isCollapsed:_,label:"Tokens",to:"/tokens"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(BatchIcon,{}),isCollapsed:_,label:"Batch",to:"/batch"})]})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(MenuItem,{marginTop:"22px",icon:jsxRuntimeExports.jsx(AddressBookIcon,{}),isCollapsed:_,label:"Address Book",to:"/address-book"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(GearIcon,{}),isCollapsed:_,label:"Settings",to:"/settings"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(HelpIcon,{}),isCollapsed:_,label:"Help",to:"/help"}),jsxRuntimeExports.jsx(AppVersion,{marginTop:"24px",fontSize:"14px",textAlign:_?"center":"left",isCollapsed:_})]})]})]})},MenuItem=({icon:_,label:a,to:$,isCollapsed:j,...et})=>{const rt=useLocation().pathname.startsWith($);return jsxRuntimeExports.jsx(Link,{to:$,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"flex-start",width:j?"44px":"176px",marginBottom:"8px",padding:"10px",background:rt?colors.gray[600]:"transparent",borderRadius:"4px",_hover:{background:rt?colors.gray[600]:colors.gray[800]},cursor:"pointer",...et,children:[_,!j&&jsxRuntimeExports.jsx(Text,{marginLeft:"10px",size:"sm",children:a})]})})},TotalBalance=()=>{const _=useTotalBalance(),[a]=useMediaQuery("(max-height: 900px)");return jsxRuntimeExports.jsxs(Box,{marginTop:"24px",marginBottom:a?"30px":"100px","data-testid":"total-balance",children:[jsxRuntimeExports.jsx(Text,{marginBottom:"4px",size:"sm",children:"Balance"}),_&&jsxRuntimeExports.jsx(TezRecapDisplay,{balance:_.mutez,dollarBalance:_.usd})]})},withSideMenu=_=>jsxRuntimeExports.jsxs(Flex,{height:"100vh",children:[jsxRuntimeExports.jsx(SideNavbar,{}),jsxRuntimeExports.jsx(Box,{flex:1,overflowX:"hidden",height:"100%",background:"linear-gradient(180deg, rgba(0, 231, 182, 0.35) -41.53%, rgba(0, 231, 182, 0.00) 34.71%)",paddingX:"24px",children:_})]}),AccountsImage=""+new URL("accounts-DTYOez9Q.png",import.meta.url).href,BatchImage=""+new URL("batch-CoYFN9ox.png",import.meta.url).href,MultisigImage=""+new URL("multisig-GRRIvmJS.png",import.meta.url).href;var js={},Carousel$1={},lib={},reactSwipe={},hasRequiredReactSwipe;function requireReactSwipe(){return hasRequiredReactSwipe||(hasRequiredReactSwipe=1,function(_){(function(a,$){$(_,reactExports,propTypesExports)})(commonjsGlobal,function(a,$,j){Object.defineProperty(a,"__esModule",{value:!0}),a.setHasSupportToCaptureOption=Et;var et=rt($),tt=rt(j);function rt(Ct){return Ct&&Ct.__esModule?Ct:{default:Ct}}var nt=Object.assign||function(Ct){for(var Ot=1;Ot=0||Object.prototype.hasOwnProperty.call(Ct,Ut)&&(zt[Ut]=Ct[Ut]);return zt}function ot(Ct,Ot){if(!(Ct instanceof Ot))throw new TypeError("Cannot call a class as a function")}var st=function(){function Ct(Ot,zt){for(var Ut=0;Ut0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return ht?Ct:Ct.capture}function Mt(Ct){if("touches"in Ct){var Ot=Ct.touches[0],zt=Ot.pageX,Ut=Ot.pageY;return{x:zt,y:Ut}}var Vt=Ct.screenX,jt=Ct.screenY;return{x:Vt,y:jt}}var kt=function(Ct){ut(Ot,Ct);function Ot(){var zt;ot(this,Ot);for(var Ut=arguments.length,Vt=Array(Ut),jt=0;jtVt&&this.props.onSwipeRight(1,Ut),this.movePosition.deltaY<-Vt?this.props.onSwipeUp(1,Ut):this.movePosition.deltaY>Vt&&this.props.onSwipeDown(1,Ut)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(Ut){this.swiper=Ut,this.props.innerRef(Ut)}},{key:"render",value:function(){var Ut=this.props;Ut.tagName;var Vt=Ut.className,jt=Ut.style,$t=Ut.children;Ut.allowMouseEvents,Ut.onSwipeUp,Ut.onSwipeDown,Ut.onSwipeLeft,Ut.onSwipeRight,Ut.onSwipeStart,Ut.onSwipeMove,Ut.onSwipeEnd,Ut.innerRef,Ut.tolerance;var Bt=it(Ut,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]);return et.default.createElement(this.props.tagName,nt({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:Vt,style:jt},Bt),$t)}}]),Ot}($.Component);kt.displayName="ReactSwipe",kt.propTypes={tagName:tt.default.string,className:tt.default.string,style:tt.default.object,children:tt.default.node,allowMouseEvents:tt.default.bool,onSwipeUp:tt.default.func,onSwipeDown:tt.default.func,onSwipeLeft:tt.default.func,onSwipeRight:tt.default.func,onSwipeStart:tt.default.func,onSwipeMove:tt.default.func,onSwipeEnd:tt.default.func,innerRef:tt.default.func,tolerance:tt.default.number.isRequired},kt.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},a.default=kt})}(reactSwipe)),reactSwipe}(function(_){(function(a,$){$(_,requireReactSwipe())})(commonjsGlobal,function(a,$){Object.defineProperty(a,"__esModule",{value:!0});var j=et($);function et(tt){return tt&&tt.__esModule?tt:{default:tt}}a.default=j.default})})(lib);var cssClasses={},classnames={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames diff --git a/index.html b/index.html index acb9812237..68a064ac51 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,7 @@ --> Umami - +